@squidcloud/client 1.0.249 → 1.0.251
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +2 -2
- package/dist/internal-common/src/public-types/extraction.public-types.d.ts +18 -0
- package/dist/typescript-client/src/extraction-client.d.ts +6 -0
- package/dist/typescript-client/src/index.d.ts +1 -0
- package/dist/typescript-client/src/public-types.d.ts +1 -0
- package/dist/typescript-client/src/squid.d.ts +2 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(()=>{"use strict";var e={9273:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5150:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});const o=r(5642);t.default=o.PromisePool,i(r(9273),t),i(r(5642),t),i(r(7837),t),i(r(2426),t),i(r(6858),t),i(r(1172),t)},7837:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePoolError=void 0;class r extends Error{constructor(e,t){super(),this.raw=e,this.item=t,this.name=this.constructor.name,this.message=this.messageFrom(e),Error.captureStackTrace(this,this.constructor)}static createFrom(e,t){return new this(e,t)}messageFrom(e){return e instanceof Error||"object"==typeof e?e.message:"string"==typeof e||"number"==typeof e?e.toString():""}}t.PromisePoolError=r},234:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePoolExecutor=void 0;const n=r(5642),i=r(7837),o=r(6858),s=r(1172);t.PromisePoolExecutor=class{constructor(){this.meta={tasks:[],items:[],errors:[],results:[],stopped:!1,concurrency:10,shouldResultsCorrespond:!1,processedItems:[],taskTimeout:0},this.handler=()=>{},this.errorHandler=void 0,this.onTaskStartedHandlers=[],this.onTaskFinishedHandlers=[]}useConcurrency(e){if(!this.isValidConcurrency(e))throw s.ValidationError.createFrom(`"concurrency" must be a number, 1 or up. Received "${e}" (${typeof e})`);return this.meta.concurrency=e,this}isValidConcurrency(e){return"number"==typeof e&&e>=1}withTaskTimeout(e){return this.meta.taskTimeout=e,this}concurrency(){return this.meta.concurrency}useCorrespondingResults(e){return this.meta.shouldResultsCorrespond=e,this}shouldUseCorrespondingResults(){return this.meta.shouldResultsCorrespond}taskTimeout(){return this.meta.taskTimeout}for(e){return this.meta.items=e,this}items(){return this.meta.items}itemsCount(){return this.items().length}tasks(){return this.meta.tasks}activeTaskCount(){return this.activeTasksCount()}activeTasksCount(){return this.tasks().length}processedItems(){return this.meta.processedItems}processedCount(){return this.processedItems().length}processedPercentage(){return this.processedCount()/this.itemsCount()*100}results(){return this.meta.results}errors(){return this.meta.errors}withHandler(e){return this.handler=e,this}hasErrorHandler(){return!!this.errorHandler}handleError(e){return this.errorHandler=e,this}onTaskStarted(e){return this.onTaskStartedHandlers=e,this}onTaskFinished(e){return this.onTaskFinishedHandlers=e,this}hasReachedConcurrencyLimit(){return this.activeTasksCount()>=this.concurrency()}stop(){throw this.markAsStopped(),new o.StopThePromisePoolError}markAsStopped(){return this.meta.stopped=!0,this}isStopped(){return this.meta.stopped}async start(){return await this.validateInputs().prepareResultsArray().process()}validateInputs(){if("function"!=typeof this.handler)throw s.ValidationError.createFrom("The first parameter for the .process(fn) method must be a function");const e=this.taskTimeout();if(!(null==e||"number"==typeof e&&e>=0))throw s.ValidationError.createFrom(`"timeout" must be undefined or a number. A number must be 0 or up. Received "${String(e)}" (${typeof e})`);if(!Array.isArray(this.items()))throw s.ValidationError.createFrom(`"items" must be an array. Received "${typeof this.items()}"`);if(this.errorHandler&&"function"!=typeof this.errorHandler)throw s.ValidationError.createFrom(`The error handler must be a function. Received "${typeof this.errorHandler}"`);return this.onTaskStartedHandlers.forEach((e=>{if(e&&"function"!=typeof e)throw s.ValidationError.createFrom(`The onTaskStarted handler must be a function. Received "${typeof e}"`)})),this.onTaskFinishedHandlers.forEach((e=>{if(e&&"function"!=typeof e)throw s.ValidationError.createFrom(`The error handler must be a function. Received "${typeof e}"`)})),this}prepareResultsArray(){return this.shouldUseCorrespondingResults()&&(this.meta.results=Array(this.items().length).fill(n.PromisePool.notRun)),this}async process(){for(const[e,t]of this.items().entries()){if(this.isStopped())break;await this.waitForProcessingSlot(),this.startProcessing(t,e)}return await this.drained()}async waitForProcessingSlot(){for(;this.hasReachedConcurrencyLimit();)await this.waitForActiveTaskToFinish()}async waitForActiveTaskToFinish(){await Promise.race(this.tasks())}startProcessing(e,t){const r=this.createTaskFor(e,t).then((e=>{this.save(e,t).removeActive(r)})).catch((async n=>{await this.handleErrorFor(n,e,t),this.removeActive(r)})).finally((()=>{this.processedItems().push(e),this.runOnTaskFinishedHandlers(e)}));this.tasks().push(r),this.runOnTaskStartedHandlers(e)}async createTaskFor(e,t){return void 0===this.taskTimeout()?this.handler(e,t,this):Promise.race([this.handler(e,t,this),this.createTaskTimeout(e)])}async createTaskTimeout(e){return new Promise(((t,r)=>{setTimeout((()=>{r(new i.PromisePoolError(`Promise in pool timed out after ${this.taskTimeout()}ms`,e))}),this.taskTimeout())}))}save(e,t){return this.shouldUseCorrespondingResults()?this.results()[t]=e:this.results().push(e),this}removeActive(e){return this.tasks().splice(this.tasks().indexOf(e),1),this}async handleErrorFor(e,t,r){if(this.shouldUseCorrespondingResults()&&(this.results()[r]=n.PromisePool.failed),!this.isStoppingThePoolError(e)){if(this.isValidationError(e))throw this.markAsStopped(),e;this.hasErrorHandler()?await this.runErrorHandlerFor(e,t):this.saveErrorFor(e,t)}}isStoppingThePoolError(e){return e instanceof o.StopThePromisePoolError}isValidationError(e){return e instanceof s.ValidationError}async runErrorHandlerFor(e,t){var r;try{await(null===(r=this.errorHandler)||void 0===r?void 0:r.call(this,e,t,this))}catch(e){this.rethrowIfNotStoppingThePool(e)}}runOnTaskStartedHandlers(e){this.onTaskStartedHandlers.forEach((t=>{t(e,this)}))}runOnTaskFinishedHandlers(e){this.onTaskFinishedHandlers.forEach((t=>{t(e,this)}))}rethrowIfNotStoppingThePool(e){if(!this.isStoppingThePoolError(e))throw e}saveErrorFor(e,t){this.errors().push(i.PromisePoolError.createFrom(e,t))}async drained(){return await this.drainActiveTasks(),{errors:this.errors(),results:this.results()}}async drainActiveTasks(){await Promise.all(this.tasks())}}},5642:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePool=void 0;const n=r(234);class i{constructor(e){this.timeout=void 0,this.concurrency=10,this.shouldResultsCorrespond=!1,this.items=null!=e?e:[],this.errorHandler=void 0,this.onTaskStartedHandlers=[],this.onTaskFinishedHandlers=[]}withConcurrency(e){return this.concurrency=e,this}static withConcurrency(e){return(new this).withConcurrency(e)}withTaskTimeout(e){return this.timeout=e,this}static withTaskTimeout(e){return(new this).withTaskTimeout(e)}for(e){return"number"==typeof this.timeout?new i(e).withConcurrency(this.concurrency).withTaskTimeout(this.timeout):new i(e).withConcurrency(this.concurrency)}static for(e){return(new this).for(e)}handleError(e){return this.errorHandler=e,this}onTaskStarted(e){return this.onTaskStartedHandlers.push(e),this}onTaskFinished(e){return this.onTaskFinishedHandlers.push(e),this}useCorrespondingResults(){return this.shouldResultsCorrespond=!0,this}async process(e){return(new n.PromisePoolExecutor).useConcurrency(this.concurrency).useCorrespondingResults(this.shouldResultsCorrespond).withTaskTimeout(this.timeout).withHandler(e).handleError(this.errorHandler).onTaskStarted(this.onTaskStartedHandlers).onTaskFinished(this.onTaskFinishedHandlers).for(this.items).start()}}t.PromisePool=i,i.notRun=Symbol("notRun"),i.failed=Symbol("failed")},2426:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6858:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StopThePromisePoolError=void 0;class r extends Error{}t.StopThePromisePoolError=r},1172:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValidationError=void 0;class r extends Error{constructor(e){super(e),Error.captureStackTrace(this,this.constructor)}static createFrom(e){return new this(e)}}t.ValidationError=r},5036:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4077),t)},6373:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callValueAssertion=t.assertRecord=t.assertArray=t.assertObject=t.getErrorMessage=t.getAssertionErrorFromProvider=t.fail=t.truthy=t.assertTruthy=void 0;const n=r(4665),i=r(1333);function o(e,t){e||s(t)}function s(e){const t=a(e);if("object"==typeof t)throw t;throw new Error(t||"Assertion error")}function a(e){return void 0===e?"":"string"==typeof e?e:e()}function u(e){const t=a(e);return"string"==typeof t?t:t.message||"<no error message>"}function c(e,t,r=void 0,n={}){const i=()=>u(r),s=e=>{const t=i();return 0===t.length?e:`${t} ${e}`};o("object"==typeof e,(()=>s("is not an object: "+typeof e))),o(void 0!==e,(()=>s("is not defined"))),o(null!==e,(()=>s("is null"))),o(!Array.isArray(e),(()=>s("is an array.")));const a=Object.entries(t);if(n.failOnUnknownFields){const t=n.allowedUnknownFieldNames||[];for(const r in e)o(t.includes(r)||a.some((([e])=>r===e)),s(`property can't be checked: ${r}`))}let l;for(const[t,r]of a){o("function"==typeof r||"object"==typeof r&&null!==r,(()=>`${i()}.${t} assertion is not an object or a function: ${typeof r}`));const n=e[t],s=()=>`${i()}.${t}`;if("object"==typeof r)o(!Array.isArray(n),(()=>`${i()}.${s()} use arrayAssertion() to create a ValueAssertion for an array`)),c(n,r,s);else if(o("function"==typeof r,(()=>`${i()}.${s()} assertion is not a function`)),"$o"===t)l=r;else{const e=r(n,s);o(void 0===e,`Assertion function must assert (void) but it returns a value: ${e}. Wrap with $u()?`)}}l&&l(e,r)}function l(e,t,r){t(e,r)}function h(e){return(t="with-space-separator")=>{const r=u(e);return r?`${r}${"with-space-separator"===t?" ":""}`:""}}function d(e,t,r){"object"==typeof t?(o(!Array.isArray(e),(()=>`${r}: use arrayAssertion() to create a ValueAssertion for an array`)),c(e,t,r)):l(e,t,r)}t.assertTruthy=o,t.truthy=function(e,t){return o(e,t),e},t.fail=s,t.getAssertionErrorFromProvider=a,t.getErrorMessage=u,t.assertObject=c,t.assertArray=function(e,t,r={},i=void 0){var s,a;const u=h(i);o(Array.isArray(e),(()=>`${u()}value is not an array: ${e}`));const c=null!==(s=r.minLength)&&void 0!==s?s:0,l=null!==(a=r.maxLength)&&void 0!==a?a:1/0;o(e.length>=c,(()=>`${u()}array length < minLength. Array length: ${e.length}, minLength: ${c}`)),o(e.length<=l,(()=>`${u()}array length > maxLength. Array length: ${e.length}, maxLength: ${l}`)),r.uniqueByIdentity&&o((0,n.checkArrayHasUniqueElements)(e,r.uniqueByIdentity),(()=>`${u()}array contains non-unique elements`));let f=0;const p=()=>`${u("no-space-separator")}[${f}]`;for(;f<e.length;f++)d(e[f],t,p)},t.assertRecord=function(e,t,r={},n=void 0){const s=h(n);o("object"==typeof e,(()=>`${s()}value is not an object: ${(0,i.formatValue)(e)}`)),o(null!==e,(()=>`${s()}value is null`)),o(!Array.isArray(e),(()=>`${s()}the value is not a record, but is an array`));for(const[n,a]of Object.entries(e)){const e=()=>`${s("no-space-separator")}['${n}']`;r.keyAssertion&&d(n,r.keyAssertion,(()=>`${e()}, key assertion failed:`)),d(a,t,e);const{keyField:u}=r;if(u){o("object"==typeof a&&null!==a,(()=>`${e()} is not an object: ${(0,i.formatValue)(a)}`));const t=a[u];o(t===n,(()=>`${e()} key value does not match object field '${u}' value: ${(0,i.formatValue)(t)}`))}}r.$o&&r.$o(e,n)},t.callValueAssertion=l},8596:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.stringAssertion=t.nullOr=t.undefinedOr=t.valueOr=t.$u=t.$a=t.recordAssertion=t.arrayAssertion=t.objectAssertion=void 0;const n=r(6373),i=r(1333);function o(e,t){return(0,n.assertTruthy)("function"==typeof e,`"check" is not a function: ${e}`),(r,i=void 0)=>(0,n.assertTruthy)(e(r),(()=>{let e=(0,n.getErrorMessage)(i)||"Check is failed";return e.endsWith(":")||(e+=":"),`${e} ${(0,n.getErrorMessage)(t)||("object"==typeof r?"[object]":`'${r}'`)}`}))}function s(e,t){return(r,i=void 0)=>{r!==e&&("object"==typeof t?(0,n.assertObject)(r,t,i):(0,n.callValueAssertion)(r,t,i))}}t.objectAssertion=function(e,t=void 0){return r=>(0,n.assertObject)(r,e,t)},t.arrayAssertion=function(e,t={}){const{minLength:r,maxLength:i}=t;return(0,n.assertTruthy)((null!=r?r:0)<=(null!=i?i:1/0),`minLength must be < maxLength! minLength ${r}, maxLength: ${i}`),(0,n.assertTruthy)((null!=r?r:0)>=0,`minLength must be a positive number: ${r}`),(0,n.assertTruthy)((null!=i?i:0)>=0,`maxLength must be a positive number: ${i}`),(r,i=void 0)=>{(0,n.assertArray)(r,e,t,i)}},t.recordAssertion=function(e,t={}){return(r,i=void 0)=>{(0,n.assertRecord)(r,e,t,i)}},t.$a=o,t.$u=function(e,t){return o(e,t)},t.valueOr=s,t.undefinedOr=function(e){return s(void 0,e)},t.nullOr=function(e){return s(null,e)},t.stringAssertion=e=>(t,r=void 0)=>{var o,s;(0,i.assertString)(t,r),(0,n.assertTruthy)(t.length>=(null!==(o=e.minLength)&&void 0!==o?o:0),`${(0,n.getErrorMessage)(r)} length is too small: ${t.length} < ${e.minLength}`),(0,n.assertTruthy)(t.length<=(null!==(s=e.maxLength)&&void 0!==s?s:1/0),`${(0,n.getErrorMessage)(r)} length is too large ${t.length} > ${e.maxLength}`)}},1333:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assertNonNullable=t.assertDate=t.assertEmail=t.assertHexString=t.assertUuid=t.assertBoolean=t.assertNumber=t.assertString=t.formatError=t.formatValue=void 0;const n=r(6373),i=r(4665);function o(e){return void 0===e?"<undefined>":"symbol"==typeof e?e.toString():null===e?"<null>":`<${typeof e}:${e}>`}function s(e,t,r){const i=(0,n.getAssertionErrorFromProvider)(e);if("object"==typeof i)throw i;return`${i?`${i}: `:""}${t} ${o(r)}`}t.formatValue=o,t.formatError=s,t.assertString=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isString)(e),(()=>s(t,"Not a string",e)))},t.assertNumber=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isNumber)(e),(()=>s(t,"Not a number",e)))},t.assertBoolean=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isBoolean)(e),(()=>s(t,"Not a boolean",e)))},t.assertUuid=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isUuid)(e),(()=>s(t,"Invalid uuid",e)))},t.assertHexString=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isHexString)(e),(()=>s(t,"Invalid hex string",e)))},t.assertEmail=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isEmail)(e),(()=>s(t,"Invalid email",e)))},t.assertDate=(e,t=void 0)=>{(0,n.assertTruthy)(e instanceof Date,(()=>s(t,"Invalid Date",e)))},t.assertNonNullable=function(e,t){(0,n.assertTruthy)((0,i.isNonNullable)(e),(()=>s(t,"Value is "+(void 0===e?"undefined":"null"),e)))}},4665:(e,t)=>{function r(e){return"string"==typeof e}function n(e,t,r){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.isNonNullable=t.isHexString=t.isUuid=t.isEmail=t.checkArraysHasEqualElementsByComparator=t.checkArraysHaveEqualElements=t.checkArrayHasUniqueElements=t.isDate=t.isNumber=t.isString=t.isBoolean=void 0,t.isBoolean=function(e){return"boolean"==typeof e},t.isString=r,t.isNumber=function(e){return"number"==typeof e},t.isDate=function(e){return e instanceof Date},t.checkArrayHasUniqueElements=function(e,t){if(e.length<=1)return!0;const r=new Set;for(const n of e){const e=t(n);if(r.has(e))return!1;r.add(e)}return!0},t.checkArraysHaveEqualElements=function(e,t){return n(e,t,((e,t)=>e===t))},t.checkArraysHasEqualElementsByComparator=n;const i=/^[-!#$%&'*+/\d=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/\d=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z\d])*\.[a-zA-Z](-?[a-zA-Z\d])+$/,o=/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF.!#$%&'*+-/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF\-.\d]+)((\.([a-zA-Z\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF]){2,63})+)$/i;t.isEmail=function(e,t={allowInternationalDomains:!1}){if(!r(e)||0===e.length||e.length>254)return!1;if(!(t.allowInternationalDomains?o:i).test(e))return!1;const n=e.split("@");return!(n[0].length>64||n[1].split(".").some((e=>e.length>63)))};const s=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;t.isUuid=function(e){return r(e)&&s.test(e)};const a=/^[0-9a-fA-F]*$/;t.isHexString=function(e){return r(e)&&a.test(e)},t.isNonNullable=function(e){return null!=e}},8630:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateRecord=t.validateArray=t.validateObject=t.tryCatch=void 0;const n=r(6373);function i(e){try{e()}catch(e){return e instanceof Error&&e.message||`${e}`}}t.tryCatch=i,t.validateObject=function(e,t,r=void 0,o={}){return i((()=>(0,n.assertObject)(e,t,r,o)))},t.validateArray=function(e,t,r={},o=void 0){return i((()=>(0,n.assertArray)(e,t,r,o)))},t.validateRecord=function(e,t,r={},o=void 0){return i((()=>(0,n.assertRecord)(e,t,r,o)))}},4077:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(6373),t),i(r(8596),t),i(r(1333),t),i(r(4665),t),i(r(8630),t)},4123:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7243),t)},7243:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TrieStore=void 0;const n=r(11),i=r(573),o=r(6022),s=r(4908);class a extends i.Subject{constructor(){super(...arguments),this.isAllDetailsMode=!1}}t.TrieStore=class{constructor(e){this.rootState=e,this.observersTrie=new s.Trie,this.batchDepth=0,this.appliedBatchActions=[],this.rootStateBeforeBatchStart=this.rootState,this.stubForUnusedPaths=[]}get state(){return this.rootState}get state$(){return this.observe([])}get(e){return this._get(this.rootState,e)}observe(e,t=[]){return this._observeChanges(e,t,"new-value-only").pipe((0,o.map)((e=>e.value)))}observeChanges(e,t=[]){return this._observeChanges(e,t,"all-details")}set(e,t,r){(null==r?void 0:r(this.get(e),t,e))||this._apply({type:"set",path:e,value:t})}delete(e){this._apply({type:"delete",path:e})}reset(e){this.observersTrie.visitDfs("pre-order",(e=>null==e?void 0:e.complete())),this.observersTrie.delete([]),this.rootState=e}runInBatch(e){this.batchDepth++;try{e()}finally{if(this.batchDepth--,0===this.batchDepth&&this.appliedBatchActions.length>0){const e={type:"batch",actions:this.appliedBatchActions};this.appliedBatchActions=[],this._notify(e)}}}_apply(e){0===this.batchDepth&&(this.rootStateBeforeBatchStart=this.rootState),this.rootState=(0,n.apply)(this.rootState,e),this.rootState===this.rootStateBeforeBatchStart||this.observersTrie.isEmpty||(this.batchDepth>0?this.appliedBatchActions.push(e):this._notify(e))}_notify(e){const t=(0,n.extractPaths)(e,"unique-and-sorted"),r=this.selectChildPathsWithObservers(t),i=(0,n.selectUniquePaths)([...t,...r]),o=new s.Trie;for(const e of i)o.fillPath(e,(()=>!0));o.visitDfs("pre-order",((t,r)=>{const n=this.observersTrie.get(r);if(n){const t=this.get(r),i=n.isAllDetailsMode?this._get(this.rootStateBeforeBatchStart,r):void 0;n.next({action:e,value:t,oldValue:i})}}))}_observeChanges(e,t=[],r){const u=0===t.length?void 0:new s.Trie;for(const e of t)null==u||u.set(e,!0);return new i.Observable((t=>{const i=this.observersTrie.getOrSet(e,(()=>new a));i.isAllDetailsMode=i.isAllDetailsMode||"all-details"===r;const s={oldValue:void 0,value:this.get(e),paths:[[]]};t.next(s);const c=i.pipe((0,o.filter)((({action:e})=>void 0===u||(0,n.extractPaths)(e,"as-is").some((e=>!u.get(e))))),(0,o.map)((({action:t,value:r,oldValue:o})=>{let s=this.stubForUnusedPaths;if(i.isAllDetailsMode){const r=(0,n.extractPaths)(t,"as-is"),i=e.length>0?r.filter((t=>(0,n.isPathPrefix)(t,e))).map((t=>t.slice(e.length))):r;s=(0,n.selectUniquePathPrefixes)(i)}return{value:r,oldValue:o,paths:s}}))).subscribe(t);return()=>{c.unsubscribe(),i.observed||this.observersTrie.delete(e)}}))}_get(e,t){let r=e;for(let e=0;e<t.length&&void 0!==r;e++){const n=t[e];r=null==r?void 0:r[n]}return r}selectChildPathsWithObservers(e){const t=[];for(const r of e)this.observersTrie.count(r,"children-only")>0&&this.observersTrie.visitDfs("pre-order",((e,r)=>{e&&t.push([...r])}),r);return t}}},11:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.selectUniquePaths=t.selectUniquePathPrefixes=t.sortPaths=t.isPathPrefix=t.extractPaths=t.deepCloneOnPath=t.deleteInPath=t.setInPath=t.apply=void 0;const n=r(5036);function i(e,t,r){if(void 0===r)return o(e,t);if(0===t.length)return(0,n.assertTruthy)("object"==typeof r&&null!==r&&!Array.isArray(r),(()=>`Root state must be a record. Trying to set '${r}', type: ${typeof r}`)),r;function i(e){const t=Number(e);return!isNaN(t)&&t>=0&&t!==1/0}let a=e;for(let e=0;e<t.length-1&&void 0!==a;e++){const r=t[e];(0,n.assertTruthy)(!Array.isArray(a)||i(r),(()=>`Invalid array index. Path: '${t.slice(0,e+1)}', index: '${r}'`)),a=a[r],(0,n.assertTruthy)(void 0===a||"object"==typeof a&&null!==a,(()=>`Cannot set a property to a non-record parent. Path: '${t.slice(0,e+1)}', type: '${null===a?"<null>":typeof a}'`))}const u=t[t.length-1];return(0,n.assertTruthy)(!Array.isArray(a)||i(u),(()=>`Invalid array index Path: '${t}`)),(null==a?void 0:a[u])===r?e:s(e,t,r)}function o(e,t){(0,n.assertTruthy)(0!==t.length,"Can't delete an empty path");let r=e;for(let i=0;i<t.length-1;i++){const o=t[i];if(r=r[o],void 0===r)return e;(0,n.assertTruthy)("object"==typeof r&&null!==r,(()=>`Cannot delete a property from a non-record parent. Path: '${t.slice(0,i+1)}', type: ${null===r?"<null>":typeof r}`))}const i=t[t.length-1];return void 0===r[i]?e:s(e,t,void 0)}function s(e,t,r){function i(e,r){(0,n.assertTruthy)(!Array.isArray(e),(()=>`Can't delete element of array. Path: '${t}'`)),delete e[r]}const o=Object.assign({},e);let s=o;for(let e=0;e<t.length-1;e++){const o=t[e],a=s[o];(0,n.assertTruthy)(void 0===a||"object"==typeof a&&null!==a,(()=>`Internal error: sub-path has an invalid type and can't be patched: '${t.slice(0,e+1)}', type: '${null===a?null:typeof a}'`));const u=void 0===a?void 0===r?void 0:{}:Array.isArray(a)?[...a]:Object.assign({},a);if(void 0===u)return i(s,o),s;s[o]=u,s=u}const a=t[t.length-1];return void 0===r?i(s,a):s[a]=r,o}function a(e,t){if(e.length<t.length)return!1;for(let r=0;r<t.length;r++)if(e[r]!==t[r])return!1;return!0}function u(e){const t=[...e];return t.sort(((e,t)=>{for(let r=0;r<e.length;r++){if(r===t.length)return 1;const n=e[r].localeCompare(t[r]);if(0!==n)return n}return e.length-t.length})),t}function c(e){const t=u(e),r=t;for(let e=0;e<t.length-1;e++){const n=t[e];for(let i=e+1;i<t.length;i++){const o=t[i];n.length===o.length&&a(n,o)&&(r[i]=void 0,e++)}}return r.filter((e=>void 0!==e))}t.apply=function e(t,r){switch(r.type){case"set":return i(t,r.path,r.value);case"delete":return o(t,r.path);case"batch":return r.actions.reduce(((t,r)=>e(t,r)),t)}},t.setInPath=i,t.deleteInPath=o,t.deepCloneOnPath=s,t.extractPaths=function e(t,r){const n=[];if("set"===t.type||"delete"===t.type)n.push(t.path);else if("batch"===t.type)for(const r of t.actions)n.push(...e(r,"as-is"));return"unique-and-sorted"===r?c(n):n},t.isPathPrefix=a,t.sortPaths=u,t.selectUniquePathPrefixes=function(e){if(1===e.length)return[...e];if(e.some((e=>0===e.length)))return[[]];const t=u(e),r=t;for(let e=0;e<r.length-1;e++){const n=t[e];for(let i=e+1;i<t.length;i++)a(t[i],n)&&(r[i]=void 0,e++)}return r.filter((e=>void 0!==e))},t.selectUniquePaths=c},4908:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7129),t)},7129:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Trie=void 0;class r{constructor(){this.root={children:new Map,childrenWithValue:0}}get(e){var t;return null===(t=this.getNode(e))||void 0===t?void 0:t.value}getOrSet(e,t){const r=this._buildPath(e);if(void 0!==r.value)return r.value;const n=t(e);return this._setNodeValue(r,n,void 0===n),n}set(e,t){const r=void 0===t?this._findNode(e):this._buildPath(e);r&&this._setNodeValue(r,t,!0)}delete(e){const t=this._findNode(e);if(void 0===t)return;if(void 0===t.parent){if(t!==this.root)throw new Error("Only root node can have no parent.");return this.root.value=void 0,this.root.children.clear(),void(this.root.childrenWithValue=0)}const r=(void 0===t.value?0:1)+t.childrenWithValue;r>0&&this._updateChildrenWithValue(t,-r),t.parent.children.delete(e[e.length-1]),this._runGc(t.parent)}clear(){this.delete([])}count(e=[],t="node-and-children"){const r=this.getNode(e);return void 0===r?0:r.childrenWithValue+("node-and-children"===t&&void 0!==r.value?1:0)}get isEmpty(){return 0===this.count()}fillPath(e,t){const n=[];let i=this.root,o=t(i.value,n);if(o!==r.StopFillToken){this._setNodeValue(i,o,!1);for(let s=0;s<e.length;s++){const a=e[s];n.push(a);let u=i.children.get(a);if(o=t(null==u?void 0:u.value,n),o===r.StopFillToken)break;u||(u={children:new Map,parent:i,childrenWithValue:0},i.children.set(a,u)),this._setNodeValue(u,o,!1),i=u}this._runGc(i)}}visitDfs(e,t,r=[]){const n=this.getNode(r);void 0!==n&&this._visitDfs(e,n,t,[...r])}_visitDfs(e,t,r,n){if("pre-order"===e&&!1===r(t.value,n))return!1;for(const[i,o]of t.children){if(n.push(i),!this._visitDfs(e,o,r,n))return!1;n.pop()}return"in-order"!==e||!1!==r(t.value,n)}getNode(e){return this._getNode(e)}_getNode(e){let t=this.root;for(const r of e)if(t=t.children.get(r),!t)return;return t}_findNode(e){let t=this.root;for(let r=0;r<e.length&&t;r++)t=t.children.get(e[r]);return t}_buildPath(e){let t=this.root;for(let r=0;r<e.length;r++){const n=e[r];let i=t.children.get(n);i||(i={children:new Map,parent:t,childrenWithValue:0},t.children.set(n,i)),t=i}return t}_setNodeValue(e,t,r){if(e.value!==t){const r=void 0===t?-1:void 0===e.value?1:0;e.value=t,this._updateChildrenWithValue(e,r)}r&&this._runGc(e)}_updateChildrenWithValue(e,t){if(0!==t)for(let r=e.parent;r;r=r.parent)if(r.childrenWithValue+=t,r.childrenWithValue<0)throw new Error("Internal error: negative counter value!")}_runGc(e){void 0===e.value&&(0===e.childrenWithValue&&e.children.clear(),e.parent&&this._runGc(e.parent))}}t.Trie=r,r.StopFillToken=Symbol("Trie.StopFillToken")},5366:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncSubject=void 0;var i=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}return n(t,e),t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t._hasValue,i=t._value,o=t.thrownError,s=t.isStopped,a=t._isComplete;r?e.error(o):(s||a)&&(n&&e.next(i),e.complete())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.prototype.complete=function(){var t=this,r=t._hasValue,n=t._value;t._isComplete||(this._isComplete=!0,r&&e.prototype.next.call(this,n),e.prototype.complete.call(this))},t}(r(20).Subject);t.AsyncSubject=i},1222:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.BehaviorSubject=void 0;var i=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return n(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(r(20).Subject);t.BehaviorSubject=i},6145:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeNotification=t.Notification=t.NotificationKind=void 0;var n,i=r(7209),o=r(8743),s=r(6612),a=r(4717);(n=t.NotificationKind||(t.NotificationKind={})).NEXT="N",n.ERROR="E",n.COMPLETE="C";var u=function(){function e(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return e.prototype.observe=function(e){return c(this,e)},e.prototype.do=function(e,t,r){var n=this,i=n.kind,o=n.value,s=n.error;return"N"===i?null==e?void 0:e(o):"E"===i?null==t?void 0:t(s):null==r?void 0:r()},e.prototype.accept=function(e,t,r){var n;return a.isFunction(null===(n=e)||void 0===n?void 0:n.next)?this.observe(e):this.do(e,t,r)},e.prototype.toObservable=function(){var e=this,t=e.kind,r=e.value,n=e.error,a="N"===t?o.of(r):"E"===t?s.throwError((function(){return n})):"C"===t?i.EMPTY:0;if(!a)throw new TypeError("Unexpected notification kind "+t);return a},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();function c(e,t){var r,n,i,o=e,s=o.kind,a=o.value,u=o.error;if("string"!=typeof s)throw new TypeError('Invalid notification, missing "kind"');"N"===s?null===(r=t.next)||void 0===r||r.call(t,a):"E"===s?null===(n=t.error)||void 0===n||n.call(t,u):null===(i=t.complete)||void 0===i||i.call(t)}t.Notification=u,t.observeNotification=c},795:(e,t)=>{function r(e,t,r){return{kind:e,value:t,error:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.createNotification=t.nextNotification=t.errorNotification=t.COMPLETE_NOTIFICATION=void 0,t.COMPLETE_NOTIFICATION=r("C",void 0,void 0),t.errorNotification=function(e){return r("E",void 0,e)},t.nextNotification=function(e){return r("N",e,void 0)},t.createNotification=r},2023:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var n=r(4512),i=r(7491),o=r(2131),s=r(2393),a=r(7820),u=r(4717),c=r(9916),l=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var o,s=this,a=(o=e)&&o instanceof n.Subscriber||function(e){return e&&u.isFunction(e.next)&&u.isFunction(e.error)&&u.isFunction(e.complete)}(o)&&i.isSubscription(o)?e:new n.SafeSubscriber(e,t,r);return c.errorContext((function(){var e=s,t=e.operator,r=e.source;a.add(t?t.call(a,r):r?s._subscribe(a):s._trySubscribe(a))})),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=h(t))((function(t,i){var o=new n.SafeSubscriber({next:function(t){try{e(t)}catch(e){i(e),o.unsubscribe()}},error:i,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[o.observable]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.pipeFromArray(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=h(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function h(e){var t;return null!==(t=null!=e?e:a.config.Promise)&&void 0!==t?t:Promise}t.Observable=l},5129:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.ReplaySubject=void 0;var i=r(20),o=r(4575),s=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=o.dateTimestampProvider);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,r),i}return n(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,i=r._buffer,o=r._infiniteTimeWindow,s=r._timestampProvider,a=r._windowTime;n||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!e.closed;i+=r?1:2)e.next(n[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<n.length&&n.splice(0,n.length-o),!i){for(var s=r.now(),a=0,u=1;u<n.length&&n[u]<=s;u+=2)a=u;a&&n.splice(0,a+1)}},t}(i.Subject);t.ReplaySubject=s},469:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Scheduler=void 0;var n=r(4575),i=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=n.dateTimestampProvider.now,e}();t.Scheduler=i},20:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousSubject=t.Subject=void 0;var o=r(2023),s=r(7491),a=r(8083),u=r(7394),c=r(9916),l=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return n(t,e),t.prototype.lift=function(e){var t=new h(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new a.ObjectUnsubscribedError},t.prototype.next=function(e){var t=this;c.errorContext((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=i(t.currentObservers),s=o.next();!s.done;s=o.next())s.value.next(e)}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;c.errorContext((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;c.errorContext((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,i=r.isStopped,o=r.observers;return n||i?s.EMPTY_SUBSCRIPTION:(this.currentObservers=null,o.push(e),new s.Subscription((function(){t.currentObservers=null,u.arrRemove(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new o.Observable;return e.source=this,e},t.create=function(e,t){return new h(e,t)},t}(o.Observable);t.Subject=l;var h=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return n(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:s.EMPTY_SUBSCRIPTION},t}(l);t.AnonymousSubject=h},4512:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_OBSERVER=t.SafeSubscriber=t.Subscriber=void 0;var i=r(4717),o=r(7491),s=r(7820),a=r(4696),u=r(6129),c=r(795),l=r(6476),h=r(9916),d=function(e){function r(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,o.isSubscription(r)&&r.add(n)):n.destination=t.EMPTY_OBSERVER,n}return n(r,e),r.create=function(e,t,r){return new y(e,t,r)},r.prototype.next=function(e){this.isStopped?m(c.nextNotification(e),this):this._next(e)},r.prototype.error=function(e){this.isStopped?m(c.errorNotification(e),this):(this.isStopped=!0,this._error(e))},r.prototype.complete=function(){this.isStopped?m(c.COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(e){this.destination.next(e)},r.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(o.Subscription);t.Subscriber=d;var f=Function.prototype.bind;function p(e,t){return f.call(e,t)}var v=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){b(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){b(e)}else b(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){b(e)}},e}(),y=function(e){function t(t,r,n){var o,a,u=e.call(this)||this;return i.isFunction(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:u&&s.config.useDeprecatedNextContext?((a=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},o={next:t.next&&p(t.next,a),error:t.error&&p(t.error,a),complete:t.complete&&p(t.complete,a)}):o=t,u.destination=new v(o),u}return n(t,e),t}(d);function b(e){s.config.useDeprecatedSynchronousErrorHandling?h.captureError(e):a.reportUnhandledError(e)}function m(e,t){var r=s.config.onStoppedNotification;r&&l.timeoutProvider.setTimeout((function(){return r(e,t)}))}t.SafeSubscriber=y,t.EMPTY_OBSERVER={closed:!0,next:u.noop,error:function(e){throw e},complete:u.noop}},7491:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.isSubscription=t.EMPTY_SUBSCRIPTION=t.Subscription=void 0;var s=r(4717),a=r(665),u=r(7394),c=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,u,c;if(!this.closed){this.closed=!0;var h=this._parentage;if(h)if(this._parentage=null,Array.isArray(h))try{for(var d=n(h),f=d.next();!f.done;f=d.next())f.value.remove(this)}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}else h.remove(this);var p=this.initialTeardown;if(s.isFunction(p))try{p()}catch(e){c=e instanceof a.UnsubscriptionError?e.errors:[e]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=n(v),b=y.next();!b.done;b=y.next()){var m=b.value;try{l(m)}catch(e){c=null!=c?c:[],e instanceof a.UnsubscriptionError?c=o(o([],i(c)),i(e.errors)):c.push(e)}}}catch(e){r={error:e}}finally{try{b&&!b.done&&(u=y.return)&&u.call(y)}finally{if(r)throw r.error}}}if(c)throw new a.UnsubscriptionError(c)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)l(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&u.arrRemove(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&u.arrRemove(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function l(e){s.isFunction(e)?e():e.unsubscribe()}t.Subscription=c,t.EMPTY_SUBSCRIPTION=c.EMPTY,t.isSubscription=function(e){return e instanceof c||e&&"closed"in e&&s.isFunction(e.remove)&&s.isFunction(e.add)&&s.isFunction(e.unsubscribe)}},7820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.config=void 0,t.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},1507:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectableObservable=void 0;var i=r(2023),o=r(7491),s=r(5884),a=r(1266),u=r(5416),c=function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,u.hasLift(t)&&(n.lift=t.lift),n}return n(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new o.Subscription;var r=this.getSubject();t.add(this.source.subscribe(a.createOperatorSubscriber(r,void 0,(function(){e._teardown(),r.complete()}),(function(t){e._teardown(),r.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=o.Subscription.EMPTY)}return t},t.prototype.refCount=function(){return s.refCount()(this)},t}(i.Observable);t.ConnectableObservable=c},994:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestInit=t.combineLatest=void 0;var n=r(2023),i=r(3787),o=r(5294),s=r(9391),a=r(8240),u=r(1824),c=r(4950),l=r(1266),h=r(5031);function d(e,t,r){return void 0===r&&(r=s.identity),function(n){f(t,(function(){for(var i=e.length,s=new Array(i),a=i,u=i,c=function(i){f(t,(function(){var c=o.from(e[i],t),h=!1;c.subscribe(l.createOperatorSubscriber(n,(function(e){s[i]=e,h||(h=!0,u--),u||n.next(r(s.slice()))}),(function(){--a||n.complete()})))}),n)},h=0;h<i;h++)c(h)}),n)}}function f(e,t,r){e?h.executeSchedule(r,e,t):t()}t.combineLatest=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=u.popScheduler(e),l=u.popResultSelector(e),h=i.argsArgArrayOrObject(e),f=h.args,p=h.keys;if(0===f.length)return o.from([],r);var v=new n.Observable(d(f,r,p?function(e){return c.createObject(p,e)}:s.identity));return l?v.pipe(a.mapOneOrManyArgs(l)):v},t.combineLatestInit=d},2070:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concat=void 0;var n=r(861),i=r(1824),o=r(5294);t.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.concatAll()(o.from(e,i.popScheduler(e)))}},7209:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.empty=t.EMPTY=void 0;var n=r(2023);t.EMPTY=new n.Observable((function(e){return e.complete()})),t.empty=function(e){return e?function(e){return new n.Observable((function(t){return e.schedule((function(){return t.complete()}))}))}(e):t.EMPTY}},5294:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.from=void 0;var n=r(4463),i=r(2296);t.from=function(e,t){return t?n.scheduled(e,t):i.innerFrom(e)}},3123:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromSubscribable=void 0;var n=r(2023);t.fromSubscribable=function(e){return new n.Observable((function(t){return e.subscribe(t)}))}},2296:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof s?s(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,i,(t=e[r](t)).done,t.value)}))}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.fromReadableStreamLike=t.fromAsyncIterable=t.fromIterable=t.fromPromise=t.fromArrayLike=t.fromInteropObservable=t.innerFrom=void 0;var a=r(5547),u=r(452),c=r(2023),l=r(1801),h=r(9451),d=r(3533),f=r(6847),p=r(3026),v=r(4717),y=r(4696),b=r(2131);function m(e){return new c.Observable((function(t){var r=e[b.observable]();if(v.isFunction(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}))}function g(e){return new c.Observable((function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()}))}function _(e){return new c.Observable((function(t){e.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,y.reportUnhandledError)}))}function O(e){return new c.Observable((function(t){var r,n;try{for(var i=s(e),o=i.next();!o.done;o=i.next()){var a=o.value;if(t.next(a),t.closed)return}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()}))}function S(e){return new c.Observable((function(t){(function(e,t){var r,s,a,u;return n(this,void 0,void 0,(function(){var n,c;return i(this,(function(i){switch(i.label){case 0:i.trys.push([0,5,6,11]),r=o(e),i.label=1;case 1:return[4,r.next()];case 2:if((s=i.sent()).done)return[3,4];if(n=s.value,t.next(n),t.closed)return[2];i.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=i.sent(),a={error:c},[3,11];case 6:return i.trys.push([6,,9,10]),s&&!s.done&&(u=r.return)?[4,u.call(r)]:[3,8];case 7:i.sent(),i.label=8;case 8:return[3,10];case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function E(e){return S(p.readableStreamLikeToAsyncGenerator(e))}t.innerFrom=function(e){if(e instanceof c.Observable)return e;if(null!=e){if(l.isInteropObservable(e))return m(e);if(a.isArrayLike(e))return g(e);if(u.isPromise(e))return _(e);if(h.isAsyncIterable(e))return S(e);if(f.isIterable(e))return O(e);if(p.isReadableStreamLike(e))return E(e)}throw d.createInvalidObservableTypeError(e)},t.fromInteropObservable=m,t.fromArrayLike=g,t.fromPromise=_,t.fromIterable=O,t.fromAsyncIterable=S,t.fromReadableStreamLike=E},8767:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.interval=void 0;var n=r(4386),i=r(5461);t.interval=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=n.asyncScheduler),e<0&&(e=0),i.timer(e,e,t)}},8743:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.of=void 0;var n=r(1824),i=r(5294);t.of=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=n.popScheduler(e);return i.from(e,r)}},6467:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.onErrorResumeNext=void 0;var n=r(2023),i=r(160),o=r(1266),s=r(6129),a=r(2296);t.onErrorResumeNext=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=i.argsOrArgArray(e);return new n.Observable((function(e){var t=0,n=function(){if(t<r.length){var i=void 0;try{i=a.innerFrom(r[t++])}catch(e){return void n()}var u=new o.OperatorSubscriber(e,void 0,s.noop,s.noop);i.subscribe(u),u.add(n)}else e.complete()};n()}))}},4143:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.raceInit=t.race=void 0;var n=r(2023),i=r(2296),o=r(160),s=r(1266);function a(e){return function(t){for(var r=[],n=function(n){r.push(i.innerFrom(e[n]).subscribe(s.createOperatorSubscriber(t,(function(e){if(r){for(var i=0;i<r.length;i++)i!==n&&r[i].unsubscribe();r=null}t.next(e)}))))},o=0;r&&!t.closed&&o<e.length;o++)n(o)}}t.race=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===(e=o.argsOrArgArray(e)).length?i.innerFrom(e[0]):new n.Observable(a(e))},t.raceInit=a},6612:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throwError=void 0;var n=r(2023),i=r(4717);t.throwError=function(e,t){var r=i.isFunction(e)?e:function(){return e},o=function(e){return e.error(r())};return new n.Observable(t?function(e){return t.schedule(o,0,e)}:o)}},5461:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timer=void 0;var n=r(2023),i=r(4386),o=r(4568),s=r(6349);t.timer=function(e,t,r){void 0===e&&(e=0),void 0===r&&(r=i.async);var a=-1;return null!=t&&(o.isScheduler(t)?r=t:a=t),new n.Observable((function(t){var n=s.isValidDate(e)?+e-r.now():e;n<0&&(n=0);var i=0;return r.schedule((function(){t.closed||(t.next(i++),0<=a?this.schedule(void 0,a):t.complete())}),n)}))}},1763:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.zip=void 0;var o=r(2023),s=r(2296),a=r(160),u=r(7209),c=r(1266),l=r(1824);t.zip=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=l.popResultSelector(e),h=a.argsOrArgArray(e);return h.length?new o.Observable((function(e){var t=h.map((function(){return[]})),o=h.map((function(){return!1}));e.add((function(){t=o=null}));for(var a=function(a){s.innerFrom(h[a]).subscribe(c.createOperatorSubscriber(e,(function(s){if(t[a].push(s),t.every((function(e){return e.length}))){var u=t.map((function(e){return e.shift()}));e.next(r?r.apply(void 0,i([],n(u))):u),t.some((function(e,t){return!e.length&&o[t]}))&&e.complete()}}),(function(){o[a]=!0,!t[a].length&&e.complete()})))},u=0;!e.closed&&u<h.length;u++)a(u);return function(){t=o=null}})):u.EMPTY}},1266:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.OperatorSubscriber=t.createOperatorSubscriber=void 0;var i=r(4512);t.createOperatorSubscriber=function(e,t,r,n,i){return new o(e,t,r,n,i)};var o=function(e){function t(t,r,n,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return n(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(i.Subscriber);t.OperatorSubscriber=o},6993:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.audit=void 0;var n=r(5416),i=r(2296),o=r(1266);t.audit=function(e){return n.operate((function(t,r){var n=!1,s=null,a=null,u=!1,c=function(){if(null==a||a.unsubscribe(),a=null,n){n=!1;var e=s;s=null,r.next(e)}u&&r.complete()},l=function(){a=null,u&&r.complete()};t.subscribe(o.createOperatorSubscriber(r,(function(t){n=!0,s=t,a||i.innerFrom(e(t)).subscribe(a=o.createOperatorSubscriber(r,c,l))}),(function(){u=!0,(!n||!a||a.closed)&&r.complete()})))}))}},4116:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.auditTime=void 0;var n=r(4386),i=r(6993),o=r(5461);t.auditTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.audit((function(){return o.timer(e,t)}))}},7190:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.buffer=void 0;var n=r(5416),i=r(6129),o=r(1266),s=r(2296);t.buffer=function(e){return n.operate((function(t,r){var n=[];return t.subscribe(o.createOperatorSubscriber(r,(function(e){return n.push(e)}),(function(){r.next(n),r.complete()}))),s.innerFrom(e).subscribe(o.createOperatorSubscriber(r,(function(){var e=n;n=[],r.next(e)}),i.noop)),function(){n=null}}))}},6835:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferCount=void 0;var i=r(5416),o=r(1266),s=r(7394);t.bufferCount=function(e,t){return void 0===t&&(t=null),t=null!=t?t:e,i.operate((function(r,i){var a=[],u=0;r.subscribe(o.createOperatorSubscriber(i,(function(r){var o,c,l,h,d=null;u++%t==0&&a.push([]);try{for(var f=n(a),p=f.next();!p.done;p=f.next())(b=p.value).push(r),e<=b.length&&(d=null!=d?d:[]).push(b)}catch(e){o={error:e}}finally{try{p&&!p.done&&(c=f.return)&&c.call(f)}finally{if(o)throw o.error}}if(d)try{for(var v=n(d),y=v.next();!y.done;y=v.next()){var b=y.value;s.arrRemove(a,b),i.next(b)}}catch(e){l={error:e}}finally{try{y&&!y.done&&(h=v.return)&&h.call(v)}finally{if(l)throw l.error}}}),(function(){var e,t;try{for(var r=n(a),o=r.next();!o.done;o=r.next()){var s=o.value;i.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.complete()}),void 0,(function(){a=null})))}))}},5219:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferTime=void 0;var i=r(7491),o=r(5416),s=r(1266),a=r(7394),u=r(4386),c=r(1824),l=r(5031);t.bufferTime=function(e){for(var t,r,h=[],d=1;d<arguments.length;d++)h[d-1]=arguments[d];var f=null!==(t=c.popScheduler(h))&&void 0!==t?t:u.asyncScheduler,p=null!==(r=h[0])&&void 0!==r?r:null,v=h[1]||1/0;return o.operate((function(t,r){var o=[],u=!1,c=function(e){var t=e.buffer;e.subs.unsubscribe(),a.arrRemove(o,e),r.next(t),u&&h()},h=function(){if(o){var t=new i.Subscription;r.add(t);var n={buffer:[],subs:t};o.push(n),l.executeSchedule(t,f,(function(){return c(n)}),e)}};null!==p&&p>=0?l.executeSchedule(r,f,h,p,!0):u=!0,h();var d=s.createOperatorSubscriber(r,(function(e){var t,r,i=o.slice();try{for(var s=n(i),a=s.next();!a.done;a=s.next()){var u=a.value,l=u.buffer;l.push(e),v<=l.length&&c(u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}),(function(){for(;null==o?void 0:o.length;)r.next(o.shift().buffer);null==d||d.unsubscribe(),r.complete(),r.unsubscribe()}),void 0,(function(){return o=null}));t.subscribe(d)}))}},118:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferToggle=void 0;var i=r(7491),o=r(5416),s=r(2296),a=r(1266),u=r(6129),c=r(7394);t.bufferToggle=function(e,t){return o.operate((function(r,o){var l=[];s.innerFrom(e).subscribe(a.createOperatorSubscriber(o,(function(e){var r=[];l.push(r);var n=new i.Subscription;n.add(s.innerFrom(t(e)).subscribe(a.createOperatorSubscriber(o,(function(){c.arrRemove(l,r),o.next(r),n.unsubscribe()}),u.noop)))}),u.noop)),r.subscribe(a.createOperatorSubscriber(o,(function(e){var t,r;try{for(var i=n(l),o=i.next();!o.done;o=i.next())o.value.push(e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}),(function(){for(;l.length>0;)o.next(l.shift());o.complete()})))}))}},7514:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bufferWhen=void 0;var n=r(5416),i=r(6129),o=r(1266),s=r(2296);t.bufferWhen=function(e){return n.operate((function(t,r){var n=null,a=null,u=function(){null==a||a.unsubscribe();var t=n;n=[],t&&r.next(t),s.innerFrom(e()).subscribe(a=o.createOperatorSubscriber(r,u,i.noop))};u(),t.subscribe(o.createOperatorSubscriber(r,(function(e){return null==n?void 0:n.push(e)}),(function(){n&&r.next(n),r.complete()}),void 0,(function(){return n=a=null})))}))}},8251:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.catchError=void 0;var n=r(2296),i=r(1266),o=r(5416);t.catchError=function e(t){return o.operate((function(r,o){var s,a=null,u=!1;a=r.subscribe(i.createOperatorSubscriber(o,void 0,void 0,(function(i){s=n.innerFrom(t(i,e(t)(r))),a?(a.unsubscribe(),a=null,s.subscribe(o)):u=!0}))),u&&(a.unsubscribe(),a=null,s.subscribe(o))}))}},1424:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineAll=void 0;var n=r(2945);t.combineAll=n.combineLatestAll},2e3:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatest=void 0;var o=r(994),s=r(5416),a=r(160),u=r(8240),c=r(2393),l=r(1824);t.combineLatest=function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var h=l.popResultSelector(t);return h?c.pipe(e.apply(void 0,i([],n(t))),u.mapOneOrManyArgs(h)):s.operate((function(e,r){o.combineLatestInit(i([e],n(a.argsOrArgArray(t))))(r)}))}},2945:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestAll=void 0;var n=r(994),i=r(587);t.combineLatestAll=function(e){return i.joinAllInternals(n.combineLatest,e)}},3928:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestWith=void 0;var o=r(2e3);t.combineLatestWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.combineLatest.apply(void 0,i([],n(e)))}},1812:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.concat=void 0;var o=r(5416),s=r(861),a=r(1824),u=r(5294);t.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=a.popScheduler(e);return o.operate((function(t,o){s.concatAll()(u.from(i([t],n(e)),r)).subscribe(o)}))}},861:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatAll=void 0;var n=r(1867);t.concatAll=function(){return n.mergeAll(1)}},1012:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatMap=void 0;var n=r(1282),i=r(4717);t.concatMap=function(e,t){return i.isFunction(t)?n.mergeMap(e,t,1):n.mergeMap(e,1)}},1157:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatMapTo=void 0;var n=r(1012),i=r(4717);t.concatMapTo=function(e,t){return i.isFunction(t)?n.concatMap((function(){return e}),t):n.concatMap((function(){return e}))}},3692:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.concatWith=void 0;var o=r(1812);t.concatWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.concat.apply(void 0,i([],n(e)))}},2216:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.connect=void 0;var n=r(20),i=r(2296),o=r(5416),s=r(3123),a={connector:function(){return new n.Subject}};t.connect=function(e,t){void 0===t&&(t=a);var r=t.connector;return o.operate((function(t,n){var o=r();i.innerFrom(e(s.fromSubscribable(o))).subscribe(n),n.add(t.subscribe(o))}))}},8041:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.count=void 0;var n=r(3818);t.count=function(e){return n.reduce((function(t,r,n){return!e||e(r,n)?t+1:t}),0)}},2747:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0;var n=r(5416),i=r(6129),o=r(1266),s=r(2296);t.debounce=function(e){return n.operate((function(t,r){var n=!1,a=null,u=null,c=function(){if(null==u||u.unsubscribe(),u=null,n){n=!1;var e=a;a=null,r.next(e)}};t.subscribe(o.createOperatorSubscriber(r,(function(t){null==u||u.unsubscribe(),n=!0,a=t,u=o.createOperatorSubscriber(r,c,i.noop),s.innerFrom(e(t)).subscribe(u)}),(function(){c(),r.complete()}),void 0,(function(){a=u=null})))}))}},3870:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounceTime=void 0;var n=r(4386),i=r(5416),o=r(1266);t.debounceTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.operate((function(r,n){var i=null,s=null,a=null,u=function(){if(i){i.unsubscribe(),i=null;var e=s;s=null,n.next(e)}};function c(){var r=a+e,o=t.now();if(o<r)return i=this.schedule(void 0,r-o),void n.add(i);u()}r.subscribe(o.createOperatorSubscriber(n,(function(r){s=r,a=t.now(),i||(i=t.schedule(c,e),n.add(i))}),(function(){u(),n.complete()}),void 0,(function(){s=i=null})))}))}},7507:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultIfEmpty=void 0;var n=r(5416),i=r(1266);t.defaultIfEmpty=function(e){return n.operate((function(t,r){var n=!1;t.subscribe(i.createOperatorSubscriber(r,(function(e){n=!0,r.next(e)}),(function(){n||r.next(e),r.complete()})))}))}},2409:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0;var n=r(4386),i=r(5137),o=r(5461);t.delay=function(e,t){void 0===t&&(t=n.asyncScheduler);var r=o.timer(e,t);return i.delayWhen((function(){return r}))}},5137:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.delayWhen=void 0;var n=r(2070),i=r(6803),o=r(2507),s=r(1357),a=r(1282),u=r(2296);t.delayWhen=function e(t,r){return r?function(s){return n.concat(r.pipe(i.take(1),o.ignoreElements()),s.pipe(e(t)))}:a.mergeMap((function(e,r){return u.innerFrom(t(e,r)).pipe(i.take(1),s.mapTo(e))}))}},4126:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dematerialize=void 0;var n=r(6145),i=r(5416),o=r(1266);t.dematerialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){return n.observeNotification(e,t)})))}))}},5208:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinct=void 0;var n=r(5416),i=r(1266),o=r(6129),s=r(2296);t.distinct=function(e,t){return n.operate((function(r,n){var a=new Set;r.subscribe(i.createOperatorSubscriber(n,(function(t){var r=e?e(t):t;a.has(r)||(a.add(r),n.next(t))}))),t&&s.innerFrom(t).subscribe(i.createOperatorSubscriber(n,(function(){return a.clear()}),o.noop))}))}},9939:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilChanged=void 0;var n=r(9391),i=r(5416),o=r(1266);function s(e,t){return e===t}t.distinctUntilChanged=function(e,t){return void 0===t&&(t=n.identity),e=null!=e?e:s,i.operate((function(r,n){var i,s=!0;r.subscribe(o.createOperatorSubscriber(n,(function(r){var o=t(r);!s&&e(i,o)||(s=!1,i=o,n.next(r))})))}))}},183:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilKeyChanged=void 0;var n=r(9939);t.distinctUntilKeyChanged=function(e,t){return n.distinctUntilChanged((function(r,n){return t?t(r[e],n[e]):r[e]===n[e]}))}},1195:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.elementAt=void 0;var n=r(9148),i=r(2914),o=r(5956),s=r(7507),a=r(6803);t.elementAt=function(e,t){if(e<0)throw new n.ArgumentOutOfRangeError;var r=arguments.length>=2;return function(u){return u.pipe(i.filter((function(t,r){return r===e})),a.take(1),r?s.defaultIfEmpty(t):o.throwIfEmpty((function(){return new n.ArgumentOutOfRangeError})))}}},3723:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.endWith=void 0;var o=r(2070),s=r(8743);t.endWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return o.concat(t,s.of.apply(void 0,i([],n(e))))}}},1909:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.every=void 0;var n=r(5416),i=r(1266);t.every=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(i){e.call(t,i,o++,r)||(n.next(!1),n.complete())}),(function(){n.next(!0),n.complete()})))}))}},9228:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaust=void 0;var n=r(9765);t.exhaust=n.exhaustAll},9765:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustAll=void 0;var n=r(8748),i=r(9391);t.exhaustAll=function(){return n.exhaustMap(i.identity)}},8748:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustMap=void 0;var n=r(4828),i=r(2296),o=r(5416),s=r(1266);t.exhaustMap=function e(t,r){return r?function(o){return o.pipe(e((function(e,o){return i.innerFrom(t(e,o)).pipe(n.map((function(t,n){return r(e,t,o,n)})))})))}:o.operate((function(e,r){var n=0,o=null,a=!1;e.subscribe(s.createOperatorSubscriber(r,(function(e){o||(o=s.createOperatorSubscriber(r,void 0,(function(){o=null,a&&r.complete()})),i.innerFrom(t(e,n++)).subscribe(o))}),(function(){a=!0,!o&&r.complete()})))}))}},8324:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.expand=void 0;var n=r(5416),i=r(3754);t.expand=function(e,t,r){return void 0===t&&(t=1/0),t=(t||0)<1?1/0:t,n.operate((function(n,o){return i.mergeInternals(n,o,e,t,void 0,!0,r)}))}},2914:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.filter=void 0;var n=r(5416),i=r(1266);t.filter=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}},9822:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.finalize=void 0;var n=r(5416);t.finalize=function(e){return n.operate((function(t,r){try{t.subscribe(r)}finally{r.add(e)}}))}},2819:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createFind=t.find=void 0;var n=r(5416),i=r(1266);function o(e,t,r){var n="index"===r;return function(r,o){var s=0;r.subscribe(i.createOperatorSubscriber(o,(function(i){var a=s++;e.call(t,i,a,r)&&(o.next(n?a:i),o.complete())}),(function(){o.next(n?-1:void 0),o.complete()})))}}t.find=function(e,t){return n.operate(o(e,t,"value"))},t.createFind=o},3367:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findIndex=void 0;var n=r(5416),i=r(2819);t.findIndex=function(e,t){return n.operate(i.createFind(e,t,"index"))}},1432:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.first=void 0;var n=r(7676),i=r(2914),o=r(6803),s=r(7507),a=r(5956),u=r(9391);t.first=function(e,t){var r=arguments.length>=2;return function(c){return c.pipe(e?i.filter((function(t,r){return e(t,r,c)})):u.identity,o.take(1),r?s.defaultIfEmpty(t):a.throwIfEmpty((function(){return new n.EmptyError})))}}},6977:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.flatMap=void 0;var n=r(1282);t.flatMap=n.mergeMap},4956:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.groupBy=void 0;var n=r(2023),i=r(2296),o=r(20),s=r(5416),a=r(1266);t.groupBy=function(e,t,r,u){return s.operate((function(s,c){var l;t&&"function"!=typeof t?(r=t.duration,l=t.element,u=t.connector):l=t;var h=new Map,d=function(e){h.forEach(e),e(c)},f=function(e){return d((function(t){return t.error(e)}))},p=0,v=!1,y=new a.OperatorSubscriber(c,(function(t){try{var s=e(t),d=h.get(s);if(!d){h.set(s,d=u?u():new o.Subject);var b=(g=s,_=d,(O=new n.Observable((function(e){p++;var t=_.subscribe(e);return function(){t.unsubscribe(),0==--p&&v&&y.unsubscribe()}}))).key=g,O);if(c.next(b),r){var m=a.createOperatorSubscriber(d,(function(){d.complete(),null==m||m.unsubscribe()}),void 0,void 0,(function(){return h.delete(s)}));y.add(i.innerFrom(r(b)).subscribe(m))}}d.next(l?l(t):t)}catch(e){f(e)}var g,_,O}),(function(){return d((function(e){return e.complete()}))}),f,(function(){return h.clear()}),(function(){return v=!0,0===p}));s.subscribe(y)}))}},2507:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ignoreElements=void 0;var n=r(5416),i=r(1266),o=r(6129);t.ignoreElements=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,o.noop))}))}},6095:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var n=r(5416),i=r(1266);t.isEmpty=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,(function(){t.next(!1),t.complete()}),(function(){t.next(!0),t.complete()})))}))}},587:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.joinAllInternals=void 0;var n=r(9391),i=r(8240),o=r(2393),s=r(1282),a=r(2984);t.joinAllInternals=function(e,t){return o.pipe(a.toArray(),s.mergeMap((function(t){return e(t)})),t?i.mapOneOrManyArgs(t):n.identity)}},3484:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.last=void 0;var n=r(7676),i=r(2914),o=r(787),s=r(5956),a=r(7507),u=r(9391);t.last=function(e,t){var r=arguments.length>=2;return function(c){return c.pipe(e?i.filter((function(t,r){return e(t,r,c)})):u.identity,o.takeLast(1),r?a.defaultIfEmpty(t):s.throwIfEmpty((function(){return new n.EmptyError})))}}},4828:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.map=void 0;var n=r(5416),i=r(1266);t.map=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){n.next(e.call(t,r,o++))})))}))}},1357:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mapTo=void 0;var n=r(4828);t.mapTo=function(e){return n.map((function(){return e}))}},7967:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.materialize=void 0;var n=r(6145),i=r(5416),o=r(1266);t.materialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){t.next(n.Notification.createNext(e))}),(function(){t.next(n.Notification.createComplete()),t.complete()}),(function(e){t.next(n.Notification.createError(e)),t.complete()})))}))}},4388:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.max=void 0;var n=r(3818),i=r(4717);t.max=function(e){return n.reduce(i.isFunction(e)?function(t,r){return e(t,r)>0?t:r}:function(e,t){return e>t?e:t})}},1550:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;var o=r(5416),s=r(160),a=r(1867),u=r(1824),c=r(5294);t.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=u.popScheduler(e),l=u.popNumber(e,1/0);return e=s.argsOrArgArray(e),o.operate((function(t,o){a.mergeAll(l)(c.from(i([t],n(e)),r)).subscribe(o)}))}},1867:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=void 0;var n=r(1282),i=r(9391);t.mergeAll=function(e){return void 0===e&&(e=1/0),n.mergeMap(i.identity,e)}},3754:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeInternals=void 0;var n=r(2296),i=r(5031),o=r(1266);t.mergeInternals=function(e,t,r,s,a,u,c,l){var h=[],d=0,f=0,p=!1,v=function(){!p||h.length||d||t.complete()},y=function(e){return d<s?b(e):h.push(e)},b=function(e){u&&t.next(e),d++;var l=!1;n.innerFrom(r(e,f++)).subscribe(o.createOperatorSubscriber(t,(function(e){null==a||a(e),u?y(e):t.next(e)}),(function(){l=!0}),void 0,(function(){if(l)try{d--;for(var e=function(){var e=h.shift();c?i.executeSchedule(t,c,(function(){return b(e)})):b(e)};h.length&&d<s;)e();v()}catch(e){t.error(e)}})))};return e.subscribe(o.createOperatorSubscriber(t,y,(function(){p=!0,v()}))),function(){null==l||l()}}},1282:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMap=void 0;var n=r(4828),i=r(2296),o=r(5416),s=r(3754),a=r(4717);t.mergeMap=function e(t,r,u){return void 0===u&&(u=1/0),a.isFunction(r)?e((function(e,o){return n.map((function(t,n){return r(e,t,o,n)}))(i.innerFrom(t(e,o)))}),u):("number"==typeof r&&(u=r),o.operate((function(e,r){return s.mergeInternals(e,r,t,u)})))}},6295:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMapTo=void 0;var n=r(1282),i=r(4717);t.mergeMapTo=function(e,t,r){return void 0===r&&(r=1/0),i.isFunction(t)?n.mergeMap((function(){return e}),t,r):("number"==typeof t&&(r=t),n.mergeMap((function(){return e}),r))}},9527:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeScan=void 0;var n=r(5416),i=r(3754);t.mergeScan=function(e,t,r){return void 0===r&&(r=1/0),n.operate((function(n,o){var s=t;return i.mergeInternals(n,o,(function(t,r){return e(s,t,r)}),r,(function(e){s=e}),!1,void 0,(function(){return s=null}))}))}},5834:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.mergeWith=void 0;var o=r(1550);t.mergeWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.merge.apply(void 0,i([],n(e)))}},1306:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.min=void 0;var n=r(3818),i=r(4717);t.min=function(e){return n.reduce(i.isFunction(e)?function(t,r){return e(t,r)<0?t:r}:function(e,t){return e<t?e:t})}},9924:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.multicast=void 0;var n=r(1507),i=r(4717),o=r(2216);t.multicast=function(e,t){var r=i.isFunction(e)?e:function(){return e};return i.isFunction(t)?o.connect(t,{connector:r}):function(e){return new n.ConnectableObservable(e,r)}}},2803:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeOn=void 0;var n=r(5031),i=r(5416),o=r(1266);t.observeOn=function(e,t){return void 0===t&&(t=0),i.operate((function(r,i){r.subscribe(o.createOperatorSubscriber(i,(function(r){return n.executeSchedule(i,e,(function(){return i.next(r)}),t)}),(function(){return n.executeSchedule(i,e,(function(){return i.complete()}),t)}),(function(r){return n.executeSchedule(i,e,(function(){return i.error(r)}),t)})))}))}},1997:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.onErrorResumeNext=t.onErrorResumeNextWith=void 0;var o=r(160),s=r(6467);function a(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=o.argsOrArgArray(e);return function(e){return s.onErrorResumeNext.apply(void 0,i([e],n(r)))}}t.onErrorResumeNextWith=a,t.onErrorResumeNext=a},4492:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pairwise=void 0;var n=r(5416),i=r(1266);t.pairwise=function(){return n.operate((function(e,t){var r,n=!1;e.subscribe(i.createOperatorSubscriber(t,(function(e){var i=r;r=e,n&&t.next([i,e]),n=!0})))}))}},5352:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.partition=void 0;var n=r(1276),i=r(2914);t.partition=function(e,t){return function(r){return[i.filter(e,t)(r),i.filter(n.not(e,t))(r)]}}},3391:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pluck=void 0;var n=r(4828);t.pluck=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length;if(0===r)throw new Error("list of properties cannot be empty.");return n.map((function(t){for(var n=t,i=0;i<r;i++){var o=null==n?void 0:n[e[i]];if(void 0===o)return;n=o}return n}))}},297:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publish=void 0;var n=r(20),i=r(9924),o=r(2216);t.publish=function(e){return e?function(t){return o.connect(e)(t)}:function(e){return i.multicast(new n.Subject)(e)}}},6383:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishBehavior=void 0;var n=r(1222),i=r(1507);t.publishBehavior=function(e){return function(t){var r=new n.BehaviorSubject(e);return new i.ConnectableObservable(t,(function(){return r}))}}},8229:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishLast=void 0;var n=r(5366),i=r(1507);t.publishLast=function(){return function(e){var t=new n.AsyncSubject;return new i.ConnectableObservable(e,(function(){return t}))}}},8226:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishReplay=void 0;var n=r(5129),i=r(9924),o=r(4717);t.publishReplay=function(e,t,r,s){r&&!o.isFunction(r)&&(s=r);var a=o.isFunction(r)?r:void 0;return function(r){return i.multicast(new n.ReplaySubject(e,t,s),a)(r)}}},8973:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.race=void 0;var o=r(160),s=r(177);t.race=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.raceWith.apply(void 0,i([],n(o.argsOrArgArray(e))))}},177:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.raceWith=void 0;var o=r(4143),s=r(5416),a=r(9391);t.raceWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length?s.operate((function(t,r){o.raceInit(i([t],n(e)))(r)})):a.identity}},3818:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reduce=void 0;var n=r(7071),i=r(5416);t.reduce=function(e,t){return i.operate(n.scanInternals(e,t,arguments.length>=2,!1,!0))}},5884:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.refCount=void 0;var n=r(5416),i=r(1266);t.refCount=function(){return n.operate((function(e,t){var r=null;e._refCount++;var n=i.createOperatorSubscriber(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)r=null;else{var n=e._connection,i=r;r=null,!n||i&&n!==i||n.unsubscribe(),t.unsubscribe()}}));e.subscribe(n),n.closed||(r=e.connect())}))}},7775:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeat=void 0;var n=r(7209),i=r(5416),o=r(1266),s=r(2296),a=r(5461);t.repeat=function(e){var t,r,u=1/0;return null!=e&&("object"==typeof e?(t=e.count,u=void 0===t?1/0:t,r=e.delay):u=e),u<=0?function(){return n.EMPTY}:i.operate((function(e,t){var n,i=0,c=function(){if(null==n||n.unsubscribe(),n=null,null!=r){var e="number"==typeof r?a.timer(r):s.innerFrom(r(i)),u=o.createOperatorSubscriber(t,(function(){u.unsubscribe(),l()}));e.subscribe(u)}else l()},l=function(){var r=!1;n=e.subscribe(o.createOperatorSubscriber(t,void 0,(function(){++i<u?n?c():r=!0:t.complete()}))),r&&c()};l()}))}},5567:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeatWhen=void 0;var n=r(2296),i=r(20),o=r(5416),s=r(1266);t.repeatWhen=function(e){return o.operate((function(t,r){var o,a,u=!1,c=!1,l=!1,h=function(){return l&&c&&(r.complete(),!0)},d=function(){l=!1,o=t.subscribe(s.createOperatorSubscriber(r,void 0,(function(){l=!0,!h()&&(a||(a=new i.Subject,n.innerFrom(e(a)).subscribe(s.createOperatorSubscriber(r,(function(){o?d():u=!0}),(function(){c=!0,h()})))),a).next()}))),u&&(o.unsubscribe(),o=null,u=!1,d())};d()}))}},4740:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retry=void 0;var n=r(5416),i=r(1266),o=r(9391),s=r(5461),a=r(2296);t.retry=function(e){var t;void 0===e&&(e=1/0);var r=(t=e&&"object"==typeof e?e:{count:e}).count,u=void 0===r?1/0:r,c=t.delay,l=t.resetOnSuccess,h=void 0!==l&&l;return u<=0?o.identity:n.operate((function(e,t){var r,n=0,o=function(){var l=!1;r=e.subscribe(i.createOperatorSubscriber(t,(function(e){h&&(n=0),t.next(e)}),void 0,(function(e){if(n++<u){var h=function(){r?(r.unsubscribe(),r=null,o()):l=!0};if(null!=c){var d="number"==typeof c?s.timer(c):a.innerFrom(c(e,n)),f=i.createOperatorSubscriber(t,(function(){f.unsubscribe(),h()}),(function(){t.complete()}));d.subscribe(f)}else h()}else t.error(e)}))),l&&(r.unsubscribe(),r=null,o())};o()}))}},264:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retryWhen=void 0;var n=r(2296),i=r(20),o=r(5416),s=r(1266);t.retryWhen=function(e){return o.operate((function(t,r){var o,a,u=!1,c=function(){o=t.subscribe(s.createOperatorSubscriber(r,void 0,void 0,(function(t){a||(a=new i.Subject,n.innerFrom(e(a)).subscribe(s.createOperatorSubscriber(r,(function(){return o?c():u=!0})))),a&&a.next(t)}))),u&&(o.unsubscribe(),o=null,u=!1,c())};c()}))}},6870:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sample=void 0;var n=r(2296),i=r(5416),o=r(6129),s=r(1266);t.sample=function(e){return i.operate((function(t,r){var i=!1,a=null;t.subscribe(s.createOperatorSubscriber(r,(function(e){i=!0,a=e}))),n.innerFrom(e).subscribe(s.createOperatorSubscriber(r,(function(){if(i){i=!1;var e=a;a=null,r.next(e)}}),o.noop))}))}},5411:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sampleTime=void 0;var n=r(4386),i=r(6870),o=r(8767);t.sampleTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.sample(o.interval(e,t))}},2457:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scan=void 0;var n=r(5416),i=r(7071);t.scan=function(e,t){return n.operate(i.scanInternals(e,t,arguments.length>=2,!0))}},7071:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scanInternals=void 0;var n=r(1266);t.scanInternals=function(e,t,r,i,o){return function(s,a){var u=r,c=t,l=0;s.subscribe(n.createOperatorSubscriber(a,(function(t){var r=l++;c=u?e(c,t,r):(u=!0,t),i&&a.next(c)}),o&&function(){u&&a.next(c),a.complete()}))}}},5109:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sequenceEqual=void 0;var n=r(5416),i=r(1266),o=r(2296);t.sequenceEqual=function(e,t){return void 0===t&&(t=function(e,t){return e===t}),n.operate((function(r,n){var s={buffer:[],complete:!1},a={buffer:[],complete:!1},u=function(e){n.next(e),n.complete()},c=function(e,r){var o=i.createOperatorSubscriber(n,(function(n){var i=r.buffer,o=r.complete;0===i.length?o?u(!1):e.buffer.push(n):!t(n,i.shift())&&u(!1)}),(function(){e.complete=!0;var t=r.complete,n=r.buffer;t&&u(0===n.length),null==o||o.unsubscribe()}));return o};r.subscribe(c(s,a)),o.innerFrom(e).subscribe(c(a,s))}))}},3329:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.share=void 0;var o=r(2296),s=r(20),a=r(4512),u=r(5416);function c(e,t){for(var r=[],s=2;s<arguments.length;s++)r[s-2]=arguments[s];if(!0!==t){if(!1!==t){var u=new a.SafeSubscriber({next:function(){u.unsubscribe(),e()}});return o.innerFrom(t.apply(void 0,i([],n(r)))).subscribe(u)}}else e()}t.share=function(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new s.Subject}:t,n=e.resetOnError,i=void 0===n||n,l=e.resetOnComplete,h=void 0===l||l,d=e.resetOnRefCountZero,f=void 0===d||d;return function(e){var t,n,s,l=0,d=!1,p=!1,v=function(){null==n||n.unsubscribe(),n=void 0},y=function(){v(),t=s=void 0,d=p=!1},b=function(){var e=t;y(),null==e||e.unsubscribe()};return u.operate((function(e,u){l++,p||d||v();var m=s=null!=s?s:r();u.add((function(){0!=--l||p||d||(n=c(b,f))})),m.subscribe(u),!t&&l>0&&(t=new a.SafeSubscriber({next:function(e){return m.next(e)},error:function(e){p=!0,v(),n=c(y,i,e),m.error(e)},complete:function(){d=!0,v(),n=c(y,h),m.complete()}}),o.innerFrom(e).subscribe(t))}))(e)}}},1738:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.shareReplay=void 0;var n=r(5129),i=r(3329);t.shareReplay=function(e,t,r){var o,s,a,u,c=!1;return e&&"object"==typeof e?(o=e.bufferSize,u=void 0===o?1/0:o,s=e.windowTime,t=void 0===s?1/0:s,c=void 0!==(a=e.refCount)&&a,r=e.scheduler):u=null!=e?e:1/0,i.share({connector:function(){return new n.ReplaySubject(u,t,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:c})}},884:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.single=void 0;var n=r(7676),i=r(8168),o=r(2318),s=r(5416),a=r(1266);t.single=function(e){return s.operate((function(t,r){var s,u=!1,c=!1,l=0;t.subscribe(a.createOperatorSubscriber(r,(function(n){c=!0,e&&!e(n,l++,t)||(u&&r.error(new i.SequenceError("Too many matching values")),u=!0,s=n)}),(function(){u?(r.next(s),r.complete()):r.error(c?new o.NotFoundError("No matching values"):new n.EmptyError)})))}))}},4411:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skip=void 0;var n=r(2914);t.skip=function(e){return n.filter((function(t,r){return e<=r}))}},9355:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipLast=void 0;var n=r(9391),i=r(5416),o=r(1266);t.skipLast=function(e){return e<=0?n.identity:i.operate((function(t,r){var n=new Array(e),i=0;return t.subscribe(o.createOperatorSubscriber(r,(function(t){var o=i++;if(o<e)n[o]=t;else{var s=o%e,a=n[s];n[s]=t,r.next(a)}}))),function(){n=null}}))}},2947:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipUntil=void 0;var n=r(5416),i=r(1266),o=r(2296),s=r(6129);t.skipUntil=function(e){return n.operate((function(t,r){var n=!1,a=i.createOperatorSubscriber(r,(function(){null==a||a.unsubscribe(),n=!0}),s.noop);o.innerFrom(e).subscribe(a),t.subscribe(i.createOperatorSubscriber(r,(function(e){return n&&r.next(e)})))}))}},9842:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipWhile=void 0;var n=r(5416),i=r(1266);t.skipWhile=function(e){return n.operate((function(t,r){var n=!1,o=0;t.subscribe(i.createOperatorSubscriber(r,(function(t){return(n||(n=!e(t,o++)))&&r.next(t)})))}))}},2778:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.startWith=void 0;var n=r(2070),i=r(1824),o=r(5416);t.startWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=i.popScheduler(e);return o.operate((function(t,i){(r?n.concat(e,t,r):n.concat(e,t)).subscribe(i)}))}},4027:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.subscribeOn=void 0;var n=r(5416);t.subscribeOn=function(e,t){return void 0===t&&(t=0),n.operate((function(r,n){n.add(e.schedule((function(){return r.subscribe(n)}),t))}))}},9061:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchAll=void 0;var n=r(6300),i=r(9391);t.switchAll=function(){return n.switchMap(i.identity)}},6300:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchMap=void 0;var n=r(2296),i=r(5416),o=r(1266);t.switchMap=function(e,t){return i.operate((function(r,i){var s=null,a=0,u=!1,c=function(){return u&&!s&&i.complete()};r.subscribe(o.createOperatorSubscriber(i,(function(r){null==s||s.unsubscribe();var u=0,l=a++;n.innerFrom(e(r,l)).subscribe(s=o.createOperatorSubscriber(i,(function(e){return i.next(t?t(r,e,l,u++):e)}),(function(){s=null,c()})))}),(function(){u=!0,c()})))}))}},1933:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchMapTo=void 0;var n=r(6300),i=r(4717);t.switchMapTo=function(e,t){return i.isFunction(t)?n.switchMap((function(){return e}),t):n.switchMap((function(){return e}))}},1689:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchScan=void 0;var n=r(6300),i=r(5416);t.switchScan=function(e,t){return i.operate((function(r,i){var o=t;return n.switchMap((function(t,r){return e(o,t,r)}),(function(e,t){return o=t,t}))(r).subscribe(i),function(){o=null}}))}},6803:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.take=void 0;var n=r(7209),i=r(5416),o=r(1266);t.take=function(e){return e<=0?function(){return n.EMPTY}:i.operate((function(t,r){var n=0;t.subscribe(o.createOperatorSubscriber(r,(function(t){++n<=e&&(r.next(t),e<=n&&r.complete())})))}))}},787:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.takeLast=void 0;var i=r(7209),o=r(5416),s=r(1266);t.takeLast=function(e){return e<=0?function(){return i.EMPTY}:o.operate((function(t,r){var i=[];t.subscribe(s.createOperatorSubscriber(r,(function(t){i.push(t),e<i.length&&i.shift()}),(function(){var e,t;try{for(var o=n(i),s=o.next();!s.done;s=o.next()){var a=s.value;r.next(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}r.complete()}),void 0,(function(){i=null})))}))}},4811:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.takeUntil=void 0;var n=r(5416),i=r(1266),o=r(2296),s=r(6129);t.takeUntil=function(e){return n.operate((function(t,r){o.innerFrom(e).subscribe(i.createOperatorSubscriber(r,(function(){return r.complete()}),s.noop)),!r.closed&&t.subscribe(r)}))}},7770:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.takeWhile=void 0;var n=r(5416),i=r(1266);t.takeWhile=function(e,t){return void 0===t&&(t=!1),n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){var i=e(r,o++);(i||t)&&n.next(r),!i&&n.complete()})))}))}},9967:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tap=void 0;var n=r(4717),i=r(5416),o=r(1266),s=r(9391);t.tap=function(e,t,r){var a=n.isFunction(e)||t||r?{next:e,error:t,complete:r}:e;return a?i.operate((function(e,t){var r;null===(r=a.subscribe)||void 0===r||r.call(a);var n=!0;e.subscribe(o.createOperatorSubscriber(t,(function(e){var r;null===(r=a.next)||void 0===r||r.call(a,e),t.next(e)}),(function(){var e;n=!1,null===(e=a.complete)||void 0===e||e.call(a),t.complete()}),(function(e){var r;n=!1,null===(r=a.error)||void 0===r||r.call(a,e),t.error(e)}),(function(){var e,t;n&&(null===(e=a.unsubscribe)||void 0===e||e.call(a)),null===(t=a.finalize)||void 0===t||t.call(a)})))})):s.identity}},6516:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=void 0;var n=r(5416),i=r(1266),o=r(2296);t.throttle=function(e,t){return n.operate((function(r,n){var s=null!=t?t:{},a=s.leading,u=void 0===a||a,c=s.trailing,l=void 0!==c&&c,h=!1,d=null,f=null,p=!1,v=function(){null==f||f.unsubscribe(),f=null,l&&(m(),p&&n.complete())},y=function(){f=null,p&&n.complete()},b=function(t){return f=o.innerFrom(e(t)).subscribe(i.createOperatorSubscriber(n,v,y))},m=function(){if(h){h=!1;var e=d;d=null,n.next(e),!p&&b(e)}};r.subscribe(i.createOperatorSubscriber(n,(function(e){h=!0,d=e,(!f||f.closed)&&(u?m():b(e))}),(function(){p=!0,(!(l&&h&&f)||f.closed)&&n.complete()})))}))}},5945:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throttleTime=void 0;var n=r(4386),i=r(6516),o=r(5461);t.throttleTime=function(e,t,r){void 0===t&&(t=n.asyncScheduler);var s=o.timer(e,t);return i.throttle((function(){return s}),r)}},5956:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfEmpty=void 0;var n=r(7676),i=r(5416),o=r(1266);function s(){return new n.EmptyError}t.throwIfEmpty=function(e){return void 0===e&&(e=s),i.operate((function(t,r){var n=!1;t.subscribe(o.createOperatorSubscriber(r,(function(e){n=!0,r.next(e)}),(function(){return n?r.complete():r.error(e())})))}))}},9712:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeInterval=t.timeInterval=void 0;var n=r(4386),i=r(5416),o=r(1266);t.timeInterval=function(e){return void 0===e&&(e=n.asyncScheduler),i.operate((function(t,r){var n=e.now();t.subscribe(o.createOperatorSubscriber(r,(function(t){var i=e.now(),o=i-n;n=i,r.next(new s(t,o))})))}))};var s=function(e,t){this.value=e,this.interval=t};t.TimeInterval=s},7517:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeout=t.TimeoutError=void 0;var n=r(4386),i=r(6349),o=r(5416),s=r(2296),a=r(6871),u=r(1266),c=r(5031);function l(e){throw new t.TimeoutError(e)}t.TimeoutError=a.createErrorClass((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}})),t.timeout=function(e,t){var r=i.isValidDate(e)?{first:e}:"number"==typeof e?{each:e}:e,a=r.first,h=r.each,d=r.with,f=void 0===d?l:d,p=r.scheduler,v=void 0===p?null!=t?t:n.asyncScheduler:p,y=r.meta,b=void 0===y?null:y;if(null==a&&null==h)throw new TypeError("No timeout provided.");return o.operate((function(e,t){var r,n,i=null,o=0,l=function(e){n=c.executeSchedule(t,v,(function(){try{r.unsubscribe(),s.innerFrom(f({meta:b,lastValue:i,seen:o})).subscribe(t)}catch(e){t.error(e)}}),e)};r=e.subscribe(u.createOperatorSubscriber(t,(function(e){null==n||n.unsubscribe(),o++,t.next(i=e),h>0&&l(h)}),void 0,void 0,(function(){(null==n?void 0:n.closed)||null==n||n.unsubscribe(),i=null}))),!o&&l(null!=a?"number"==typeof a?a:+a-v.now():h)}))}},2001:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutWith=void 0;var n=r(4386),i=r(6349),o=r(7517);t.timeoutWith=function(e,t,r){var s,a,u;if(r=null!=r?r:n.async,i.isValidDate(e)?s=e:"number"==typeof e&&(a=e),!t)throw new TypeError("No observable provided to switch to");if(u=function(){return t},null==s&&null==a)throw new TypeError("No timeout provided.");return o.timeout({first:s,each:a,scheduler:r,with:u})}},8158:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timestamp=void 0;var n=r(4575),i=r(4828);t.timestamp=function(e){return void 0===e&&(e=n.dateTimestampProvider),i.map((function(t){return{value:t,timestamp:e.now()}}))}},2984:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toArray=void 0;var n=r(3818),i=r(5416),o=function(e,t){return e.push(t),e};t.toArray=function(){return i.operate((function(e,t){n.reduce(o,[])(e).subscribe(t)}))}},5492:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.window=void 0;var n=r(20),i=r(5416),o=r(1266),s=r(6129),a=r(2296);t.window=function(e){return i.operate((function(t,r){var i=new n.Subject;r.next(i.asObservable());var u=function(e){i.error(e),r.error(e)};return t.subscribe(o.createOperatorSubscriber(r,(function(e){return null==i?void 0:i.next(e)}),(function(){i.complete(),r.complete()}),u)),a.innerFrom(e).subscribe(o.createOperatorSubscriber(r,(function(){i.complete(),r.next(i=new n.Subject)}),s.noop,u)),function(){null==i||i.unsubscribe(),i=null}}))}},6817:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.windowCount=void 0;var i=r(20),o=r(5416),s=r(1266);t.windowCount=function(e,t){void 0===t&&(t=0);var r=t>0?t:e;return o.operate((function(t,o){var a=[new i.Subject],u=0;o.next(a[0].asObservable()),t.subscribe(s.createOperatorSubscriber(o,(function(t){var s,c;try{for(var l=n(a),h=l.next();!h.done;h=l.next())h.value.next(t)}catch(e){s={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(s)throw s.error}}var d=u-e+1;if(d>=0&&d%r==0&&a.shift().complete(),++u%r==0){var f=new i.Subject;a.push(f),o.next(f.asObservable())}}),(function(){for(;a.length>0;)a.shift().complete();o.complete()}),(function(e){for(;a.length>0;)a.shift().error(e);o.error(e)}),(function(){a=null})))}))}},6841:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.windowTime=void 0;var n=r(20),i=r(4386),o=r(7491),s=r(5416),a=r(1266),u=r(7394),c=r(1824),l=r(5031);t.windowTime=function(e){for(var t,r,h=[],d=1;d<arguments.length;d++)h[d-1]=arguments[d];var f=null!==(t=c.popScheduler(h))&&void 0!==t?t:i.asyncScheduler,p=null!==(r=h[0])&&void 0!==r?r:null,v=h[1]||1/0;return s.operate((function(t,r){var i=[],s=!1,c=function(e){var t=e.window,r=e.subs;t.complete(),r.unsubscribe(),u.arrRemove(i,e),s&&h()},h=function(){if(i){var t=new o.Subscription;r.add(t);var s=new n.Subject,a={window:s,subs:t,seen:0};i.push(a),r.next(s.asObservable()),l.executeSchedule(t,f,(function(){return c(a)}),e)}};null!==p&&p>=0?l.executeSchedule(r,f,h,p,!0):s=!0,h();var d=function(e){return i.slice().forEach(e)},y=function(e){d((function(t){var r=t.window;return e(r)})),e(r),r.unsubscribe()};return t.subscribe(a.createOperatorSubscriber(r,(function(e){d((function(t){t.window.next(e),v<=++t.seen&&c(t)}))}),(function(){return y((function(e){return e.complete()}))}),(function(e){return y((function(t){return t.error(e)}))}))),function(){i=null}}))}},4880:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.windowToggle=void 0;var i=r(20),o=r(7491),s=r(5416),a=r(2296),u=r(1266),c=r(6129),l=r(7394);t.windowToggle=function(e,t){return s.operate((function(r,s){var h=[],d=function(e){for(;0<h.length;)h.shift().error(e);s.error(e)};a.innerFrom(e).subscribe(u.createOperatorSubscriber(s,(function(e){var r=new i.Subject;h.push(r);var n,f=new o.Subscription;try{n=a.innerFrom(t(e))}catch(e){return void d(e)}s.next(r.asObservable()),f.add(n.subscribe(u.createOperatorSubscriber(s,(function(){l.arrRemove(h,r),r.complete(),f.unsubscribe()}),c.noop,d)))}),c.noop)),r.subscribe(u.createOperatorSubscriber(s,(function(e){var t,r,i=h.slice();try{for(var o=n(i),s=o.next();!s.done;s=o.next())s.value.next(e)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}),(function(){for(;0<h.length;)h.shift().complete();s.complete()}),d,(function(){for(;0<h.length;)h.shift().unsubscribe()})))}))}},3016:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.windowWhen=void 0;var n=r(20),i=r(5416),o=r(1266),s=r(2296);t.windowWhen=function(e){return i.operate((function(t,r){var i,a,u=function(e){i.error(e),r.error(e)},c=function(){var t;null==a||a.unsubscribe(),null==i||i.complete(),i=new n.Subject,r.next(i.asObservable());try{t=s.innerFrom(e())}catch(e){return void u(e)}t.subscribe(a=o.createOperatorSubscriber(r,c,c,u))};c(),t.subscribe(o.createOperatorSubscriber(r,(function(e){return i.next(e)}),(function(){i.complete(),r.complete()}),u,(function(){null==a||a.unsubscribe(),i=null})))}))}},9163:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.withLatestFrom=void 0;var o=r(5416),s=r(1266),a=r(2296),u=r(9391),c=r(6129),l=r(1824);t.withLatestFrom=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=l.popResultSelector(e);return o.operate((function(t,o){for(var l=e.length,h=new Array(l),d=e.map((function(){return!1})),f=!1,p=function(t){a.innerFrom(e[t]).subscribe(s.createOperatorSubscriber(o,(function(e){h[t]=e,f||d[t]||(d[t]=!0,(f=d.every(u.identity))&&(d=null))}),c.noop))},v=0;v<l;v++)p(v);t.subscribe(s.createOperatorSubscriber(o,(function(e){if(f){var t=i([e],n(h));o.next(r?r.apply(void 0,i([],n(t))):t)}})))}))}},2681:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.zip=void 0;var o=r(1763),s=r(5416);t.zip=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.operate((function(t,r){o.zip.apply(void 0,i([t],n(e))).subscribe(r)}))}},5606:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.zipAll=void 0;var n=r(1763),i=r(587);t.zipAll=function(e){return i.joinAllInternals(n.zip,e)}},973:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.zipWith=void 0;var o=r(2681);t.zipWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.zip.apply(void 0,i([],n(e)))}},8762:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleArray=void 0;var n=r(2023);t.scheduleArray=function(e,t){return new n.Observable((function(r){var n=0;return t.schedule((function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())}))}))}},3741:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleAsyncIterable=void 0;var n=r(2023),i=r(5031);t.scheduleAsyncIterable=function(e,t){if(!e)throw new Error("Iterable cannot be null");return new n.Observable((function(r){i.executeSchedule(r,t,(function(){var n=e[Symbol.asyncIterator]();i.executeSchedule(r,t,(function(){n.next().then((function(e){e.done?r.complete():r.next(e.value)}))}),0,!0)}))}))}},3585:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleIterable=void 0;var n=r(2023),i=r(3967),o=r(4717),s=r(5031);t.scheduleIterable=function(e,t){return new n.Observable((function(r){var n;return s.executeSchedule(r,t,(function(){n=e[i.iterator](),s.executeSchedule(r,t,(function(){var e,t,i;try{t=(e=n.next()).value,i=e.done}catch(e){return void r.error(e)}i?r.complete():r.next(t)}),0,!0)})),function(){return o.isFunction(null==n?void 0:n.return)&&n.return()}}))}},4502:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleObservable=void 0;var n=r(2296),i=r(2803),o=r(4027);t.scheduleObservable=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},2366:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.schedulePromise=void 0;var n=r(2296),i=r(2803),o=r(4027);t.schedulePromise=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},9136:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleReadableStreamLike=void 0;var n=r(3741),i=r(3026);t.scheduleReadableStreamLike=function(e,t){return n.scheduleAsyncIterable(i.readableStreamLikeToAsyncGenerator(e),t)}},4463:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduled=void 0;var n=r(4502),i=r(2366),o=r(8762),s=r(3585),a=r(3741),u=r(1801),c=r(452),l=r(5547),h=r(6847),d=r(9451),f=r(3533),p=r(3026),v=r(9136);t.scheduled=function(e,t){if(null!=e){if(u.isInteropObservable(e))return n.scheduleObservable(e,t);if(l.isArrayLike(e))return o.scheduleArray(e,t);if(c.isPromise(e))return i.schedulePromise(e,t);if(d.isAsyncIterable(e))return a.scheduleAsyncIterable(e,t);if(h.isIterable(e))return s.scheduleIterable(e,t);if(p.isReadableStreamLike(e))return v.scheduleReadableStreamLike(e,t)}throw f.createInvalidObservableTypeError(e)}},7638:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.Action=void 0;var i=function(e){function t(t,r){return e.call(this)||this}return n(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(r(7491).Subscription);t.Action=i},1080:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncAction=void 0;var i=r(7638),o=r(2320),s=r(7394),a=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return n(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,i=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(i,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),o.intervalProvider.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&o.intervalProvider.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,s.arrRemove(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(i.Action);t.AsyncAction=a},1017:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncScheduler=void 0;var i=r(469),o=function(e){function t(t,r){void 0===r&&(r=i.Scheduler.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return n(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(i.Scheduler);t.AsyncScheduler=o},4386:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.async=t.asyncScheduler=void 0;var n=r(1080),i=r(1017);t.asyncScheduler=new i.AsyncScheduler(n.AsyncAction),t.async=t.asyncScheduler},4575:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dateTimestampProvider=void 0,t.dateTimestampProvider={now:function(){return(t.dateTimestampProvider.delegate||Date).now()},delegate:void 0}},2320:function(e,t){var r=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.intervalProvider=void 0,t.intervalProvider={setInterval:function(e,i){for(var o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];var a=t.intervalProvider.delegate;return(null==a?void 0:a.setInterval)?a.setInterval.apply(a,n([e,i],r(o))):setInterval.apply(void 0,n([e,i],r(o)))},clearInterval:function(e){var r=t.intervalProvider.delegate;return((null==r?void 0:r.clearInterval)||clearInterval)(e)},delegate:void 0}},6476:function(e,t){var r=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutProvider=void 0,t.timeoutProvider={setTimeout:function(e,i){for(var o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];var a=t.timeoutProvider.delegate;return(null==a?void 0:a.setTimeout)?a.setTimeout.apply(a,n([e,i],r(o))):setTimeout.apply(void 0,n([e,i],r(o)))},clearTimeout:function(e){var r=t.timeoutProvider.delegate;return((null==r?void 0:r.clearTimeout)||clearTimeout)(e)},delegate:void 0}},3967:(e,t)=>{function r(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}Object.defineProperty(t,"__esModule",{value:!0}),t.iterator=t.getSymbolIterator=void 0,t.getSymbolIterator=r,t.iterator=r()},2131:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observable=void 0,t.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},9148:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentOutOfRangeError=void 0;var n=r(6871);t.ArgumentOutOfRangeError=n.createErrorClass((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}}))},7676:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyError=void 0;var n=r(6871);t.EmptyError=n.createErrorClass((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}))},2318:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NotFoundError=void 0;var n=r(6871);t.NotFoundError=n.createErrorClass((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}}))},8083:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectUnsubscribedError=void 0;var n=r(6871);t.ObjectUnsubscribedError=n.createErrorClass((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}))},8168:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SequenceError=void 0;var n=r(6871);t.SequenceError=n.createErrorClass((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}))},665:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnsubscriptionError=void 0;var n=r(6871);t.UnsubscriptionError=n.createErrorClass((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}))},1824:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.popNumber=t.popScheduler=t.popResultSelector=void 0;var n=r(4717),i=r(4568);function o(e){return e[e.length-1]}t.popResultSelector=function(e){return n.isFunction(o(e))?e.pop():void 0},t.popScheduler=function(e){return i.isScheduler(o(e))?e.pop():void 0},t.popNumber=function(e,t){return"number"==typeof o(e)?e.pop():t}},3787:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.argsArgArrayOrObject=void 0;var r=Array.isArray,n=Object.getPrototypeOf,i=Object.prototype,o=Object.keys;t.argsArgArrayOrObject=function(e){if(1===e.length){var t=e[0];if(r(t))return{args:t,keys:null};if((a=t)&&"object"==typeof a&&n(a)===i){var s=o(t);return{args:s.map((function(e){return t[e]})),keys:s}}}var a;return{args:e,keys:null}}},160:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.argsOrArgArray=void 0;var r=Array.isArray;t.argsOrArgArray=function(e){return 1===e.length&&r(e[0])?e[0]:e}},7394:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.arrRemove=void 0,t.arrRemove=function(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}},6871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createErrorClass=void 0,t.createErrorClass=function(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}},4950:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createObject=void 0,t.createObject=function(e,t){return e.reduce((function(e,r,n){return e[r]=t[n],e}),{})}},9916:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.captureError=t.errorContext=void 0;var n=r(7820),i=null;t.errorContext=function(e){if(n.config.useDeprecatedSynchronousErrorHandling){var t=!i;if(t&&(i={errorThrown:!1,error:null}),e(),t){var r=i,o=r.errorThrown,s=r.error;if(i=null,o)throw s}}else e()},t.captureError=function(e){n.config.useDeprecatedSynchronousErrorHandling&&i&&(i.errorThrown=!0,i.error=e)}},5031:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.executeSchedule=void 0,t.executeSchedule=function(e,t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var o=t.schedule((function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()}),n);if(e.add(o),!i)return o}},9391:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.identity=void 0,t.identity=function(e){return e}},5547:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayLike=void 0,t.isArrayLike=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},9451:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isAsyncIterable=void 0;var n=r(4717);t.isAsyncIterable=function(e){return Symbol.asyncIterator&&n.isFunction(null==e?void 0:e[Symbol.asyncIterator])}},6349:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isValidDate=void 0,t.isValidDate=function(e){return e instanceof Date&&!isNaN(e)}},4717:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e}},1801:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isInteropObservable=void 0;var n=r(2131),i=r(4717);t.isInteropObservable=function(e){return i.isFunction(e[n.observable])}},6847:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isIterable=void 0;var n=r(3967),i=r(4717);t.isIterable=function(e){return i.isFunction(null==e?void 0:e[n.iterator])}},452:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isPromise=void 0;var n=r(4717);t.isPromise=function(e){return n.isFunction(null==e?void 0:e.then)}},3026:function(e,t,r){var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=this&&this.__await||function(e){return this instanceof i?(this.v=e,this):new i(e)},o=this&&this.__asyncGenerator||function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){s.push([e,t,r,n])>1||u(e,t)}))})}function u(e,t){try{(r=o[e](t)).value instanceof i?Promise.resolve(r.value.v).then(c,l):h(s[0][2],r)}catch(e){h(s[0][3],e)}var r}function c(e){u("next",e)}function l(e){u("throw",e)}function h(e,t){e(t),s.shift(),s.length&&u(s[0][0],s[0][1])}};Object.defineProperty(t,"__esModule",{value:!0}),t.isReadableStreamLike=t.readableStreamLikeToAsyncGenerator=void 0;var s=r(4717);t.readableStreamLikeToAsyncGenerator=function(e){return o(this,arguments,(function(){var t,r,o;return n(this,(function(n){switch(n.label){case 0:t=e.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,i(t.read())];case 3:return r=n.sent(),o=r.value,r.done?[4,i(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,i(o)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))},t.isReadableStreamLike=function(e){return s.isFunction(null==e?void 0:e.getReader)}},4568:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isScheduler=void 0;var n=r(4717);t.isScheduler=function(e){return e&&n.isFunction(e.schedule)}},5416:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.operate=t.hasLift=void 0;var n=r(4717);function i(e){return n.isFunction(null==e?void 0:e.lift)}t.hasLift=i,t.operate=function(e){return function(t){if(i(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}},8240:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.mapOneOrManyArgs=void 0;var o=r(4828),s=Array.isArray;t.mapOneOrManyArgs=function(e){return o.map((function(t){return function(e,t){return s(t)?e.apply(void 0,i([],n(t))):e(t)}(e,t)}))}},6129:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.noop=void 0,t.noop=function(){}},1276:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.not=void 0,t.not=function(e,t){return function(r,n){return!e.call(t,r,n)}}},2393:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pipeFromArray=t.pipe=void 0;var n=r(9391);function i(e){return 0===e.length?n.identity:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}t.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(e)},t.pipeFromArray=i},4696:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reportUnhandledError=void 0;var n=r(7820),i=r(6476);t.reportUnhandledError=function(e){i.timeoutProvider.setTimeout((function(){var t=n.config.onUnhandledError;if(!t)throw e;t(e)}))}},3533:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createInvalidObservableTypeError=void 0,t.createInvalidObservableTypeError=function(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}},6022:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=t.merge=t.max=t.materialize=t.mapTo=t.map=t.last=t.isEmpty=t.ignoreElements=t.groupBy=t.first=t.findIndex=t.find=t.finalize=t.filter=t.expand=t.exhaustMap=t.exhaustAll=t.exhaust=t.every=t.endWith=t.elementAt=t.distinctUntilKeyChanged=t.distinctUntilChanged=t.distinct=t.dematerialize=t.delayWhen=t.delay=t.defaultIfEmpty=t.debounceTime=t.debounce=t.count=t.connect=t.concatWith=t.concatMapTo=t.concatMap=t.concatAll=t.concat=t.combineLatestWith=t.combineLatest=t.combineLatestAll=t.combineAll=t.catchError=t.bufferWhen=t.bufferToggle=t.bufferTime=t.bufferCount=t.buffer=t.auditTime=t.audit=void 0,t.timeInterval=t.throwIfEmpty=t.throttleTime=t.throttle=t.tap=t.takeWhile=t.takeUntil=t.takeLast=t.take=t.switchScan=t.switchMapTo=t.switchMap=t.switchAll=t.subscribeOn=t.startWith=t.skipWhile=t.skipUntil=t.skipLast=t.skip=t.single=t.shareReplay=t.share=t.sequenceEqual=t.scan=t.sampleTime=t.sample=t.refCount=t.retryWhen=t.retry=t.repeatWhen=t.repeat=t.reduce=t.raceWith=t.race=t.publishReplay=t.publishLast=t.publishBehavior=t.publish=t.pluck=t.partition=t.pairwise=t.onErrorResumeNext=t.observeOn=t.multicast=t.min=t.mergeWith=t.mergeScan=t.mergeMapTo=t.mergeMap=t.flatMap=void 0,t.zipWith=t.zipAll=t.zip=t.withLatestFrom=t.windowWhen=t.windowToggle=t.windowTime=t.windowCount=t.window=t.toArray=t.timestamp=t.timeoutWith=t.timeout=void 0;var n=r(6993);Object.defineProperty(t,"audit",{enumerable:!0,get:function(){return n.audit}});var i=r(4116);Object.defineProperty(t,"auditTime",{enumerable:!0,get:function(){return i.auditTime}});var o=r(7190);Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return o.buffer}});var s=r(6835);Object.defineProperty(t,"bufferCount",{enumerable:!0,get:function(){return s.bufferCount}});var a=r(5219);Object.defineProperty(t,"bufferTime",{enumerable:!0,get:function(){return a.bufferTime}});var u=r(118);Object.defineProperty(t,"bufferToggle",{enumerable:!0,get:function(){return u.bufferToggle}});var c=r(7514);Object.defineProperty(t,"bufferWhen",{enumerable:!0,get:function(){return c.bufferWhen}});var l=r(8251);Object.defineProperty(t,"catchError",{enumerable:!0,get:function(){return l.catchError}});var h=r(1424);Object.defineProperty(t,"combineAll",{enumerable:!0,get:function(){return h.combineAll}});var d=r(2945);Object.defineProperty(t,"combineLatestAll",{enumerable:!0,get:function(){return d.combineLatestAll}});var f=r(2e3);Object.defineProperty(t,"combineLatest",{enumerable:!0,get:function(){return f.combineLatest}});var p=r(3928);Object.defineProperty(t,"combineLatestWith",{enumerable:!0,get:function(){return p.combineLatestWith}});var v=r(1812);Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return v.concat}});var y=r(861);Object.defineProperty(t,"concatAll",{enumerable:!0,get:function(){return y.concatAll}});var b=r(1012);Object.defineProperty(t,"concatMap",{enumerable:!0,get:function(){return b.concatMap}});var m=r(1157);Object.defineProperty(t,"concatMapTo",{enumerable:!0,get:function(){return m.concatMapTo}});var g=r(3692);Object.defineProperty(t,"concatWith",{enumerable:!0,get:function(){return g.concatWith}});var _=r(2216);Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return _.connect}});var O=r(8041);Object.defineProperty(t,"count",{enumerable:!0,get:function(){return O.count}});var S=r(2747);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return S.debounce}});var E=r(3870);Object.defineProperty(t,"debounceTime",{enumerable:!0,get:function(){return E.debounceTime}});var w=r(7507);Object.defineProperty(t,"defaultIfEmpty",{enumerable:!0,get:function(){return w.defaultIfEmpty}});var T=r(2409);Object.defineProperty(t,"delay",{enumerable:!0,get:function(){return T.delay}});var I=r(5137);Object.defineProperty(t,"delayWhen",{enumerable:!0,get:function(){return I.delayWhen}});var A=r(4126);Object.defineProperty(t,"dematerialize",{enumerable:!0,get:function(){return A.dematerialize}});var M=r(5208);Object.defineProperty(t,"distinct",{enumerable:!0,get:function(){return M.distinct}});var F=r(9939);Object.defineProperty(t,"distinctUntilChanged",{enumerable:!0,get:function(){return F.distinctUntilChanged}});var k=r(183);Object.defineProperty(t,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return k.distinctUntilKeyChanged}});var D=r(1195);Object.defineProperty(t,"elementAt",{enumerable:!0,get:function(){return D.elementAt}});var j=r(3723);Object.defineProperty(t,"endWith",{enumerable:!0,get:function(){return j.endWith}});var x=r(1909);Object.defineProperty(t,"every",{enumerable:!0,get:function(){return x.every}});var P=r(9228);Object.defineProperty(t,"exhaust",{enumerable:!0,get:function(){return P.exhaust}});var N=r(9765);Object.defineProperty(t,"exhaustAll",{enumerable:!0,get:function(){return N.exhaustAll}});var C=r(8748);Object.defineProperty(t,"exhaustMap",{enumerable:!0,get:function(){return C.exhaustMap}});var R=r(8324);Object.defineProperty(t,"expand",{enumerable:!0,get:function(){return R.expand}});var q=r(2914);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return q.filter}});var L=r(9822);Object.defineProperty(t,"finalize",{enumerable:!0,get:function(){return L.finalize}});var B=r(2819);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return B.find}});var Q=r(3367);Object.defineProperty(t,"findIndex",{enumerable:!0,get:function(){return Q.findIndex}});var V=r(1432);Object.defineProperty(t,"first",{enumerable:!0,get:function(){return V.first}});var U=r(4956);Object.defineProperty(t,"groupBy",{enumerable:!0,get:function(){return U.groupBy}});var z=r(2507);Object.defineProperty(t,"ignoreElements",{enumerable:!0,get:function(){return z.ignoreElements}});var Y=r(6095);Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return Y.isEmpty}});var W=r(3484);Object.defineProperty(t,"last",{enumerable:!0,get:function(){return W.last}});var $=r(4828);Object.defineProperty(t,"map",{enumerable:!0,get:function(){return $.map}});var G=r(1357);Object.defineProperty(t,"mapTo",{enumerable:!0,get:function(){return G.mapTo}});var H=r(7967);Object.defineProperty(t,"materialize",{enumerable:!0,get:function(){return H.materialize}});var K=r(4388);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return K.max}});var J=r(1550);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return J.merge}});var X=r(1867);Object.defineProperty(t,"mergeAll",{enumerable:!0,get:function(){return X.mergeAll}});var Z=r(6977);Object.defineProperty(t,"flatMap",{enumerable:!0,get:function(){return Z.flatMap}});var ee=r(1282);Object.defineProperty(t,"mergeMap",{enumerable:!0,get:function(){return ee.mergeMap}});var te=r(6295);Object.defineProperty(t,"mergeMapTo",{enumerable:!0,get:function(){return te.mergeMapTo}});var re=r(9527);Object.defineProperty(t,"mergeScan",{enumerable:!0,get:function(){return re.mergeScan}});var ne=r(5834);Object.defineProperty(t,"mergeWith",{enumerable:!0,get:function(){return ne.mergeWith}});var ie=r(1306);Object.defineProperty(t,"min",{enumerable:!0,get:function(){return ie.min}});var oe=r(9924);Object.defineProperty(t,"multicast",{enumerable:!0,get:function(){return oe.multicast}});var se=r(2803);Object.defineProperty(t,"observeOn",{enumerable:!0,get:function(){return se.observeOn}});var ae=r(1997);Object.defineProperty(t,"onErrorResumeNext",{enumerable:!0,get:function(){return ae.onErrorResumeNext}});var ue=r(4492);Object.defineProperty(t,"pairwise",{enumerable:!0,get:function(){return ue.pairwise}});var ce=r(5352);Object.defineProperty(t,"partition",{enumerable:!0,get:function(){return ce.partition}});var le=r(3391);Object.defineProperty(t,"pluck",{enumerable:!0,get:function(){return le.pluck}});var he=r(297);Object.defineProperty(t,"publish",{enumerable:!0,get:function(){return he.publish}});var de=r(6383);Object.defineProperty(t,"publishBehavior",{enumerable:!0,get:function(){return de.publishBehavior}});var fe=r(8229);Object.defineProperty(t,"publishLast",{enumerable:!0,get:function(){return fe.publishLast}});var pe=r(8226);Object.defineProperty(t,"publishReplay",{enumerable:!0,get:function(){return pe.publishReplay}});var ve=r(8973);Object.defineProperty(t,"race",{enumerable:!0,get:function(){return ve.race}});var ye=r(177);Object.defineProperty(t,"raceWith",{enumerable:!0,get:function(){return ye.raceWith}});var be=r(3818);Object.defineProperty(t,"reduce",{enumerable:!0,get:function(){return be.reduce}});var me=r(7775);Object.defineProperty(t,"repeat",{enumerable:!0,get:function(){return me.repeat}});var ge=r(5567);Object.defineProperty(t,"repeatWhen",{enumerable:!0,get:function(){return ge.repeatWhen}});var _e=r(4740);Object.defineProperty(t,"retry",{enumerable:!0,get:function(){return _e.retry}});var Oe=r(264);Object.defineProperty(t,"retryWhen",{enumerable:!0,get:function(){return Oe.retryWhen}});var Se=r(5884);Object.defineProperty(t,"refCount",{enumerable:!0,get:function(){return Se.refCount}});var Ee=r(6870);Object.defineProperty(t,"sample",{enumerable:!0,get:function(){return Ee.sample}});var we=r(5411);Object.defineProperty(t,"sampleTime",{enumerable:!0,get:function(){return we.sampleTime}});var Te=r(2457);Object.defineProperty(t,"scan",{enumerable:!0,get:function(){return Te.scan}});var Ie=r(5109);Object.defineProperty(t,"sequenceEqual",{enumerable:!0,get:function(){return Ie.sequenceEqual}});var Ae=r(3329);Object.defineProperty(t,"share",{enumerable:!0,get:function(){return Ae.share}});var Me=r(1738);Object.defineProperty(t,"shareReplay",{enumerable:!0,get:function(){return Me.shareReplay}});var Fe=r(884);Object.defineProperty(t,"single",{enumerable:!0,get:function(){return Fe.single}});var ke=r(4411);Object.defineProperty(t,"skip",{enumerable:!0,get:function(){return ke.skip}});var De=r(9355);Object.defineProperty(t,"skipLast",{enumerable:!0,get:function(){return De.skipLast}});var je=r(2947);Object.defineProperty(t,"skipUntil",{enumerable:!0,get:function(){return je.skipUntil}});var xe=r(9842);Object.defineProperty(t,"skipWhile",{enumerable:!0,get:function(){return xe.skipWhile}});var Pe=r(2778);Object.defineProperty(t,"startWith",{enumerable:!0,get:function(){return Pe.startWith}});var Ne=r(4027);Object.defineProperty(t,"subscribeOn",{enumerable:!0,get:function(){return Ne.subscribeOn}});var Ce=r(9061);Object.defineProperty(t,"switchAll",{enumerable:!0,get:function(){return Ce.switchAll}});var Re=r(6300);Object.defineProperty(t,"switchMap",{enumerable:!0,get:function(){return Re.switchMap}});var qe=r(1933);Object.defineProperty(t,"switchMapTo",{enumerable:!0,get:function(){return qe.switchMapTo}});var Le=r(1689);Object.defineProperty(t,"switchScan",{enumerable:!0,get:function(){return Le.switchScan}});var Be=r(6803);Object.defineProperty(t,"take",{enumerable:!0,get:function(){return Be.take}});var Qe=r(787);Object.defineProperty(t,"takeLast",{enumerable:!0,get:function(){return Qe.takeLast}});var Ve=r(4811);Object.defineProperty(t,"takeUntil",{enumerable:!0,get:function(){return Ve.takeUntil}});var Ue=r(7770);Object.defineProperty(t,"takeWhile",{enumerable:!0,get:function(){return Ue.takeWhile}});var ze=r(9967);Object.defineProperty(t,"tap",{enumerable:!0,get:function(){return ze.tap}});var Ye=r(6516);Object.defineProperty(t,"throttle",{enumerable:!0,get:function(){return Ye.throttle}});var We=r(5945);Object.defineProperty(t,"throttleTime",{enumerable:!0,get:function(){return We.throttleTime}});var $e=r(5956);Object.defineProperty(t,"throwIfEmpty",{enumerable:!0,get:function(){return $e.throwIfEmpty}});var Ge=r(9712);Object.defineProperty(t,"timeInterval",{enumerable:!0,get:function(){return Ge.timeInterval}});var He=r(7517);Object.defineProperty(t,"timeout",{enumerable:!0,get:function(){return He.timeout}});var Ke=r(2001);Object.defineProperty(t,"timeoutWith",{enumerable:!0,get:function(){return Ke.timeoutWith}});var Je=r(8158);Object.defineProperty(t,"timestamp",{enumerable:!0,get:function(){return Je.timestamp}});var Xe=r(2984);Object.defineProperty(t,"toArray",{enumerable:!0,get:function(){return Xe.toArray}});var Ze=r(5492);Object.defineProperty(t,"window",{enumerable:!0,get:function(){return Ze.window}});var et=r(6817);Object.defineProperty(t,"windowCount",{enumerable:!0,get:function(){return et.windowCount}});var tt=r(6841);Object.defineProperty(t,"windowTime",{enumerable:!0,get:function(){return tt.windowTime}});var rt=r(4880);Object.defineProperty(t,"windowToggle",{enumerable:!0,get:function(){return rt.windowToggle}});var nt=r(3016);Object.defineProperty(t,"windowWhen",{enumerable:!0,get:function(){return nt.windowWhen}});var it=r(9163);Object.defineProperty(t,"withLatestFrom",{enumerable:!0,get:function(){return it.withLatestFrom}});var ot=r(2681);Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return ot.zip}});var st=r(5606);Object.defineProperty(t,"zipAll",{enumerable:!0,get:function(){return st.zipAll}});var at=r(973);Object.defineProperty(t,"zipWith",{enumerable:!0,get:function(){return at.zipWith}})},573:e=>{e.exports=require("rxjs")},5086:e=>{e.exports=require("ws")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{AI_CHAT_MODEL_NAMES:()=>Fe,AI_EMBEDDINGS_MODEL_NAMES:()=>De,AI_IMAGE_MODEL_NAMES:()=>Pe,ALL_OPERATORS:()=>ze,ANTHROPIC_CHAT_MODEL_NAMES:()=>Me,AiAssistantClient:()=>i,AiChatbotChatContext:()=>Ne,AiChatbotClient:()=>G,AiChatbotClientFactory:()=>X,AiChatbotContextReference:()=>K,AiChatbotInstructionReference:()=>J,AiChatbotProfileReference:()=>H,AiClient:()=>ee,AiImageClient:()=>Z,ApiClient:()=>re,ApiKeysSecretClient:()=>Vu,AuthManager:()=>ne,BackendFunctionManager:()=>Se,BaseQueryBuilder:()=>et,Changes:()=>nt,ClientConnectionState:()=>$e,ClientIdService:()=>Te,CollectionReference:()=>ht,CollectionReferenceFactory:()=>ft,ConnectionDetails:()=>pt,CronExpression:()=>Ce,DEFAULT_SHORT_ID_LENGTH:()=>z,DataManager:()=>Ot,DestructManager:()=>Et,DistributedLockImpl:()=>Tt,DistributedLockManager:()=>wt,DocumentReference:()=>Je,DocumentReferenceFactory:()=>At,DocumentStore:()=>Mt,ENVIRONMENT_IDS:()=>Re,FETCH_BEYOND_LIMIT:()=>Iu,GEMINI_CHAT_MODEL_NAMES:()=>Ae,GraphQLClient:()=>nu,GraphQLClientFactory:()=>iu,HttpStatus:()=>Le,IntegrationSchemaType:()=>Qe,IntegrationType:()=>Be,JoinQueryBuilder:()=>it,LIMIT_UNDERFLOW_TRIGGER:()=>Au,LimitUnderflowState:()=>Ou,LocalQueryManager:()=>mu,METRIC_TYPES:()=>Ve,MutationSender:()=>ou,NOOP_FN:()=>Uu,NativeQueryManager:()=>su,OPENAI_CHAT_MODEL_NAMES:()=>Ie,OPENAI_EMBEDDINGS_MODEL_NAMES:()=>ke,OPENAI_IMAGE_MODEL_NAMES:()=>je,ObservabilityClient:()=>Bu,Pagination:()=>Xe,QueryBuilder:()=>rt,QueryBuilderFactory:()=>Ze,QuerySender:()=>_u,QuerySubscriptionManager:()=>Mu,QueueManagerFactory:()=>ju,QueueManagerImpl:()=>Pu,RateLimiter:()=>Nu,RpcError:()=>Cu,RpcManager:()=>Lu,SQUID_REGIONS:()=>Ye,STABLE_DIFFUSION_MODEL_NAMES:()=>xe,SUPPORTED_SQUID_REGIONS:()=>We,SecretClient:()=>Qu,SocketManager:()=>$u,Squid:()=>Ku,StorageClient:()=>Hu,allEnvironmentIds:()=>qe,deserializeQuery:()=>au,generateId:()=>U,generateShortId:()=>W,isSimpleCondition:()=>Ue,rawSquidHttpPost:()=>Ru,tryDeserializing:()=>qu});class i{constructor(e){this.rpcManager=e}async createAssistant(e,t,r,n){const i={name:e,instructions:t,functions:r,toolTypes:n};return(await this.rpcManager.post("ai/assistant/createAssistant",i)).assistantId}async deleteAssistant(e){const t={assistantId:e};await this.rpcManager.post("ai/assistant/deleteAssistant",t)}async createThread(e){const t={assistantId:e};return(await this.rpcManager.post("ai/assistant/createThread",t)).threadId}async deleteThread(e){const t={threadId:e};await this.rpcManager.post("ai/assistant/deleteThread",t)}async queryAssistant(e,t,r,n,i){const o={assistantId:e,threadId:t,prompt:r,fileIds:n,options:i};return(await this.rpcManager.post("ai/assistant/queryAssistant",o)).answer}async addFileToAssistant(e,t){const r={assistantId:e};return(await this.rpcManager.post("ai/assistant/addFileToAssistant",r,[t],"file")).fileId}async removeFileFromAssistant(e,t){const r={assistantId:e,fileId:t};await this.rpcManager.post("ai/assistant/removeFileFromAssistant",r)}async addFileToThread(e,t){const r={threadId:e};return(await this.rpcManager.post("ai/assistant/addFileToThread",r,[t],"file")).fileId}}var o=r(573);function s(e){return"function"==typeof e}function a(e){return function(t){if(function(e){return s(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}var u=function(e,t){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},u(e,t)};function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var l=function(){return l=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},l.apply(this,arguments)};function h(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function d(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}function f(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function y(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var b,m,g=(b=function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}},(m=b((function(e){Error.call(e),e.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),m.prototype.constructor=m,m);function _(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var O=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=p(o),u=a.next();!u.done;u=a.next())u.value.remove(this)}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(s(c))try{c()}catch(e){i=e instanceof g?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var h=p(l),d=h.next();!d.done;d=h.next()){var f=d.value;try{S(f)}catch(e){i=null!=i?i:[],e instanceof g?i=y(y([],v(i)),v(e.errors)):i.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(i)throw new g(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)S(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&_(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&_(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function S(e){s(e)?e():e.unsubscribe()}O.EMPTY;var E=null,w=null,T=!1,I=!1,A={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=A.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,y([e,t],v(r))):setTimeout.apply(void 0,y([e,t],v(r)))},clearTimeout:function(e){var t=A.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function M(){}var F=k("C",void 0,void 0);function k(e,t,r){return{kind:e,value:t,error:r}}var D=function(e){function t(t){var r,n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,((r=t)instanceof O||r&&"closed"in r&&s(r.remove)&&s(r.add)&&s(r.unsubscribe))&&t.add(n)):n.destination=q,n}return c(t,e),t.create=function(e,t,r){return new N(e,t,r)},t.prototype.next=function(e){this.isStopped?R(function(e){return k("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?R(k("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?R(F,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(O),j=Function.prototype.bind;function x(e,t){return j.call(e,t)}var P=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){C(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){C(e)}else C(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){C(e)}},e}(),N=function(e){function t(t,r,n){var i,o,a=e.call(this)||this;return s(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:a&&I?((o=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},i={next:t.next&&x(t.next,o),error:t.error&&x(t.error,o),complete:t.complete&&x(t.complete,o)}):i=t,a.destination=new P(i),a}return c(t,e),t}(D);function C(e){T||function(e){A.setTimeout((function(){if(!E)throw e;E(e)}))}(e)}function R(e,t){var r=w;r&&A.setTimeout((function(){return r(e,t)}))}var q={closed:!0,next:M,error:function(e){throw e},complete:M};function L(e,t,r,n,i){return new B(e,t,r,n,i)}var B=function(e){function t(t,r,n,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return c(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(D);function Q(e,t){return a((function(r,n){var i=0;r.subscribe(L(n,(function(r){n.next(e.call(t,r,i++))})))}))}var V=r(5036);function U(){let e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){const r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}const z=18,Y="abcdefghijklmnopqrstuvwxyz0123456789";function W(e=z,t=""){(0,V.assertTruthy)(t.length<e,"ID prefix is too long");let r="";for(let t=0;t<e;t++)r+=Y.charAt(Math.floor(Math.random()*Y.length));return t.length>0&&(r=t+r.substring(t.length)),r}const $={smoothTyping:!0,disableHistory:!1,includeReference:!1,responseFormat:"text"};class G{constructor(e,t,r){this.rpcManager=e,this.socketManager=t,this.integrationId=r,this.ongoingChatSequences={},this.socketManager.observeNotifications().pipe((0,o.filter)((e=>"aiChatbot"===e.type)),Q((e=>e))).subscribe((e=>{this.handleChatResponse(e).then()}))}profile(e){return new H(this,this.integrationId,e)}async mutate(e,t){await this.rpcManager.post("ai/chatbot/mutate",e,t?[t]:[])}chat(e,t,r){const n=U(),i=void 0===(r=Object.assign(Object.assign({},$),r||{})).smoothTyping||r.smoothTyping;let s="";const a=new o.Subject,u=new o.Subject;this.ongoingChatSequences[n]=u;let c=-1;u.pipe((0,o.tap)((({tokenIndex:e})=>{void 0!==e&&e<c&&console.warn("Received token index out of order",e,c),void 0!==e&&(c=e)})),(0,o.concatMap)((({value:e,complete:t})=>t?(0,o.of)({value:e,complete:t}):(0,o.of)(e).pipe(i?(0,o.delay)(5):(0,o.tap)(),Q((e=>({value:e,complete:!1})))))),(0,o.takeWhile)((({complete:e})=>!e),!0)).subscribe({next:({value:e})=>{s+=e,a.next(s)},error:e=>{console.error(e)},complete:()=>{a.complete()}});const l={profileId:e,prompt:t,options:r,integrationId:this.integrationId,clientRequestId:n};return this.rpcManager.post("ai/chatbot/chat",l).catch((e=>{a.error(e),a.complete()})),a.pipe((0,o.finalize)((()=>{delete this.ongoingChatSequences[n]})),(0,o.share)())}ask(e,t,r){return(0,o.lastValueFrom)(this.chat(e,t,Object.assign(Object.assign({},r||{}),{smoothTyping:!1})))}async handleChatResponse(e){const t=this.ongoingChatSequences[e.clientRequestId];if(!t)return;const{token:r,complete:n,tokenIndex:i}=e.payload;if(n&&!r.length)t.next({value:"",complete:!0,tokenIndex:void 0});else if(r.match(/\[.*?]\((.*?)\)/g))t.next({value:r,complete:n,tokenIndex:void 0===i?void 0:i});else for(let e=0;e<r.length;e++)t.next({value:r[e],complete:n&&e===r.length-1,tokenIndex:void 0===i?void 0:i})}}class H{constructor(e,t,r){this.client=e,this.integrationId=t,this.profileId=r}chat(e,t){return this.client.chat(this.profileId,e,t)}ask(e,t){return this.client.ask(this.profileId,e,t)}context(e){return new K(this.client,this.integrationId,this.profileId,e)}instruction(e){return new J(this.client,this.integrationId,this.profileId,e)}insert(e){const{modelName:t,isPublic:r=!1}=e,n={type:"insert",resource:"profile",profileId:this.profileId,payload:{modelName:t,isPublic:r,strictContext:!1},integrationId:this.integrationId};return this.client.mutate(n)}update(e){const{modelName:t,isPublic:r}=e,n={type:"update",resource:"profile",profileId:this.profileId,payload:{modelName:t,isPublic:r,strictContext:!1},integrationId:this.integrationId};return this.client.mutate(n)}delete(){const e={type:"delete",resource:"profile",profileId:this.profileId,integrationId:this.integrationId,payload:{}};return this.client.mutate(e)}}class K{constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||U()}insert(e,t){const{title:r,context:n}=e,i={type:"insert",resource:"context",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id,title:r,context:n}};return this.client.mutate(i,t)}update(e){const{title:t,context:r}=e,n={type:"update",resource:"context",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id,title:t,context:r}};return this.client.mutate(n)}delete(){const e={type:"delete",resource:"context",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id}};return this.client.mutate(e)}}class J{constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||U()}insert(e){const{instruction:t}=e,r={type:"insert",resource:"instruction",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id,instruction:t}};return this.client.mutate(r)}update(e){const{instruction:t}=e,r={type:"update",resource:"instruction",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id,instruction:t}};return this.client.mutate(r)}delete(){const e={type:"delete",resource:"instruction",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id}};return this.client.mutate(e)}}class X{constructor(e,t){this.rpcManager=e,this.socketManager=t,this.chatbotsMap=new Map}getChatbot(e){let t=this.chatbotsMap.get(e);return t||(t=new G(this.rpcManager,this.socketManager,e),this.chatbotsMap.set(e,t),t)}}class Z{constructor(e){this.rpcManager=e}async generate(e,t){const r={prompt:e,options:t};return this.rpcManager.post("ai/image/generate",r)}}class ee{constructor(e,t){this.aiChatbotClientFactory=e,this.rpcManager=t,this.aiAssistantClient=new i(this.rpcManager)}chatbot(e){return this.aiChatbotClientFactory.getChatbot(e)}assistant(){return this.aiAssistantClient}image(){return new Z(this.rpcManager)}executeAiQuery(e,t){const r={integrationId:e,prompt:t};return this.rpcManager.post("aiData/executeAiQuery",r)}}const te={headers:{},queryParams:{},pathParams:{}};class re{constructor(e){this.rpcManager=e}async get(e,t,r){return this.request(e,t,void 0,r,"get")}async post(e,t,r,n){return this.request(e,t,r,n,"post")}async delete(e,t,r,n){return this.request(e,t,r,n,"delete")}async patch(e,t,r,n){return this.request(e,t,r,n,"patch")}async put(e,t,r,n){return this.request(e,t,r,n,"put")}async request(e,t,r,n,i){const o={integrationId:e,endpointId:t,body:r,options:Object.assign(Object.assign({},te),this.convertOptionsToStrings(n||{})),overrideMethod:i};return await this.rpcManager.rawPost("api/callApi",o,void 0,void 0,!1)}convertOptionsToStrings(e){return{headers:this.convertToStrings(e.headers),queryParams:this.convertToStrings(e.queryParams),pathParams:this.convertToStrings(e.pathParams)}}convertToStrings(e){if(!e)return{};const t=Object.entries(e).filter((([,e])=>void 0!==e)).map((([e,t])=>[e,String(t)]));return Object.fromEntries(t)}}class ne{constructor(e,t){this.apiKey=e,this.authProvider=t}setAuthProvider(e){this.authProvider=e}async getAuthData(){var e;return{token:await this.getTokenFromAuthProvider(),integrationId:null===(e=this.authProvider)||void 0===e?void 0:e.integrationId}}async getTokenFromAuthProvider(){var e;const t=null===(e=this.authProvider)||void 0===e?void 0:e.getToken();return"object"==typeof t?await t:t}getApiKey(){return this.apiKey}async getToken(){var e;if(this.apiKey)return{type:"ApiKey",token:this.apiKey};const t=await this.getTokenFromAuthProvider();return t?{type:"Bearer",token:t,integrationId:null===(e=this.authProvider)||void 0===e?void 0:e.integrationId}:void 0}}const ie=/[.\[\]]/;function oe(e,t){if(!e)return;const r=t.split(ie);let n,i=e;for(;i&&r.length;){const e=r.shift();if(e){if("object"!=typeof i||!(e in i))return;n=i[e],i=n}}return n}function se(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ae(e,t,r,n="."){var i;const o=t.split(n);let s=e;for(;o.length;){const e=(0,V.truthy)(o.shift());if(o.length){const t=s[e],r=se(t)&&null!==(i=pe(t))&&void 0!==i?i:{};s[e]=r,s=r}else s[e]=r}}function ue(e,t,r="."){var n;const i=t.split(r);let o=e;for(;i.length;){const e=(0,V.truthy)(i.shift());if(i.length){const t=se(o[e])&&null!==(n=pe(o[e]))&&void 0!==n?n:{};o[e]=t,o=t}else delete o[e]}}function ce(e,t,r){if(e.has(t)){const n=e.get(t);e.delete(t),e.set(r,n)}}function le(e){return null==e}function he(e,t){if(e===t)return!0;if(null===e||null===t)return!1;const r=typeof e;if(r!==typeof t)return!1;if("object"!==r)return e===t;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n)if(!i.includes(r)||!he(e[r],t[r]))return!1;return!0}function de(e,t){const r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=fe(e[n],t);return r}function fe(e,t){const r=t?t(e):void 0;if(void 0!==r)return r;if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return de(e,t);if(e instanceof Map)return new Map(de(Array.from(e),t));if(e instanceof Set)return new Set(de(Array.from(e),t));if(ArrayBuffer.isView(e))return(n=e)instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length);var n;const i={};for(const r in e)Object.hasOwnProperty.call(e,r)&&(i[r]=fe(e[r],t));return i}function pe(e){return"object"!=typeof e||null===e?e:e instanceof Date?new Date(e):Array.isArray(e)?[...e]:e instanceof Map?new Map(Array.from(e)):e instanceof Set?new Set(Array.from(e)):Object.assign({},e)}function ve(e,t){if(e===t||le(e)&&le(t))return 0;if(le(e))return-1;if(le(t))return 1;const r=typeof e,n=typeof t;return r!==n?r<n?-1:1:"number"==typeof e?((0,V.assertTruthy)("number"==typeof t),isNaN(e)&&isNaN(t)?0:isNaN(e)?-1:isNaN(t)?1:e<t?-1:1):"boolean"==typeof e?((0,V.assertTruthy)("boolean"==typeof t),e<t?-1:1):"bigint"==typeof e?((0,V.assertTruthy)("bigint"==typeof t),e<t?-1:1):"string"==typeof e?((0,V.assertTruthy)("string"==typeof t),e<t?-1:1):e instanceof Date&&t instanceof Date?Math.sign(e.getTime()-t.getTime()):0}function ye(e,t){return e.reduce(((e,r)=>{const n=t(r);return e[n]?e[n].push(r):e[n]=[r],e}),{})}function be(e){if(Array.isArray(e))return e.map((e=>be(e)));if("object"!=typeof e||null===e||e instanceof Date)return e;const t=Object.keys(e),r={};return t.sort().forEach((t=>{r[t]=be(e[t])})),r}function me(e){return ge(be(e))}function ge(e){if(void 0===e)return null;const t=fe(e,(e=>function(e){return"[object Date]"===Object.prototype.toString.call(e)}(e)?{$date:e.toISOString()}:void 0));return JSON.stringify(t)}function _e(e){return fe(JSON.parse(e),(e=>{if(null===e||"object"!=typeof e)return;const t=e,r=t.$date;return r&&1===Object.keys(t).length?new Date(r):void 0}))}function Oe(e){if(void 0===e)throw new Error("INVALID_ENCODE_VALUE");const t=ge(e);if("undefined"!=typeof Buffer)return Buffer.from(t,"utf8").toString("base64");{const e=(new TextEncoder).encode(t);let r="";for(let t=0;t<e.length;t++)r+=String.fromCharCode(e[t]);return btoa(r)}}class Se{constructor(e,t){this.clientIdService=e,this.rpcManager=t}executeFunctionAndSubscribe(e,...t){const r=[],n=[];t.forEach((e=>{"undefined"!=typeof File&&e instanceof File?r.push(e):n.push(e)}));const i={functionName:e,paramsArrayStr:ge(n)},s=`backend-function/execute?${encodeURIComponent(e)}`;return(0,o.race)((0,o.from)(this.rpcManager.post(s,i,r.length>0?r:[])).pipe(Q((e=>{if(!e.success)throw new Error(e.payload);return _e(e.payload)}))),this.clientIdService.observeClientTooOld().pipe(Q((()=>{throw new Error("CLIENT_NOT_CONNECTED")}))))}}function Ee(){if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;if("undefined"!=typeof self)return self;throw new Error("Unable to locate global object")}class we{static log(...e){we.info(...e)}static info(...e){console.log(`%c[${we.getTimestampString()}] INFO`,"color:green",...e)}static warn(...e){console.warn(`%c[${we.getTimestampString()}] WARN`,"color:yellow",...e)}static error(...e){console.error(`%c[${we.getTimestampString()}] ERROR`,"color:red",...e)}static debug(...e){(function(){const e=Ee();return e&&e.SQUID_DEBUG_ENABLED})()&&console.log(`%c[${we.getTimestampString()}] DEBUG`,"color:cyan",...e)}static getTimestampString(){const e=new Date;return`${e.toLocaleTimeString()}.${e.getMilliseconds()}`}}class Te{constructor(e){this.destructManager=e,this.clientTooOldSubject=new o.BehaviorSubject(!1),this.isTenant=!0===Ee().squidTenant,this.clientIdSubject=new o.BehaviorSubject(this.generateClientId()),this.destructManager.onDestruct((()=>{this.clientTooOldSubject.complete(),this.clientIdSubject.complete()}))}observeClientId(){return this.clientIdSubject}observeClientTooOld(){return this.clientTooOldSubject.pipe((0,o.filter)((e=>e)),(0,o.map)((()=>{})))}notifyClientTooOld(){this.clientTooOldSubject.next(!0),this.clientIdSubject.next(this.generateClientId())}notifyClientNotTooOld(){this.clientTooOldSubject.next(!1)}observeClientReadyToBeRegenerated(){return this.clientTooOldSubject.pipe((0,o.skip)(1),(0,o.filter)((e=>!e)),(0,o.map)((()=>{})))}getClientId(){return this.clientIdSubject.value}isClientTooOld(){return this.clientTooOldSubject.value}generateClientId(){return`${this.isTenant?"tenant-":""}${U()}`}}const Ie=["gpt-3.5-turbo","gpt-3.5-turbo-1106","gpt-4","gpt-4-turbo-preview","gpt-4o","gpt-4-turbo"],Ae=["gemini-pro"],Me=["claude-3-opus-20240229","claude-3-sonnet-20240229","claude-3-haiku-20240307","claude-3-5-sonnet-20240620"],Fe=[...Ie,...Me,...Ae],ke=["text-embedding-3-small","text-embedding-3-large","text-embedding-ada-002"],De=[...ke],je=["dall-e-3"],xe=["stable-diffusion-core"],Pe=[...je,...xe];class Ne{constructor(e){this.profileId=e.profileId,this.prompt=e.prompt}}var Ce;!function(e){e.EVERY_SECOND="* * * * * *",e.EVERY_5_SECONDS="*/5 * * * * *",e.EVERY_10_SECONDS="*/10 * * * * *",e.EVERY_30_SECONDS="*/30 * * * * *",e.EVERY_MINUTE="*/1 * * * *",e.EVERY_5_MINUTES="0 */5 * * * *",e.EVERY_10_MINUTES="0 */10 * * * *",e.EVERY_30_MINUTES="0 */30 * * * *",e.EVERY_HOUR="0 0-23/1 * * *",e.EVERY_2_HOURS="0 0-23/2 * * *",e.EVERY_3_HOURS="0 0-23/3 * * *",e.EVERY_4_HOURS="0 0-23/4 * * *",e.EVERY_5_HOURS="0 0-23/5 * * *",e.EVERY_6_HOURS="0 0-23/6 * * *",e.EVERY_7_HOURS="0 0-23/7 * * *",e.EVERY_8_HOURS="0 0-23/8 * * *",e.EVERY_9_HOURS="0 0-23/9 * * *",e.EVERY_10_HOURS="0 0-23/10 * * *",e.EVERY_11_HOURS="0 0-23/11 * * *",e.EVERY_12_HOURS="0 0-23/12 * * *",e.EVERY_DAY_AT_1AM="0 01 * * *",e.EVERY_DAY_AT_2AM="0 02 * * *",e.EVERY_DAY_AT_3AM="0 03 * * *",e.EVERY_DAY_AT_4AM="0 04 * * *",e.EVERY_DAY_AT_5AM="0 05 * * *",e.EVERY_DAY_AT_6AM="0 06 * * *",e.EVERY_DAY_AT_7AM="0 07 * * *",e.EVERY_DAY_AT_8AM="0 08 * * *",e.EVERY_DAY_AT_9AM="0 09 * * *",e.EVERY_DAY_AT_10AM="0 10 * * *",e.EVERY_DAY_AT_11AM="0 11 * * *",e.EVERY_DAY_AT_NOON="0 12 * * *",e.EVERY_DAY_AT_1PM="0 13 * * *",e.EVERY_DAY_AT_2PM="0 14 * * *",e.EVERY_DAY_AT_3PM="0 15 * * *",e.EVERY_DAY_AT_4PM="0 16 * * *",e.EVERY_DAY_AT_5PM="0 17 * * *",e.EVERY_DAY_AT_6PM="0 18 * * *",e.EVERY_DAY_AT_7PM="0 19 * * *",e.EVERY_DAY_AT_8PM="0 20 * * *",e.EVERY_DAY_AT_9PM="0 21 * * *",e.EVERY_DAY_AT_10PM="0 22 * * *",e.EVERY_DAY_AT_11PM="0 23 * * *",e.EVERY_DAY_AT_MIDNIGHT="0 0 * * *",e.EVERY_WEEK="0 0 * * 7",e.EVERY_WEEKDAY="0 0 * * 1-5",e.EVERY_WEEKEND="0 0 * * 6,7",e.EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT="0 0 1 * *",e.EVERY_1ST_DAY_OF_MONTH_AT_NOON="0 12 1 * *",e.EVERY_2ND_HOUR="0 */2 * * *",e.EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM="0 1-23/2 * * *",e.EVERY_2ND_MONTH="0 0 1 */2 *",e.EVERY_QUARTER="0 0 1 */3 *",e.EVERY_6_MONTHS="0 0 1 */6 *",e.EVERY_YEAR="0 0 1 1 *",e.EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM="0 */30 9-17 * * *",e.EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM="0 */30 9-18 * * *",e.EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM="0 */30 10-19 * * *",e.MONDAY_TO_FRIDAY_AT_1AM="0 0 01 * * 1-5",e.MONDAY_TO_FRIDAY_AT_2AM="0 0 02 * * 1-5",e.MONDAY_TO_FRIDAY_AT_3AM="0 0 03 * * 1-5",e.MONDAY_TO_FRIDAY_AT_4AM="0 0 04 * * 1-5",e.MONDAY_TO_FRIDAY_AT_5AM="0 0 05 * * 1-5",e.MONDAY_TO_FRIDAY_AT_6AM="0 0 06 * * 1-5",e.MONDAY_TO_FRIDAY_AT_7AM="0 0 07 * * 1-5",e.MONDAY_TO_FRIDAY_AT_8AM="0 0 08 * * 1-5",e.MONDAY_TO_FRIDAY_AT_9AM="0 0 09 * * 1-5",e.MONDAY_TO_FRIDAY_AT_09_30AM="0 30 09 * * 1-5",e.MONDAY_TO_FRIDAY_AT_10AM="0 0 10 * * 1-5",e.MONDAY_TO_FRIDAY_AT_11AM="0 0 11 * * 1-5",e.MONDAY_TO_FRIDAY_AT_11_30AM="0 30 11 * * 1-5",e.MONDAY_TO_FRIDAY_AT_12PM="0 0 12 * * 1-5",e.MONDAY_TO_FRIDAY_AT_1PM="0 0 13 * * 1-5",e.MONDAY_TO_FRIDAY_AT_2PM="0 0 14 * * 1-5",e.MONDAY_TO_FRIDAY_AT_3PM="0 0 15 * * 1-5",e.MONDAY_TO_FRIDAY_AT_4PM="0 0 16 * * 1-5",e.MONDAY_TO_FRIDAY_AT_5PM="0 0 17 * * 1-5",e.MONDAY_TO_FRIDAY_AT_6PM="0 0 18 * * 1-5",e.MONDAY_TO_FRIDAY_AT_7PM="0 0 19 * * 1-5",e.MONDAY_TO_FRIDAY_AT_8PM="0 0 20 * * 1-5",e.MONDAY_TO_FRIDAY_AT_9PM="0 0 21 * * 1-5",e.MONDAY_TO_FRIDAY_AT_10PM="0 0 22 * * 1-5",e.MONDAY_TO_FRIDAY_AT_11PM="0 0 23 * * 1-5"}(Ce||(Ce={}));const Re=["dev","prod"],qe=[...Re];var Le,Be,Qe;!function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLYHINTS=103]="EARLYHINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.AMBIGUOUS=300]="AMBIGUOUS",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",e[e.MISDIRECTED=421]="MISDIRECTED",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED"}(Le||(Le={})),function(e){e.built_in_db="built_in_db",e.mongo="mongo",e.mysql="mysql",e.clickhouse="clickhouse",e.mssql="mssql",e.postgres="postgres",e.cockroach="cockroach",e.api="api",e.graphql="graphql",e.snowflake="snowflake",e.datadog="datadog",e.newrelic="newrelic",e.auth0="auth0",e.jwt_rsa="jwt_rsa",e.jwt_hmac="jwt_hmac",e.ai_chatbot="ai_chatbot",e.cognito="cognito",e.okta="okta",e.descope="descope",e.firebase_auth="firebase_auth",e.kafka="kafka",e.confluent="confluent",e.built_in_queue="built_in_queue",e.s3="s3",e.gcs="gcs",e.built_in_s3="built_in_s3",e.built_in_gcs="built_in_gcs",e.algolia="algolia",e.elastic_observability="elastic_observability",e.elastic_search="elastic_search",e.elastic_enterprise_search="elastic_enterprise_search",e.sentry="sentry",e.sap_hana="sap_hana",e.salesforce_crm="salesforce_crm",e.documentdb="documentdb",e.dynamodb="dynamodb",e.cassandra="cassandra",e.alloydb="alloydb",e.spanner="spanner",e.db2="db2",e.mariadb="mariadb",e.oracledb="oracledb",e.redis="redis",e.xata="xata",e.azure_sql="azure_sql",e.azure_postgresql="azure_postgresql",e.azure_cosmosdb="azure_cosmosdb",e.firestore="firestore",e.bigquery="bigquery",e.cloudsql="cloudsql"}(Be||(Be={})),function(e){e.data="data",e.api="api",e.graphql="graphql"}(Qe||(Qe={}));const Ve=["gauge","count"];function Ue(e){return"fieldName"in e}const ze=["==","!=",">=","<=",">","<","like","not like","like_cs","not like_cs","array_includes_some","array_includes_all","array_not_includes"],Ye=["us-east-1.aws","ap-south-1.aws","us-central1.gcp"],We=Ye;var $e;!function(e){e.CONNECTED="CONNECTED",e.DISCONNECTED="DISCONNECTED",e.REMOVED="REMOVED"}($e||($e={}));const Ge="__squidId";function He(e){return _e(e)}function Ke(...e){const[t,r,n]=e,i="object"==typeof t?t:{docId:t,collectionName:r,integrationId:n};return i.integrationId||(i.integrationId=void 0),me(i)}class Je{constructor(e,t,r){this._squidDocId=e,this.dataManager=t,this.queryBuilderFactory=r,this.refId=U()}get squidDocId(){return this._squidDocId}get data(){return fe(this.dataRef)}get dataRef(){return(0,V.truthy)(this.dataManager.getProperties(this.squidDocId),(()=>{const{collectionName:e,integrationId:t,docId:r}=He(this.squidDocId);return`No data found for document reference: ${JSON.stringify({docId:r,collectionName:e,integrationId:t},null,2)}`}))}get hasData(){return!!this.dataManager.getProperties(this.squidDocId)}async snapshot(){if(this.hasSquidPlaceholderId())throw new Error("Cannot invoke snapshot of a document that was created locally without storing it on the server.");if(this.isTracked()&&this.hasData)return this.data;const e=await this.queryBuilderFactory.getForDocument(this.squidDocId).dereference().snapshot();return(0,V.truthy)(e.length<=1,"Got more than one doc for the same id:"+this.squidDocId),e.length?e[0]:void 0}snapshots(){return this.queryBuilderFactory.getForDocument(this.squidDocId).dereference().snapshots().pipe((0,o.map)((e=>((0,V.truthy)(e.length<=1,"Got more than one doc for the same id:"+this.squidDocId),e.length?e[0]:void 0))))}peek(){return this.isTracked()&&this.hasData?this.data:void 0}isDirty(){return this.dataManager.isDirty(this.squidDocId)}isTracked(){return this.dataManager.isTracked(this.squidDocId)}async update(e,t){const r={};Object.entries(e).forEach((([e,t])=>{const n=void 0!==t?{type:"update",value:t}:{type:"removeProperty"};r[e]=[n]}));const n={type:"update",squidDocIdObj:He(this.squidDocId),properties:r};return this.dataManager.applyOutgoingMutation(n,t)}async setInPath(e,t,r){return this.update({[e]:fe(t)},r)}async deleteInPath(e,t){return this.update({[e]:void 0},t)}incrementInPath(e,t,r){const n={type:"applyNumericFn",fn:"increment",value:t},i={type:"update",squidDocIdObj:He(this.squidDocId),properties:{[e]:[n]}};return this.dataManager.applyOutgoingMutation(i,r)}decrementInPath(e,t,r){return this.incrementInPath(e,-t,r)}async insert(e,t){const r=He(this.squidDocId),n=r.integrationId;let i=_e(r.docId);if(i[Ge]&&(i={}),n===Be.built_in_db&&i.__id)try{const e=_e(i.__id);i=Object.assign(Object.assign({},i),e)}catch(e){}const o={type:"insert",squidDocIdObj:r,properties:Object.assign(Object.assign(Object.assign({},e),{__docId__:r.docId}),i)};return this.dataManager.applyOutgoingMutation(o,t)}async delete(e){const t={type:"delete",squidDocIdObj:He(this.squidDocId)};return this.dataManager.applyOutgoingMutation(t,e)}migrateDocIds(e){const t=e[this.squidDocId];t&&(this._squidDocId=t)}hasSquidPlaceholderId(){const e=_e(this._squidDocId);if("object"==typeof e&&e.docId){const t=_e(e.docId);if("object"==typeof t&&Object.keys(t).includes(Ge))return!0}return!1}}Error;class Xe{constructor(e,t={}){this.internalStateObserver=new o.BehaviorSubject(null),this.firstElement=null,this.isDestroyed=new o.BehaviorSubject(!1),this.snapshotSubject=new o.Subject,this.onFirstPage=!0,this.navigatingToLastPage=!1,this.lastElement=null,(0,V.assertTruthy)(e.getSortOrders().length>0,"Unable to paginate results. Please specify a sort order."),this.snapshotSubject.pipe((0,o.switchAll)()).subscribe((e=>this.dataReceived(e))),this.templateSnapshotEmitter=e.clone(),this.paginateOptions=Object.assign({pageSize:100,subscribe:!0},t),this.goToFirstPage()}goToFirstPage(){this.onFirstPage=!0;const e=this.templateSnapshotEmitter.clone().limit(3*this.paginateOptions.pageSize).snapshots(this.paginateOptions.subscribe);this.snapshotSubject.next(e)}compareObjects(e,t){if(e===t||le(e)&&le(t))return 0;if(le(e))return-1;if(le(t))return 1;const r=this.templateSnapshotEmitter.getSortOrders();for(const{fieldName:n,asc:i}of r){const r=ve(oe(e,n),oe(t,n));if(0!==r)return i?r:-r}return 0}async dataReceived(e){const t=e.map((e=>this.templateSnapshotEmitter.extractData(e)));if(0===e.length)return void(this.onFirstPage?this.internalStateObserver.next({numBefore:0,numAfter:0,data:e,extractedData:t}):this.goToFirstPage());if(null===this.firstElement)if(null!==this.lastElement){const r=t.filter((e=>1===this.compareObjects(e,this.lastElement))).length;this.firstElement=t[e.length-r-this.paginateOptions.pageSize],this.lastElement=null}else this.navigatingToLastPage&&(this.firstElement=t[e.length-this.paginateOptions.pageSize],this.navigatingToLastPage=!1);const r=t.filter((e=>-1===this.compareObjects(e,this.firstElement))).length,n=Math.max(0,e.length-r-this.paginateOptions.pageSize);r!==e.length?this.internalStateObserver.next({numBefore:r,numAfter:n,data:e,extractedData:t}):this.prevInternal({numBefore:r,numAfter:n,data:e,extractedData:t})}doNewQuery(e,t){if(this.onFirstPage=!1,t){const t=this.templateSnapshotEmitter.clone().limit(3*this.paginateOptions.pageSize).flipSortOrder();e&&t.addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((t=>({fieldName:t.fieldName,operator:t.asc?"<=":">=",value:oe(e,t.fieldName)||null})))),this.snapshotSubject.next(t.snapshots(this.paginateOptions.subscribe).pipe((0,o.map)((e=>e.reverse()))))}else{const t=this.templateSnapshotEmitter.clone().limit(3*this.paginateOptions.pageSize);e&&t.addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((t=>({fieldName:t.fieldName,operator:t.asc?">=":"<=",value:oe(e,t.fieldName)||null})))),this.snapshotSubject.next(t.snapshots(this.paginateOptions.subscribe))}}async waitForInternalState(){const e=this.internalStateObserver.value;return null!==e?e:await(0,o.firstValueFrom)((0,o.race)(this.isDestroyed.pipe((0,o.filter)(Boolean),(0,o.map)((()=>({data:[],extractedData:[],numBefore:0,numAfter:0})))),this.internalStateObserver.pipe((0,o.filter)((e=>null!==e)),(0,o.take)(1))))}internalStateToState(e){const{data:t,numBefore:r,numAfter:n,extractedData:i}=e;return{data:t.filter(((e,t)=>-1!==this.compareObjects(i[t],this.firstElement))).slice(0,this.paginateOptions.pageSize),hasNext:n>0,hasPrev:r>0}}unsubscribe(){this.isDestroyed.next(!0),this.isDestroyed.complete(),this.internalStateObserver.complete(),this.snapshotSubject.complete()}prevInternal(e){const{numBefore:t,numAfter:r,extractedData:n}=e;this.firstElement=null,this.lastElement=n[t-1],this.internalStateObserver.next(null),this.doNewQuery(n[n.length-r-1],!0)}async prev(){return this.prevInternal(await this.waitForInternalState()),await this.waitForData()}async next(){const{numBefore:e,extractedData:t}=await this.waitForInternalState();return e+this.paginateOptions.pageSize<t.length&&(this.firstElement=t[e+this.paginateOptions.pageSize]),this.internalStateObserver.next(null),this.doNewQuery(t[e],!1),await this.waitForData()}async waitForData(){return this.internalStateToState(await this.waitForInternalState())}observeState(){return this.internalStateObserver.pipe((0,o.filter)((e=>null!==e)),(0,o.map)((e=>this.internalStateToState(e))))}async first(){return await this.waitForInternalState(),this.internalStateObserver.next(null),this.firstElement=null,this.lastElement=null,this.goToFirstPage(),await this.waitForData()}async refreshPage(){const{extractedData:e}=await this.waitForInternalState();return this.internalStateObserver.next(null),this.onFirstPage?this.goToFirstPage():this.doNewQuery(e[0],!1),await this.waitForData()}async last(){await this.waitForInternalState(),this.internalStateObserver.next(null),this.firstElement=null,this.lastElement=null,this.navigatingToLastPage=!0;const e=this.templateSnapshotEmitter.clone().limit(3*this.paginateOptions.pageSize).flipSortOrder().snapshots(this.paginateOptions.subscribe).pipe((0,o.map)((e=>e.reverse())));return this.snapshotSubject.next(e),await this.waitForData()}}class Ze{constructor(e,t,r,n){this.querySubscriptionManager=e,this.localQueryManager=t,this.documentReferenceFactory=r,this.documentIdentityService=n}getForDocument(e){const{collectionName:t,integrationId:r,docId:n}=He(e),i=_e(n),o=this.get(t,r);for(const[e,t]of Object.entries(i))o.where(e,"==",t);return o}get(e,t){return new rt(e,t,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this,this.documentIdentityService)}}class et{constructor(){this.containsEmptyInCondition=!1}eq(e,t){return this.where(e,"==",t)}neq(e,t){return this.where(e,"!=",t)}in(e,t){return this.where(e,"in",t)}nin(e,t){return this.where(e,"not in",t)}gt(e,t){return this.where(e,">",t)}gte(e,t){return this.where(e,">=",t)}lt(e,t){return this.where(e,"<",t)}lte(e,t){return this.where(e,"<=",t)}like(e,t,r){return this.throwIfInvalidLikePattern(t),this.where(e,r?"like_cs":"like",t)}notLike(e,t,r){return this.throwIfInvalidLikePattern(t),this.where(e,r?"not like_cs":"not like",t)}arrayIncludesSome(e,t){return this.where(e,"array_includes_some",t)}arrayIncludesAll(e,t){return this.where(e,"array_includes_all",t)}arrayNotIncludes(e,t){return this.where(e,"array_not_includes",t)}throwIfInvalidLikePattern(e){if(/\\(?![%_\\])/.test(e))throw new Error("Invalid pattern. Cannot have any \\ which are not followed by _, % or \\")}}class tt{constructor(e){this.queryBuilder=e}peek(){return this.queryBuilder.peek().map((e=>e.data))}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1).pipe((0,o.defaultIfEmpty)([])))}snapshots(e){return this.queryBuilder.snapshots(e).pipe(Q((e=>e.map((e=>e.data)))))}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){return new tt(this.queryBuilder.clone())}addCompositeCondition(e){return this.queryBuilder.addCompositeCondition(e),this}limit(e){return this.queryBuilder.limit(e),this}getLimit(){return this.queryBuilder.getLimit()}flipSortOrder(){return this.queryBuilder.flipSortOrder(),this}extractData(e){return e}serialize(){return Object.assign(Object.assign({},this.queryBuilder.serialize()),{dereference:!0})}paginate(e){return new Xe(this,e)}}class rt extends et{constructor(e,t,r,n,i,o,s){super(),this.collectionName=e,this.integrationId=t,this.querySubscriptionManager=r,this.localQueryManager=n,this.documentReferenceFactory=i,this.queryBuilderFactory=o,this.documentIdentityService=s,this.forceFetchFromServer=!1,this.query={integrationId:t,collectionName:e,conditions:[],limit:-1,sortOrder:[]}}where(e,t,r){if("in"===t||"not in"===t){const n=Array.isArray(r)?[...r]:[r];"in"===t&&0===n.length&&(this.containsEmptyInCondition=!0);for(const r of n)this.query.conditions.push({fieldName:e,operator:"in"===t?"==":"!=",value:r});return this}return this.query.conditions.push({fieldName:e,operator:t,value:r}),this}limit(e){return function(e){(0,V.assertNumber)(e,"Limit needs to be a number"),-1!==e&&((0,V.assertTruthy)(e>0,"query limit has to be greater than 0"),(0,V.assertTruthy)(Math.floor(e)===e,"query limit has to be an integer"),(0,V.assertTruthy)(e<=2e4,"Limit can be maximum 20000"))}(e),this.query.limit=e,this}getLimit(){return this.query.limit}limitBy(e,...t){const r=this.query.sortOrder.map((e=>e.fieldName));return(0,V.assertTruthy)(he(t.sort(),r.slice(0,t.length).sort()),"All fields in limitBy must be appear in the first fields in the sortBy list."),this.query.limitBy={limit:e,fields:t,reverseSort:!1},this}sortBy(e,t=!0){const r={asc:t,fieldName:e};return function(e){if(!(e instanceof Object))throw new Error("Field sort has to be an object");const t=e;var r,n,i,o;(0,V.assertTruthy)((r=t,n=["fieldName","asc"],!Array.isArray(r)&&[...Object.keys(r)].every((e=>n.includes(e)))),"Field sort should only contain a fieldName and asc"),(0,V.assertTruthy)((i=t.asc,o="boolean",Array.isArray(i)?i.every((e=>typeof e===o)):typeof i===o),"Asc needs to be boolean")}(r),(0,V.assertTruthy)(!this.query.sortOrder.some((t=>t.fieldName===e)),`${e} already in the sort list.`),this.query.sortOrder.push(r),this}build(){const e=this.mergeConditions();return Object.assign(Object.assign({},this.query),{conditions:e})}mergeConditions(){const e=[],t=ye(this.query.conditions.filter(Ue)||[],(e=>e.fieldName));for(const r of Object.values(t)){const t=ye(r,(e=>e.operator));for(const[r,n]of Object.entries(t)){if("=="===r||"!="===r){e.push(...n);continue}const t=[...n];t.sort(((e,t)=>ve(e.value,t.value))),">"===r||">="===r?e.push(t[t.length-1]):e.push(t[0])}}return[...this.query.conditions.filter((e=>!Ue(e))),...e]}getSortOrder(){return this.query.sortOrder}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1).pipe((0,o.defaultIfEmpty)([])))}setForceFetchFromServer(){return this.forceFetchFromServer=!0,this}peek(){return this.localQueryManager.peek(this.build())}snapshots(e=!0){if(this.containsEmptyInCondition)return new o.BehaviorSubject([]);const t=this.build();return this.querySubscriptionManager.processQuery(t,this.collectionName,{},{},e,this.forceFetchFromServer).pipe(Q((e=>e.map((e=>{(0,V.assertTruthy)(1===Object.keys(e).length);const t=e[this.collectionName],r=Ke((0,V.truthy)(t).__docId__,this.collectionName,this.integrationId);return this.documentReferenceFactory.create(r,this.queryBuilderFactory)})))))}changes(){let e,t=new Set;return this.snapshots().pipe((0,o.combineLatestWith)(this.documentIdentityService.observeChanges().pipe((0,o.switchMap)((t=>(Object.entries(t).forEach((([t,r])=>{!function(e,t,r){const n=e[t];void 0!==n&&(e[r]=n,delete e[t])}(e||{},t,r)})),o.NEVER))),(0,o.startWith)({}))),Q((([r])=>{let n=[];const i=[],o=[];if(e){for(const o of r){const r=o.squidDocId,s=o.dataRef;if(t.has(s))delete e[r],t.delete(s);else if(e[r]){i.push(o);const n=e[r];delete e[r],t.delete(n)}else n.push(o)}for(const e of t)o.push(e)}else n=r;e={},t=new Set;for(const n of r){const r=n.dataRef;e[n.squidDocId]=r,t.add(r)}return new nt(n,i,o)})))}get hash(){return Oe(this.build())}dereference(){return new tt(this)}getSortOrders(){return this.query.sortOrder}clone(){const e=new rt(this.collectionName,this.integrationId,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.queryBuilderFactory,this.documentIdentityService);return e.query=fe(this.query),e.containsEmptyInCondition=this.containsEmptyInCondition,e}addCompositeCondition(e){return e.length?(this.query.conditions.push({fields:e}),this):this}flipSortOrder(){return this.query.sortOrder=this.query.sortOrder.map((e=>Object.assign(Object.assign({},e),{asc:!e.asc}))),this.query.limitBy&&(this.query.limitBy.reverseSort=!this.query.limitBy.reverseSort),this}serialize(){return{type:"simple",dereference:!1,query:this.build()}}extractData(e){return e.dataRef}paginate(e){return new Xe(this,e)}}class nt{constructor(e,t,r){this.inserts=e,this.updates=t,this.deletes=r}}class it extends et{constructor(e,t,r,n,i,o,s,a,u,c,l){super(),this.collectionName=e,this.integrationId=t,this.querySubscriptionManager=r,this.documentReferenceFactory=n,this.queryBuilderFactory=i,this.rootAlias=o,this.latestAlias=s,this.leftToRight=a,this.joins=u,this.joinConditions=c,this.queryBuilder=l}where(e,t,r){return this.queryBuilder.where(e,t,r),this}limit(e){return this.queryBuilder.limit(e),this}getLimit(){return this.queryBuilder.getLimit()}sortBy(e,t=!0){return this.queryBuilder.sortBy(e,t),this}join(e,t,r,n){var i,o;const s=null!==(i=null==n?void 0:n.leftAlias)&&void 0!==i?i:this.latestAlias,a=Object.assign(Object.assign({},r),{leftAlias:s,isInner:null!==(o=null==n?void 0:n.isInner)&&void 0!==o&&o}),u=Object.assign(Object.assign({},this.leftToRight),{[t]:[]});return u[s].push(t),new it(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,this.rootAlias,t,u,Object.assign(Object.assign({},this.joins),{[t]:e.build()}),Object.assign(Object.assign({},this.joinConditions),{[t]:a}),this.queryBuilder)}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1))}snapshots(e=!0){return this.containsEmptyInCondition?new o.BehaviorSubject([]):this.querySubscriptionManager.processQuery(this.build(),this.rootAlias,fe(this.joins),fe(this.joinConditions),e,!1).pipe(Q((e=>e.map((e=>{const t={};for(const[r,n]of Object.entries(e)){const e=r===this.rootAlias?this.collectionName:this.joins[r].collectionName,i=r===this.rootAlias?this.integrationId:this.joins[r].integrationId,o=n?Ke(n.__docId__,e,i):void 0;t[r]=o?this.documentReferenceFactory.create(o,this.queryBuilderFactory):void 0}return t})))))}peek(){throw new Error("peek is not currently supported for join queries")}grouped(){return new at(this)}dereference(){return new ot(this)}build(){return this.queryBuilder.build()}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){const e=new it(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,this.rootAlias,this.latestAlias,fe(this.leftToRight),fe(this.joins),fe(this.joinConditions),this.queryBuilder.clone());return e.containsEmptyInCondition=this.containsEmptyInCondition,e}addCompositeCondition(e){return this.queryBuilder.addCompositeCondition(e),this}flipSortOrder(){return this.queryBuilder.flipSortOrder(),this}extractData(e){return e[this.rootAlias].dataRef}serialize(){return{type:"join",grouped:!1,dereference:!1,root:{alias:this.rootAlias,query:this.build()},leftToRight:this.leftToRight,joins:this.joins,joinConditions:this.joinConditions}}paginate(e){return new Xe(this,e)}}class ot{constructor(e){this.joinQueryBuilder=e}grouped(){return this.joinQueryBuilder.grouped().dereference()}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(Q((e=>e.map((e=>function(e,t){const r={},n=Object.keys(e);for(const t of n){const n=e[t];r[t]=null==(i=n)?void 0:i.data}var i;return r}(e))))))}peek(){throw new Error("peek is not currently supported for join queries")}getSortOrders(){return this.joinQueryBuilder.getSortOrders()}clone(){return new ot(this.joinQueryBuilder.clone())}addCompositeCondition(e){return this.joinQueryBuilder.addCompositeCondition(e),this}flipSortOrder(){return this.joinQueryBuilder.flipSortOrder(),this}limit(e){return this.joinQueryBuilder.limit(e),this}extractData(e){return e[this.joinQueryBuilder.rootAlias]}paginate(e){return new Xe(this,e)}serialize(){return Object.assign(Object.assign({},this.joinQueryBuilder.serialize()),{dereference:!0})}getLimit(){return this.joinQueryBuilder.getLimit()}}class st{constructor(e){this.groupedJoin=e}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.groupedJoin.snapshots(e).pipe(Q((e=>e.map((e=>this.dereference(e,this.groupedJoin.joinQueryBuilder.rootAlias))))))}peek(){throw new Error("peek is not currently supported for join queries")}dereference(e,t){const r=this.groupedJoin.joinQueryBuilder.leftToRight[t];if(r.length){const n={[t]:e[t].data};for(const t of r)n[t]=e[t].map((e=>this.dereference(e,t)));return n}return e.data}getSortOrders(){return this.groupedJoin.getSortOrders()}clone(){return new st(this.groupedJoin.clone())}addCompositeCondition(e){return this.groupedJoin.addCompositeCondition(e),this}flipSortOrder(){return this.groupedJoin.flipSortOrder(),this}limit(e){return this.groupedJoin.limit(e),this}getLimit(){return this.groupedJoin.getLimit()}extractData(e){return e[this.groupedJoin.joinQueryBuilder.rootAlias]}serialize(){return Object.assign(Object.assign({},this.groupedJoin.joinQueryBuilder.serialize()),{dereference:!0,grouped:!0})}paginate(e){return new Xe(this,e)}}class at{constructor(e){this.joinQueryBuilder=e}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(Q((e=>this.groupData(e,this.joinQueryBuilder.rootAlias))))}peek(){throw new Error("peek is not currently supported for join queries")}dereference(){return new st(this)}groupData(e,t){const r=ye(e,(e=>{var r;return null===(r=e[t])||void 0===r?void 0:r.squidDocId}));return Object.values(r).filter((e=>void 0!==e[0][t])).map((e=>{const r=this.joinQueryBuilder.leftToRight[t],n=e[0][t];if(0===r.length)return n;const i={[t]:n};for(const t of r)i[t]=this.groupData(e,t);return i}))}getSortOrders(){return this.joinQueryBuilder.getSortOrders()}clone(){return new at(this.joinQueryBuilder.clone())}addCompositeCondition(e){return this.joinQueryBuilder.addCompositeCondition(e),this}flipSortOrder(){return this.joinQueryBuilder.flipSortOrder(),this}limit(e){return this.joinQueryBuilder.limit(e),this}getLimit(){return this.joinQueryBuilder.getLimit()}extractData(e){return Object.keys(this.joinQueryBuilder.leftToRight).length>1?e[this.joinQueryBuilder.rootAlias].dataRef:e.dataRef}serialize(){return Object.assign(Object.assign({},this.joinQueryBuilder.serialize()),{grouped:!0})}paginate(e){return new Xe(this,e)}}function ut(e,t,r){if(e=e instanceof Date?e.getTime():null!=e?e:null,t=t instanceof Date?t.getTime():null!=t?t:null,"=="===r)return he(e,t);if("!="===r)return!he(e,t);switch(r){case"<":return!le(e)&&(!!le(t)||t<e);case"<=":return!!le(t)||!le(e)&&t<=e;case">":return!le(t)&&(!!le(e)||t>e);case">=":return!!le(e)||!le(t)&&t>=e;case"like":return"string"==typeof t&&"string"==typeof e&&ct(t,e,!1);case"not like":return!("string"==typeof t&&"string"==typeof e&&ct(t,e,!1));case"like_cs":return"string"==typeof t&&"string"==typeof e&&ct(t,e,!0);case"not like_cs":return!("string"==typeof t&&"string"==typeof e&&ct(t,e,!0));case"array_includes_some":{const r=t;return Array.isArray(t)&&Array.isArray(e)&&e.some((e=>(0,V.truthy)(r,"VALUE_CANNOT_BE_NULL").some((t=>he(t,e)))))}case"array_includes_all":{const r=t;return Array.isArray(e)&&Array.isArray(t)&&e.every((e=>(0,V.truthy)(r,"VALUE_CANNOT_BE_NULL").some((t=>he(t,e)))))}case"array_not_includes":{const r=t;return Array.isArray(t)&&Array.isArray(e)&&e.every((e=>!(0,V.truthy)(r,"VALUE_CANNOT_BE_NULL").some((t=>he(t,e)))))}default:throw new Error(`Unsupported operator comparison: ${r}`)}}function ct(e,t,r){r||(e=e.toLowerCase(),t=t.toLowerCase());const n=function(e){let t="";for(let r=0;r<e.length;++r)"\\"===e[r]?r+1<e.length&&["%","_"].includes(e[r+1])?(t+=e[r+1],r++):r+1<e.length&&"\\"===e[r+1]?(t+="\\\\",r++):t+="\\":"%"===e[r]?t+="[\\s\\S]*":"_"===e[r]?t+="[\\s\\S]":("/-\\^$*+?.()[]{}|".includes(e[r])&&(t+="\\"),t+=e[r]);return t}(t);return new RegExp(`^${n}$`).test(e)}function lt(e,t){return`${e}_${t}`}class ht{constructor(e,t,r,n,i,o){this.collectionName=e,this.integrationId=t,this.documentReferenceFactory=r,this.queryBuilderFactory=n,this.querySubscriptionManager=i,this.dataManager=o,this.refId=U()}doc(e){if(e&&"string"!=typeof e&&"object"!=typeof e&&!Array.isArray(e))throw new Error("Invalid doc id. Can be only object or string.");if(this.integrationId!==Be.built_in_db)if(e){if("object"!=typeof e)throw new Error("Invalid doc id. String doc ids are only supported for the built_in_db integration. For all other integrations, the doc id must be an object.")}else e={[Ge]:U()};else e=e&&"string"!=typeof e?{__id:me(e)}:{__id:e||U()};const t=Ke(me(e),this.collectionName,this.integrationId);return this.documentReferenceFactory.create(t,this.queryBuilderFactory)}async insertMany(e,t){await this.dataManager.runInTransaction((async t=>{for(const r of e)await this.doc(r.id).insert(r.data,t)}),t)}async deleteMany(e,t){await this.dataManager.runInTransaction((async t=>{for(const r of e)r instanceof Je?await r.delete(t):await this.doc(r).delete(t)}),t)}query(){return this.queryBuilderFactory.get(this.collectionName,this.integrationId)}joinQuery(e){return new it(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,e,e,{[e]:[]},{},{},this.query())}or(...e){return new dt(...e)}}class dt{constructor(...e){if(0===e.length)throw new Error("At least one query builder must be provided");this.snapshotEmitters=e.map((e=>e.clone()));const t=Math.max(...this.snapshotEmitters.map((e=>{const t=e.getLimit();return-1===t?1e3:t})));this.snapshotEmitters.forEach((e=>e.limit(t)));const r=this.snapshotEmitters[0].getSortOrders();for(const e of this.snapshotEmitters){const t=e.getSortOrders();if(t.length!==r.length)throw new Error("All the queries must have the same sort order");for(let e=0;e<r.length;e++)if(t[e].fieldName!==r[e].fieldName||t[e].asc!==r[e].asc)throw new Error("All the queries must have the same sort order")}}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1))}snapshots(e=!0){const t=this.snapshotEmitters.map((t=>t.snapshots(e)));return this.or(this.snapshotEmitters[0].getSortOrders(),...t)}peek(){throw new Error("peek is not currently supported for merged queries")}or(e,...t){return(0,o.combineLatest)([...t]).pipe((0,o.map)((t=>{const r=new Set,n=t.flat(),i=[];for(const e of n)r.has(this.extractData(e))||(r.add(this.extractData(e)),i.push(e));return i.sort(((t,r)=>{for(const{fieldName:n,asc:i}of e){const e=oe(this.extractData(t),n),o=oe(this.extractData(r),n);if(!ut(e,o,"=="))return ut(o,e,"<")?i?-1:1:i?1:-1}return 0})).slice(0,this.getLimit())})))}clone(){return new dt(...this.snapshotEmitters.map((e=>e.clone())))}getSortOrders(){return this.snapshotEmitters[0].getSortOrders()}addCompositeCondition(e){for(const t of this.snapshotEmitters)t.addCompositeCondition(e);return this}limit(e){return this.snapshotEmitters.forEach((t=>t.limit(e))),this}getLimit(){return this.snapshotEmitters[0].getLimit()}flipSortOrder(){return this.snapshotEmitters.forEach((e=>e.flipSortOrder())),this}serialize(){return{type:"merged",queries:this.snapshotEmitters.map((e=>e.serialize()))}}extractData(e){return this.snapshotEmitters[0].extractData(e)}paginate(e){return new Xe(this,e)}}class ft{constructor(e,t,r,n){this.documentReferenceFactory=e,this.queryBuilderFactory=t,this.querySubscriptionManager=r,this.dataManager=n,this.collections=new Map}get(e,t){let r=this.collections.get(t);r||(r=new Map,this.collections.set(t,r));let n=r.get(e);return n||(n=new ht(e,t,this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager,this.dataManager),r.set(e,n)),n}}class pt{constructor(e,t){this.clientIdService=e,this.socketManager=t,this.isConnected=!1,this.socketManager.observeConnectionReady().subscribe((e=>{this.isConnected=e}))}get connected(){return this.isConnected}get clientId(){return this.clientIdService.getClientId()}observeConnected(){return this.socketManager.observeConnectionReady()}}var vt=r(5150);function yt(e,t){switch(t.type){case"applyNumericFn":return function(e,t){if("increment"===t.fn)return null==e?t.value:e+t.value;throw new Error("Unknown numeric function: "+JSON.stringify(t))}(e,t);case"applyStringFn":return function(e,t){switch(t.fn){case"trim":return"string"!=typeof e?e:e.trim();case"extendString":return null==e?t.value:e+t.value;default:throw new Error("Unknown string function: "+JSON.stringify(t))}}(e,t);case"update":return"object"==typeof t.value?fe(t.value):t.value;case"removeProperty":return;default:throw new Error("Unknown property mutation type: "+JSON.stringify(t))}}function bt(e){return Object.entries(e.properties).sort((([e],[t])=>e.split(".").length-t.split(".").length))}function mt(e){let t=0;for(;t+1<e.length;){const i=(r=e[t],"removeProperty"===(n=e[t+1]).type||"update"===n.type?n:"applyNumericFn"===n.type?((0,V.assertTruthy)("increment"===n.fn,"Unrecognized applyNumericFn"),"applyNumericFn"===r.type?((0,V.assertTruthy)("increment"===r.fn,"Unrecognized applyNumericFn"),{type:"applyNumericFn",fn:"increment",value:r.value+n.value}):"update"===r.type?{type:"update",value:r.value+n.value}:n):"extendString"===n.fn?"update"===r.type?{type:"update",value:r.value+n.value}:"applyStringFn"===r.type?"trim"===r.fn?null:{type:"applyStringFn",fn:"extendString",value:r.value+n.value}:n:null);i?e.splice(t,2,i):++t}var r,n;return e}function gt(e){let t=[];return(0,o.from)(e).pipe((0,o.groupBy)((e=>`${e.squidDocIdObj.integrationId}${e.squidDocIdObj.collectionName}/${e.squidDocIdObj.docId}`)),(0,o.mergeMap)((e=>e.pipe((0,o.reduce)(((e,t)=>function(e,t){if("insert"===t.type)return t;if("delete"===t.type)return t;if("delete"===e.type)throw new Error("Cannot delete and then update");if((0,V.assertTruthy)("update"===t.type,"Invalid mutation type"),"update"===e.type)return function(e,t){const r=fe(e);t=fe(t);for(const[e]of bt(r)){const n=e.split(".").length;Object.entries(t.properties).some((([t])=>e.startsWith(t+".")&&n>t.split(".").length))&&delete r.properties[e]}for(const[e,n]of bt(t))r.properties[e]=mt([...r.properties[e]||[],...n]);return r}(e,t);const r=fe(e);for(const[e,n]of bt(t)){const t=n;for(const n of t){const t=yt(oe(r.properties,e),n);void 0===t?ue(r.properties,e):ae(r.properties,e,t)}}return r}(e,t)))))),(0,o.toArray)()).subscribe((e=>{t=e})),t}const _t="dataManager_runInTransaction";class Ot{constructor(e,t,r,n,i,s,a,u,c){this.documentStore=e,this.mutationSender=t,this.socketManager=r,this.querySubscriptionManager=n,this.queryBuilderFactory=i,this.lockManager=s,this.destructManager=a,this.documentIdentityService=u,this.querySender=c,this.docIdToLocalTimestamp=new Map,this.batchClientRequestIds=new Set,this.docIdToServerTimestamp=new Map,this.pendingIncomingUpdates=new Map,this.pendingOutgoingMutations=new Map,this.pendingOutgoingMutationsChanged=new o.Subject,this.outgoingMutationsEmpty=new o.BehaviorSubject(!0),this.knownDirtyDocs=new Set,this.failedDocsToResync=[],this.refreshDocIdToTimestamp=new Map,this.handleIncomingMessagesForTests=!0,this.destructManager.onDestruct((()=>{this.destruct()})),this.documentIdentityService.observeChanges().subscribe(this.migrateDocIds.bind(this)),this.handleNotifications(),this.startDeleteExpiredTimestampsJob(),this.handleOrphanDocs(),this.outgoingMutationsEmpty.subscribe((e=>{this.querySender.safeToSendQueriesToServer.next(e)}))}getProperties(e){return this.documentStore.getDocumentOrUndefined(e)}isDirty(e){var t;if(this.knownDirtyDocs.has(e))return!0;if(null===(t=this.pendingOutgoingMutations.get(e))||void 0===t?void 0:t.length)return!0;const r=this.docIdToServerTimestamp.get(e),n=r&&!r.expireTimestamp?r.timestamp:void 0,i=this.docIdToLocalTimestamp.get(e);return!((!i||n)&&!this.isForgotten(e)&&!this.isLocalOnly(e)&&i===n)}async runInTransaction(e,t){if(t)return(0,V.assertTruthy)(t===this.currentTransactionId,"Transaction already ended."),e(t).then((e=>Promise.resolve(e)));this.lockManager.canGetLock(_t)?this.lockManager.lockSync(_t):await this.lockManager.lock(_t);let r=St;const n=()=>r!==St;return new Promise((async(t,i)=>{try{let o;this.currentTransactionId=U();try{o=await e(this.currentTransactionId)}catch(e){r=e}finally{this.finishTransaction(n()?void 0:{resolve:()=>t(o),reject:i})}}catch(e){r=n()?r:e}finally{try{this.lockManager.release(_t)}catch(e){r=n()?r:e}}n()&&i(r)}))}async applyOutgoingMutation(e,t){var r;const n=Ke(e.squidDocIdObj);this.knownDirtyDocs.add(n),t||this.lockManager.canGetLock(_t)||(await this.lockManager.lock(_t),this.lockManager.release(_t)),this.knownDirtyDocs.delete(n);const i=null===(r=this.pendingOutgoingMutations.get(n))||void 0===r?void 0:r.slice(-1)[0];if(i&&!i.sentToServer)i.mutation=gt([i.mutation,e])[0],this.outgoingMutationsEmpty.next(!1);else{const t={mutation:this.removeInternalProperties(e),sentToServer:!1},r=this.pendingOutgoingMutations.get(n)||[];r.push(t),this.pendingOutgoingMutations.set(n,r),this.outgoingMutationsEmpty.next(!1),this.pendingOutgoingMutationsChanged.next()}return this.runInTransaction((async()=>{const t=this.documentStore.getDocumentOrUndefined(n),r="delete"===e.type?void 0:"update"===e.type?function(e,t){if(!e)return;const r=Object.assign({},e),n=bt(t);for(const[e,t]of n){const n=t;for(const t of n){const n=yt(oe(r,e),t);void 0===n?ue(r,e):ae(r,e,n)}}return r}(t,e):Object.assign({},e.properties);this.updateDocumentFromSnapshot(n,r)&&("insert"===e.type&&this.docIdToLocalTimestamp.set(n,(new Date).getTime()),this.querySubscriptionManager.setClientRequestIdsForLocalDoc(n,r).forEach((e=>this.batchClientRequestIds.add(e))))}),t)}async runInTransactionSync(e,t){if(t)return(0,V.assertTruthy)(t===this.currentTransactionId,"Transaction already ended."),void e(t);await this.lockManager.lock(_t);try{this.currentTransactionId=U();try{return e(this.currentTransactionId)}catch(e){console.error("error while executing callback function in transaction",e)}finally{this.finishTransaction()}}catch(e){console.error("error while executing transaction",e)}finally{this.lockManager.release(_t)}}removeInternalProperties(e){if("delete"===e.type)return e;const t=Object.assign(Object.assign({},e),{properties:Object.assign({},e.properties)});return delete t.properties.__docId__,delete t.properties.__ts__,t}handleNotifications(){this.socketManager.observeNotifications().pipe((0,o.filter)((e=>"mutations"===e.type)),Q((e=>e))).subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,o.filter)(Boolean),(0,o.take)(1)).subscribe((()=>{this.handleIncomingMutations(e.payload)}))})),this.querySubscriptionManager.observeQueryResults().subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,o.filter)(Boolean),(0,o.take)(1)).subscribe((()=>{this.handleIncomingQuerySnapshots(e)}))}))}handleIncomingMutations(e){if(!this.handleIncomingMessagesForTests)return;const t=e.reduce(((e,t)=>this.querySubscriptionManager.hasOngoingQuery(t.clientRequestId)?(e[t.squidDocId]={properties:t.doc,timestamp:t.mutationTimestamp},e):e),{});this.applyIncomingUpdates(t)}handleIncomingQuerySnapshots(e){if(!this.handleIncomingMessagesForTests)return;if(!this.querySubscriptionManager.hasOngoingQuery(e.clientRequestId))return;const t=this.querySubscriptionManager.getQuery(e.clientRequestId),r={};for(const n of e.docs){const e=Ke(n.__docId__,t.collectionName,t.integrationId);r[e]={properties:n,timestamp:n.__ts__}}this.runInTransactionSync((t=>{this.querySubscriptionManager.setGotInitialResult(e.clientRequestId),this.batchClientRequestIds.add(e.clientRequestId),this.applyIncomingUpdates(r,t)&&this.querySubscriptionManager.hasSubscription(e.clientRequestId)&&this.batchClientRequestIds.delete(e.clientRequestId)})).then()}applyIncomingUpdates(e,t){let r=!1;const n=new Set,i=new Set;for(const[t,o]of Object.entries(e)){const e=this.pendingIncomingUpdates.get(t),s=this.docIdToServerTimestamp.get(t);e&&e.timestamp>o.timestamp?r=!0:s&&s.timestamp>o.timestamp?i.add(t):(this.pendingIncomingUpdates.set(t,o),n.add(t))}return this.runInTransactionSync((()=>{for(const e of n)this.maybeApplyIncomingUpdate(e);for(const e of i)this.refreshQueryMapping(e)}),t).then(),r}maybeApplyIncomingUpdate(e){const t=this.pendingIncomingUpdates.get(e);if(!t)return;const r=this.pendingOutgoingMutations.get(e);r&&r.length||(this.updateDocumentFromSnapshot(e,t.properties),this.acknowledgeDocument(e,t.timestamp,!t.properties),this.docIdToLocalTimestamp.set(e,t.timestamp),this.pendingIncomingUpdates.delete(e),this.refreshQueryMapping(e))}refreshQueryMapping(e){const t=this.documentStore.getDocumentOrUndefined(e);this.querySubscriptionManager.setClientRequestIdsForLocalDoc(e,t).forEach((e=>{this.batchClientRequestIds.add(e)})),t&&(this.querySubscriptionManager.findQueriesForDocument(t,e).length||this.forgetDocument(e))}destruct(){this.stopDeleteExpiredTimestampsJob()}stopDeleteExpiredTimestampsJob(){void 0!==this.deleteExpiredTimestampsInterval&&(clearInterval(this.deleteExpiredTimestampsInterval),this.deleteExpiredTimestampsInterval=void 0)}startDeleteExpiredTimestampsJob(){this.deleteExpiredTimestampsInterval=setInterval((()=>{const e=[...this.docIdToServerTimestamp.entries()].filter((([e,t])=>!(!t.expireTimestamp||t.expireTimestamp>Date.now()||this.isTracked(e))));for(const[t]of e)this.docIdToServerTimestamp.delete(t),this.forgetDocument(t)}),1e4)}isTracked(e){if(this.pendingIncomingUpdates.get(e))return!0;const t=this.pendingOutgoingMutations.get(e);return!(!t||!t.length)||this.querySubscriptionManager.hasOngoingQueryForDocId(e)}isForgotten(e){return this.documentStore.hasData(e)&&!this.isTracked(e)}isLocalOnly(e){return!this.hasBeenAcknowledged(e)&&this.documentStore.hasData(e)}hasBeenAcknowledged(e){return this.docIdToServerTimestamp.has(e)}updateDocumentFromSnapshot(e,t){const r=this.documentStore.getDocumentOrUndefined(e);return!(!r&&!t||r===t)&&((!r||!t||me(Object.assign(Object.assign({},t),{__ts__:void 0}))!==me(r))&&(this.documentStore.saveDocument(e,t),!0))}finishTransaction(e){this.currentTransactionId=void 0;const t=[...this.batchClientRequestIds.values()];this.batchClientRequestIds.clear(),this.querySubscriptionManager.notifyAllSubscriptions(t),this.sendAllUnsentOutgoingMutations(e).then()}async sendAllUnsentOutgoingMutations(e){const t=this.groupOutgoingMutationsByIntegrationId();try{await vt.PromisePool.for(t).withConcurrency(t.length||1).handleError((e=>{throw e})).process((async([e,t])=>{await this.sendMutationsForIntegration([...t],e)})),this.pendingOutgoingMutations.size||this.outgoingMutationsEmpty.next(!0),await this.refreshUpdatedDocuments(),this.hasPendingSentMutations()?(await(0,o.firstValueFrom)(this.pendingOutgoingMutationsChanged.pipe((0,o.filter)((()=>!this.hasPendingSentMutations())))),null==e||e.resolve()):null==e||e.resolve()}catch(t){this.pendingOutgoingMutations.size||(this.outgoingMutationsEmpty.next(!0),await this.resyncFailedUpdates()),null==e||e.reject(t)}}async sendMutationsForIntegration(e,t){try{const{timestamp:r,idResolutionMap:n={},refreshList:i=[]}=await this.mutationSender.sendMutations(e.map((e=>e.mutation)),t);this.documentIdentityService.migrate(n),i.forEach((e=>{this.refreshDocIdToTimestamp.set(n[e]||e,r)}));for(const t of e){let e=this.removeOutgoingMutation(t);n[e]&&(e=n[e]),this.acknowledgeDocument(e,r),this.isTracked(e)||(this.setExpiration(e,!0),this.forgetDocument(e))}}catch(t){for(const t of e){const e=this.removeOutgoingMutation(t);this.forgetDocument(e),(this.hasBeenAcknowledged(e)||"insert"===t.mutation.type)&&this.failedDocsToResync.push(e)}throw t}}removeOutgoingMutation(e){const t=Ke(e.mutation.squidDocIdObj),r=(0,V.truthy)(this.pendingOutgoingMutations.get(t));return r.splice(r.indexOf(e),1),r.length||this.pendingOutgoingMutations.delete(t),this.pendingOutgoingMutationsChanged.next(),t}async resyncFailedUpdates(){const e=[...this.failedDocsToResync];this.failedDocsToResync.splice(0);for(const t of e){const{docId:e}=He(t);this.setExpiration(t,!0);try{const r=e.includes(Ge)?[]:await this.queryBuilderFactory.getForDocument(t).setForceFetchFromServer().snapshot();if((0,V.truthy)(r.length<=1,"Got more than one doc for the same id:"+t),!r.length){this.forgetDocument(t);const e=this.querySubscriptionManager.setClientRequestIdsForLocalDoc(t,void 0);this.querySubscriptionManager.notifyAllSubscriptions(e)}}catch(e){this.querySubscriptionManager.errorOutAllQueries(t,e)}}}async refreshUpdatedDocuments(){var e;const t=[];for(const[r,n]of this.refreshDocIdToTimestamp.entries()){const i=null===(e=this.docIdToServerTimestamp.get(r))||void 0===e?void 0:e.timestamp;i&&i>n||t.push(r)}this.refreshDocIdToTimestamp.clear(),await Promise.allSettled(t.map((e=>this.queryBuilderFactory.getForDocument(e).snapshot())))}groupOutgoingMutationsByIntegrationId(){const e={};for(const[,t]of[...this.pendingOutgoingMutations.entries()]){const r=t[t.length-1];if(r&&!r.sentToServer){const t=r.mutation.squidDocIdObj.integrationId;(e[t]||(e[t]=[])).push(r),r.sentToServer=!0}}return Object.entries(e)}handleOrphanDocs(){this.querySubscriptionManager.onOrphanDocuments.subscribe((e=>{for(const t of e)this.isTracked(t)||this.forgetDocument(t)}))}acknowledgeDocument(e,t,r=!1){this.docIdToServerTimestamp.set(e,{timestamp:t}),this.setExpiration(e,r)}setExpiration(e,t){const r=this.docIdToServerTimestamp.get(e);r&&(r.expireTimestamp=t?Date.now()+2e4:void 0)}forgetDocument(e){this.docIdToLocalTimestamp.delete(e),this.setExpiration(e,!0)}migrateDocIds(e){this.pendingOutgoingMutations.forEach((t=>{t.forEach((t=>{const r=Ke(t.mutation.squidDocIdObj),n=e[r];n&&(t.mutation.squidDocIdObj=He(n))}))})),Object.entries(e).forEach((([e,t])=>{ce(this.pendingOutgoingMutations,e,t),ce(this.docIdToLocalTimestamp,e,t),ce(this.docIdToServerTimestamp,e,t)}))}hasPendingSentMutations(){for(const e of this.pendingOutgoingMutations.values())for(const t of e)if(t.sentToServer)return!0;return!1}}const St=Symbol("undefined");class Et{constructor(){this.preDestructors=[],this.destructors=[],this.isDestructedSubject=new o.BehaviorSubject(!1)}get isDestructing(){return this.isDestructedSubject.value}observeIsDestructing(){return this.isDestructedSubject.asObservable().pipe((0,o.filter)(Boolean),Q((()=>{})))}onPreDestruct(e){this.preDestructors.push(e)}onDestruct(e){this.destructors.push(e)}async destruct(){this.reportDestructed();const e=this.preDestructors.concat(this.destructors);let t=e.shift();for(;t;){try{await t()}catch(e){console.error("Error while destructing Squid",e)}t=e.shift()}}reportDestructed(){this.isDestructing||this.isDestructedSubject.next(!0)}}class wt{constructor(e,t){this.socketManager=e,this.destructManager=t,this.ongoingLocks={},this.acquireLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,o.filter)((e=>"lockAcquired"===e.type))),this.releaseLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,o.filter)((e=>"lockReleased"===e.type))),this.lockWaitForConnectionThreshold=2e3,t.onPreDestruct((()=>{this.releaseAllLocks()})),this.socketManager.observeConnectionReady().subscribe((e=>{e||this.releaseAllLocks()})),this.releaseLockMessagesFromServer.subscribe((e=>{const t=this.ongoingLocks[e.payload.clientRequestId];void 0!==t&&t.release()}))}async lock(e,t=1e3){if(!await(0,o.firstValueFrom)((0,o.race)((0,o.timer)(this.lockWaitForConnectionThreshold).pipe(Q((()=>!1))),this.socketManager.observeConnectionReady().pipe((0,o.filter)(Boolean)),this.destructManager.observeIsDestructing())))return Promise.reject("CLIENT_NOT_CONNECTED");const r=U(),n={type:"acquireLock",payload:{mutex:e,timeoutMillis:t,clientRequestId:r}};this.socketManager.sendMessage(n);const i=await(0,o.firstValueFrom)((0,o.race)((0,o.timer)(t+4e3).pipe((0,o.take)(1),Q((()=>({payload:{error:"TIMEOUT_GETTING_LOCK",lockId:void 0}})))),this.acquireLockMessagesFromServer.pipe((0,o.filter)((e=>e.payload.clientRequestId===r)))));if(this.destructManager.isDestructing)throw new Error("Destructing");if(!i.payload.lockId)throw new Error(`Failed to acquire lock: ${i.payload.error}`);const s=i.payload.lockId,a=new Tt(s,r,this.ongoingLocks,this.socketManager);return this.ongoingLocks[s]=a,a}releaseAllLocks(){for(const[e,t]of Object.entries(this.ongoingLocks))t.release(),delete this.ongoingLocks[e]}}class Tt{constructor(e,t,r,n){this.lockId=e,this.clientRequestId=t,this.ongoingLocks=r,this.socketManager=n,this.released=!1,this.onReleaseSubject=new o.Subject}release(){if(this.released)return;this.released=!0,delete this.ongoingLocks[this.lockId];const e={type:"releaseLock",payload:{lockId:this.lockId,clientRequestId:this.clientRequestId}};this.socketManager.sendMessage(e),this.onReleaseSubject.next()}observeRelease(){return this.onReleaseSubject.asObservable()}isReleased(){return this.released}}class It{constructor(e,t){this.documentStore=e,this.destructManager=t,this.changeNotifier=new o.BehaviorSubject({}),this.destructManager.onDestruct((()=>{this.changeNotifier.complete()}))}migrate(e){Object.entries(e).forEach((([e,t])=>{this.documentStore.migrateDocId(e,t)})),this.changeNotifier.next(e)}observeChanges(){return this.changeNotifier.asObservable()}}class At{constructor(e){this.documentIdentityService=e,this.documents=new Map,this.documentsForCollection=new Map,this.documentIdentityService.observeChanges().subscribe(this.migrateDocIds.bind(this))}create(e,t){let r=this.documents.get(e);if(r)return r;r=new Je(e,(0,V.truthy)(this.dataManager,"dataManager not found"),t);const{integrationId:n,collectionName:i}=He(e);this.documents.set(e,r);const o=this.getCollectionKey(n,i),s=this.documentsForCollection.get(o)||[];return this.documentsForCollection.set(o,s.concat(r)),r}setDataManager(e){this.dataManager=e}getDocumentsForCollection(e,t){const r=this.getCollectionKey(e,t);return(this.documentsForCollection.get(r)||[]).filter((e=>e.hasData))}migrateDocIds(e){for(const[,t]of this.documents)t.migrateDocIds(e);Object.entries(e).forEach((([e,t])=>{const r=He(e),n=He(t);ce(this.documents,r.docId,n.docId)}))}getCollectionKey(e,t){return`${e}_${t}`}}class Mt{constructor(){this.squidDocIdToDoc=new Map}saveDocument(e,t){const r=this.squidDocIdToDoc.get(e);if(void 0===r&&!t)return;if(void 0!==r){if(t){const r=fe(t),n=this.removeInternalProperties(r);return this.squidDocIdToDoc.set(e,n),n}return void this.squidDocIdToDoc.delete(e)}const n=this.removeInternalProperties(t);return this.squidDocIdToDoc.set(e,n),t}hasData(e){return void 0!==this.squidDocIdToDoc.get(e)}getDocument(e){return(0,V.truthy)(this.getDocumentOrUndefined(e))}getDocumentOrUndefined(e){return this.squidDocIdToDoc.get(e)}compareSquidDocs(e,t,r){for(const{fieldName:n,asc:i}of r){const r=ve(oe(e,n),oe(t,n));if(0!==r)return i?r:-r}return 0}group(e,t){return Object.values(ye(e,(e=>me(t.map((t=>oe(e,t)))))))}sortAndLimitDocs(e,t){if(0===e.size)return[];const r=[...e].map((e=>this.squidDocIdToDoc.get(e))).filter(V.isNonNullable),{sortOrder:n,limitBy:i}=t,o=r.sort(((e,t)=>this.compareSquidDocs(e,t,n))),s=t.limit<0?2e3:t.limit;if(!i)return o.slice(0,s);const{limit:a,fields:u,reverseSort:c}=i,l=this.group(o,u);let h;return h=c?l.map((e=>e.slice(-a))):l.map((e=>e.slice(0,a))),h.flat().slice(0,s)}removeInternalProperties(e){if(!e)return;const t=Object.assign({},e);return delete t.__ts__,t}migrateDocId(e,t){const r=this.getDocumentOrUndefined(e);if(!r)return;ce(this.squidDocIdToDoc,e,t);const n=He(t),i=_e(n.docId);this.saveDocument(t,Object.assign(Object.assign(Object.assign({},r),i),{__docId__:n.docId}))}}var Ft="Invariant Violation",kt=Object.setPrototypeOf,Dt=void 0===kt?function(e,t){return e.__proto__=t,e}:kt,jt=function(e){function t(r){void 0===r&&(r=Ft);var n=e.call(this,"number"==typeof r?Ft+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=Ft,Dt(n,t.prototype),n}return c(t,e),t}(Error);function xt(e,t){if(!e)throw new jt(t)}var Pt,Nt=["debug","log","warn","error","silent"],Ct=Nt.indexOf("log");function Rt(e){return function(){if(Nt.indexOf(e)>=Ct)return(console[e]||console.log).apply(console,arguments)}}(Pt=xt||(xt={})).debug=Rt("debug"),Pt.log=Rt("log"),Pt.warn=Rt("warn"),Pt.error=Rt("error");var qt="3.8.9";function Lt(e){try{return e()}catch(e){}}const Bt=Lt((function(){return globalThis}))||Lt((function(){return window}))||Lt((function(){return self}))||Lt((function(){return global}))||Lt((function(){return Lt.constructor("return this")()}));var Qt=new Map;function Vt(e){var t=Qt.get(e)||1;return Qt.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function Ut(e,t){void 0===t&&(t=0);var r=Vt("stringifyForDisplay");return JSON.stringify(e,(function(e,t){return void 0===t?r:t}),t).split(JSON.stringify(r)).join("<undefined>")}function zt(e){return function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if("number"==typeof t){var i=t;(t=Ht(i))||(t=Kt(i,r),r=[])}e.apply(void 0,[t].concat(r))}}var Yt=Object.assign((function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];e||xt(e,Ht(t,r)||Kt(t,r))}),{debug:zt(xt.debug),log:zt(xt.log),warn:zt(xt.warn),error:zt(xt.error)});function Wt(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new jt(Ht(e,t)||Kt(e,t))}var $t=Symbol.for("ApolloErrorMessageHandler_"+qt);function Gt(e){return"string"==typeof e?e:Ut(e,2).slice(0,1e3)}function Ht(e,t){if(void 0===t&&(t=[]),e)return Bt[$t]&&Bt[$t](e,t.map(Gt))}function Kt(e,t){if(void 0===t&&(t=[]),e)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:qt,message:e,args:t.map(Gt)})))}function Jt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Xt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Zt(e,t,r){return t&&Xt(e.prototype,t),r&&Xt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}globalThis.__DEV__;var er=function(){return"function"==typeof Symbol},tr=function(e){return er()&&Boolean(Symbol[e])},rr=function(e){return tr(e)?Symbol[e]:"@@"+e};er()&&!tr("observable")&&(Symbol.observable=Symbol("observable"));var nr=rr("iterator"),ir=rr("observable"),or=rr("species");function sr(e,t){var r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function ar(e){var t=e.constructor;return void 0!==t&&null===(t=t[or])&&(t=void 0),void 0!==t?t:br}function ur(e){return e instanceof br}function cr(e){cr.log?cr.log(e):setTimeout((function(){throw e}))}function lr(e){Promise.resolve().then((function(){try{e()}catch(e){cr(e)}}))}function hr(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var r=sr(t,"unsubscribe");r&&r.call(t)}}catch(e){cr(e)}}function dr(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function fr(e,t,r){e._state="running";var n=e._observer;try{var i=sr(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(dr(e),!i)throw r;i.call(n,r);break;case"complete":dr(e),i&&i.call(n)}}catch(e){cr(e)}"closed"===e._state?hr(e):"running"===e._state&&(e._state="ready")}function pr(e,t,r){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void lr((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(fr(e,t[r].type,t[r].value),"closed"!==e._state);++r);}}(e)}))):void fr(e,t,r);e._queue.push({type:t,value:r})}}var vr=function(){function e(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";var r=new yr(this);try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}return e.prototype.unsubscribe=function(){"closed"!==this._state&&(dr(this),hr(this))},Zt(e,[{key:"closed",get:function(){return"closed"===this._state}}]),e}(),yr=function(){function e(e){this._subscription=e}var t=e.prototype;return t.next=function(e){pr(this._subscription,"next",e)},t.error=function(e){pr(this._subscription,"error",e)},t.complete=function(){pr(this._subscription,"complete")},Zt(e,[{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),br=function(){function e(t){if(!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}var t=e.prototype;return t.subscribe=function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new vr(e,this._subscriber)},t.forEach=function(e){var t=this;return new Promise((function(r,n){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,o)}catch(e){n(e),i.unsubscribe()}},error:n,complete:r});else n(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),r()}}))},t.map=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(ar(this))((function(r){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})}))},t.filter=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(ar(this))((function(r){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})}))},t.reduce=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=ar(this),n=arguments.length>1,i=!1,o=arguments[1];return new r((function(r){return t.subscribe({next:function(t){var s=!i;if(i=!0,!s||n)try{o=e(o,t)}catch(e){return r.error(e)}else o=t},error:function(e){r.error(e)},complete:function(){if(!i&&!n)return r.error(new TypeError("Cannot reduce an empty sequence"));r.next(o),r.complete()}})}))},t.concat=function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=ar(this);return new i((function(t){var n,o=0;return function e(s){n=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===r.length?(n=void 0,t.complete()):e(i.from(r[o++]))}})}(e),function(){n&&(n.unsubscribe(),n=void 0)}}))},t.flatMap=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=ar(this);return new r((function(n){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return n.error(e)}var o=r.from(t).subscribe({next:function(e){n.next(e)},error:function(e){n.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error:function(e){n.error(e)},complete:function(){s()}});function s(){o.closed&&0===i.length&&n.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))},t[ir]=function(){return this},e.from=function(t){var r="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var n=sr(t,ir);if(n){var i=n.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return ur(i)&&i.constructor===r?i:new r((function(e){return i.subscribe(e)}))}if(tr("iterator")&&(n=sr(t,nr)))return new r((function(e){lr((function(){if(!e.closed){for(var r,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Jt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jt(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(n.call(t));!(r=i()).done;){var o=r.value;if(e.next(o),e.closed)return}e.complete()}}))}));if(Array.isArray(t))return new r((function(e){lr((function(){if(!e.closed){for(var r=0;r<t.length;++r)if(e.next(t[r]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")},e.of=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return new("function"==typeof this?this:e)((function(e){lr((function(){if(!e.closed){for(var t=0;t<r.length;++t)if(e.next(r[t]),e.closed)return;e.complete()}}))}))},Zt(e,null,[{key:or,get:function(){return this}}]),e}();function mr(e){return null!==e&&"object"==typeof e}function gr(e,t){var r=t,n=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw Wt(70,e.operation,e.name?" named '".concat(e.name.value,"'"):"");"FragmentDefinition"===e.kind&&n.push(e)})),void 0===r&&(Yt(1===n.length,71,n.length),r=n[0].name.value),l(l({},e),{definitions:y([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],e.definitions,!0)})}function _r(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function Or(e,t){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var r=e.name.value;if("function"==typeof t)return t(r);var n=t&&t[r];return Yt(n,72,r),n||null;default:return null}}function Sr(e){return{__ref:String(e)}}function Er(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function wr(e,t,r,n){if(function(e){return"IntValue"===e.kind}(r)||function(e){return"FloatValue"===e.kind}(r))e[t.value]=Number(r.value);else if(function(e){return"BooleanValue"===e.kind}(r)||function(e){return"StringValue"===e.kind}(r))e[t.value]=r.value;else if(function(e){return"ObjectValue"===e.kind}(r)){var i={};r.fields.map((function(e){return wr(i,e.name,e.value,n)})),e[t.value]=i}else if(function(e){return"Variable"===e.kind}(r)){var o=(n||{})[r.name.value];e[t.value]=o}else if(function(e){return"ListValue"===e.kind}(r))e[t.value]=r.values.map((function(e){var r={};return wr(r,t,e,n),r[t.value]}));else if(function(e){return"EnumValue"===e.kind}(r))e[t.value]=r.value;else{if(!function(e){return"NullValue"===e.kind}(r))throw Wt(81,t.value,r.kind);e[t.value]=null}}er()&&Object.defineProperty(br,Symbol("extensions"),{value:{symbol:ir,hostReportError:cr},configurable:!0});var Tr=["connection","include","skip","client","rest","export","nonreactive"],Ir=Object.assign((function(e,t,r){if(t&&r&&r.connection&&r.connection.key){if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach((function(e){i[e]=t[e]})),"".concat(r.connection.key,"(").concat(Ar(i),")")}return r.connection.key}var o=e;if(t){var s=Ar(t);o+="(".concat(s,")")}return r&&Object.keys(r).forEach((function(e){-1===Tr.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@".concat(e,"(").concat(Ar(r[e]),")"):o+="@".concat(e))})),o}),{setStringify:function(e){var t=Ar;return Ar=e,t}}),Ar=function(e){return JSON.stringify(e,Mr)};function Mr(e,t){return mr(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function Fr(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return wr(r,n,i,t)})),r}return null}function kr(e){return e.alias?e.alias.value:e.name.value}function Dr(e,t,r){for(var n,i=0,o=t.selections;i<o.length;i++)if(jr(u=o[i])){if("__typename"===u.name.value)return e[kr(u)]}else n?n.push(u):n=[u];if("string"==typeof e.__typename)return e.__typename;if(n)for(var s=0,a=n;s<a.length;s++){var u,c=Dr(e,Or(u=a[s],r).selectionSet,r);if("string"==typeof c)return c}}function jr(e){return"Field"===e.kind}function xr(e){Yt(e&&"Document"===e.kind,73);var t=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw Wt(74,e.kind);return e}));return Yt(t.length<=1,75,t.length),e}function Pr(e){return xr(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function Nr(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&!!e.name})).map((function(e){return e.name.value}))[0]||null}function Cr(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function Rr(e){var t=Pr(e);return Yt(t&&"query"===t.operation,76),t}function qr(e){var t;xr(e);for(var r=0,n=e.definitions;r<n.length;r++){var i=n[r];if("OperationDefinition"===i.kind){var o=i.operation;if("query"===o||"mutation"===o||"subscription"===o)return i}"FragmentDefinition"!==i.kind||t||(t=i)}if(t)return t;throw Wt(80)}function Lr(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&wr(t,e.variable.name,e.defaultValue)})),t}function Br(e,t){return t?t(e):br.of()}function Qr(e){return"function"==typeof e?new Ur(e):e}function Vr(e){return e.request.length<=1}var Ur=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return br.of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(Qr).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,r,n){var i=Qr(r),o=Qr(n||new e(Br));return Vr(i)&&Vr(o)?new e((function(e){return t(e)?i.request(e)||br.of():o.request(e)||br.of()})):new e((function(e,r){return t(e)?i.request(e,r)||br.of():o.request(e,r)||br.of()}))},e.execute=function(e,t){return e.request(function(e,t){var r=l({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){r=l(l({},r),"function"==typeof e?e(r):e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return l({},r)}}),t}(t.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?Nr(t.query)||void 0:""),t}(function(e){for(var t=["query","operationName","variables","extensions","context"],r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];if(t.indexOf(i)<0)throw Wt(43,i)}return e}(t))))||br.of()},e.concat=function(t,r){var n=Qr(t);if(Vr(n))return!1!==globalThis.__DEV__&&Yt.warn(35,n),n;var i=Qr(r);return Vr(i)?new e((function(e){return n.request(e,(function(e){return i.request(e)||br.of()}))||br.of()})):new e((function(e,t){return n.request(e,(function(e){return i.request(e,t)||br.of()}))||br.of()}))},e.prototype.split=function(t,r,n){return this.concat(e.split(t,r,n||new e(Br)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw Wt(36)},e.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}(),zr=Ur.execute;function Yr(e,t){if(!Boolean(e))throw new Error(t)}const Wr=10,$r=2;function Gr(e){return Hr(e,[])}function Hr(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const r=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:Hr(t,r)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>$r)return"[Array]";const r=Math.min(Wr,e.length),n=e.length-r,i=[];for(let n=0;n<r;++n)i.push(Hr(e[n],t));return 1===n?i.push("... 1 more item"):n>1&&i.push(`... ${n} more items`),"["+i.join(", ")+"]"}(e,r);return function(e,t){const r=Object.entries(e);if(0===r.length)return"{}";if(t.length>$r)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const n=r.map((([e,r])=>e+": "+Hr(r,t)));return"{ "+n.join(", ")+" }"}(e,r)}(e,t);default:return String(e)}}class Kr{constructor(e,t,r){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class Jr{constructor(e,t,r,n,i,o){this.kind=e,this.start=t,this.end=r,this.line=n,this.column=i,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const Xr={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Zr=new Set(Object.keys(Xr));function en(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&Zr.has(t)}var tn,rn,nn;!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(tn||(tn={})),(nn=rn||(rn={})).NAME="Name",nn.DOCUMENT="Document",nn.OPERATION_DEFINITION="OperationDefinition",nn.VARIABLE_DEFINITION="VariableDefinition",nn.SELECTION_SET="SelectionSet",nn.FIELD="Field",nn.ARGUMENT="Argument",nn.FRAGMENT_SPREAD="FragmentSpread",nn.INLINE_FRAGMENT="InlineFragment",nn.FRAGMENT_DEFINITION="FragmentDefinition",nn.VARIABLE="Variable",nn.INT="IntValue",nn.FLOAT="FloatValue",nn.STRING="StringValue",nn.BOOLEAN="BooleanValue",nn.NULL="NullValue",nn.ENUM="EnumValue",nn.LIST="ListValue",nn.OBJECT="ObjectValue",nn.OBJECT_FIELD="ObjectField",nn.DIRECTIVE="Directive",nn.NAMED_TYPE="NamedType",nn.LIST_TYPE="ListType",nn.NON_NULL_TYPE="NonNullType",nn.SCHEMA_DEFINITION="SchemaDefinition",nn.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",nn.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",nn.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",nn.FIELD_DEFINITION="FieldDefinition",nn.INPUT_VALUE_DEFINITION="InputValueDefinition",nn.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",nn.UNION_TYPE_DEFINITION="UnionTypeDefinition",nn.ENUM_TYPE_DEFINITION="EnumTypeDefinition",nn.ENUM_VALUE_DEFINITION="EnumValueDefinition",nn.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",nn.DIRECTIVE_DEFINITION="DirectiveDefinition",nn.SCHEMA_EXTENSION="SchemaExtension",nn.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",nn.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",nn.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",nn.UNION_TYPE_EXTENSION="UnionTypeExtension",nn.ENUM_TYPE_EXTENSION="EnumTypeExtension",nn.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension";const on=Object.freeze({});function sn(e,t,r=Xr){const n=new Map;for(const e of Object.values(rn))n.set(e,an(t,e));let i,o,s,a=Array.isArray(e),u=[e],c=-1,l=[],h=e;const d=[],f=[];do{c++;const e=c===u.length,b=e&&0!==l.length;if(e){if(o=0===f.length?void 0:d[d.length-1],h=s,s=f.pop(),b)if(a){h=h.slice();let e=0;for(const[t,r]of l){const n=t-e;null===r?(h.splice(n,1),e++):h[n]=r}}else{h=Object.defineProperties({},Object.getOwnPropertyDescriptors(h));for(const[e,t]of l)h[e]=t}c=i.index,u=i.keys,l=i.edits,a=i.inArray,i=i.prev}else if(s){if(o=a?c:u[c],h=s[o],null==h)continue;d.push(o)}let m;if(!Array.isArray(h)){var p,v;en(h)||Yr(!1,`Invalid AST Node: ${Gr(h)}.`);const r=e?null===(p=n.get(h.kind))||void 0===p?void 0:p.leave:null===(v=n.get(h.kind))||void 0===v?void 0:v.enter;if(m=null==r?void 0:r.call(t,h,o,s,d,f),m===on)break;if(!1===m){if(!e){d.pop();continue}}else if(void 0!==m&&(l.push([o,m]),!e)){if(!en(m)){d.pop();continue}h=m}}var y;void 0===m&&b&&l.push([o,h]),e?d.pop():(i={inArray:a,index:c,keys:u,edits:l,prev:i},a=Array.isArray(h),u=a?h:null!==(y=r[h.kind])&&void 0!==y?y:[],c=-1,l=[],s&&f.push(s),s=h)}while(void 0!==i);return 0!==l.length?l[l.length-1][1]:e}function an(e,t){const r=e[t];return"object"==typeof r?r:"function"==typeof r?{enter:r,leave:void 0}:{enter:e.enter,leave:e.leave}}function un(e,t){var r=e.directives;return!r||!r.length||function(e){var t=[];return e&&e.length&&e.forEach((function(e){if(function(e){var t=e.name.value;return"skip"===t||"include"===t}(e)){var r=e.arguments,n=e.name.value;Yt(r&&1===r.length,67,n);var i=r[0];Yt(i.name&&"if"===i.name.value,68,n);var o=i.value;Yt(o&&("Variable"===o.kind||"BooleanValue"===o.kind),69,n),t.push({directive:e,ifArgument:i})}})),t}(r).every((function(e){var r=e.directive,n=e.ifArgument,i=!1;return"Variable"===n.value.kind?(i=t&&t[n.value.name.value],Yt(void 0!==i,66,r.name.value)):i=n.value.value,"skip"===r.name.value?!i:i}))}function cn(e,t,r){var n=new Set(e),i=n.size;return sn(t,{Directive:function(e){if(n.delete(e.name.value)&&(!r||!n.size))return on}}),r?!n.size:n.size<i}function ln(e){return e&&cn(["client","export"],e,!0)}var hn=function(e,t){var r;try{r=JSON.stringify(e)}catch(e){var n=Wt(39,t,e.message);throw n.parseError=e,n}return r},dn="function"==typeof WeakMap&&"ReactNative"!==Lt((function(){return navigator.product})),fn="function"==typeof WeakSet,pn="function"==typeof Symbol&&"function"==typeof Symbol.for,vn=pn&&Symbol.asyncIterator;function yn(e){var t={next:function(){return e.read()}};return vn&&(t[Symbol.asyncIterator]=function(){return this}),t}function bn(e){var t,r,n,i,o=e;if(e.body&&(o=e.body),i=o,vn&&i[Symbol.asyncIterator])return function(e){var t,r=e[Symbol.asyncIterator]();return(t={next:function(){return r.next()}})[Symbol.asyncIterator]=function(){return this},t}(o);if(function(e){return!!e.getReader}(o))return yn(o.getReader());if(function(e){return!!e.stream}(o))return yn(o.stream().getReader());if(function(e){return!!e.arrayBuffer}(o))return t=o.arrayBuffer(),r=!1,n={next:function(){return r?Promise.resolve({value:void 0,done:!0}):(r=!0,new Promise((function(e,r){t.then((function(t){e({value:t,done:!1})})).catch(r)})))}},vn&&(n[Symbol.asyncIterator]=function(){return this}),n;if(function(e){return!!e.pipe}(o))return function(e){var t=null,r=null,n=!1,i=[],o=[];function s(e){if(!r){if(o.length){var t=o.shift();if(Array.isArray(t)&&t[0])return t[0]({value:e,done:!1})}i.push(e)}}function a(e){r=e,o.slice().forEach((function(t){t[1](e)})),!t||t()}function u(){n=!0,o.slice().forEach((function(e){e[0]({value:void 0,done:!0})})),!t||t()}t=function(){t=null,e.removeListener("data",s),e.removeListener("error",a),e.removeListener("end",u),e.removeListener("finish",u),e.removeListener("close",u)},e.on("data",s),e.on("error",a),e.on("end",u),e.on("finish",u),e.on("close",u);var c={next:function(){return new Promise((function(e,t){return r?t(r):i.length?e({value:i.shift(),done:!1}):n?e({value:void 0,done:!0}):void o.push([e,t])}))}};return vn&&(c[Symbol.asyncIterator]=function(){return this}),c}(o);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}Lt((function(){return window.document.createElement})),Lt((function(){return navigator.userAgent.indexOf("jsdom")>=0}));var mn=function(e,t,r){var n=new Error(r);throw n.name="ServerError",n.response=e,n.statusCode=e.status,n.result=t,n},gn=Symbol(),_n=function(e){function t(r){var n,i,o=r.graphQLErrors,s=r.protocolErrors,a=r.clientErrors,u=r.networkError,c=r.errorMessage,l=r.extraInfo,h=e.call(this,c)||this;return h.name="ApolloError",h.graphQLErrors=o||[],h.protocolErrors=s||[],h.clientErrors=a||[],h.networkError=u||null,h.message=c||(i=y(y(y([],(n=h).graphQLErrors,!0),n.clientErrors,!0),n.protocolErrors,!0),n.networkError&&i.push(n.networkError),i.map((function(e){return mr(e)&&e.message||"Error message not found."})).join("\n")),h.extraInfo=l,h.__proto__=t.prototype,h}return c(t,e),t}(Error),On=Array.isArray;function Sn(e){return Array.isArray(e)&&e.length>0}var En=Object.prototype.hasOwnProperty;function wn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Tn(e)}function Tn(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new An,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var In=function(e,t,r){return this.merge(e[r],t[r])},An=function(){function e(e){void 0===e&&(e=In),this.reconciler=e,this.isObject=mr,this.pastCopies=new Set}return e.prototype.merge=function(e,t){for(var r=this,n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return mr(t)&&mr(e)?(Object.keys(t).forEach((function(i){if(En.call(e,i)){var o=e[i];if(t[i]!==o){var s=r.reconciler.apply(r,y([e,t,i],n,!1));s!==o&&((e=r.shallowCopyForMerge(e))[i]=s)}}else(e=r.shallowCopyForMerge(e))[i]=t[i]})),e):t},e.prototype.shallowCopyForMerge=function(e){return mr(e)&&(this.pastCopies.has(e)||(e=Array.isArray(e)?e.slice(0):l({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},e}();function Mn(e){return"incremental"in e}function Fn(e){return mr(e)&&"payload"in e}function kn(e,t){var r=e,n=new An;return Mn(t)&&Sn(t.incremental)&&t.incremental.forEach((function(e){for(var t=e.data,i=e.path,o=i.length-1;o>=0;--o){var s=i[o],a=isNaN(+s)?{}:[];a[s]=t,t=a}r=n.merge(r,t)})),r}var Dn=Object.prototype.hasOwnProperty;function jn(e){var t={};return e.split("\n").forEach((function(e){var r=e.indexOf(":");if(r>-1){var n=e.slice(0,r).trim().toLowerCase(),i=e.slice(r+1).trim();t[n]=i}})),t}function xn(e,t){e.status>=300&&mn(e,function(){try{return JSON.parse(t)}catch(e){return t}}(),"Response not successful: Received status code ".concat(e.status));try{return JSON.parse(t)}catch(n){var r=n;throw r.name="ServerParseError",r.response=e,r.statusCode=e.status,r.bodyText=t,r}}function Pn(e){return 9===e||32===e}function Nn(e){return e>=48&&e<=57}function Cn(e){return e>=97&&e<=122||e>=65&&e<=90}function Rn(e){return Cn(e)||95===e}function qn(e){var t;let r=Number.MAX_SAFE_INTEGER,n=null,i=-1;for(let t=0;t<e.length;++t){var o;const s=e[t],a=Ln(s);a!==s.length&&(n=null!==(o=n)&&void 0!==o?o:t,i=t,0!==t&&a<r&&(r=a))}return e.map(((e,t)=>0===t?e:e.slice(r))).slice(null!==(t=n)&&void 0!==t?t:0,i+1)}function Ln(e){let t=0;for(;t<e.length&&Pn(e.charCodeAt(t));)++t;return t}const Bn=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Qn(e){return Vn[e.charCodeAt(0)]}const Vn=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],Un={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>zn(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Wn("(",zn(e.variableDefinitions,", "),")"),r=zn([e.operation,zn([e.name,t]),zn(e.directives," ")]," ");return("query"===r?"":r+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:r,directives:n})=>e+": "+t+Wn(" = ",r)+Wn(" ",zn(n," "))},SelectionSet:{leave:({selections:e})=>Yn(e)},Field:{leave({alias:e,name:t,arguments:r,directives:n,selectionSet:i}){const o=Wn("",e,": ")+t;let s=o+Wn("(",zn(r,", "),")");return s.length>80&&(s=o+Wn("(\n",$n(zn(r,"\n")),"\n)")),zn([s,zn(n," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Wn(" ",zn(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:r})=>zn(["...",Wn("on ",e),zn(t," "),r]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:r,directives:n,selectionSet:i})=>`fragment ${e}${Wn("(",zn(r,", "),")")} on ${t} ${Wn("",zn(n," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const r=e.replace(/"""/g,'\\"""'),n=r.split(/\r\n|[\n\r]/g),i=1===n.length,o=n.length>1&&n.slice(1).every((e=>0===e.length||Pn(e.charCodeAt(0)))),s=r.endsWith('\\"""'),a=e.endsWith('"')&&!s,u=e.endsWith("\\"),c=a||u,l=!i||e.length>70||c||o||s;let h="";const d=i&&Pn(e.charCodeAt(0));return(l&&!d||o)&&(h+="\n"),h+=r,(l||c)&&(h+="\n"),'"""'+h+'"""'}(e):`"${e.replace(Bn,Qn)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+zn(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+zn(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Wn("(",zn(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:r})=>Wn("",e,"\n")+zn(["schema",zn(t," "),Yn(r)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:r})=>Wn("",e,"\n")+zn(["scalar",t,zn(r," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Wn("",e,"\n")+zn(["type",t,Wn("implements ",zn(r," & ")),zn(n," "),Yn(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:r,type:n,directives:i})=>Wn("",e,"\n")+t+(Gn(r)?Wn("(\n",$n(zn(r,"\n")),"\n)"):Wn("(",zn(r,", "),")"))+": "+n+Wn(" ",zn(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:r,defaultValue:n,directives:i})=>Wn("",e,"\n")+zn([t+": "+r,Wn("= ",n),zn(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Wn("",e,"\n")+zn(["interface",t,Wn("implements ",zn(r," & ")),zn(n," "),Yn(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:r,types:n})=>Wn("",e,"\n")+zn(["union",t,zn(r," "),Wn("= ",zn(n," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:r,values:n})=>Wn("",e,"\n")+zn(["enum",t,zn(r," "),Yn(n)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:r})=>Wn("",e,"\n")+zn([t,zn(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:r,fields:n})=>Wn("",e,"\n")+zn(["input",t,zn(r," "),Yn(n)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:r,repeatable:n,locations:i})=>Wn("",e,"\n")+"directive @"+t+(Gn(r)?Wn("(\n",$n(zn(r,"\n")),"\n)"):Wn("(",zn(r,", "),")"))+(n?" repeatable":"")+" on "+zn(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>zn(["extend schema",zn(e," "),Yn(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>zn(["extend scalar",e,zn(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>zn(["extend type",e,Wn("implements ",zn(t," & ")),zn(r," "),Yn(n)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>zn(["extend interface",e,Wn("implements ",zn(t," & ")),zn(r," "),Yn(n)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:r})=>zn(["extend union",e,zn(t," "),Wn("= ",zn(r," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:r})=>zn(["extend enum",e,zn(t," "),Yn(r)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:r})=>zn(["extend input",e,zn(t," "),Yn(r)]," ")}};function zn(e,t=""){var r;return null!==(r=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==r?r:""}function Yn(e){return Wn("{\n",$n(zn(e,"\n")),"\n}")}function Wn(e,t,r=""){return null!=t&&""!==t?e+t+r:""}function $n(e){return Wn(" ",e.replace(/\n/g,"\n "))}function Gn(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}var Hn=dn?new WeakMap:void 0,Kn=function(e){var t;return(t=null==Hn?void 0:Hn.get(e))||(t=function(e){return sn(e,Un)}(e),null==Hn||Hn.set(e,t)),t},Jn={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},Xn=function(e,t){return t(e)};function Zn(e){return new br((function(t){t.error(e)}))}var ei={kind:rn.FIELD,name:{kind:rn.NAME,value:"__typename"}};function ti(e,t){return!e||e.selectionSet.selections.every((function(e){return e.kind===rn.FRAGMENT_SPREAD&&ti(t[e.name.value],t)}))}function ri(e){return ti(Pr(e)||function(e){Yt("Document"===e.kind,77),Yt(e.definitions.length<=1,78);var t=e.definitions[0];return Yt("FragmentDefinition"===t.kind,79),t}(e),_r(Cr(e)))?null:e}function ni(e){var t=new Map;return function(r){void 0===r&&(r=e);var n=t.get(r);return n||t.set(r,n={variables:new Set,fragmentSpreads:new Set}),n}}function ii(e,t){xr(t);for(var r=ni(""),n=ni(""),i=function(e){for(var t=0,i=void 0;t<e.length&&(i=e[t]);++t)if(!On(i)){if(i.kind===rn.OPERATION_DEFINITION)return r(i.name&&i.name.value);if(i.kind===rn.FRAGMENT_DEFINITION)return n(i.name.value)}return!1!==globalThis.__DEV__&&Yt.error(82),null},o=0,s=t.definitions.length-1;s>=0;--s)t.definitions[s].kind===rn.OPERATION_DEFINITION&&++o;var a,u,c,h=(a=e,u=new Map,c=new Map,a.forEach((function(e){e&&(e.name?u.set(e.name,e):e.test&&c.set(e.test,e))})),function(e){var t=u.get(e.name.value);return!t&&c.size&&c.forEach((function(r,n){n(e)&&(t=r)})),t}),d=function(e){return Sn(e)&&e.map(h).some((function(e){return e&&e.remove}))},f=new Map,p=!1,v={enter:function(e){if(d(e.directives))return p=!0,null}},y=sn(t,{Field:v,InlineFragment:v,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(e,t,r,n,o){var s=i(o);s&&s.variables.add(e.name.value)}},FragmentSpread:{enter:function(e,t,r,n,o){if(d(e.directives))return p=!0,null;var s=i(o);s&&s.fragmentSpreads.add(e.name.value)}},FragmentDefinition:{enter:function(e,t,r,n){f.set(JSON.stringify(n),e)},leave:function(e,t,r,i){return e===f.get(JSON.stringify(i))?e:o>0&&e.selectionSet.selections.every((function(e){return e.kind===rn.FIELD&&"__typename"===e.name.value}))?(n(e.name.value).removed=!0,p=!0,null):void 0}},Directive:{leave:function(e){if(h(e))return p=!0,null}}});if(!p)return t;var b=function(e){return e.transitiveVars||(e.transitiveVars=new Set(e.variables),e.removed||e.fragmentSpreads.forEach((function(t){b(n(t)).transitiveVars.forEach((function(t){e.transitiveVars.add(t)}))}))),e},m=new Set;y.definitions.forEach((function(e){e.kind===rn.OPERATION_DEFINITION?b(r(e.name&&e.name.value)).fragmentSpreads.forEach((function(e){m.add(e)})):e.kind!==rn.FRAGMENT_DEFINITION||0!==o||n(e.name.value).removed||m.add(e.name.value)})),m.forEach((function(e){b(n(e)).fragmentSpreads.forEach((function(e){m.add(e)}))}));var g={enter:function(e){if(t=e.name.value,!m.has(t)||n(t).removed)return null;var t}};return ri(sn(y,{FragmentSpread:g,FragmentDefinition:g,OperationDefinition:{leave:function(e){if(e.variableDefinitions){var t=b(r(e.name&&e.name.value)).transitiveVars;if(t.size<e.variableDefinitions.length)return l(l({},e),{variableDefinitions:e.variableDefinitions.filter((function(e){return t.has(e.variable.name.value)}))})}}}}))}var oi=Object.assign((function(e){return sn(e,{SelectionSet:{enter:function(e,t,r){if(!r||r.kind!==rn.OPERATION_DEFINITION){var n=e.selections;if(n&&!n.some((function(e){return jr(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var i=r;if(!(jr(i)&&i.directives&&i.directives.some((function(e){return"export"===e.name.value}))))return l(l({},e),{selections:y(y([],n,!0),[ei],!1)})}}}}})}),{added:function(e){return e===ei}});function si(e){return"query"===qr(e).operation?e:sn(e,{OperationDefinition:{enter:function(e){return l(l({},e),{operation:"query"})}}})}function ai(e){return xr(e),ii([{test:function(e){return"client"===e.name.value},remove:!0}],e)}var ui=Lt((function(){return fetch})),ci=function(e){void 0===e&&(e={});var t=e.uri,r=void 0===t?"/graphql":t,n=e.fetch,i=e.print,o=void 0===i?Xn:i,s=e.includeExtensions,a=e.preserveHeaderCase,u=e.useGETForQueries,c=e.includeUnusedVariables,p=void 0!==c&&c,v=h(e,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);!1!==globalThis.__DEV__&&function(e){if(!e&&"undefined"==typeof fetch)throw Wt(37)}(n||ui);var y={http:{includeExtensions:s,preserveHeaderCase:a},options:v.fetchOptions,credentials:v.credentials,headers:v.headers};return new Ur((function(e){var t=function(e,t){return e.getContext().uri||("function"==typeof t?t(e):t||"/graphql")}(e,r),i=e.getContext(),s={};if(i.clientAwareness){var a=i.clientAwareness,c=a.name,h=a.version;c&&(s["apollographql-client-name"]=c),h&&(s["apollographql-client-version"]=h)}var v=l(l({},s),i.headers),b={http:i.http,options:i.fetchOptions,credentials:i.credentials,headers:v};if(cn(["client"],e.query)){var m=ai(e.query);if(!m)return Zn(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));e.query=m}var g,_,O,S,E,w=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},o={};r.forEach((function(e){i=l(l(l({},i),e.options),{headers:l(l({},i.headers),e.headers)}),e.credentials&&(i.credentials=e.credentials),o=l(l({},o),e.http)})),i.headers&&(i.headers=function(e,t){if(!t){var r=Object.create(null);return Object.keys(Object(e)).forEach((function(t){r[t.toLowerCase()]=e[t]})),r}var n=Object.create(null);Object.keys(Object(e)).forEach((function(t){n[t.toLowerCase()]={originalName:t,value:e[t]}}));var i=Object.create(null);return Object.keys(n).forEach((function(e){i[n[e].originalName]=n[e].value})),i}(i.headers,o.preserveHeaderCase));var s=e.operationName,a=e.extensions,u=e.variables,c=e.query,h={operationName:s,variables:u};return o.includeExtensions&&(h.extensions=a),o.includeQuery&&(h.query=t(c,Kn)),{options:i,body:h}}(e,o,Jn,y,b),T=w.options,I=w.body;I.variables&&!p&&(I.variables=(g=I.variables,_=e.query,O=l({},g),S=new Set(Object.keys(g)),sn(_,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&S.delete(e.name.value)}}),S.forEach((function(e){delete O[e]})),O)),T.signal||"undefined"==typeof AbortController||(E=new AbortController,T.signal=E.signal);var A,M="OperationDefinition"===(A=qr(e.query)).kind&&"subscription"===A.operation,F=cn(["defer"],e.query);if(u&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(T.method="GET"),F||M){T.headers=T.headers||{};var k="multipart/mixed;";M&&F&&!1!==globalThis.__DEV__&&Yt.warn(38),M?k+="boundary=graphql;subscriptionSpec=1.0,application/json":F&&(k+="deferSpec=20220824,application/json"),T.headers.accept=k}if("GET"===T.method){var D=function(e,t){var r=[],n=function(e,t){r.push("".concat(e,"=").concat(encodeURIComponent(t)))};if("query"in t&&n("query",t.query),t.operationName&&n("operationName",t.operationName),t.variables){var i=void 0;try{i=hn(t.variables,"Variables map")}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=hn(t.extensions,"Extensions map")}catch(e){return{parseError:e}}n("extensions",o)}var s="",a=e,u=e.indexOf("#");-1!==u&&(s=e.substr(u),a=e.substr(0,u));var c=-1===a.indexOf("?")?"?":"&";return{newURI:a+c+r.join("&")+s}}(t,I),j=D.newURI,x=D.parseError;if(x)return Zn(x);t=j}else try{T.body=hn(I,"Payload")}catch(x){return Zn(x)}return new br((function(r){var i=n||Lt((function(){return fetch}))||ui,o=r.next.bind(r);return i(t,T).then((function(t){var r;e.setContext({response:t});var n,i=null===(r=t.headers)||void 0===r?void 0:r.get("content-type");return null!==i&&/^multipart\/mixed/i.test(i)?function(e,t){var r;return d(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,h,d,p,v,y,b,m,g,_,O,S,E,w,T,I,A;return f(this,(function(f){switch(f.label){case 0:if(void 0===TextDecoder)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");n=new TextDecoder("utf-8"),i=null===(r=e.headers)||void 0===r?void 0:r.get("content-type"),o="boundary=",s=(null==i?void 0:i.includes(o))?null==i?void 0:i.substring((null==i?void 0:i.indexOf(o))+9).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",a="\r\n--".concat(s),u="",c=bn(e),h=!0,f.label=1;case 1:return h?[4,c.next()]:[3,3];case 2:for(d=f.sent(),p=d.value,v=d.done,y="string"==typeof p?p:n.decode(p),b=u.length-a.length+1,h=!v,m=(u+=y).indexOf(a,b);m>-1;){if(g=void 0,I=[u.slice(0,m),u.slice(m+a.length)],u=I[1],_=(g=I[0]).indexOf("\r\n\r\n"),O=jn(g.slice(0,_)),(S=O["content-type"])&&-1===S.toLowerCase().indexOf("application/json"))throw new Error("Unsupported patch content type: application/json is required.");if(E=g.slice(_))if(w=xn(e,E),Object.keys(w).length>1||"data"in w||"incremental"in w||"errors"in w||"payload"in w)Fn(w)?(T={},"payload"in w&&(T=l({},w.payload)),"errors"in w&&(T=l(l({},T),{extensions:l(l({},"extensions"in T?T.extensions:null),(A={},A[gn]=w.errors,A))})),t(T)):t(w);else if(1===Object.keys(w).length&&"hasNext"in w&&!w.hasNext)return[2];m=u.indexOf(a)}return[3,1];case 3:return[2]}}))}))}(t,o):(n=e,function(e){return e.text().then((function(t){return xn(e,t)})).then((function(t){return Array.isArray(t)||Dn.call(t,"data")||Dn.call(t,"errors")||mn(e,t,"Server response was missing for query '".concat(Array.isArray(n)?n.map((function(e){return e.operationName})):n.operationName,"'.")),t}))})(t).then(o)})).then((function(){E=void 0,r.complete()})).catch((function(e){E=void 0,function(e,t){e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e)}(e,r)})),function(){E&&E.abort()}}))}))},li=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,ci(t).request)||this;return r.options=t,r}return c(t,e),t}(Ur);const{toString:hi,hasOwnProperty:di}=Object.prototype,fi=Function.prototype.toString,pi=new Map;function vi(e,t){try{return bi(e,t)}finally{pi.clear()}}const yi=vi;function bi(e,t){if(e===t)return!0;const r=hi.call(e);if(r!==hi.call(t))return!1;switch(r){case"[object Array]":if(e.length!==t.length)return!1;case"[object Object]":{if(Oi(e,t))return!0;const r=mi(e),n=mi(t),i=r.length;if(i!==n.length)return!1;for(let e=0;e<i;++e)if(!di.call(t,r[e]))return!1;for(let n=0;n<i;++n){const i=r[n];if(!bi(e[i],t[i]))return!1}return!0}case"[object Error]":return e.name===t.name&&e.message===t.message;case"[object Number]":if(e!=e)return t!=t;case"[object Boolean]":case"[object Date]":return+e==+t;case"[object RegExp]":case"[object String]":return e==`${t}`;case"[object Map]":case"[object Set]":{if(e.size!==t.size)return!1;if(Oi(e,t))return!0;const n=e.entries(),i="[object Map]"===r;for(;;){const e=n.next();if(e.done)break;const[r,o]=e.value;if(!t.has(r))return!1;if(i&&!bi(o,t.get(r)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":e=new Uint8Array(e),t=new Uint8Array(t);case"[object DataView]":{let r=e.byteLength;if(r===t.byteLength)for(;r--&&e[r]===t[r];);return-1===r}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const r=fi.call(e);return r===fi.call(t)&&!function(e,t){const r=e.length-t.length;return r>=0&&e.indexOf(t,r)===r}(r,_i)}}return!1}function mi(e){return Object.keys(e).filter(gi,e)}function gi(e){return void 0!==this[e]}const _i="{ [native code] }";function Oi(e,t){let r=pi.get(e);if(r){if(r.has(t))return!0}else pi.set(e,r=new Set);return r.add(t),!1}const Si=()=>Object.create(null),{forEach:Ei,slice:wi}=Array.prototype,{hasOwnProperty:Ti}=Object.prototype;class Ii{constructor(e=!0,t=Si){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return Ei.call(e,(e=>t=t.getChildTrie(e))),Ti.call(t,"data")?t.data:t.data=this.makeData(wi.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let r=0,n=e.length;t&&r<n;++r){const n=t.mapFor(e[r],!1);t=n&&n.get(e[r])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const r=e[0],n=this.mapFor(r,!1),i=n&&n.get(r);i&&(t=i.removeArray(wi.call(e,1)),i.data||i.weak||i.strong&&i.strong.size||n.delete(r))}else t=this.data,delete this.data;return t}getChildTrie(e){const t=this.mapFor(e,!0);let r=t.get(e);return r||t.set(e,r=new Ii(this.weakness,this.makeData)),r}mapFor(e,t){return this.weakness&&function(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}}var Ai,Mi,Fi=function(){function e(){this.known=new(fn?WeakSet:Set),this.pool=new Ii(dn),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return mr(e)&&this.known.has(e)},e.prototype.pass=function(e){if(mr(e)){var t=function(e){return mr(e)?On(e)?e.slice(0):l({__proto__:Object.getPrototypeOf(e)},e):e}(e);return this.passes.set(t,e),t}return e},e.prototype.admit=function(e){var t=this;if(mr(e)){var r=this.passes.get(e);if(r)return r;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var n=e.map(this.admit,this);return(a=this.pool.lookupArray(n)).array||(this.known.add(a.array=n),!1!==globalThis.__DEV__&&Object.freeze(n)),a.array;case null:case Object.prototype:if(this.known.has(e))return e;var i=Object.getPrototypeOf(e),o=[i],s=this.sortedKeys(e);o.push(s.json);var a,u=o.length;if(s.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(a=this.pool.lookupArray(o)).object){var c=a.object=Object.create(i);this.known.add(c),s.sorted.forEach((function(e,t){c[e]=o[u+t]})),!1!==globalThis.__DEV__&&Object.freeze(c)}return a.object}}return e},e.prototype.sortedKeys=function(e){var t=Object.keys(e),r=this.pool.lookupArray(t);if(!r.keys){t.sort();var n=JSON.stringify(t);(r.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,r.keys={sorted:t,json:n})}return r.keys},e}(),ki=Object.assign((function(e){if(mr(e)){void 0===Ai&&Di();var t=Ai.admit(e),r=Mi.get(t);return void 0===r&&Mi.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:Di});function Di(){Ai=new Fi,Mi=new(dn?WeakMap:Map)}function ji(e){return e}var xi=function(){function e(e,t){void 0===t&&(t=Object.create(null)),this.resultCache=fn?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),!1!==t.cache&&(this.stableCacheKeys=new Ii(dn,(function(e){return{key:e}})))}return e.prototype.getCacheKey=function(e){return[e]},e.identity=function(){return new e(ji,{cache:!1})},e.split=function(t,r,n){return void 0===n&&(n=e.identity()),new e((function(e){return(t(e)?r:n).transformDocument(e)}),{cache:!1})},e.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var t=this.getStableCacheEntry(e);if(t&&t.value)return t.value;xr(e);var r=this.transform(e);return this.resultCache.add(r),t&&(t.value=r),r},e.prototype.concat=function(t){var r=this;return new e((function(e){return t.transformDocument(r.transformDocument(e))}),{cache:!1})},e.prototype.getStableCacheEntry=function(e){if(this.stableCacheKeys){var t=this.getCacheKey(e);return t?(Yt(Array.isArray(t),65),this.stableCacheKeys.lookupArray(t)):void 0}},e}();function Pi(e,t,r){return new br((function(n){var i={then:function(e){return new Promise((function(t){return t(e())}))}};function o(e,t){return function(r){if(e){var o=function(){return n.closed?0:e(r)};i=i.then(o,o).then((function(e){return n.next(e)}),(function(e){return n.error(e)}))}else n[t](r)}}var s={next:o(t,"next"),error:o(r,"error"),complete:function(){i.then((function(){return n.complete()}))}},a=e.subscribe(s);return function(){return a.unsubscribe()}}))}function Ni(e){return Sn(Ci(e))}function Ci(e){var t=Sn(e.errors)?e.errors.slice(0):[];return Mn(e)&&Sn(e.incremental)&&e.incremental.forEach((function(e){e.errors&&t.push.apply(t,e.errors)})),t}function Ri(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function qi(e){function t(t){Object.defineProperty(e,t,{value:br})}return pn&&Symbol.species&&t(Symbol.species),t("@@species"),e}function Li(e){return e&&"function"==typeof e.then}var Bi,Qi=function(e){function t(t){var r=e.call(this,(function(e){return r.addObserver(e),function(){return r.removeObserver(e)}}))||this;return r.observers=new Set,r.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],r.notify("next",e),Ri(r.observers,"next",e))},error:function(e){var t=r.sub;null!==t&&(t&&setTimeout((function(){return t.unsubscribe()})),r.sub=null,r.latest=["error",e],r.reject(e),r.notify("error",e),Ri(r.observers,"error",e))},complete:function(){var e=r,t=e.sub,n=e.sources;if(null!==t){var i=(void 0===n?[]:n).shift();i?Li(i)?i.then((function(e){return r.sub=e.subscribe(r.handlers)})):r.sub=i.subscribe(r.handlers):(t&&setTimeout((function(){return t.unsubscribe()})),r.sub=null,r.latest&&"next"===r.latest[0]?r.resolve(r.latest[1]):r.resolve(),r.notify("complete"),Ri(r.observers,"complete"))}}},r.nextResultListeners=new Set,r.cancel=function(e){r.reject(e),r.sources=[],r.handlers.complete()},r.promise.catch((function(e){})),"function"==typeof t&&(t=[new br(t)]),Li(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return c(t,e),t.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},t.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],r=e[t];r&&r.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},t.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e))},t.prototype.removeObserver=function(e){this.observers.delete(e)&&this.observers.size<1&&this.handlers.complete()},t.prototype.notify=function(e,t){var r=this.nextResultListeners;r.size&&(this.nextResultListeners=new Set,r.forEach((function(r){return r(e,t)})))},t.prototype.beforeNext=function(e){var t=!1;this.nextResultListeners.add((function(r,n){t||(t=!0,e(r,n))}))},t}(br);function Vi(e){return!!e&&e<7}function Ui(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Object.create(null);return e.forEach((function(e){e&&Object.keys(e).forEach((function(t){var n=e[t];void 0!==n&&(r[t]=n)}))})),r}qi(Qi),function(e){e[e.loading=1]="loading",e[e.setVariables=2]="setVariables",e[e.fetchMore=3]="fetchMore",e[e.refetch=4]="refetch",e[e.poll=6]="poll",e[e.ready=7]="ready",e[e.error=8]="error"}(Bi||(Bi={}));var zi=Object.prototype.toString;function Yi(e){return Wi(e)}function Wi(e,t){switch(zi.call(e)){case"[object Array]":if((t=t||new Map).has(e))return t.get(e);var r=e.slice(0);return t.set(e,r),r.forEach((function(e,n){r[n]=Wi(e,t)})),r;case"[object Object]":if((t=t||new Map).has(e))return t.get(e);var n=Object.create(Object.getPrototypeOf(e));return t.set(e,n),Object.keys(e).forEach((function(r){n[r]=Wi(e[r],t)})),n;default:return e}}function $i(e,t,r,n){var i=t.data,o=h(t,["data"]),s=r.data,a=h(r,["data"]);return yi(o,a)&&Gi(qr(e).selectionSet,i,s,{fragmentMap:_r(Cr(e)),variables:n})}function Gi(e,t,r,n){if(t===r)return!0;var i=new Set;return e.selections.every((function(e){if(i.has(e))return!0;if(i.add(e),!un(e,n.variables))return!0;if(Hi(e))return!0;if(jr(e)){var o=kr(e),s=t&&t[o],a=r&&r[o],u=e.selectionSet;if(!u)return yi(s,a);var c=Array.isArray(s),l=Array.isArray(a);if(c!==l)return!1;if(c&&l){var h=s.length;if(a.length!==h)return!1;for(var d=0;d<h;++d)if(!Gi(u,s[d],a[d],n))return!1;return!0}return Gi(u,s,a,n)}var f=Or(e,n.fragmentMap);return f?!!Hi(f)||Gi(f.selectionSet,t,r,n):void 0}))}function Hi(e){return!!e.directives&&e.directives.some(Ki)}function Ki(e){return"nonreactive"===e.name.value}var Ji=Object.assign,Xi=Object.hasOwnProperty,Zi=function(e){function t(t){var r=t.queryManager,n=t.queryInfo,i=t.options,o=e.call(this,(function(e){try{var t=e._subscription._observer;t&&!t.error&&(t.error=to)}catch(e){}var r=!o.observers.size;o.observers.add(e);var n=o.last;return n&&n.error?e.error&&e.error(n.error):n&&n.result&&e.next&&e.next(n.result),r&&o.reobserve().catch((function(){})),function(){o.observers.delete(e)&&!o.observers.size&&o.tearDownQuery()}}))||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=n,o.queryManager=r,o.waitForOwnResult=no(i.fetchPolicy),o.isTornDown=!1;var s=r.defaultOptions.watchQuery,a=(void 0===s?{}:s).fetchPolicy,u=void 0===a?"cache-first":a,c=i.fetchPolicy,h=void 0===c?u:c,d=i.initialFetchPolicy,f=void 0===d?"standby"===h?u:h:d;o.options=l(l({},i),{initialFetchPolicy:f,fetchPolicy:h}),o.queryId=n.queryId||r.generateQueryId();var p=Pr(o.query);return o.queryName=p&&p.name&&p.name.value,o}return c(t,e),Object.defineProperty(t.prototype,"query",{get:function(){return this.lastQuery||this.options.query},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),t.prototype.result=function(){var e=this;return new Promise((function(t,r){var n={next:function(r){t(r),e.observers.delete(n),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){i.unsubscribe()}),0)},error:r},i=e.subscribe(n)}))},t.prototype.getCurrentResult=function(e){void 0===e&&(e=!0);var t=this.getLastResult(!0),r=this.queryInfo.networkStatus||t&&t.networkStatus||Bi.ready,n=l(l({},t),{loading:Vi(r),networkStatus:r}),i=this.options.fetchPolicy,o=void 0===i?"cache-first":i;if(no(o)||this.queryManager.getDocumentInfo(this.query).hasForcedResolvers);else if(this.waitForOwnResult)this.queryInfo.updateWatch();else{var s=this.queryInfo.getDiff();(s.complete||this.options.returnPartialData)&&(n.data=s.result),vi(n.data,{})&&(n.data=void 0),s.complete?(delete n.partial,!s.complete||n.networkStatus!==Bi.loading||"cache-first"!==o&&"cache-only"!==o||(n.networkStatus=Bi.ready,n.loading=!1)):n.partial=!0,!1===globalThis.__DEV__||s.complete||this.options.partialRefetch||n.loading||n.data||n.error||ro(s.missing)}return e&&this.updateLastResult(n),n},t.prototype.isDifferentFromLastResult=function(e,t){return!this.last||(this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective?!$i(this.query,this.last.result,e,this.variables):!vi(this.last.result,e))||t&&!vi(this.last.variables,t)},t.prototype.getLast=function(e,t){var r=this.last;if(r&&r[e]&&(!t||vi(r.variables,this.variables)))return r[e]},t.prototype.getLastResult=function(e){return this.getLast("result",e)},t.prototype.getLastError=function(e){return this.getLast("error",e)},t.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},t.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},t.prototype.refetch=function(e){var t,r={pollInterval:0},n=this.options.fetchPolicy;if(r.fetchPolicy="cache-and-network"===n?n:"no-cache"===n?"no-cache":"network-only",!1!==globalThis.__DEV__&&e&&Xi.call(e,"variables")){var i=Rr(this.query),o=i.variableDefinitions;o&&o.some((function(e){return"variables"===e.variable.name.value}))||!1!==globalThis.__DEV__&&Yt.warn(20,e,(null===(t=i.name)||void 0===t?void 0:t.value)||i)}return e&&!vi(this.options.variables,e)&&(r.variables=this.options.variables=l(l({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(r,Bi.refetch)},t.prototype.fetchMore=function(e){var t=this,r=l(l({},e.query?e:l(l(l(l({},this.options),{query:this.options.query}),e),{variables:l(l({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"});r.query=this.transformDocument(r.query);var n=this.queryManager.generateQueryId();this.lastQuery=e.query?this.transformDocument(this.options.query):r.query;var i=this.queryInfo,o=i.networkStatus;i.networkStatus=Bi.fetchMore,r.notifyOnNetworkStatusChange&&this.observe();var s=new Set;return this.queryManager.fetchQuery(n,r,Bi.fetchMore).then((function(a){return t.queryManager.removeQuery(n),i.networkStatus===Bi.fetchMore&&(i.networkStatus=o),t.queryManager.cache.batch({update:function(n){var i=e.updateQuery;i?n.updateQuery({query:t.query,variables:t.variables,returnPartialData:!0,optimistic:!1},(function(e){return i(e,{fetchMoreResult:a.data,variables:r.variables})})):n.writeQuery({query:r.query,variables:r.variables,data:a.data})},onWatchUpdated:function(e){s.add(e.query)}}),a})).finally((function(){s.has(t.query)||eo(t)}))},t.prototype.subscribeToMore=function(e){var t=this,r=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(r){var n=e.updateQuery;n&&t.updateQuery((function(e,t){var i=t.variables;return n(e,{subscriptionData:r,variables:i})}))},error:function(t){e.onError?e.onError(t):!1!==globalThis.__DEV__&&Yt.error(21,t)}});return this.subscriptions.add(r),function(){t.subscriptions.delete(r)&&r.unsubscribe()}},t.prototype.setOptions=function(e){return this.reobserve(e)},t.prototype.silentSetOptions=function(e){var t=Ui(this.options,e||{});Ji(this.options,t)},t.prototype.setVariables=function(e){return vi(this.variables,e)?this.observers.size?this.result():Promise.resolve():(this.options.variables=e,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:e},Bi.setVariables):Promise.resolve())},t.prototype.updateQuery=function(e){var t=this.queryManager,r=e(t.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});r&&(t.cache.writeQuery({query:this.options.query,data:r,variables:this.variables}),t.broadcastQueries())},t.prototype.startPolling=function(e){this.options.pollInterval=e,this.updatePolling()},t.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},t.prototype.applyNextFetchPolicy=function(e,t){if(t.nextFetchPolicy){var r=t.fetchPolicy,n=void 0===r?"cache-first":r,i=t.initialFetchPolicy,o=void 0===i?n:i;"standby"===n||("function"==typeof t.nextFetchPolicy?t.fetchPolicy=t.nextFetchPolicy(n,{reason:e,options:t,observable:this,initialFetchPolicy:o}):t.fetchPolicy="variables-changed"===e?o:t.nextFetchPolicy)}return t.fetchPolicy},t.prototype.fetch=function(e,t,r){return this.queryManager.setObservableQuery(this),this.queryManager.fetchConcastWithInfo(this.queryId,e,t,r)},t.prototype.updatePolling=function(){var e=this;if(!this.queryManager.ssrMode){var t=this.pollingInfo,r=this.options.pollInterval;if(r){if(!t||t.interval!==r){Yt(r,22),(t||(this.pollingInfo={})).interval=r;var n=function(){e.pollingInfo&&(Vi(e.queryInfo.networkStatus)?i():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"network-only"},Bi.poll).then(i,i))},i=function(){var t=e.pollingInfo;t&&(clearTimeout(t.timeout),t.timeout=setTimeout(n,t.interval))};i()}}else t&&(clearTimeout(t.timeout),delete this.pollingInfo)}},t.prototype.updateLastResult=function(e,t){void 0===t&&(t=this.variables);var r=this.getLastError();return r&&this.last&&!vi(t,this.last.variables)&&(r=void 0),this.last=l({result:this.queryManager.assumeImmutableResults?e:Yi(e),variables:t},r?{error:r}:null)},t.prototype.reobserveAsConcast=function(e,t){var r=this;this.isTornDown=!1;var n=t===Bi.refetch||t===Bi.fetchMore||t===Bi.poll,i=this.options.variables,o=this.options.fetchPolicy,s=Ui(this.options,e||{}),a=n?s:Ji(this.options,s),u=this.transformDocument(a.query);this.lastQuery=u,n||(this.updatePolling(),e&&e.variables&&!vi(e.variables,i)&&"standby"!==a.fetchPolicy&&a.fetchPolicy===o&&(this.applyNextFetchPolicy("variables-changed",a),void 0===t&&(t=Bi.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=no(a.fetchPolicy));var c=function(){r.concast===f&&(r.waitForOwnResult=!1)},h=a.variables&&l({},a.variables),d=this.fetch(a,t,u),f=d.concast,p=d.fromLink,v={next:function(e){c(),r.reportResult(e,h)},error:function(e){c(),r.reportError(e,h)}};return n||!p&&this.concast||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=f,this.observer=v),f.addObserver(v),f},t.prototype.reobserve=function(e,t){return this.reobserveAsConcast(e,t).promise},t.prototype.resubscribeAfterError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.last;this.resetLastResults();var n=this.subscribe.apply(this,e);return this.last=r,n},t.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},t.prototype.reportResult=function(e,t){var r=this.getLastError(),n=this.isDifferentFromLastResult(e,t);(r||!e.partial||this.options.returnPartialData)&&this.updateLastResult(e,t),(r||n)&&Ri(this.observers,"next",e)},t.prototype.reportError=function(e,t){var r=l(l({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:Bi.error,loading:!1});this.updateLastResult(r,t),Ri(this.observers,"error",this.last.error=e)},t.prototype.hasObservers=function(){return this.observers.size>0},t.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},t.prototype.transformDocument=function(e){return this.queryManager.transform(e)},t}(br);function eo(e){var t=e.options,r=t.fetchPolicy,n=t.nextFetchPolicy;return"cache-and-network"===r||"network-only"===r?e.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(e,t){return this.nextFetchPolicy=n,"function"==typeof this.nextFetchPolicy?this.nextFetchPolicy(e,t):r}}):e.reobserve()}function to(e){!1!==globalThis.__DEV__&&Yt.error(23,e.message,e.stack)}function ro(e){!1!==globalThis.__DEV__&&e&&!1!==globalThis.__DEV__&&Yt.debug(24,e)}function no(e){return"network-only"===e||"no-cache"===e||"standby"===e}function io(e){return e.kind===rn.FIELD||e.kind===rn.FRAGMENT_SPREAD||e.kind===rn.INLINE_FRAGMENT}qi(Zi);const oo=()=>Object.create(null),{forEach:so,slice:ao}=Array.prototype,{hasOwnProperty:uo}=Object.prototype;class co{constructor(e=!0,t=oo){this.weakness=e,this.makeData=t}lookup(...e){return this.lookupArray(e)}lookupArray(e){let t=this;return so.call(e,(e=>t=t.getChildTrie(e))),uo.call(t,"data")?t.data:t.data=this.makeData(ao.call(e))}peek(...e){return this.peekArray(e)}peekArray(e){let t=this;for(let r=0,n=e.length;t&&r<n;++r){const n=this.weakness&&lo(e[r])?t.weak:t.strong;t=n&&n.get(e[r])}return t&&t.data}getChildTrie(e){const t=this.weakness&&lo(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map);let r=t.get(e);return r||t.set(e,r=new co(this.weakness,this.makeData)),r}}function lo(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}function ho(){}class fo{constructor(e=1/0,t=ho){this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:e,newer:r}=t;r&&(r.older=e),e&&(e.newer=r),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=r)}return t}set(e,t){let r=this.getNode(e);return r?r.value=t:(r={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=r),this.newest=r,this.oldest=this.oldest||r,this.map.set(e,r),r.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const t=this.map.get(e);return!!t&&(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0)}}var po=null,vo={},yo=1;function bo(e){try{return e()}catch(e){}}var mo="@wry/context:Slot",go=bo((function(){return globalThis}))||bo((function(){return r.g}))||Object.create(null),_o=go[mo]||Array[mo]||function(e){try{Object.defineProperty(go,mo,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}}(function(){function e(){this.id=["slot",yo++,Date.now(),Math.random().toString(36).slice(2)].join(":")}return e.prototype.hasValue=function(){for(var e=po;e;e=e.parent)if(this.id in e.slots){var t=e.slots[this.id];if(t===vo)break;return e!==po&&(po.slots[this.id]=t),!0}return po&&(po.slots[this.id]=vo),!1},e.prototype.getValue=function(){if(this.hasValue())return po.slots[this.id]},e.prototype.withValue=function(e,t,r,n){var i,o=((i={__proto__:null})[this.id]=e,i),s=po;po={parent:s,slots:o};try{return t.apply(n,r)}finally{po=s}},e.bind=function(e){var t=po;return function(){var r=po;try{return po=t,e.apply(this,arguments)}finally{po=r}}},e.noContext=function(e,t,r){if(!po)return e.apply(r,t);var n=po;try{return po=null,e.apply(r,t)}finally{po=n}},e}());_o.bind,_o.noContext;const Oo=new _o,{hasOwnProperty:So}=Object.prototype,Eo=Array.from||function(e){const t=[];return e.forEach((e=>t.push(e))),t};function wo(e){const{unsubscribe:t}=e;"function"==typeof t&&(e.unsubscribe=void 0,t())}const To=[],Io=100;function Ao(e,t){if(!e)throw new Error(t||"assertion failure")}function Mo(e,t){const r=e.length;return r>0&&r===t.length&&e[r-1]===t[r-1]}function Fo(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}function ko(e){return e.slice(0)}class Do{constructor(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++Do.count}peek(){if(1===this.value.length&&!Po(this))return jo(this),this.value[0]}recompute(e){return Ao(!this.recomputing,"already recomputing"),jo(this),Po(this)?function(e,t){return Qo(e),Oo.withValue(e,xo,[e,t]),function(e,t){if("function"==typeof e.subscribe)try{wo(e),e.unsubscribe=e.subscribe.apply(null,t)}catch(t){return e.setDirty(),!1}return!0}(e,t)&&function(e){e.dirty=!1,Po(e)||Co(e)}(e),Fo(e.value)}(this,e):Fo(this.value)}setDirty(){this.dirty||(this.dirty=!0,No(this),wo(this))}dispose(){this.setDirty(),Qo(this),Ro(this,((e,t)=>{e.setDirty(),Vo(e,this)}))}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=To.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(Eo(this.deps).forEach((e=>e.delete(this))),this.deps.clear(),To.push(this.deps),this.deps=null)}}function jo(e){const t=Oo.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),Po(e)?qo(t,e):Lo(t,e),t}function xo(e,t){e.recomputing=!0;const{normalizeResult:r}=e;let n;r&&1===e.value.length&&(n=ko(e.value)),e.value.length=0;try{if(e.value[0]=e.fn.apply(null,t),r&&n&&!Mo(n,e.value))try{e.value[0]=r(e.value[0],n[0])}catch(e){}}catch(t){e.value[1]=t}e.recomputing=!1}function Po(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function No(e){Ro(e,qo)}function Co(e){Ro(e,Lo)}function Ro(e,t){const r=e.parents.size;if(r){const n=Eo(e.parents);for(let i=0;i<r;++i)t(n[i],e)}}function qo(e,t){Ao(e.childValues.has(t)),Ao(Po(t));const r=!Po(e);if(e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=To.pop()||new Set;e.dirtyChildren.add(t),r&&No(e)}function Lo(e,t){Ao(e.childValues.has(t)),Ao(!Po(t));const r=e.childValues.get(t);0===r.length?e.childValues.set(t,ko(t.value)):Mo(r,t.value)||e.setDirty(),Bo(e,t),Po(e)||Co(e)}function Bo(e,t){const r=e.dirtyChildren;r&&(r.delete(t),0===r.size&&(To.length<Io&&To.push(r),e.dirtyChildren=null))}function Qo(e){e.childValues.size>0&&e.childValues.forEach(((t,r)=>{Vo(e,r)})),e.forgetDeps(),Ao(null===e.dirtyChildren)}function Vo(e,t){t.parents.delete(e),e.childValues.delete(t),Bo(e,t)}Do.count=0;const Uo={setDirty:!0,dispose:!0,forget:!0};function zo(e){const t=new Map,r=e&&e.subscribe;function n(e){const n=Oo.getValue();if(n){let i=t.get(e);i||t.set(e,i=new Set),n.dependOn(i),"function"==typeof r&&(wo(i),i.unsubscribe=r(e))}}return n.dirty=function(e,r){const n=t.get(e);if(n){const i=r&&So.call(Uo,r)?r:"setDirty";Eo(n).forEach((e=>e[i]())),t.delete(e),wo(n)}},n}let Yo;function Wo(...e){return(Yo||(Yo=new co("function"==typeof WeakMap))).lookupArray(e)}const $o=new Set;function Go(e,{max:t=Math.pow(2,16),keyArgs:r,makeCacheKey:n=Wo,normalizeResult:i,subscribe:o,cache:s=fo}=Object.create(null)){const a="function"==typeof s?new s(t,(e=>e.dispose())):s,u=function(){const t=n.apply(null,r?r.apply(null,arguments):arguments);if(void 0===t)return e.apply(null,arguments);let s=a.get(t);s||(a.set(t,s=new Do(e)),s.normalizeResult=i,s.subscribe=o,s.forget=()=>a.delete(t));const u=s.recompute(Array.prototype.slice.call(arguments));return a.set(t,s),$o.add(a),Oo.hasValue()||($o.forEach((e=>e.clean())),$o.clear()),u};function c(e){const t=e&&a.get(e);t&&t.setDirty()}function l(e){const t=e&&a.get(e);if(t)return t.peek()}function h(e){return!!e&&a.delete(e)}return Object.defineProperty(u,"size",{get:()=>a.size,configurable:!1,enumerable:!1}),Object.freeze(u.options={max:t,keyArgs:r,makeCacheKey:n,normalizeResult:i,subscribe:o,cache:a}),u.dirtyKey=c,u.dirty=function(){c(n.apply(null,arguments))},u.peekKey=l,u.peek=function(){return l(n.apply(null,arguments))},u.forgetKey=h,u.forget=function(){return h(n.apply(null,arguments))},u.makeCacheKey=n,u.getKey=r?function(){return n.apply(null,r.apply(null,arguments))}:n,Object.freeze(u)}var Ho=new _o,Ko=new WeakMap;function Jo(e){var t=Ko.get(e);return t||Ko.set(e,t={vars:new Set,dep:zo()}),t}function Xo(e){Jo(e).vars.forEach((function(t){return t.forgetCache(e)}))}function Zo(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){Jo(e).dep.dirty(n),function(e){e.broadcastWatches&&e.broadcastWatches()}(e)}));var s=Array.from(r);r.clear(),s.forEach((function(t){return t(e)}))}}else{var a=Ho.getValue();a&&(i(a),Jo(a).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),Jo(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}var es=function(){function e(e){var t=e.cache,r=e.client,n=e.resolvers,i=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,r&&(this.client=r),n&&this.addResolvers(n),i&&this.setFragmentMatcher(i)}return e.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=wn(t.resolvers,e)})):this.resolvers=wn(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers||{}},e.prototype.runResolvers=function(e){var t=e.document,r=e.remoteResult,n=e.context,i=e.variables,o=e.onlyRunForcedResolvers,s=void 0!==o&&o;return d(this,void 0,void 0,(function(){return f(this,(function(e){return t?[2,this.resolveDocument(t,r.data,n,i,this.fragmentMatcher,s).then((function(e){return l(l({},r),{data:e.result})}))]:[2,r]}))}))},e.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},e.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},e.prototype.clientQuery=function(e){return cn(["client"],e)&&this.resolvers?e:null},e.prototype.serverQuery=function(e){return ai(e)},e.prototype.prepareContext=function(e){var t=this.cache;return l(l({},e),{cache:t,getCacheKey:function(e){return t.identify(e)}})},e.prototype.addExportedVariables=function(e,t,r){return void 0===t&&(t={}),void 0===r&&(r={}),d(this,void 0,void 0,(function(){return f(this,(function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(r),t).then((function(e){return l(l({},t),e.exportedVariables)}))]:[2,l({},t)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return sn(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return on}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:si(e),variables:t,returnPartialData:!0,optimistic:!1}).result},e.prototype.resolveDocument=function(e,t,r,n,i,o){return void 0===r&&(r={}),void 0===n&&(n={}),void 0===i&&(i=function(){return!0}),void 0===o&&(o=!1),d(this,void 0,void 0,(function(){var s,a,u,c,h,d,p,v,y,b;return f(this,(function(f){return s=qr(e),a=Cr(e),u=_r(a),c=this.collectSelectionsToResolve(s,u),h=s.operation,d=h?h.charAt(0).toUpperCase()+h.slice(1):"Query",v=(p=this).cache,y=p.client,b={fragmentMap:u,context:l(l({},r),{cache:v,client:y}),variables:n,fragmentMatcher:i,defaultOperationType:d,exportedVariables:{},selectionsToResolve:c,onlyRunForcedResolvers:o},[2,this.resolveSelectionSet(s.selectionSet,!1,t,b).then((function(e){return{result:e,exportedVariables:b.exportedVariables}}))]}))}))},e.prototype.resolveSelectionSet=function(e,t,r,n){return d(this,void 0,void 0,(function(){var i,o,s,a,u,c=this;return f(this,(function(l){return i=n.fragmentMap,o=n.context,s=n.variables,a=[r],u=function(e){return d(c,void 0,void 0,(function(){var u,c;return f(this,(function(l){return(t||n.selectionsToResolve.has(e))&&un(e,s)?jr(e)?[2,this.resolveField(e,t,r,n).then((function(t){var r;void 0!==t&&a.push(((r={})[kr(e)]=t,r))}))]:(function(e){return"InlineFragment"===e.kind}(e)?u=e:(u=i[e.name.value],Yt(u,18,e.name.value)),u&&u.typeCondition&&(c=u.typeCondition.name.value,n.fragmentMatcher(r,c,o))?[2,this.resolveSelectionSet(u.selectionSet,t,r,n).then((function(e){a.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(e.selections.map(u)).then((function(){return Tn(a)}))]}))}))},e.prototype.resolveField=function(e,t,r,n){return d(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d,p=this;return f(this,(function(f){return r?(i=n.variables,o=e.name.value,s=kr(e),a=o!==s,u=r[s]||r[o],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=r.__typename||n.defaultOperationType,(h=this.resolvers&&this.resolvers[l])&&(d=h[a?o:s])&&(c=Promise.resolve(Ho.withValue(this.cache,d,[r,Fr(e,i),n.context,{field:e,fragmentMap:n.fragmentMap}])))),[2,c.then((function(r){var i,o;if(void 0===r&&(r=u),e.directives&&e.directives.forEach((function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach((function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(n.exportedVariables[e.value.value]=r)}))})),!e.selectionSet)return r;if(null==r)return r;var s=null!==(o=null===(i=e.directives)||void 0===i?void 0:i.some((function(e){return"client"===e.name.value})))&&void 0!==o&&o;return Array.isArray(r)?p.resolveSubSelectedArray(e,t||s,r,n):e.selectionSet?p.resolveSelectionSet(e.selectionSet,t||s,r,n):void 0}))]):[2,null]}))}))},e.prototype.resolveSubSelectedArray=function(e,t,r,n){var i=this;return Promise.all(r.map((function(r){return null===r?null:Array.isArray(r)?i.resolveSubSelectedArray(e,t,r,n):e.selectionSet?i.resolveSelectionSet(e.selectionSet,t,r,n):void 0})))},e.prototype.collectSelectionsToResolve=function(e,t){var r=function(e){return!Array.isArray(e)},n=this.selectionsToResolveCache;return function e(i){if(!n.has(i)){var o=new Set;n.set(i,o),sn(i,{Directive:function(e,t,n,i,s){"client"===e.name.value&&s.forEach((function(e){r(e)&&io(e)&&o.add(e)}))},FragmentSpread:function(n,i,s,a,u){var c=t[n.name.value];Yt(c,19,n.name.value);var l=e(c);l.size>0&&(u.forEach((function(e){r(e)&&io(e)&&o.add(e)})),o.add(n),l.forEach((function(e){o.add(e)})))}})}return n.get(i)}(e)},e}(),ts=new(dn?WeakMap:Map);function rs(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return ts.set(e,(ts.get(e)+1)%1e15),r.apply(this,arguments)})}function ns(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var is=function(){function e(e,t){void 0===t&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var r=this.cache=e.cache;ts.has(r)||(ts.set(r,0),rs(r,"evict"),rs(r,"modify"),rs(r,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||Bi.loading;return this.variables&&this.networkStatus!==Bi.loading&&!vi(this.variables,e.variables)&&(t=Bi.setVariables),vi(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},e.prototype.reset=function(){ns(this),this.dirty=!1},e.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&vi(e,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables);var t=this.observableQuery;if(t&&"no-cache"===t.options.fetchPolicy)return{complete:!1};var r=this.cache.diff(e);return this.updateLastDiff(r,e),r},e.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},e.prototype.getDiffOptions=function(e){var t;return void 0===e&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:null===(t=this.observableQuery)||void 0===t?void 0:t.options.canonizeResults}},e.prototype.setDiff=function(e){var t=this,r=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),this.dirty||vi(r&&r.result,e&&e.result)||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout((function(){return t.notify()}),0)))},e.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){t.getDiff().fromOptimisticTransaction?e.observe():eo(e)})):delete this.oqListener)},e.prototype.notify=function(){var e=this;ns(this),this.shouldNotify()&&this.listeners.forEach((function(t){return t(e)})),this.dirty=!1},e.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Vi(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if("cache-only"!==e&&"cache-and-network"!==e)return!1}return!0},e.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=e.prototype.cancel;var t=this.observableQuery;t&&t.stopPolling()}},e.prototype.cancel=function(){},e.prototype.updateWatch=function(e){var t=this;void 0===e&&(e=this.variables);var r=this.observableQuery;if(!r||"no-cache"!==r.options.fetchPolicy){var n=l(l({},this.getDiffOptions(e)),{watcher:this,callback:function(e){return t.setDiff(e)}});this.lastWatch&&vi(n,this.lastWatch)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},e.prototype.resetLastWrite=function(){this.lastWrite=void 0},e.prototype.shouldWrite=function(e,t){var r=this.lastWrite;return!(r&&r.dmCount===ts.get(this.cache)&&vi(t,r.variables)&&vi(e.data,r.result.data))},e.prototype.markResult=function(e,t,r,n){var i=this,o=new An,s=Sn(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Sn(e.incremental)){var a=kn(this.getDiff().result,e);e.data=a}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=s,"no-cache"===r.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(r.variables)):0!==n&&(os(e,r.errorPolicy)?this.cache.performTransaction((function(o){if(i.shouldWrite(e,r.variables))o.writeQuery({query:t,data:e.data,variables:r.variables,overwrite:1===n}),i.lastWrite={result:e,variables:r.variables,dmCount:ts.get(i.cache)};else if(i.lastDiff&&i.lastDiff.diff.complete)return void(e.data=i.lastDiff.diff.result);var s=i.getDiffOptions(r.variables),a=o.diff(s);!i.stopped&&vi(i.variables,r.variables)&&i.updateWatch(r.variables),i.updateLastDiff(a,s),a.complete&&(e.data=a.result)})):this.lastWrite=void 0)},e.prototype.markReady=function(){return this.networkError=null,this.networkStatus=Bi.ready},e.prototype.markError=function(e){return this.networkStatus=Bi.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function os(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!Ni(e);return!n&&r&&e.data&&(n=!0),n}var ss=Object.prototype.hasOwnProperty,as=function(){function e(e){var t=e.cache,r=e.link,n=e.defaultOptions,i=e.documentTransform,o=e.queryDeduplication,s=void 0!==o&&o,a=e.onBroadcast,u=e.ssrMode,c=void 0!==u&&u,l=e.clientAwareness,h=void 0===l?{}:l,d=e.localState,f=e.assumeImmutableResults,p=void 0===f?!!t.assumeImmutableResults:f,v=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(dn?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map;var y=new xi((function(e){return v.cache.transformDocument(e)}),{cache:!1});this.cache=t,this.link=r,this.defaultOptions=n||Object.create(null),this.queryDeduplication=s,this.clientAwareness=h,this.localState=d||new es({cache:t}),this.ssrMode=c,this.assumeImmutableResults=p,this.documentTransform=i?y.concat(i).concat(y):y,(this.onBroadcast=a)&&(this.mutationStore=Object.create(null))}return e.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(Wt(25))},e.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},e.prototype.mutate=function(e){var t,r,n=e.mutation,i=e.variables,o=e.optimisticResponse,s=e.updateQueries,a=e.refetchQueries,u=void 0===a?[]:a,c=e.awaitRefetchQueries,h=void 0!==c&&c,p=e.update,v=e.onQueryUpdated,y=e.fetchPolicy,b=void 0===y?(null===(t=this.defaultOptions.mutate)||void 0===t?void 0:t.fetchPolicy)||"network-only":y,m=e.errorPolicy,g=void 0===m?(null===(r=this.defaultOptions.mutate)||void 0===r?void 0:r.errorPolicy)||"none":m,_=e.keepRootFields,O=e.context;return d(this,void 0,void 0,(function(){var e,t,r,a;return f(this,(function(c){switch(c.label){case 0:return Yt(n,26),Yt("network-only"===b||"no-cache"===b,27),e=this.generateMutationId(),n=this.cache.transformForLink(this.transform(n)),t=this.getDocumentInfo(n).hasClientExports,i=this.getVariables(n,i),t?[4,this.localState.addExportedVariables(n,i,O)]:[3,2];case 1:i=c.sent(),c.label=2;case 2:return r=this.mutationStore&&(this.mutationStore[e]={mutation:n,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:e,document:n,variables:i,fetchPolicy:b,errorPolicy:g,context:O,updateQueries:s,update:p,keepRootFields:_}),this.broadcastQueries(),a=this,[2,new Promise((function(t,c){return Pi(a.getObservableFromLink(n,l(l({},O),{optimisticResponse:o}),i,!1),(function(t){if(Ni(t)&&"none"===g)throw new _n({graphQLErrors:Ci(t)});r&&(r.loading=!1,r.error=null);var c=l({},t);return"function"==typeof u&&(u=u(c)),"ignore"===g&&Ni(c)&&delete c.errors,a.markMutationResult({mutationId:e,result:c,document:n,variables:i,fetchPolicy:b,errorPolicy:g,context:O,update:p,updateQueries:s,awaitRefetchQueries:h,refetchQueries:u,removeOptimistic:o?e:void 0,onQueryUpdated:v,keepRootFields:_})})).subscribe({next:function(e){a.broadcastQueries(),"hasNext"in e&&!1!==e.hasNext||t(e)},error:function(t){r&&(r.loading=!1,r.error=t),o&&a.cache.removeOptimistic(e),a.broadcastQueries(),c(t instanceof _n?t:new _n({networkError:t}))}})}))]}}))}))},e.prototype.markMutationResult=function(e,t){var r=this;void 0===t&&(t=this.cache);var n=e.result,i=[],o="no-cache"===e.fetchPolicy;if(!o&&os(n,e.errorPolicy)){if(Mn(n)||i.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Mn(n)&&Sn(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),a=void 0;s.result&&(a=kn(s.result,n)),void 0!==a&&(n.data=a,i.push({result:a,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach((function(e,o){var s=e.observableQuery,a=s&&s.queryName;if(a&&ss.call(u,a)){var c=u[a],l=r.queries.get(o),h=l.document,d=l.variables,f=t.diff({query:h,variables:d,returnPartialData:!0,optimistic:!1}),p=f.result;if(f.complete&&p){var v=c(p,{mutationResult:n,queryName:h&&Nr(h)||void 0,queryVariables:d});v&&i.push({result:v,dataId:"ROOT_QUERY",query:h,variables:d})}}}))}if(i.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var c=[];if(this.refetchQueries({updateCache:function(t){o||i.forEach((function(e){return t.write(e)}));var s,a=e.update,u=!(Mn(s=n)||function(e){return"hasNext"in e&&"data"in e}(s))||Mn(n)&&!n.hasNext;if(a){if(!o){var c=t.diff({id:"ROOT_MUTATION",query:r.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});c.complete&&("incremental"in(n=l(l({},n),{data:c.result}))&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}u&&a(t,n,{context:e.context,variables:e.variables})}o||e.keepRootFields||!u||t.modify({id:"ROOT_MUTATION",fields:function(e,t){var r=t.fieldName,n=t.DELETE;return"__typename"===r?e:n}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach((function(e){return c.push(e)})),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(c).then((function(){return n}))}return Promise.resolve(n)},e.prototype.markMutationOptimistic=function(e,t){var r=this,n="function"==typeof e?e(t.variables):e;return this.cache.recordOptimisticTransaction((function(e){try{r.markMutationResult(l(l({},t),{result:{data:n}}),e)}catch(e){!1!==globalThis.__DEV__&&Yt.error(e)}}),t.mutationId)},e.prototype.fetchQuery=function(e,t,r){return this.fetchConcastWithInfo(e,t,r).concast.promise},e.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,r){e[r]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},e.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},e.prototype.transform=function(e){return this.documentTransform.transformDocument(e)},e.prototype.getDocumentInfo=function(e){var t=this.transformCache;if(!t.has(e)){var r={hasClientExports:ln(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:cn(["nonreactive"],e),clientQuery:this.localState.clientQuery(e),serverQuery:ii([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"}],e),defaultVars:Lr(Pr(e)),asQuery:l(l({},e),{definitions:e.definitions.map((function(e){return"OperationDefinition"===e.kind&&"query"!==e.operation?l(l({},e),{operation:"query"}):e}))})};t.set(e,r)}return t.get(e)},e.prototype.getVariables=function(e,t){return l(l({},this.getDocumentInfo(e).defaultVars),t)},e.prototype.watchQuery=function(e){var t=this.transform(e.query);void 0===(e=l(l({},e),{variables:this.getVariables(t,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var r=new is(this),n=new Zi({queryManager:this,queryInfo:r,options:e});return n.lastQuery=t,this.queries.set(n.queryId,r),r.init({document:t,observableQuery:n,variables:n.variables}),n},e.prototype.query=function(e,t){var r=this;return void 0===t&&(t=this.generateQueryId()),Yt(e.query,28),Yt("Document"===e.query.kind,29),Yt(!e.returnPartialData,30),Yt(!e.pollInterval,31),this.fetchQuery(t,l(l({},e),{query:this.transform(e.query)})).finally((function(){return r.stopQuery(t)}))},e.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},e.prototype.generateRequestId=function(){return this.requestIdCounter++},e.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},e.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},e.prototype.clearStore=function(e){return void 0===e&&(e={discardWatches:!0}),this.cancelPendingFetches(Wt(32)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=Bi.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},e.prototype.getObservableQueries=function(e){var t=this;void 0===e&&(e="active");var r=new Map,n=new Map,i=new Set;return Array.isArray(e)&&e.forEach((function(e){var r;"string"==typeof e?n.set(e,!1):mr(r=e)&&"Document"===r.kind&&Array.isArray(r.definitions)?n.set(t.transform(e),!1):mr(e)&&e.query&&i.add(e)})),this.queries.forEach((function(t,i){var o=t.observableQuery,s=t.document;if(o){if("all"===e)return void r.set(i,o);var a=o.queryName;if("standby"===o.options.fetchPolicy||"active"===e&&!o.hasObservers())return;("active"===e||a&&n.has(a)||s&&n.has(s))&&(r.set(i,o),a&&n.set(a,!0),s&&n.set(s,!0))}})),i.size&&i.forEach((function(e){var n=Vt("legacyOneTimeQuery"),i=t.getQuery(n).init({document:e.query,variables:e.variables}),o=new Zi({queryManager:t,queryInfo:i,options:l(l({},e),{fetchPolicy:"network-only"})});Yt(o.queryId===n),i.setObservableQuery(o),r.set(n,o)})),!1!==globalThis.__DEV__&&n.size&&n.forEach((function(e,t){e||!1!==globalThis.__DEV__&&Yt.warn("string"==typeof t?33:34,t)})),r},e.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.getObservableQueries(e?"all":"active").forEach((function(n,i){var o=n.options.fetchPolicy;n.resetLastResults(),(e||"standby"!==o&&"cache-only"!==o)&&r.push(n.refetch()),t.getQuery(i).setDiff(null)})),this.broadcastQueries(),Promise.all(r)},e.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},e.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,n=e.fetchPolicy,i=e.errorPolicy,o=void 0===i?"none":i,s=e.variables,a=e.context,u=void 0===a?{}:a;r=this.transform(r),s=this.getVariables(r,s);var c=function(e){return t.getObservableFromLink(r,u,e).map((function(i){"no-cache"!==n&&(os(i,o)&&t.cache.write({query:r,result:i.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries());var s=Ni(i),a=function(e){return!!e.extensions&&Array.isArray(e.extensions[gn])}(i);if(s||a){var u={};if(s&&(u.graphQLErrors=i.errors),a&&(u.protocolErrors=i.extensions[gn]),"none"===o||a)throw new _n(u)}return"ignore"===o&&delete i.errors,i}))};if(this.getDocumentInfo(r).hasClientExports){var l=this.localState.addExportedVariables(r,s,u).then(c);return new br((function(e){var t=null;return l.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(s)},e.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},e.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},e.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},e.prototype.getLocalState=function(){return this.localState},e.prototype.getObservableFromLink=function(e,t,r,n){var i,o,s=this;void 0===n&&(n=null!==(i=null==t?void 0:t.queryDeduplication)&&void 0!==i?i:this.queryDeduplication);var a=this.getDocumentInfo(e),u=a.serverQuery,c=a.clientQuery;if(u){var h=this.inFlightLinkObservables,d=this.link,f={query:u,variables:r,operationName:Nr(u)||void 0,context:this.prepareContext(l(l({},t),{forceFetch:!n}))};if(t=f.context,n){var p=Kn(u),v=h.get(p)||new Map;h.set(p,v);var y=ki(r);if(!(o=v.get(y))){var b=new Qi([zr(d,f)]);v.set(y,o=b),b.beforeNext((function(){v.delete(y)&&v.size<1&&h.delete(p)}))}}else o=new Qi([zr(d,f)])}else o=new Qi([br.of({data:{}})]),t=this.prepareContext(t);return c&&(o=Pi(o,(function(e){return s.localState.runResolvers({document:c,remoteResult:e,context:t,variables:r})}))),o},e.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId(),i=this.cache.transformForLink(r.query);return Pi(this.getObservableFromLink(i,r.context,r.variables),(function(o){var s=Ci(o),a=s.length>0;if(n>=e.lastRequestId){if(a&&"none"===r.errorPolicy)throw e.markError(new _n({graphQLErrors:s}));e.markResult(o,i,r,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:Bi.ready};return a&&"ignore"!==r.errorPolicy&&(u.errors=s,u.networkStatus=Bi.error),u}),(function(t){var r=t.hasOwnProperty("graphQLErrors")?t:new _n({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},e.prototype.fetchConcastWithInfo=function(e,t,r,n){var i=this;void 0===r&&(r=Bi.loading),void 0===n&&(n=t.query);var o,s,a=this.getVariables(n,t.variables),u=this.getQuery(e),c=this.defaultOptions.watchQuery,l=t.fetchPolicy,h=void 0===l?c&&c.fetchPolicy||"cache-first":l,d=t.errorPolicy,f=void 0===d?c&&c.errorPolicy||"none":d,p=t.returnPartialData,v=void 0!==p&&p,y=t.notifyOnNetworkStatusChange,b=void 0!==y&&y,m=t.context,g=void 0===m?{}:m,_=Object.assign({},t,{query:n,variables:a,fetchPolicy:h,errorPolicy:f,returnPartialData:v,notifyOnNetworkStatusChange:b,context:g}),O=function(e){_.variables=e;var n=i.fetchQueryByPolicy(u,_,r);return"standby"!==_.fetchPolicy&&n.sources.length>0&&u.observableQuery&&u.observableQuery.applyNextFetchPolicy("after-fetch",t),n},S=function(){return i.fetchCancelFns.delete(e)};if(this.fetchCancelFns.set(e,(function(e){S(),setTimeout((function(){return o.cancel(e)}))})),this.getDocumentInfo(_.query).hasClientExports)o=new Qi(this.localState.addExportedVariables(_.query,_.variables,_.context).then(O).then((function(e){return e.sources}))),s=!0;else{var E=O(_.variables);s=E.fromLink,o=new Qi(E.sources)}return o.promise.then(S,S),{concast:o,fromLink:s}},e.prototype.refetchQueries=function(e){var t=this,r=e.updateCache,n=e.include,i=e.optimistic,o=void 0!==i&&i,s=e.removeOptimistic,a=void 0===s?o?Vt("refetchQueries"):void 0:s,u=e.onQueryUpdated,c=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){c.set(r,{oq:e,lastDiff:t.getQuery(r).getDiff()})}));var l=new Map;return r&&this.cache.batch({update:r,optimistic:o&&a||!1,removeOptimistic:a,onWatchUpdated:function(e,t,r){var n=e.watcher instanceof is&&e.watcher.observableQuery;if(n){if(u){c.delete(n.queryId);var i=u(n,t,r);return!0===i&&(i=n.refetch()),!1!==i&&l.set(n,i),i}null!==u&&c.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),c.size&&c.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,s=e.diff;if(u){if(!s){var a=i.queryInfo;a.reset(),s=a.getDiff()}n=u(i,s,o)}u&&!0!==n||(n=i.refetch()),!1!==n&&l.set(i,n),r.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(r)})),a&&this.cache.removeOptimistic(a),l},e.prototype.fetchQueryByPolicy=function(e,t,r){var n=this,i=t.query,o=t.variables,s=t.fetchPolicy,a=t.refetchWritePolicy,u=t.errorPolicy,c=t.returnPartialData,h=t.context,d=t.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:i,variables:o,networkStatus:r});var p=function(){return e.getDiff()},v=function(t,r){void 0===r&&(r=e.networkStatus||Bi.loading);var s=t.result;!1===globalThis.__DEV__||c||vi(s,{})||ro(t.missing);var a=function(e){return br.of(l({data:e,loading:Vi(r),networkStatus:r},t.complete?null:{partial:!0}))};return s&&n.getDocumentInfo(i).hasForcedResolvers?n.localState.runResolvers({document:i,remoteResult:{data:s},context:h,variables:o,onlyRunForcedResolvers:!0}).then((function(e){return a(e.data||void 0)})):"none"===u&&r===Bi.refetch&&Array.isArray(t.missing)?a(void 0):a(s)},y="no-cache"===s?0:r===Bi.refetch&&"merge"!==a?1:2,b=function(){return n.getResultsFromLink(e,y,{query:i,variables:o,context:h,fetchPolicy:s,errorPolicy:u})},m=d&&"number"==typeof f&&f!==r&&Vi(r);switch(s){default:case"cache-first":return(g=p()).complete?{fromLink:!1,sources:[v(g,e.markReady())]}:c||m?{fromLink:!0,sources:[v(g),b()]}:{fromLink:!0,sources:[b()]};case"cache-and-network":var g;return(g=p()).complete||c||m?{fromLink:!0,sources:[v(g),b()]}:{fromLink:!0,sources:[b()]};case"cache-only":return{fromLink:!1,sources:[v(p(),e.markReady())]};case"network-only":return m?{fromLink:!0,sources:[v(p()),b()]}:{fromLink:!0,sources:[b()]};case"no-cache":return m?{fromLink:!0,sources:[v(e.getDiff()),b()]}:{fromLink:!0,sources:[b()]};case"standby":return{fromLink:!1,sources:[]}}},e.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new is(this,e)),this.queries.get(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return l(l({},t),{clientAwareness:this.clientAwareness})},e}();function us(e,t){return Ui(e,t,t.variables&&{variables:Ui(l(l({},e&&e.variables),t.variables))})}var cs=!1,ls=function(){function e(e){var t=this;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw Wt(15);var r=e.uri,n=e.credentials,i=e.headers,o=e.cache,s=e.documentTransform,a=e.ssrMode,u=void 0!==a&&a,c=e.ssrForceFetchDelay,l=void 0===c?0:c,h=e.connectToDevTools,d=void 0===h?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1!==globalThis.__DEV__:h,f=e.queryDeduplication,p=void 0===f||f,v=e.defaultOptions,y=e.assumeImmutableResults,b=void 0===y?o.assumeImmutableResults:y,m=e.resolvers,g=e.typeDefs,_=e.fragmentMatcher,O=e.name,S=e.version,E=e.link;E||(E=r?new li({uri:r,credentials:n,headers:i}):Ur.empty()),this.link=E,this.cache=o,this.disableNetworkFetches=u||l>0,this.queryDeduplication=p,this.defaultOptions=v||Object.create(null),this.typeDefs=g,l&&setTimeout((function(){return t.disableNetworkFetches=!1}),l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),this.version=qt,this.localState=new es({cache:o,client:this,resolvers:m,fragmentMatcher:_}),this.queryManager=new as({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,documentTransform:s,queryDeduplication:p,ssrMode:u,clientAwareness:{name:O,version:S},localState:this.localState,assumeImmutableResults:b,onBroadcast:d?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0}),d&&this.connectToDevTools()}return e.prototype.connectToDevTools=function(){if("object"==typeof window){var e=window,t=Symbol.for("apollo.devtools");(e[t]=e[t]||[]).push(this),e.__APOLLO_CLIENT__=this}cs||!1===globalThis.__DEV__||(cs=!0,setTimeout((function(){if("undefined"!=typeof window&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__){var e=window.navigator,t=e&&e.userAgent,r=void 0;"string"==typeof t&&(t.indexOf("Chrome/")>-1?r="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":t.indexOf("Firefox/")>-1&&(r="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),r&&!1!==globalThis.__DEV__&&Yt.log("Download the Apollo DevTools for a better development experience: %s",r)}}),1e4))},Object.defineProperty(e.prototype,"documentTransform",{get:function(){return this.queryManager.documentTransform},enumerable:!1,configurable:!0}),e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=us(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=l(l({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=us(this.defaultOptions.query,e)),Yt("cache-and-network"!==e.fetchPolicy,16),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=l(l({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=us(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},e.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},e.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return!1!==e.broadcast&&this.queryManager.broadcastQueries(),t},e.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return!1!==e.broadcast&&this.queryManager.broadcastQueries(),t},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return zr(this.link,e)},e.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore({discardWatches:!1})})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},e.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore({discardWatches:!0})})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},e.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},e.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),r=[],n=[];t.forEach((function(e,t){r.push(t),n.push(e)}));var i=Promise.all(n);return i.queries=r,i.results=n,i.catch((function(e){!1!==globalThis.__DEV__&&Yt.debug(17,e)})),i},e.prototype.getObservableQueries=function(e){return void 0===e&&(e="active"),this.queryManager.getObservableQueries(e)},e.prototype.extract=function(e){return this.cache.extract(e)},e.prototype.restore=function(e){return this.cache.restore(e)},e.prototype.addResolvers=function(e){this.localState.addResolvers(e)},e.prototype.setResolvers=function(e){this.localState.setResolvers(e)},e.prototype.getResolvers=function(){return this.localState.getResolvers()},e.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},e.prototype.setLink=function(e){this.link=this.queryManager.link=e},e}(),hs=function(){function e(){this.assumeImmutableResults=!1,this.getFragmentDoc=Go(gr)}return e.prototype.batch=function(e){var t,r=this,n="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;return this.performTransaction((function(){return t=e.update(r)}),n),t},e.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},e.prototype.transformDocument=function(e){return e},e.prototype.transformForLink=function(e){return e},e.prototype.identify=function(e){},e.prototype.gc=function(){return[]},e.prototype.modify=function(e){return!1},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(l(l({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(l(l({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},e.prototype.writeQuery=function(e){var t=e.id,r=e.data,n=h(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:r}))},e.prototype.writeFragment=function(e){var t=e.id,r=e.data,n=e.fragment,i=e.fragmentName,o=h(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,i),dataId:t,result:r}))},e.prototype.updateQuery=function(e,t){return this.batch({update:function(r){var n=r.readQuery(e),i=t(n);return null==i?n:(r.writeQuery(l(l({},e),{data:i})),i)}})},e.prototype.updateFragment=function(e,t){return this.batch({update:function(r){var n=r.readFragment(e),i=t(n);return null==i?n:(r.writeFragment(l(l({},e),{data:i})),i)}})},e}(),ds=function(e){function t(r,n,i,o){var s,a=e.call(this,r)||this;if(a.message=r,a.path=n,a.query=i,a.variables=o,Array.isArray(a.path)){a.missing=a.message;for(var u=a.path.length-1;u>=0;--u)a.missing=((s={})[a.path[u]]=a.missing,s)}else a.missing=a.path;return a.__proto__=t.prototype,a}return c(t,e),t}(Error);function fs(e){return!1!==globalThis.__DEV__&&(t=e,(r=new Set([t])).forEach((function(e){mr(e)&&function(e){if(!1!==globalThis.__DEV__&&!Object.isFrozen(e))try{Object.freeze(e)}catch(e){if(e instanceof TypeError)return null;throw e}return e}(e)===e&&Object.getOwnPropertyNames(e).forEach((function(t){mr(e[t])&&r.add(e[t])}))}))),e;var t,r}var ps=Object.prototype.hasOwnProperty;function vs(e){return null==e}function ys(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=vs(n)?vs(i)?void 0:{_id:i}:{id:n}),vs(n)&&!vs(i)&&(n=i),!vs(n)))return"".concat(r,":").concat("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))}var bs={dataIdFromObject:ys,addTypename:!0,resultCaching:!0,canonizeResults:!1};function ms(e){var t=e.canonizeResults;return void 0===t?bs.canonizeResults:t}var gs=/^[_a-z][_0-9a-z]*/i;function _s(e){var t=e.match(gs);return t?t[0]:e}function Os(e,t,r){return!!mr(t)&&(On(t)?t.every((function(t){return Os(e,t,r)})):e.selections.every((function(e){if(jr(e)&&un(e,r)){var n=kr(e);return ps.call(t,n)&&(!e.selectionSet||Os(e.selectionSet,t[n],r))}return!0})))}function Ss(e){return mr(e)&&!Er(e)&&!On(e)}function Es(e,t){var r=_r(Cr(e));return{fragmentMap:r,lookupFragment:function(e){var n=r[e];return!n&&t&&(n=t.lookup(e)),n||null}}}var ws=Object.create(null),Ts=function(){return ws},Is=Object.create(null),As=function(){function e(e,t){var r=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(e,t){return fs(Er(e)?r.get(e.__ref,t):e&&e[t])},this.canRead=function(e){return Er(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return Sr(e);if(Er(e))return e;var n=r.policies.identify(e)[0];if(n){var i=Sr(n);return t&&r.merge(n,e),i}}}return e.prototype.toObject=function(){return l({},this.data)},e.prototype.has=function(e){return void 0!==this.lookup(e,!0)},e.prototype.get=function(e,t){if(this.group.depend(e,t),ps.call(this.data,e)){var r=this.data[e];if(r&&ps.call(r,t))return r[t]}return"__typename"===t&&ps.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Ds?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),ps.call(this.data,e)?this.data[e]:this instanceof Ds?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},e.prototype.merge=function(e,t){var r,n=this;Er(e)&&(e=e.__ref),Er(t)&&(t=t.__ref);var i="string"==typeof e?this.lookup(r=e):e,o="string"==typeof t?this.lookup(r=t):t;if(o){Yt("string"==typeof r,1);var s=new An(xs).merge(i,o);if(this.data[r]=s,s!==i&&(delete this.refs[r],this.group.caching)){var a=Object.create(null);i||(a.__exists=1),Object.keys(o).forEach((function(e){if(!i||i[e]!==s[e]){a[e]=1;var t=_s(e);t===e||n.policies.hasKeyArgs(s.__typename,t)||(a[t]=1),void 0!==s[e]||n instanceof Ds||delete s[e]}})),!a.__typename||i&&i.__typename||this.policies.rootTypenamesById[r]!==s.__typename||delete a.__typename,Object.keys(a).forEach((function(e){return n.group.dirty(r,e)}))}}},e.prototype.modify=function(e,t){var r=this,n=this.lookup(e);if(n){var i=Object.create(null),o=!1,s=!0,a={DELETE:ws,INVALIDATE:Is,isReference:Er,toReference:this.toReference,canRead:this.canRead,readField:function(t,n){return r.policies.readField("string"==typeof t?{fieldName:t,from:n||Sr(e)}:t,{store:r})}};if(Object.keys(n).forEach((function(u){var c=_s(u),h=n[u];if(void 0!==h){var d="function"==typeof t?t:t[u]||t[c];if(d){var f=d===Ts?ws:d(fs(h),l(l({},a),{fieldName:c,storeFieldName:u,storage:r.getStorage(e,u)}));if(f===Is)r.group.dirty(e,u);else if(f===ws&&(f=void 0),f!==h&&(i[u]=f,o=!0,h=f,!1!==globalThis.__DEV__)){var p=function(e){if(void 0===r.lookup(e.__ref))return!1!==globalThis.__DEV__&&Yt.warn(2,e),!0};if(Er(f))p(f);else if(Array.isArray(f))for(var v=!1,y=void 0,b=0,m=f;b<m.length;b++){var g=m[b];if(Er(g)){if(v=!0,p(g))break}else"object"==typeof g&&g&&r.policies.identify(g)[0]&&(y=g);if(v&&void 0!==y){!1!==globalThis.__DEV__&&Yt.warn(3,y);break}}}}void 0!==h&&(s=!1)}})),o)return this.merge(e,i),s&&(this instanceof Ds?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},e.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),s=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,s?((n={})[s]=Ts,n):Ts)}return!1},e.prototype.evict=function(e,t){var r=!1;return e.id&&(ps.call(this.data,e.id)&&(r=this.delete(e.id,e.fieldName,e.args)),this instanceof Ds&&this!==t&&(r=this.parent.evict(e,t)||r),(e.fieldName||r)&&this.group.dirty(e.id,e.fieldName||"__exists")),r},e.prototype.clear=function(){this.replace(null)},e.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){ps.call(e.policies.rootTypenamesById,t)||r.push(t)})),r.length&&(t.__META={extraRootIds:r.sort()}),t},e.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach((function(r){e&&ps.call(e,r)||t.delete(r)})),e){var r=e.__META,n=h(e,["__META"]);Object.keys(n).forEach((function(e){t.merge(e,n[e])})),r&&r.extraRootIds.forEach(this.retain,this)}},e.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},e.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},e.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Ds?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},e.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){ps.call(r,n)&&(Object.keys(e.findChildRefIds(n)).forEach(t.add,t),delete r[n])}));var n=Object.keys(r);if(n.length){for(var i=this;i instanceof Ds;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},e.prototype.findChildRefIds=function(e){if(!ps.call(this.refs,e)){var t=this.refs[e]=Object.create(null),r=this.data[e];if(!r)return t;var n=new Set([r]);n.forEach((function(e){Er(e)&&(t[e.__ref]=!0),mr(e)&&Object.keys(e).forEach((function(t){var r=e[t];mr(r)&&n.add(r)}))}))}return this.refs[e]},e.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},e}(),Ms=function(){function e(e,t){void 0===t&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return e.prototype.resetCaching=function(){this.d=this.caching?zo():null,this.keyMaker=new Ii(dn)},e.prototype.depend=function(e,t){if(this.d){this.d(Fs(e,t));var r=_s(t);r!==t&&this.d(Fs(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(Fs(e,t),"__exists"===t?"forget":"setDirty")},e}();function Fs(e,t){return t+"#"+e}function ks(e,t){Ps(e)&&e.group.depend(t,"__exists")}!function(e){var t=function(e){function t(t){var r=t.policies,n=t.resultCaching,i=void 0===n||n,o=t.seed,s=e.call(this,r,new Ms(i))||this;return s.stump=new js(s),s.storageTrie=new Ii(dn),o&&s.replace(o),s}return c(t,e),t.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},t.prototype.removeLayer=function(){return this},t.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},t}(e);e.Root=t}(As||(As={}));var Ds=function(e){function t(t,r,n,i){var o=e.call(this,r.policies,i)||this;return o.id=t,o.parent=r,o.replay=n,o.group=i,n(o),o}return c(t,e),t.prototype.addLayer=function(e,r){return new t(e,this,r,this.group)},t.prototype.removeLayer=function(e){var t=this,r=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach((function(e){var n=t.data[e],i=r.lookup(e);i?n?n!==i&&Object.keys(n).forEach((function(r){vi(n[r],i[r])||t.group.dirty(e,r)})):(t.group.dirty(e,"__exists"),Object.keys(i).forEach((function(r){t.group.dirty(e,r)}))):t.delete(e)})),r):r===this.parent?this:r.addLayer(this.id,this.replay)},t.prototype.toObject=function(){return l(l({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var r=this.parent.findChildRefIds(t);return ps.call(this.data,t)?l(l({},r),e.prototype.findChildRefIds.call(this,t)):r},t.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},t}(As),js=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,(function(){}),new Ms(t.group.caching,t.group))||this}return c(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(e,t){return this.parent.merge(e,t)},t}(Ds);function xs(e,t,r){var n=e[r],i=t[r];return vi(n,i)?n:i}function Ps(e){return!!(e instanceof As&&e.group.caching)}function Ns(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var Cs=function(){function e(e){var t=this;this.knownResults=new(dn?WeakMap:Map),this.config=Ui(e,{addTypename:!1!==e.addTypename,canonizeResults:ms(e)}),this.canon=e.canon||new Fi,this.executeSelectionSet=Go((function(e){var r,n=e.context.canonizeResults,i=Ns(e);i[3]=!n;var o=(r=t.executeSelectionSet).peek.apply(r,i);return o?n?l(l({},o),{result:t.canon.admit(o.result)}):o:(ks(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))}),{max:this.config.resultCacheMaxSize,keyArgs:Ns,makeCacheKey:function(e,t,r,n){if(Ps(r.store))return r.store.makeCacheKey(e,Er(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=Go((function(e){return ks(e.context.store,e.enclosingRef.__ref),t.execSubSelectedArrayImpl(e)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var t=e.field,r=e.array,n=e.context;if(Ps(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return e.prototype.resetCanon=function(){this.canon=new Fi},e.prototype.diffQueryAgainstStore=function(e){var t=e.store,r=e.query,n=e.rootId,i=void 0===n?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,a=void 0===s||s,u=e.canonizeResults,c=void 0===u?this.config.canonizeResults:u,h=this.config.cache.policies;o=l(l({},Lr(Rr(r))),o);var d,f=Sr(i),p=this.executeSelectionSet({selectionSet:qr(r).selectionSet,objectOrReference:f,enclosingRef:f,context:l({store:t,query:r,policies:h,variables:o,varString:ki(o),canonizeResults:c},Es(r,this.config.fragments))});if(p.missing&&(d=[new ds(Rs(p.missing),p.missing,r,o)],!a))throw d[0];return{result:p.result,complete:!d,missing:d}},e.prototype.isFresh=function(e,t,r,n){if(Ps(n.store)&&this.knownResults.get(e)===r){var i=this.executeSelectionSet.peek(r,t,n,this.canon.isKnown(e));if(i&&e===i.result)return!0}return!1},e.prototype.execSelectionSetImpl=function(e){var t=this,r=e.selectionSet,n=e.objectOrReference,i=e.enclosingRef,o=e.context;if(Er(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s,a=o.variables,u=o.policies,c=o.store.getFieldValue(n,"__typename"),l=[],h=new An;function d(e,t){var r;return e.missing&&(s=h.merge(s,((r={})[t]=e.missing,r))),e.result}this.config.addTypename&&"string"==typeof c&&!u.rootIdsByTypename[c]&&l.push({__typename:c});var f=new Set(r.selections);f.forEach((function(e){var r,p;if(un(e,a))if(jr(e)){var v=u.readField({fieldName:e.name.value,field:e,variables:o.variables,from:n},o),y=kr(e);void 0===v?oi.added(e)||(s=h.merge(s,((r={})[y]="Can't find field '".concat(e.name.value,"' on ").concat(Er(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),r))):On(v)?v=d(t.executeSubSelectedArray({field:e,array:v,enclosingRef:i,context:o}),y):e.selectionSet?null!=v&&(v=d(t.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:v,enclosingRef:Er(v)?v:i,context:o}),y)):o.canonizeResults&&(v=t.canon.pass(v)),void 0!==v&&l.push(((p={})[y]=v,p))}else{var b=Or(e,o.lookupFragment);if(!b&&e.kind===rn.FRAGMENT_SPREAD)throw Wt(9,e.name.value);b&&u.fragmentMatches(b,c)&&b.selectionSet.selections.forEach(f.add,f)}}));var p={result:Tn(l),missing:s},v=o.canonizeResults?this.canon.admit(p):fs(p);return v.result&&this.knownResults.set(v.result,r),v},e.prototype.execSubSelectedArrayImpl=function(e){var t,r=this,n=e.field,i=e.array,o=e.enclosingRef,s=e.context,a=new An;function u(e,r){var n;return e.missing&&(t=a.merge(t,((n={})[r]=e.missing,n))),e.result}return n.selectionSet&&(i=i.filter(s.store.canRead)),i=i.map((function(e,t){return null===e?null:On(e)?u(r.executeSubSelectedArray({field:n,array:e,enclosingRef:o,context:s}),t):n.selectionSet?u(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:e,enclosingRef:Er(e)?e:o,context:s}),t):(!1!==globalThis.__DEV__&&function(e,t,r){if(!t.selectionSet){var n=new Set([r]);n.forEach((function(r){mr(r)&&(Yt(!Er(r),10,function(e,t){return Er(t)?e.get(t.__ref,"__typename"):t&&t.__typename}(e,r),t.name.value),Object.values(r).forEach(n.add,n))}))}}(s.store,n,e),e)})),{result:s.canonizeResults?this.canon.admit(i):i,missing:t}},e}();function Rs(e){try{JSON.stringify(e,(function(e,t){if("string"==typeof t)throw t;return t}))}catch(e){return e}}var qs=Object.create(null);function Ls(e){var t=JSON.stringify(e);return qs[t]||(qs[t]=Object.create(null))}function Bs(e){var t=Ls(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,r){var n=function(e,t){return r.readField(t,e)},i=r.keyObject=Vs(e,(function(e){var i=Ys(r.storeObject,e,n);return void 0===i&&t!==r.storeObject&&ps.call(t,e[0])&&(i=Ys(t,e,zs)),Yt(void 0!==i,4,e.join("."),t),i}));return"".concat(r.typename,":").concat(JSON.stringify(i))})}function Qs(e){var t=Ls(e);return t.keyArgsFn||(t.keyArgsFn=function(t,r){var n=r.field,i=r.variables,o=r.fieldName,s=Vs(e,(function(e){var r=e[0],o=r.charAt(0);if("@"!==o)if("$"!==o){if(t)return Ys(t,e)}else{var s=r.slice(1);if(i&&ps.call(i,s)){var a=e.slice(0);return a[0]=s,Ys(i,a)}}else if(n&&Sn(n.directives)){var u=r.slice(1),c=n.directives.find((function(e){return e.name.value===u})),l=c&&Fr(c,i);return l&&Ys(l,e.slice(1))}})),a=JSON.stringify(s);return(t||"{}"!==a)&&(o+=":"+a),o})}function Vs(e,t){var r=new An;return Us(e).reduce((function(e,n){var i,o=t(n);if(void 0!==o){for(var s=n.length-1;s>=0;--s)(i={})[n[s]]=o,o=i;e=r.merge(e,o)}return e}),Object.create(null))}function Us(e){var t=Ls(e);if(!t.paths){var r=t.paths=[],n=[];e.forEach((function(t,i){On(t)?(Us(t).forEach((function(e){return r.push(n.concat(e))})),n.length=0):(n.push(t),On(e[i+1])||(r.push(n.slice(0)),n.length=0))}))}return t.paths}function zs(e,t){return e[t]}function Ys(e,t,r){return r=r||zs,Ws(t.reduce((function e(t,n){return On(t)?t.map((function(t){return e(t,n)})):t&&r(t,n)}),e))}function Ws(e){return mr(e)?On(e)?e.map(Ws):Vs(Object.keys(e).sort(),(function(t){return Ys(e,t)})):e}function $s(e){return void 0!==e.args?e.args:e.field?Fr(e.field,e.variables):null}Ir.setStringify(ki);var Gs=function(){},Hs=function(e,t){return t.fieldName},Ks=function(e,t,r){return(0,r.mergeObjects)(e,t)},Js=function(e,t){return t},Xs=function(){function e(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=l({dataIdFromObject:ys},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return e.prototype.identify=function(e,t){var r,n=this,i=t&&(t.typename||(null===(r=t.storeObject)||void 0===r?void 0:r.__typename))||e.__typename;if(i===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o,s=t&&t.storeObject||e,a=l(l({},t),{typename:i,storeObject:s,readField:t&&t.readField||function(){var e=ea(arguments,s);return n.readField(e,{store:n.cache.data,variables:e.variables})}}),u=i&&this.getTypePolicy(i),c=u&&u.keyFn||this.config.dataIdFromObject;c;){var h=c(l(l({},e),s),a);if(!On(h)){o=h;break}c=Bs(h)}return o=o?String(o):void 0,a.keyObject?[o,a.keyObject]:[o]},e.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach((function(r){var n=e[r],i=n.queryType,o=n.mutationType,s=n.subscriptionType,a=h(n,["queryType","mutationType","subscriptionType"]);i&&t.setRootTypename("Query",r),o&&t.setRootTypename("Mutation",r),s&&t.setRootTypename("Subscription",r),ps.call(t.toBeAdded,r)?t.toBeAdded[r].push(a):t.toBeAdded[r]=[a]}))},e.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function s(e,t){e.merge="function"==typeof t?t:!0===t?Ks:!1===t?Js:e.merge}s(n,t.merge),n.keyFn=!1===i?Gs:On(i)?Bs(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var a=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===a?Hs:On(a)?Qs(a):"function"==typeof a?a:n.keyFn,"function"==typeof u&&(n.read=u),s(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||Hs)}))},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var r="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[r];t!==n&&(Yt(!n||n===e,5,e),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=r,this.rootTypenamesById[r]=t)},e.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach((function(r){t.getSupertypeSet(r,!0),e[r].forEach((function(e){t.getSupertypeSet(e,!0).add(r);var n=e.match(gs);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},e.prototype.getTypePolicy=function(e){var t=this;if(!ps.call(this.typePolicies,e)){var r=this.typePolicies[e]=Object.create(null);r.fields=Object.create(null);var n=this.supertypeMap.get(e);!n&&this.fuzzySubtypes.size&&(n=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach((function(r,i){if(r.test(e)){var o=t.supertypeMap.get(i);o&&o.forEach((function(e){return n.add(e)}))}}))),n&&n.size&&n.forEach((function(e){var n=t.getTypePolicy(e),i=n.fields,o=h(n,["fields"]);Object.assign(r,o),Object.assign(r.fields,i)}))}var i=this.toBeAdded[e];return i&&i.length&&i.splice(0).forEach((function(r){t.updateTypePolicy(e,r)})),this.typePolicies[e]},e.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},e.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},e.prototype.fragmentMatches=function(e,t,r,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),a=[s],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&a.indexOf(t)<0&&a.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=!1,h=0;h<a.length;++h){var d=a[h];if(d.has(o))return s.has(o)||(l&&!1!==globalThis.__DEV__&&Yt.warn(6,t,o),s.add(o)),!0;d.forEach(u),c&&h===a.length-1&&Os(e.selectionSet,r,n)&&(c=!1,l=!0,this.fuzzySubtypes.forEach((function(e,r){var n=t.match(e);n&&n[0]===t&&u(r)})))}return!1},e.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},e.prototype.getStoreFieldName=function(e){var t,r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},a=$s(e);o;){var u=o(a,s);if(!On(u)){t=u||n;break}o=Qs(u)}return void 0===t&&(t=e.field?function(e,t){var r=null;e.directives&&(r={},e.directives.forEach((function(e){r[e.name.value]={},e.arguments&&e.arguments.forEach((function(n){var i=n.name,o=n.value;return wr(r[e.name.value],i,o,t)}))})));var n=null;return e.arguments&&e.arguments.length&&(n={},e.arguments.forEach((function(e){var r=e.name,i=e.value;return wr(n,r,i,t)}))),Ir(e.name.value,n,r)}(e.field,e.variables):Ir(n,$s(e))),!1===t?n:n===_s(t)?t:n+":"+t},e.prototype.readField=function(e,t){var r=e.from;if(r&&(e.field||e.fieldName)){if(void 0===e.typename){var n=t.store.getFieldValue(r,"__typename");n&&(e.typename=n)}var i=this.getStoreFieldName(e),o=_s(i),s=t.store.getFieldValue(r,i),a=this.getFieldPolicy(e.typename,o,!1),u=a&&a.read;if(u){var c=Zs(this,r,e,t,t.store.getStorage(Er(r)?r.__ref:r,i));return Ho.withValue(this.cache,u,[s,c])}return s}},e.prototype.getReadFunction=function(e,t){var r=this.getFieldPolicy(e,t,!1);return r&&r.read},e.prototype.getMergeFunction=function(e,t,r){var n=this.getFieldPolicy(e,t,!1),i=n&&n.merge;return!i&&r&&(i=(n=this.getTypePolicy(r))&&n.merge),i},e.prototype.runMergeFunction=function(e,t,r,n,i){var o=r.field,s=r.typename,a=r.merge;return a===Ks?ta(n.store)(e,t):a===Js?t:(n.overwrite&&(e=void 0),a(e,t,Zs(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},e}();function Zs(e,t,r,n,i){var o=e.getStoreFieldName(r),s=_s(o),a=r.variables||n.variables,u=n.store,c=u.toReference,l=u.canRead;return{args:$s(r),field:r.field||null,fieldName:s,storeFieldName:o,variables:a,isReference:Er,toReference:c,storage:i,cache:e.cache,canRead:l,readField:function(){return e.readField(ea(arguments,t,a),n)},mergeObjects:ta(n.store)}}function ea(e,t,r){var n,i=e[0],o=e[1],s=e.length;return"string"==typeof i?n={fieldName:i,from:s>1?o:t}:(n=l({},i),ps.call(n,"from")||(n.from=t)),!1!==globalThis.__DEV__&&void 0===n.from&&!1!==globalThis.__DEV__&&Yt.warn(7,Ut(Array.from(e))),void 0===n.variables&&(n.variables=r),n}function ta(e){return function(t,r){if(On(t)||On(r))throw Wt(8);if(mr(t)&&mr(r)){var n=e.getFieldValue(t,"__typename"),i=e.getFieldValue(r,"__typename");if(n&&i&&n!==i)return r;if(Er(t)&&Ss(r))return e.merge(t.__ref,r),t;if(Ss(t)&&Er(r))return e.merge(t,r.__ref),r;if(Ss(t)&&Ss(r))return l(l({},t),r)}return r}}function ra(e,t,r){var n="".concat(t).concat(r),i=e.flavors.get(n);return i||e.flavors.set(n,i=e.clientOnly===t&&e.deferred===r?e:l(l({},e),{clientOnly:t,deferred:r})),i}var na=function(){function e(e,t,r){this.cache=e,this.reader=t,this.fragments=r}return e.prototype.writeToStore=function(e,t){var r=this,n=t.query,i=t.result,o=t.dataId,s=t.variables,a=t.overwrite,u=Pr(n),c=new An;s=l(l({},Lr(u)),s);var h=l(l({store:e,written:Object.create(null),merge:function(e,t){return c.merge(e,t)},variables:s,varString:ki(s)},Es(n,this.fragments)),{overwrite:!!a,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),d=this.processSelectionSet({result:i||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:h});if(!Er(d))throw Wt(11,i);return h.incomingById.forEach((function(t,n){var i=t.storeObject,o=t.mergeTree,s=t.fieldNodeSet,a=Sr(n);if(o&&o.map.size){var u=r.applyMerges(o,a,i,h);if(Er(u))return;i=u}if(!1!==globalThis.__DEV__&&!h.overwrite){var c=Object.create(null);s.forEach((function(e){e.selectionSet&&(c[e.name.value]=!0)})),Object.keys(i).forEach((function(e){(function(e){return!0===c[_s(e)]})(e)&&!function(e){var t=o&&o.map.get(e);return Boolean(t&&t.info&&t.info.merge)}(e)&&function(e,t,r,n){var i=function(e){var t=n.getFieldValue(e,r);return"object"==typeof t&&t},o=i(e);if(o){var s=i(t);if(s&&!Er(o)&&!vi(o,s)&&!Object.keys(o).every((function(e){return void 0!==n.getFieldValue(s,e)}))){var a=n.getFieldValue(e,"__typename")||n.getFieldValue(t,"__typename"),u=_s(r),c="".concat(a,".").concat(u);if(!ca.has(c)){ca.add(c);var l=[];On(o)||On(s)||[o,s].forEach((function(e){var t=n.getFieldValue(e,"__typename");"string"!=typeof t||l.includes(t)||l.push(t)})),!1!==globalThis.__DEV__&&Yt.warn(14,u,a,l.length?"either ensure all objects of type "+l.join(" and ")+" have an ID or a custom merge function, or ":"",c,o,s)}}}}(a,i,e,h.store)}))}e.merge(n,i)})),e.retain(d.__ref),d},e.prototype.processSelectionSet=function(e){var t=this,r=e.dataId,n=e.result,i=e.selectionSet,o=e.context,s=e.mergeTree,a=this.cache.policies,u=Object.create(null),c=r&&a.rootTypenamesById[r]||Dr(n,i,o.fragmentMap)||r&&o.store.get(r,"__typename");"string"==typeof c&&(u.__typename=c);var h=function(){var e=ea(arguments,u,o.variables);if(Er(e.from)){var t=o.incomingById.get(e.from.__ref);if(t){var r=a.readField(l(l({},e),{from:t.storeObject}),o);if(void 0!==r)return r}}return a.readField(e,o)},d=new Set;this.flattenFields(i,n,o,c).forEach((function(e,r){var i,o=kr(r),l=n[o];if(d.add(r),void 0!==l){var f=a.getStoreFieldName({typename:c,fieldName:r.name.value,field:r,variables:e.variables}),p=oa(s,f),v=t.processFieldValue(l,r,r.selectionSet?ra(e,!1,!1):e,p),y=void 0;r.selectionSet&&(Er(v)||Ss(v))&&(y=h("__typename",v));var b=a.getMergeFunction(c,r.name.value,y);b?p.info={field:r,typename:c,merge:b}:ua(s,f),u=e.merge(u,((i={})[f]=v,i))}else!1===globalThis.__DEV__||e.clientOnly||e.deferred||oi.added(r)||a.getReadFunction(c,r.name.value)||!1!==globalThis.__DEV__&&Yt.error(12,kr(r),n)}));try{var f=a.identify(n,{typename:c,selectionSet:i,fragmentMap:o.fragmentMap,storeObject:u,readField:h}),p=f[0],v=f[1];r=r||p,v&&(u=o.merge(u,v))}catch(e){if(!r)throw e}if("string"==typeof r){var y=Sr(r),b=o.written[r]||(o.written[r]=[]);if(b.indexOf(i)>=0)return y;if(b.push(i),this.reader&&this.reader.isFresh(n,y,i,o))return y;var m=o.incomingById.get(r);return m?(m.storeObject=o.merge(m.storeObject,u),m.mergeTree=sa(m.mergeTree,s),d.forEach((function(e){return m.fieldNodeSet.add(e)}))):o.incomingById.set(r,{storeObject:u,mergeTree:aa(s)?void 0:s,fieldNodeSet:d}),y}return u},e.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?On(e)?e.map((function(e,o){var s=i.processFieldValue(e,t,r,oa(n,o));return ua(n,o),s})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):!1!==globalThis.__DEV__?Yi(e):e},e.prototype.flattenFields=function(e,t,r,n){void 0===n&&(n=Dr(t,e,r.fragmentMap));var i=new Map,o=this.cache.policies,s=new Ii(!1);return function e(a,u){var c=s.lookup(a,u.clientOnly,u.deferred);c.visited||(c.visited=!0,a.selections.forEach((function(s){if(un(s,r.variables)){var a=u.clientOnly,c=u.deferred;if(a&&c||!Sn(s.directives)||s.directives.forEach((function(e){var t=e.name.value;if("client"===t&&(a=!0),"defer"===t){var n=Fr(e,r.variables);n&&!1===n.if||(c=!0)}})),jr(s)){var l=i.get(s);l&&(a=a&&l.clientOnly,c=c&&l.deferred),i.set(s,ra(r,a,c))}else{var h=Or(s,r.lookupFragment);if(!h&&s.kind===rn.FRAGMENT_SPREAD)throw Wt(13,s.name.value);h&&o.fragmentMatches(h,n,t,r.variables)&&e(h.selectionSet,ra(r,a,c))}}})))}(e,r),i},e.prototype.applyMerges=function(e,t,r,n,i){var o,s=this;if(e.map.size&&!Er(r)){var a,u=On(r)||!Er(t)&&!Ss(t)?void 0:t,c=r;u&&!i&&(i=[Er(u)?u.__ref:u]);var h=function(e,t){return On(e)?"number"==typeof t?e[t]:void 0:n.store.getFieldValue(e,String(t))};e.map.forEach((function(e,t){var r=h(u,t),o=h(c,t);if(void 0!==o){i&&i.push(t);var l=s.applyMerges(e,r,o,n,i);l!==o&&(a=a||new Map).set(t,l),i&&Yt(i.pop()===t)}})),a&&(r=On(c)?c.slice(0):l({},c),a.forEach((function(e,t){r[t]=e})))}return e.info?this.cache.policies.runMergeFunction(t,r,e.info,n,i&&(o=n.store).getStorage.apply(o,i)):r},e}(),ia=[];function oa(e,t){var r=e.map;return r.has(t)||r.set(t,ia.pop()||{map:new Map}),r.get(t)}function sa(e,t){if(e===t||!t||aa(t))return e;if(!e||aa(e))return t;var r=e.info&&t.info?l(l({},e.info),t.info):e.info||t.info,n=e.map.size&&t.map.size,i={info:r,map:n?new Map:e.map.size?e.map:t.map};if(n){var o=new Set(t.map.keys());e.map.forEach((function(e,r){i.map.set(r,sa(e,t.map.get(r))),o.delete(r)})),o.forEach((function(r){i.map.set(r,sa(t.map.get(r),e.map.get(r)))}))}return i}function aa(e){return!e||!(e.info||e.map.size)}function ua(e,t){var r=e.map,n=r.get(t);n&&aa(n)&&(ia.push(n),r.delete(t))}var ca=new Set,la=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.watches=new Set,r.addTypenameTransform=new xi(oi),r.assumeImmutableResults=!0,r.makeVar=Zo,r.txCount=0,r.config=function(e){return Ui(bs,e)}(t),r.addTypename=!!r.config.addTypename,r.policies=new Xs({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return c(t,e),t.prototype.init=function(){var e=this.data=new As.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()},t.prototype.resetResultCache=function(e){var t=this,r=this.storeReader,n=this.config.fragments;this.storeWriter=new na(this,this.storeReader=new Cs({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:ms(this.config),canon:e?void 0:r&&r.canon,fragments:n}),n),this.maybeBroadcastWatch=Go((function(e,r){return t.broadcastWatch(e,r)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var r=e.optimistic?t.optimisticData:t.data;if(Ps(r)){var n=e.optimistic,i=e.id,o=e.variables;return r.makeCacheKey(e.query,e.callback,ki({optimistic:n,id:i,variables:o}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach((function(e){return e.resetCaching()}))},t.prototype.restore=function(e){return this.init(),e&&this.data.replace(e),this},t.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},t.prototype.read=function(e){var t=e.returnPartialData,r=void 0!==t&&t;try{return this.storeReader.diffQueryAgainstStore(l(l({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:r})).result||null}catch(e){if(e instanceof ds)return null;throw e}},t.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.modify=function(e){if(ps.call(e,"id")&&!e.id)return!1;var t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.diff=function(e){return this.storeReader.diffQueryAgainstStore(l(l({},e),{store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",config:this.config}))},t.prototype.watch=function(e){var t,r=this;return this.watches.size||Jo(t=this).vars.forEach((function(e){return e.attachCache(t)})),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){r.watches.delete(e)&&!r.watches.size&&Xo(r),r.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){ki.reset();var t=this.optimisticData.gc();return e&&!this.txCount&&(e.resetResultCache?this.resetResultCache(e.resetResultIdentities):e.resetResultIdentities&&this.storeReader.resetCanon()),t},t.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},t.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},t.prototype.identify=function(e){if(Er(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(e){!1!==globalThis.__DEV__&&Yt.warn(e)}},t.prototype.evict=function(e){if(!e.id){if(ps.call(e,"id"))return!1;e=l(l({},e),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(e,this.data)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.reset=function(e){var t=this;return this.init(),ki.reset(),e&&e.discardWatches?(this.watches.forEach((function(e){return t.maybeBroadcastWatch.forget(e)})),this.watches.clear(),Xo(this)):this.broadcastWatches(),Promise.resolve()},t.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},t.prototype.batch=function(e){var t,r=this,n=e.update,i=e.optimistic,o=void 0===i||i,s=e.removeOptimistic,a=e.onWatchUpdated,u=function(e){var i=r,o=i.data,s=i.optimisticData;++r.txCount,e&&(r.data=r.optimisticData=e);try{return t=n(r)}finally{--r.txCount,r.data=o,r.optimisticData=s}},c=new Set;return a&&!this.txCount&&this.broadcastWatches(l(l({},e),{onWatchUpdated:function(e){return c.add(e),!1}})),"string"==typeof o?this.optimisticData=this.optimisticData.addLayer(o,u):!1===o?u(this.data):u(),"string"==typeof s&&(this.optimisticData=this.optimisticData.removeLayer(s)),a&&c.size?(this.broadcastWatches(l(l({},e),{onWatchUpdated:function(e,t){var r=a.call(this,e,t);return!1!==r&&c.delete(e),r}})),c.size&&c.forEach((function(e){return r.maybeBroadcastWatch.dirty(e)}))):this.broadcastWatches(e),t},t.prototype.performTransaction=function(e,t){return this.batch({update:e,optimistic:t||null!==t})},t.prototype.transformDocument=function(e){return this.addTypenameToDocument(this.addFragmentsToDocument(e))},t.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,e)}))},t.prototype.addFragmentsToDocument=function(e){var t=this.config.fragments;return t?t.transform(e):e},t.prototype.addTypenameToDocument=function(e){return this.addTypename?this.addTypenameTransform.transformDocument(e):e},t.prototype.broadcastWatch=function(e,t){var r=e.lastDiff,n=this.diff(e);t&&(e.optimistic&&"string"==typeof t.optimistic&&(n.fromOptimisticTransaction=!0),t.onWatchUpdated&&!1===t.onWatchUpdated.call(this,e,n,r))||r&&vi(r.result,n.result)||e.callback(e.lastDiff=n,r)},t}(hs);function ha(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const da=/\r\n|[\n\r]/g;function fa(e,t){let r=0,n=1;for(const i of e.body.matchAll(da)){if("number"==typeof i.index||ha(!1),i.index>=t)break;r=i.index+i[0].length,n+=1}return{line:n,column:t+1-r}}function pa(e,t){const r=e.locationOffset.column-1,n="".padStart(r)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=1===t.line?r:0,u=t.column+a,c=`${e.name}:${s}:${u}\n`,l=n.split(/\r\n|[\n\r]/g),h=l[i];if(h.length>120){const e=Math.floor(u/80),t=u%80,r=[];for(let e=0;e<h.length;e+=80)r.push(h.slice(e,e+80));return c+va([[`${s} |`,r[0]],...r.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",r[e+1]]])}return c+va([[s-1+" |",l[i-1]],[`${s} |`,h],["|","^".padStart(u)],[`${s+1} |`,l[i+1]]])}function va(e){const t=e.filter((([e,t])=>void 0!==t)),r=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(r)+(t?" "+t:""))).join("\n")}class ya extends Error{constructor(e,...t){var r,n,i;const{nodes:o,source:s,positions:a,path:u,originalError:c,extensions:l}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=u?u:void 0,this.originalError=null!=c?c:void 0,this.nodes=ba(Array.isArray(o)?o:o?[o]:void 0);const h=ba(null===(r=this.nodes)||void 0===r?void 0:r.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=s?s:null==h||null===(n=h[0])||void 0===n?void 0:n.source,this.positions=null!=a?a:null==h?void 0:h.map((e=>e.start)),this.locations=a&&s?a.map((e=>fa(s,e))):null==h?void 0:h.map((e=>fa(e.source,e.start)));const d="object"==typeof(f=null==c?void 0:c.extensions)&&null!==f?null==c?void 0:c.extensions:void 0;var f;this.extensions=null!==(i=null!=l?l:d)&&void 0!==i?i:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=c&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,ya):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const r of this.nodes)r.loc&&(e+="\n\n"+pa((t=r.loc).source,fa(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+pa(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function ba(e){return void 0===e||0===e.length?void 0:e}function ma(e,t,r){return new ya(`Syntax Error: ${r}`,{source:e,positions:[t]})}var ga,_a,Oa;!function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(ga||(ga={})),(Oa=_a||(_a={})).SOF="<SOF>",Oa.EOF="<EOF>",Oa.BANG="!",Oa.DOLLAR="$",Oa.AMP="&",Oa.PAREN_L="(",Oa.PAREN_R=")",Oa.SPREAD="...",Oa.COLON=":",Oa.EQUALS="=",Oa.AT="@",Oa.BRACKET_L="[",Oa.BRACKET_R="]",Oa.BRACE_L="{",Oa.PIPE="|",Oa.BRACE_R="}",Oa.NAME="Name",Oa.INT="Int",Oa.FLOAT="Float",Oa.STRING="String",Oa.BLOCK_STRING="BlockString",Oa.COMMENT="Comment";class Sa{constructor(e){const t=new Jr(_a.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==_a.EOF)do{if(e.next)e=e.next;else{const t=Fa(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===_a.COMMENT);return e}}function Ea(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function wa(e,t){return Ta(e.charCodeAt(t))&&Ia(e.charCodeAt(t+1))}function Ta(e){return e>=55296&&e<=56319}function Ia(e){return e>=56320&&e<=57343}function Aa(e,t){const r=e.source.body.codePointAt(t);if(void 0===r)return _a.EOF;if(r>=32&&r<=126){const e=String.fromCodePoint(r);return'"'===e?"'\"'":`"${e}"`}return"U+"+r.toString(16).toUpperCase().padStart(4,"0")}function Ma(e,t,r,n,i){const o=e.line,s=1+r-e.lineStart;return new Jr(t,r,n,o,s,i)}function Fa(e,t){const r=e.source.body,n=r.length;let i=t;for(;i<n;){const t=r.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===r.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return ka(e,i);case 33:return Ma(e,_a.BANG,i,i+1);case 36:return Ma(e,_a.DOLLAR,i,i+1);case 38:return Ma(e,_a.AMP,i,i+1);case 40:return Ma(e,_a.PAREN_L,i,i+1);case 41:return Ma(e,_a.PAREN_R,i,i+1);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return Ma(e,_a.SPREAD,i,i+3);break;case 58:return Ma(e,_a.COLON,i,i+1);case 61:return Ma(e,_a.EQUALS,i,i+1);case 64:return Ma(e,_a.AT,i,i+1);case 91:return Ma(e,_a.BRACKET_L,i,i+1);case 93:return Ma(e,_a.BRACKET_R,i,i+1);case 123:return Ma(e,_a.BRACE_L,i,i+1);case 124:return Ma(e,_a.PIPE,i,i+1);case 125:return Ma(e,_a.BRACE_R,i,i+1);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?La(e,i):xa(e,i)}if(Nn(t)||45===t)return Da(e,i,t);if(Rn(t))return Ba(e,i);throw ma(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":Ea(t)||wa(r,i)?`Unexpected character: ${Aa(e,i)}.`:`Invalid character: ${Aa(e,i)}.`)}return Ma(e,_a.EOF,n,n)}function ka(e,t){const r=e.source.body,n=r.length;let i=t+1;for(;i<n;){const e=r.charCodeAt(i);if(10===e||13===e)break;if(Ea(e))++i;else{if(!wa(r,i))break;i+=2}}return Ma(e,_a.COMMENT,t,i,r.slice(t+1,i))}function Da(e,t,r){const n=e.source.body;let i=t,o=r,s=!1;if(45===o&&(o=n.charCodeAt(++i)),48===o){if(o=n.charCodeAt(++i),Nn(o))throw ma(e.source,i,`Invalid number, unexpected digit after 0: ${Aa(e,i)}.`)}else i=ja(e,i,o),o=n.charCodeAt(i);if(46===o&&(s=!0,o=n.charCodeAt(++i),i=ja(e,i,o),o=n.charCodeAt(i)),69!==o&&101!==o||(s=!0,o=n.charCodeAt(++i),43!==o&&45!==o||(o=n.charCodeAt(++i)),i=ja(e,i,o),o=n.charCodeAt(i)),46===o||Rn(o))throw ma(e.source,i,`Invalid number, expected digit but got: ${Aa(e,i)}.`);return Ma(e,s?_a.FLOAT:_a.INT,t,i,n.slice(t,i))}function ja(e,t,r){if(!Nn(r))throw ma(e.source,t,`Invalid number, expected digit but got: ${Aa(e,t)}.`);const n=e.source.body;let i=t+1;for(;Nn(n.charCodeAt(i));)++i;return i}function xa(e,t){const r=e.source.body,n=r.length;let i=t+1,o=i,s="";for(;i<n;){const n=r.charCodeAt(i);if(34===n)return s+=r.slice(o,i),Ma(e,_a.STRING,t,i+1,s);if(92!==n){if(10===n||13===n)break;if(Ea(n))++i;else{if(!wa(r,i))throw ma(e.source,i,`Invalid character within String: ${Aa(e,i)}.`);i+=2}}else{s+=r.slice(o,i);const t=117===r.charCodeAt(i+1)?123===r.charCodeAt(i+2)?Pa(e,i):Na(e,i):qa(e,i);s+=t.value,i+=t.size,o=i}}throw ma(e.source,i,"Unterminated string.")}function Pa(e,t){const r=e.source.body;let n=0,i=3;for(;i<12;){const e=r.charCodeAt(t+i++);if(125===e){if(i<5||!Ea(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|Ra(e),n<0)break}throw ma(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+i)}".`)}function Na(e,t){const r=e.source.body,n=Ca(r,t+2);if(Ea(n))return{value:String.fromCodePoint(n),size:6};if(Ta(n)&&92===r.charCodeAt(t+6)&&117===r.charCodeAt(t+7)){const e=Ca(r,t+8);if(Ia(e))return{value:String.fromCodePoint(n,e),size:12}}throw ma(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+6)}".`)}function Ca(e,t){return Ra(e.charCodeAt(t))<<12|Ra(e.charCodeAt(t+1))<<8|Ra(e.charCodeAt(t+2))<<4|Ra(e.charCodeAt(t+3))}function Ra(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function qa(e,t){const r=e.source.body;switch(r.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw ma(e.source,t,`Invalid character escape sequence: "${r.slice(t,t+2)}".`)}function La(e,t){const r=e.source.body,n=r.length;let i=e.lineStart,o=t+3,s=o,a="";const u=[];for(;o<n;){const n=r.charCodeAt(o);if(34===n&&34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)){a+=r.slice(s,o),u.push(a);const n=Ma(e,_a.BLOCK_STRING,t,o+3,qn(u).join("\n"));return e.line+=u.length-1,e.lineStart=i,n}if(92!==n||34!==r.charCodeAt(o+1)||34!==r.charCodeAt(o+2)||34!==r.charCodeAt(o+3))if(10!==n&&13!==n)if(Ea(n))++o;else{if(!wa(r,o))throw ma(e.source,o,`Invalid character within String: ${Aa(e,o)}.`);o+=2}else a+=r.slice(s,o),u.push(a),13===n&&10===r.charCodeAt(o+1)?o+=2:++o,a="",s=o,i=o;else a+=r.slice(s,o),s=o+1,o+=4}throw ma(e.source,o,"Unterminated string.")}function Ba(e,t){const r=e.source.body,n=r.length;let i=t+1;for(;i<n&&(Cn(o=r.charCodeAt(i))||Nn(o)||95===o);)++i;var o;return Ma(e,_a.NAME,t,i,r.slice(t,i))}class Qa{constructor(e,t="GraphQL request",r={line:1,column:1}){"string"==typeof e||Yr(!1,`Body must be a string. Received: ${Gr(e)}.`),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||Yr(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Yr(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class Va{constructor(e,t={}){const r=function(e){return e instanceof Qa}(e)?e:new Qa(e);this._lexer=new Sa(r),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(_a.NAME);return this.node(e,{kind:rn.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:rn.DOCUMENT,definitions:this.many(_a.SOF,this.parseDefinition,_a.EOF)})}parseDefinition(){if(this.peek(_a.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===_a.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw ma(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(_a.BRACE_L))return this.node(e,{kind:rn.OPERATION_DEFINITION,operation:tn.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let r;return this.peek(_a.NAME)&&(r=this.parseName()),this.node(e,{kind:rn.OPERATION_DEFINITION,operation:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(_a.NAME);switch(e.value){case"query":return tn.QUERY;case"mutation":return tn.MUTATION;case"subscription":return tn.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(_a.PAREN_L,this.parseVariableDefinition,_a.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:rn.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(_a.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(_a.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(_a.DOLLAR),this.node(e,{kind:rn.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:rn.SELECTION_SET,selections:this.many(_a.BRACE_L,this.parseSelection,_a.BRACE_R)})}parseSelection(){return this.peek(_a.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let r,n;return this.expectOptionalToken(_a.COLON)?(r=t,n=this.parseName()):n=t,this.node(e,{kind:rn.FIELD,alias:r,name:n,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(_a.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(_a.PAREN_L,t,_a.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,r=this.parseName();return this.expectToken(_a.COLON),this.node(t,{kind:rn.ARGUMENT,name:r,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(_a.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(_a.NAME)?this.node(e,{kind:rn.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:rn.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:rn.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:rn.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case _a.BRACKET_L:return this.parseList(e);case _a.BRACE_L:return this.parseObject(e);case _a.INT:return this.advanceLexer(),this.node(t,{kind:rn.INT,value:t.value});case _a.FLOAT:return this.advanceLexer(),this.node(t,{kind:rn.FLOAT,value:t.value});case _a.STRING:case _a.BLOCK_STRING:return this.parseStringLiteral();case _a.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:rn.BOOLEAN,value:!0});case"false":return this.node(t,{kind:rn.BOOLEAN,value:!1});case"null":return this.node(t,{kind:rn.NULL});default:return this.node(t,{kind:rn.ENUM,value:t.value})}case _a.DOLLAR:if(e){if(this.expectToken(_a.DOLLAR),this._lexer.token.kind===_a.NAME){const e=this._lexer.token.value;throw ma(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:rn.STRING,value:e.value,block:e.kind===_a.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:rn.LIST,values:this.any(_a.BRACKET_L,(()=>this.parseValueLiteral(e)),_a.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:rn.OBJECT,fields:this.any(_a.BRACE_L,(()=>this.parseObjectField(e)),_a.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,r=this.parseName();return this.expectToken(_a.COLON),this.node(t,{kind:rn.OBJECT_FIELD,name:r,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(_a.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(_a.AT),this.node(t,{kind:rn.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(_a.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(_a.BRACKET_R),t=this.node(e,{kind:rn.LIST_TYPE,type:r})}else t=this.parseNamedType();return this.expectOptionalToken(_a.BANG)?this.node(e,{kind:rn.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:rn.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(_a.STRING)||this.peek(_a.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),n=this.many(_a.BRACE_L,this.parseOperationTypeDefinition,_a.BRACE_R);return this.node(e,{kind:rn.SCHEMA_DEFINITION,description:t,directives:r,operationTypes:n})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(_a.COLON);const r=this.parseNamedType();return this.node(e,{kind:rn.OPERATION_TYPE_DEFINITION,operation:t,type:r})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),n=this.parseConstDirectives();return this.node(e,{kind:rn.SCALAR_TYPE_DEFINITION,description:t,name:r,directives:n})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:rn.OBJECT_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:i,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(_a.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(_a.BRACE_L,this.parseFieldDefinition,_a.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName(),n=this.parseArgumentDefs();this.expectToken(_a.COLON);const i=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:rn.FIELD_DEFINITION,description:t,name:r,arguments:n,type:i,directives:o})}parseArgumentDefs(){return this.optionalMany(_a.PAREN_L,this.parseInputValueDef,_a.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName();this.expectToken(_a.COLON);const n=this.parseTypeReference();let i;this.expectOptionalToken(_a.EQUALS)&&(i=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:rn.INPUT_VALUE_DEFINITION,description:t,name:r,type:n,defaultValue:i,directives:o})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:rn.INTERFACE_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:i,fields:o})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:rn.UNION_TYPE_DEFINITION,description:t,name:r,directives:n,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(_a.EQUALS)?this.delimitedMany(_a.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:rn.ENUM_TYPE_DEFINITION,description:t,name:r,directives:n,values:i})}parseEnumValuesDefinition(){return this.optionalMany(_a.BRACE_L,this.parseEnumValueDefinition,_a.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseEnumValueName(),n=this.parseConstDirectives();return this.node(e,{kind:rn.ENUM_VALUE_DEFINITION,description:t,name:r,directives:n})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw ma(this._lexer.source,this._lexer.token.start,`${Ua(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:rn.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:r,directives:n,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(_a.BRACE_L,this.parseInputValueDef,_a.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===_a.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),r=this.optionalMany(_a.BRACE_L,this.parseOperationTypeDefinition,_a.BRACE_R);if(0===t.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:rn.SCHEMA_EXTENSION,directives:t,operationTypes:r})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),r=this.parseConstDirectives();if(0===r.length)throw this.unexpected();return this.node(e,{kind:rn.SCALAR_TYPE_EXTENSION,name:t,directives:r})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),r=this.parseImplementsInterfaces(),n=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===r.length&&0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:rn.OBJECT_TYPE_EXTENSION,name:t,interfaces:r,directives:n,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),r=this.parseImplementsInterfaces(),n=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===r.length&&0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:rn.INTERFACE_TYPE_EXTENSION,name:t,interfaces:r,directives:n,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),r=this.parseConstDirectives(),n=this.parseUnionMemberTypes();if(0===r.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:rn.UNION_TYPE_EXTENSION,name:t,directives:r,types:n})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),r=this.parseConstDirectives(),n=this.parseEnumValuesDefinition();if(0===r.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:rn.ENUM_TYPE_EXTENSION,name:t,directives:r,values:n})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),r=this.parseConstDirectives(),n=this.parseInputFieldsDefinition();if(0===r.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:rn.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:r,fields:n})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(_a.AT);const r=this.parseName(),n=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:rn.DIRECTIVE_DEFINITION,description:t,name:r,arguments:n,repeatable:i,locations:o})}parseDirectiveLocations(){return this.delimitedMany(_a.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(ga,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new Kr(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw ma(this._lexer.source,t.start,`Expected ${za(e)}, found ${Ua(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==_a.NAME||t.value!==e)throw ma(this._lexer.source,t.start,`Expected "${e}", found ${Ua(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===_a.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return ma(this._lexer.source,t.start,`Unexpected ${Ua(t)}.`)}any(e,t,r){this.expectToken(e);const n=[];for(;!this.expectOptionalToken(r);)n.push(t.call(this));return n}optionalMany(e,t,r){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(r));return e}return[]}many(e,t,r){this.expectToken(e);const n=[];do{n.push(t.call(this))}while(!this.expectOptionalToken(r));return n}delimitedMany(e,t){this.expectOptionalToken(e);const r=[];do{r.push(t.call(this))}while(this.expectOptionalToken(e));return r}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(void 0!==e&&t.kind!==_a.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw ma(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function Ua(e){const t=e.value;return za(e.kind)+(null!=t?` "${t}"`:"")}function za(e){return function(e){return e===_a.BANG||e===_a.DOLLAR||e===_a.AMP||e===_a.PAREN_L||e===_a.PAREN_R||e===_a.SPREAD||e===_a.COLON||e===_a.EQUALS||e===_a.AT||e===_a.BRACKET_L||e===_a.BRACKET_R||e===_a.BRACE_L||e===_a.PIPE||e===_a.BRACE_R}(e)?`"${e}"`:e}var Ya=new Map,Wa=new Map,$a=!0,Ga=!1;function Ha(e){return e.replace(/[\s,]+/g," ").trim()}function Ka(e){var t,r,n,i=Ha(e);if(!Ya.has(i)){var o=function(e,t){return new Va(e,t).parseDocument()}(e,{experimentalFragmentVariables:Ga,allowLegacyFragmentVariables:Ga});if(!o||"Document"!==o.kind)throw new Error("Not a valid GraphQL document.");Ya.set(i,function(e){var t=new Set(e.definitions);t.forEach((function(e){e.loc&&delete e.loc,Object.keys(e).forEach((function(r){var n=e[r];n&&"object"==typeof n&&t.add(n)}))}));var r=e.loc;return r&&(delete r.startToken,delete r.endToken),e}((t=o,r=new Set,n=[],t.definitions.forEach((function(e){if("FragmentDefinition"===e.kind){var t=e.name.value,i=Ha((s=e.loc).source.body.substring(s.start,s.end)),o=Wa.get(t);o&&!o.has(i)?$a&&console.warn("Warning: fragment with name "+t+" already exists.\ngraphql-tag enforces all fragment names across your application to be unique; read more about\nthis in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"):o||Wa.set(t,o=new Set),o.add(i),r.has(i)||(r.add(i),n.push(e))}else n.push(e);var s})),l(l({},t),{definitions:n}))))}return Ya.get(i)}function Ja(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];"string"==typeof e&&(e=[e]);var n=e[0];return t.forEach((function(t,r){t&&"Document"===t.kind?n+=t.loc.source.body:n+=t,n+=e[r+1]})),Ka(n)}var Xa,Za=Ja;(Xa=Ja||(Ja={})).gql=Za,Xa.resetCaches=function(){Ya.clear(),Wa.clear()},Xa.disableFragmentWarnings=function(){$a=!1},Xa.enableExperimentalFragmentVariables=function(){Ga=!0},Xa.disableExperimentalFragmentVariables=function(){Ga=!1},Ja.default=Ja;const eu=["aiData","api","application","application-kotlin","backend-function","extraction","internal-storage","internalCodeExecutor","mutation","named-query","native-query","observability","openapi","query","queue","quota","secret","storage","webhooks","ws"];function tu(e,t,r){const n=new URL("https://squid.cloud");n.host=`${t}.${e}.${n.host}`;const i=r.replace(/^\//g,"").split("/")[0]||"";ru(e)&&(n.protocol="http",n.port=eu.includes(i)?"8001":"8000",function(e){return/android$/.test(e)}(e)?n.host="10.0.2.2":function(e){return/ios$/.test(e)}(e)&&(n.host="localhost"));const o=n.toString();r=r.startsWith("/")?r.slice(1):r;const s=o.replace(/\/$/g,"");return r.length?`${s}/${r}`:s}function ru(e){return/^local/.test(e)}class nu{constructor(e,t,r,n){this.rpcManager=e,this.region=r,this.appId=n;const i=tu(this.region,this.appId,`${t}/graphql`);this.client=new ls({link:new li({uri:i,headers:this.rpcManager.getStaticHeaders()}),cache:new la})}async query(e){return(await this.client.query({query:Ja`
|
|
1
|
+
(()=>{"use strict";var e={9273:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5150:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});const o=r(5642);t.default=o.PromisePool,i(r(9273),t),i(r(5642),t),i(r(7837),t),i(r(2426),t),i(r(6858),t),i(r(1172),t)},7837:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePoolError=void 0;class r extends Error{constructor(e,t){super(),this.raw=e,this.item=t,this.name=this.constructor.name,this.message=this.messageFrom(e),Error.captureStackTrace(this,this.constructor)}static createFrom(e,t){return new this(e,t)}messageFrom(e){return e instanceof Error||"object"==typeof e?e.message:"string"==typeof e||"number"==typeof e?e.toString():""}}t.PromisePoolError=r},234:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePoolExecutor=void 0;const n=r(5642),i=r(7837),o=r(6858),s=r(1172);t.PromisePoolExecutor=class{constructor(){this.meta={tasks:[],items:[],errors:[],results:[],stopped:!1,concurrency:10,shouldResultsCorrespond:!1,processedItems:[],taskTimeout:0},this.handler=()=>{},this.errorHandler=void 0,this.onTaskStartedHandlers=[],this.onTaskFinishedHandlers=[]}useConcurrency(e){if(!this.isValidConcurrency(e))throw s.ValidationError.createFrom(`"concurrency" must be a number, 1 or up. Received "${e}" (${typeof e})`);return this.meta.concurrency=e,this}isValidConcurrency(e){return"number"==typeof e&&e>=1}withTaskTimeout(e){return this.meta.taskTimeout=e,this}concurrency(){return this.meta.concurrency}useCorrespondingResults(e){return this.meta.shouldResultsCorrespond=e,this}shouldUseCorrespondingResults(){return this.meta.shouldResultsCorrespond}taskTimeout(){return this.meta.taskTimeout}for(e){return this.meta.items=e,this}items(){return this.meta.items}itemsCount(){return this.items().length}tasks(){return this.meta.tasks}activeTaskCount(){return this.activeTasksCount()}activeTasksCount(){return this.tasks().length}processedItems(){return this.meta.processedItems}processedCount(){return this.processedItems().length}processedPercentage(){return this.processedCount()/this.itemsCount()*100}results(){return this.meta.results}errors(){return this.meta.errors}withHandler(e){return this.handler=e,this}hasErrorHandler(){return!!this.errorHandler}handleError(e){return this.errorHandler=e,this}onTaskStarted(e){return this.onTaskStartedHandlers=e,this}onTaskFinished(e){return this.onTaskFinishedHandlers=e,this}hasReachedConcurrencyLimit(){return this.activeTasksCount()>=this.concurrency()}stop(){throw this.markAsStopped(),new o.StopThePromisePoolError}markAsStopped(){return this.meta.stopped=!0,this}isStopped(){return this.meta.stopped}async start(){return await this.validateInputs().prepareResultsArray().process()}validateInputs(){if("function"!=typeof this.handler)throw s.ValidationError.createFrom("The first parameter for the .process(fn) method must be a function");const e=this.taskTimeout();if(!(null==e||"number"==typeof e&&e>=0))throw s.ValidationError.createFrom(`"timeout" must be undefined or a number. A number must be 0 or up. Received "${String(e)}" (${typeof e})`);if(!Array.isArray(this.items()))throw s.ValidationError.createFrom(`"items" must be an array. Received "${typeof this.items()}"`);if(this.errorHandler&&"function"!=typeof this.errorHandler)throw s.ValidationError.createFrom(`The error handler must be a function. Received "${typeof this.errorHandler}"`);return this.onTaskStartedHandlers.forEach((e=>{if(e&&"function"!=typeof e)throw s.ValidationError.createFrom(`The onTaskStarted handler must be a function. Received "${typeof e}"`)})),this.onTaskFinishedHandlers.forEach((e=>{if(e&&"function"!=typeof e)throw s.ValidationError.createFrom(`The error handler must be a function. Received "${typeof e}"`)})),this}prepareResultsArray(){return this.shouldUseCorrespondingResults()&&(this.meta.results=Array(this.items().length).fill(n.PromisePool.notRun)),this}async process(){for(const[e,t]of this.items().entries()){if(this.isStopped())break;await this.waitForProcessingSlot(),this.startProcessing(t,e)}return await this.drained()}async waitForProcessingSlot(){for(;this.hasReachedConcurrencyLimit();)await this.waitForActiveTaskToFinish()}async waitForActiveTaskToFinish(){await Promise.race(this.tasks())}startProcessing(e,t){const r=this.createTaskFor(e,t).then((e=>{this.save(e,t).removeActive(r)})).catch((async n=>{await this.handleErrorFor(n,e,t),this.removeActive(r)})).finally((()=>{this.processedItems().push(e),this.runOnTaskFinishedHandlers(e)}));this.tasks().push(r),this.runOnTaskStartedHandlers(e)}async createTaskFor(e,t){return void 0===this.taskTimeout()?this.handler(e,t,this):Promise.race([this.handler(e,t,this),this.createTaskTimeout(e)])}async createTaskTimeout(e){return new Promise(((t,r)=>{setTimeout((()=>{r(new i.PromisePoolError(`Promise in pool timed out after ${this.taskTimeout()}ms`,e))}),this.taskTimeout())}))}save(e,t){return this.shouldUseCorrespondingResults()?this.results()[t]=e:this.results().push(e),this}removeActive(e){return this.tasks().splice(this.tasks().indexOf(e),1),this}async handleErrorFor(e,t,r){if(this.shouldUseCorrespondingResults()&&(this.results()[r]=n.PromisePool.failed),!this.isStoppingThePoolError(e)){if(this.isValidationError(e))throw this.markAsStopped(),e;this.hasErrorHandler()?await this.runErrorHandlerFor(e,t):this.saveErrorFor(e,t)}}isStoppingThePoolError(e){return e instanceof o.StopThePromisePoolError}isValidationError(e){return e instanceof s.ValidationError}async runErrorHandlerFor(e,t){var r;try{await(null===(r=this.errorHandler)||void 0===r?void 0:r.call(this,e,t,this))}catch(e){this.rethrowIfNotStoppingThePool(e)}}runOnTaskStartedHandlers(e){this.onTaskStartedHandlers.forEach((t=>{t(e,this)}))}runOnTaskFinishedHandlers(e){this.onTaskFinishedHandlers.forEach((t=>{t(e,this)}))}rethrowIfNotStoppingThePool(e){if(!this.isStoppingThePoolError(e))throw e}saveErrorFor(e,t){this.errors().push(i.PromisePoolError.createFrom(e,t))}async drained(){return await this.drainActiveTasks(),{errors:this.errors(),results:this.results()}}async drainActiveTasks(){await Promise.all(this.tasks())}}},5642:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePool=void 0;const n=r(234);class i{constructor(e){this.timeout=void 0,this.concurrency=10,this.shouldResultsCorrespond=!1,this.items=null!=e?e:[],this.errorHandler=void 0,this.onTaskStartedHandlers=[],this.onTaskFinishedHandlers=[]}withConcurrency(e){return this.concurrency=e,this}static withConcurrency(e){return(new this).withConcurrency(e)}withTaskTimeout(e){return this.timeout=e,this}static withTaskTimeout(e){return(new this).withTaskTimeout(e)}for(e){return"number"==typeof this.timeout?new i(e).withConcurrency(this.concurrency).withTaskTimeout(this.timeout):new i(e).withConcurrency(this.concurrency)}static for(e){return(new this).for(e)}handleError(e){return this.errorHandler=e,this}onTaskStarted(e){return this.onTaskStartedHandlers.push(e),this}onTaskFinished(e){return this.onTaskFinishedHandlers.push(e),this}useCorrespondingResults(){return this.shouldResultsCorrespond=!0,this}async process(e){return(new n.PromisePoolExecutor).useConcurrency(this.concurrency).useCorrespondingResults(this.shouldResultsCorrespond).withTaskTimeout(this.timeout).withHandler(e).handleError(this.errorHandler).onTaskStarted(this.onTaskStartedHandlers).onTaskFinished(this.onTaskFinishedHandlers).for(this.items).start()}}t.PromisePool=i,i.notRun=Symbol("notRun"),i.failed=Symbol("failed")},2426:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6858:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StopThePromisePoolError=void 0;class r extends Error{}t.StopThePromisePoolError=r},1172:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValidationError=void 0;class r extends Error{constructor(e){super(e),Error.captureStackTrace(this,this.constructor)}static createFrom(e){return new this(e)}}t.ValidationError=r},5036:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4077),t)},6373:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callValueAssertion=t.assertRecord=t.assertArray=t.assertObject=t.getErrorMessage=t.getAssertionErrorFromProvider=t.fail=t.truthy=t.assertTruthy=void 0;const n=r(4665),i=r(1333);function o(e,t){e||s(t)}function s(e){const t=a(e);if("object"==typeof t)throw t;throw new Error(t||"Assertion error")}function a(e){return void 0===e?"":"string"==typeof e?e:e()}function u(e){const t=a(e);return"string"==typeof t?t:t.message||"<no error message>"}function c(e,t,r=void 0,n={}){const i=()=>u(r),s=e=>{const t=i();return 0===t.length?e:`${t} ${e}`};o("object"==typeof e,(()=>s("is not an object: "+typeof e))),o(void 0!==e,(()=>s("is not defined"))),o(null!==e,(()=>s("is null"))),o(!Array.isArray(e),(()=>s("is an array.")));const a=Object.entries(t);if(n.failOnUnknownFields){const t=n.allowedUnknownFieldNames||[];for(const r in e)o(t.includes(r)||a.some((([e])=>r===e)),s(`property can't be checked: ${r}`))}let l;for(const[t,r]of a){o("function"==typeof r||"object"==typeof r&&null!==r,(()=>`${i()}.${t} assertion is not an object or a function: ${typeof r}`));const n=e[t],s=()=>`${i()}.${t}`;if("object"==typeof r)o(!Array.isArray(n),(()=>`${i()}.${s()} use arrayAssertion() to create a ValueAssertion for an array`)),c(n,r,s);else if(o("function"==typeof r,(()=>`${i()}.${s()} assertion is not a function`)),"$o"===t)l=r;else{const e=r(n,s);o(void 0===e,`Assertion function must assert (void) but it returns a value: ${e}. Wrap with $u()?`)}}l&&l(e,r)}function l(e,t,r){t(e,r)}function h(e){return(t="with-space-separator")=>{const r=u(e);return r?`${r}${"with-space-separator"===t?" ":""}`:""}}function d(e,t,r){"object"==typeof t?(o(!Array.isArray(e),(()=>`${r}: use arrayAssertion() to create a ValueAssertion for an array`)),c(e,t,r)):l(e,t,r)}t.assertTruthy=o,t.truthy=function(e,t){return o(e,t),e},t.fail=s,t.getAssertionErrorFromProvider=a,t.getErrorMessage=u,t.assertObject=c,t.assertArray=function(e,t,r={},i=void 0){var s,a;const u=h(i);o(Array.isArray(e),(()=>`${u()}value is not an array: ${e}`));const c=null!==(s=r.minLength)&&void 0!==s?s:0,l=null!==(a=r.maxLength)&&void 0!==a?a:1/0;o(e.length>=c,(()=>`${u()}array length < minLength. Array length: ${e.length}, minLength: ${c}`)),o(e.length<=l,(()=>`${u()}array length > maxLength. Array length: ${e.length}, maxLength: ${l}`)),r.uniqueByIdentity&&o((0,n.checkArrayHasUniqueElements)(e,r.uniqueByIdentity),(()=>`${u()}array contains non-unique elements`));let f=0;const p=()=>`${u("no-space-separator")}[${f}]`;for(;f<e.length;f++)d(e[f],t,p)},t.assertRecord=function(e,t,r={},n=void 0){const s=h(n);o("object"==typeof e,(()=>`${s()}value is not an object: ${(0,i.formatValue)(e)}`)),o(null!==e,(()=>`${s()}value is null`)),o(!Array.isArray(e),(()=>`${s()}the value is not a record, but is an array`));for(const[n,a]of Object.entries(e)){const e=()=>`${s("no-space-separator")}['${n}']`;r.keyAssertion&&d(n,r.keyAssertion,(()=>`${e()}, key assertion failed:`)),d(a,t,e);const{keyField:u}=r;if(u){o("object"==typeof a&&null!==a,(()=>`${e()} is not an object: ${(0,i.formatValue)(a)}`));const t=a[u];o(t===n,(()=>`${e()} key value does not match object field '${u}' value: ${(0,i.formatValue)(t)}`))}}r.$o&&r.$o(e,n)},t.callValueAssertion=l},8596:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.stringAssertion=t.nullOr=t.undefinedOr=t.valueOr=t.$u=t.$a=t.recordAssertion=t.arrayAssertion=t.objectAssertion=void 0;const n=r(6373),i=r(1333);function o(e,t){return(0,n.assertTruthy)("function"==typeof e,`"check" is not a function: ${e}`),(r,i=void 0)=>(0,n.assertTruthy)(e(r),(()=>{let e=(0,n.getErrorMessage)(i)||"Check is failed";return e.endsWith(":")||(e+=":"),`${e} ${(0,n.getErrorMessage)(t)||("object"==typeof r?"[object]":`'${r}'`)}`}))}function s(e,t){return(r,i=void 0)=>{r!==e&&("object"==typeof t?(0,n.assertObject)(r,t,i):(0,n.callValueAssertion)(r,t,i))}}t.objectAssertion=function(e,t=void 0){return r=>(0,n.assertObject)(r,e,t)},t.arrayAssertion=function(e,t={}){const{minLength:r,maxLength:i}=t;return(0,n.assertTruthy)((null!=r?r:0)<=(null!=i?i:1/0),`minLength must be < maxLength! minLength ${r}, maxLength: ${i}`),(0,n.assertTruthy)((null!=r?r:0)>=0,`minLength must be a positive number: ${r}`),(0,n.assertTruthy)((null!=i?i:0)>=0,`maxLength must be a positive number: ${i}`),(r,i=void 0)=>{(0,n.assertArray)(r,e,t,i)}},t.recordAssertion=function(e,t={}){return(r,i=void 0)=>{(0,n.assertRecord)(r,e,t,i)}},t.$a=o,t.$u=function(e,t){return o(e,t)},t.valueOr=s,t.undefinedOr=function(e){return s(void 0,e)},t.nullOr=function(e){return s(null,e)},t.stringAssertion=e=>(t,r=void 0)=>{var o,s;(0,i.assertString)(t,r),(0,n.assertTruthy)(t.length>=(null!==(o=e.minLength)&&void 0!==o?o:0),`${(0,n.getErrorMessage)(r)} length is too small: ${t.length} < ${e.minLength}`),(0,n.assertTruthy)(t.length<=(null!==(s=e.maxLength)&&void 0!==s?s:1/0),`${(0,n.getErrorMessage)(r)} length is too large ${t.length} > ${e.maxLength}`)}},1333:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assertNonNullable=t.assertDate=t.assertEmail=t.assertHexString=t.assertUuid=t.assertBoolean=t.assertNumber=t.assertString=t.formatError=t.formatValue=void 0;const n=r(6373),i=r(4665);function o(e){return void 0===e?"<undefined>":"symbol"==typeof e?e.toString():null===e?"<null>":`<${typeof e}:${e}>`}function s(e,t,r){const i=(0,n.getAssertionErrorFromProvider)(e);if("object"==typeof i)throw i;return`${i?`${i}: `:""}${t} ${o(r)}`}t.formatValue=o,t.formatError=s,t.assertString=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isString)(e),(()=>s(t,"Not a string",e)))},t.assertNumber=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isNumber)(e),(()=>s(t,"Not a number",e)))},t.assertBoolean=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isBoolean)(e),(()=>s(t,"Not a boolean",e)))},t.assertUuid=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isUuid)(e),(()=>s(t,"Invalid uuid",e)))},t.assertHexString=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isHexString)(e),(()=>s(t,"Invalid hex string",e)))},t.assertEmail=(e,t=void 0)=>{(0,n.assertTruthy)((0,i.isEmail)(e),(()=>s(t,"Invalid email",e)))},t.assertDate=(e,t=void 0)=>{(0,n.assertTruthy)(e instanceof Date,(()=>s(t,"Invalid Date",e)))},t.assertNonNullable=function(e,t){(0,n.assertTruthy)((0,i.isNonNullable)(e),(()=>s(t,"Value is "+(void 0===e?"undefined":"null"),e)))}},4665:(e,t)=>{function r(e){return"string"==typeof e}function n(e,t,r){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.isNonNullable=t.isHexString=t.isUuid=t.isEmail=t.checkArraysHasEqualElementsByComparator=t.checkArraysHaveEqualElements=t.checkArrayHasUniqueElements=t.isDate=t.isNumber=t.isString=t.isBoolean=void 0,t.isBoolean=function(e){return"boolean"==typeof e},t.isString=r,t.isNumber=function(e){return"number"==typeof e},t.isDate=function(e){return e instanceof Date},t.checkArrayHasUniqueElements=function(e,t){if(e.length<=1)return!0;const r=new Set;for(const n of e){const e=t(n);if(r.has(e))return!1;r.add(e)}return!0},t.checkArraysHaveEqualElements=function(e,t){return n(e,t,((e,t)=>e===t))},t.checkArraysHasEqualElementsByComparator=n;const i=/^[-!#$%&'*+/\d=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/\d=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z\d])*\.[a-zA-Z](-?[a-zA-Z\d])+$/,o=/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF.!#$%&'*+-/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF\-.\d]+)((\.([a-zA-Z\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF]){2,63})+)$/i;t.isEmail=function(e,t={allowInternationalDomains:!1}){if(!r(e)||0===e.length||e.length>254)return!1;if(!(t.allowInternationalDomains?o:i).test(e))return!1;const n=e.split("@");return!(n[0].length>64||n[1].split(".").some((e=>e.length>63)))};const s=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;t.isUuid=function(e){return r(e)&&s.test(e)};const a=/^[0-9a-fA-F]*$/;t.isHexString=function(e){return r(e)&&a.test(e)},t.isNonNullable=function(e){return null!=e}},8630:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateRecord=t.validateArray=t.validateObject=t.tryCatch=void 0;const n=r(6373);function i(e){try{e()}catch(e){return e instanceof Error&&e.message||`${e}`}}t.tryCatch=i,t.validateObject=function(e,t,r=void 0,o={}){return i((()=>(0,n.assertObject)(e,t,r,o)))},t.validateArray=function(e,t,r={},o=void 0){return i((()=>(0,n.assertArray)(e,t,r,o)))},t.validateRecord=function(e,t,r={},o=void 0){return i((()=>(0,n.assertRecord)(e,t,r,o)))}},4077:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(6373),t),i(r(8596),t),i(r(1333),t),i(r(4665),t),i(r(8630),t)},4123:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7243),t)},7243:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TrieStore=void 0;const n=r(11),i=r(573),o=r(6022),s=r(4908);class a extends i.Subject{constructor(){super(...arguments),this.isAllDetailsMode=!1}}t.TrieStore=class{constructor(e){this.rootState=e,this.observersTrie=new s.Trie,this.batchDepth=0,this.appliedBatchActions=[],this.rootStateBeforeBatchStart=this.rootState,this.stubForUnusedPaths=[]}get state(){return this.rootState}get state$(){return this.observe([])}get(e){return this._get(this.rootState,e)}observe(e,t=[]){return this._observeChanges(e,t,"new-value-only").pipe((0,o.map)((e=>e.value)))}observeChanges(e,t=[]){return this._observeChanges(e,t,"all-details")}set(e,t,r){(null==r?void 0:r(this.get(e),t,e))||this._apply({type:"set",path:e,value:t})}delete(e){this._apply({type:"delete",path:e})}reset(e){this.observersTrie.visitDfs("pre-order",(e=>null==e?void 0:e.complete())),this.observersTrie.delete([]),this.rootState=e}runInBatch(e){this.batchDepth++;try{e()}finally{if(this.batchDepth--,0===this.batchDepth&&this.appliedBatchActions.length>0){const e={type:"batch",actions:this.appliedBatchActions};this.appliedBatchActions=[],this._notify(e)}}}_apply(e){0===this.batchDepth&&(this.rootStateBeforeBatchStart=this.rootState),this.rootState=(0,n.apply)(this.rootState,e),this.rootState===this.rootStateBeforeBatchStart||this.observersTrie.isEmpty||(this.batchDepth>0?this.appliedBatchActions.push(e):this._notify(e))}_notify(e){const t=(0,n.extractPaths)(e,"unique-and-sorted"),r=this.selectChildPathsWithObservers(t),i=(0,n.selectUniquePaths)([...t,...r]),o=new s.Trie;for(const e of i)o.fillPath(e,(()=>!0));o.visitDfs("pre-order",((t,r)=>{const n=this.observersTrie.get(r);if(n){const t=this.get(r),i=n.isAllDetailsMode?this._get(this.rootStateBeforeBatchStart,r):void 0;n.next({action:e,value:t,oldValue:i})}}))}_observeChanges(e,t=[],r){const u=0===t.length?void 0:new s.Trie;for(const e of t)null==u||u.set(e,!0);return new i.Observable((t=>{const i=this.observersTrie.getOrSet(e,(()=>new a));i.isAllDetailsMode=i.isAllDetailsMode||"all-details"===r;const s={oldValue:void 0,value:this.get(e),paths:[[]]};t.next(s);const c=i.pipe((0,o.filter)((({action:e})=>void 0===u||(0,n.extractPaths)(e,"as-is").some((e=>!u.get(e))))),(0,o.map)((({action:t,value:r,oldValue:o})=>{let s=this.stubForUnusedPaths;if(i.isAllDetailsMode){const r=(0,n.extractPaths)(t,"as-is"),i=e.length>0?r.filter((t=>(0,n.isPathPrefix)(t,e))).map((t=>t.slice(e.length))):r;s=(0,n.selectUniquePathPrefixes)(i)}return{value:r,oldValue:o,paths:s}}))).subscribe(t);return()=>{c.unsubscribe(),i.observed||this.observersTrie.delete(e)}}))}_get(e,t){let r=e;for(let e=0;e<t.length&&void 0!==r;e++){const n=t[e];r=null==r?void 0:r[n]}return r}selectChildPathsWithObservers(e){const t=[];for(const r of e)this.observersTrie.count(r,"children-only")>0&&this.observersTrie.visitDfs("pre-order",((e,r)=>{e&&t.push([...r])}),r);return t}}},11:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.selectUniquePaths=t.selectUniquePathPrefixes=t.sortPaths=t.isPathPrefix=t.extractPaths=t.deepCloneOnPath=t.deleteInPath=t.setInPath=t.apply=void 0;const n=r(5036);function i(e,t,r){if(void 0===r)return o(e,t);if(0===t.length)return(0,n.assertTruthy)("object"==typeof r&&null!==r&&!Array.isArray(r),(()=>`Root state must be a record. Trying to set '${r}', type: ${typeof r}`)),r;function i(e){const t=Number(e);return!isNaN(t)&&t>=0&&t!==1/0}let a=e;for(let e=0;e<t.length-1&&void 0!==a;e++){const r=t[e];(0,n.assertTruthy)(!Array.isArray(a)||i(r),(()=>`Invalid array index. Path: '${t.slice(0,e+1)}', index: '${r}'`)),a=a[r],(0,n.assertTruthy)(void 0===a||"object"==typeof a&&null!==a,(()=>`Cannot set a property to a non-record parent. Path: '${t.slice(0,e+1)}', type: '${null===a?"<null>":typeof a}'`))}const u=t[t.length-1];return(0,n.assertTruthy)(!Array.isArray(a)||i(u),(()=>`Invalid array index Path: '${t}`)),(null==a?void 0:a[u])===r?e:s(e,t,r)}function o(e,t){(0,n.assertTruthy)(0!==t.length,"Can't delete an empty path");let r=e;for(let i=0;i<t.length-1;i++){const o=t[i];if(r=r[o],void 0===r)return e;(0,n.assertTruthy)("object"==typeof r&&null!==r,(()=>`Cannot delete a property from a non-record parent. Path: '${t.slice(0,i+1)}', type: ${null===r?"<null>":typeof r}`))}const i=t[t.length-1];return void 0===r[i]?e:s(e,t,void 0)}function s(e,t,r){function i(e,r){(0,n.assertTruthy)(!Array.isArray(e),(()=>`Can't delete element of array. Path: '${t}'`)),delete e[r]}const o=Object.assign({},e);let s=o;for(let e=0;e<t.length-1;e++){const o=t[e],a=s[o];(0,n.assertTruthy)(void 0===a||"object"==typeof a&&null!==a,(()=>`Internal error: sub-path has an invalid type and can't be patched: '${t.slice(0,e+1)}', type: '${null===a?null:typeof a}'`));const u=void 0===a?void 0===r?void 0:{}:Array.isArray(a)?[...a]:Object.assign({},a);if(void 0===u)return i(s,o),s;s[o]=u,s=u}const a=t[t.length-1];return void 0===r?i(s,a):s[a]=r,o}function a(e,t){if(e.length<t.length)return!1;for(let r=0;r<t.length;r++)if(e[r]!==t[r])return!1;return!0}function u(e){const t=[...e];return t.sort(((e,t)=>{for(let r=0;r<e.length;r++){if(r===t.length)return 1;const n=e[r].localeCompare(t[r]);if(0!==n)return n}return e.length-t.length})),t}function c(e){const t=u(e),r=t;for(let e=0;e<t.length-1;e++){const n=t[e];for(let i=e+1;i<t.length;i++){const o=t[i];n.length===o.length&&a(n,o)&&(r[i]=void 0,e++)}}return r.filter((e=>void 0!==e))}t.apply=function e(t,r){switch(r.type){case"set":return i(t,r.path,r.value);case"delete":return o(t,r.path);case"batch":return r.actions.reduce(((t,r)=>e(t,r)),t)}},t.setInPath=i,t.deleteInPath=o,t.deepCloneOnPath=s,t.extractPaths=function e(t,r){const n=[];if("set"===t.type||"delete"===t.type)n.push(t.path);else if("batch"===t.type)for(const r of t.actions)n.push(...e(r,"as-is"));return"unique-and-sorted"===r?c(n):n},t.isPathPrefix=a,t.sortPaths=u,t.selectUniquePathPrefixes=function(e){if(1===e.length)return[...e];if(e.some((e=>0===e.length)))return[[]];const t=u(e),r=t;for(let e=0;e<r.length-1;e++){const n=t[e];for(let i=e+1;i<t.length;i++)a(t[i],n)&&(r[i]=void 0,e++)}return r.filter((e=>void 0!==e))},t.selectUniquePaths=c},4908:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7129),t)},7129:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Trie=void 0;class r{constructor(){this.root={children:new Map,childrenWithValue:0}}get(e){var t;return null===(t=this.getNode(e))||void 0===t?void 0:t.value}getOrSet(e,t){const r=this._buildPath(e);if(void 0!==r.value)return r.value;const n=t(e);return this._setNodeValue(r,n,void 0===n),n}set(e,t){const r=void 0===t?this._findNode(e):this._buildPath(e);r&&this._setNodeValue(r,t,!0)}delete(e){const t=this._findNode(e);if(void 0===t)return;if(void 0===t.parent){if(t!==this.root)throw new Error("Only root node can have no parent.");return this.root.value=void 0,this.root.children.clear(),void(this.root.childrenWithValue=0)}const r=(void 0===t.value?0:1)+t.childrenWithValue;r>0&&this._updateChildrenWithValue(t,-r),t.parent.children.delete(e[e.length-1]),this._runGc(t.parent)}clear(){this.delete([])}count(e=[],t="node-and-children"){const r=this.getNode(e);return void 0===r?0:r.childrenWithValue+("node-and-children"===t&&void 0!==r.value?1:0)}get isEmpty(){return 0===this.count()}fillPath(e,t){const n=[];let i=this.root,o=t(i.value,n);if(o!==r.StopFillToken){this._setNodeValue(i,o,!1);for(let s=0;s<e.length;s++){const a=e[s];n.push(a);let u=i.children.get(a);if(o=t(null==u?void 0:u.value,n),o===r.StopFillToken)break;u||(u={children:new Map,parent:i,childrenWithValue:0},i.children.set(a,u)),this._setNodeValue(u,o,!1),i=u}this._runGc(i)}}visitDfs(e,t,r=[]){const n=this.getNode(r);void 0!==n&&this._visitDfs(e,n,t,[...r])}_visitDfs(e,t,r,n){if("pre-order"===e&&!1===r(t.value,n))return!1;for(const[i,o]of t.children){if(n.push(i),!this._visitDfs(e,o,r,n))return!1;n.pop()}return"in-order"!==e||!1!==r(t.value,n)}getNode(e){return this._getNode(e)}_getNode(e){let t=this.root;for(const r of e)if(t=t.children.get(r),!t)return;return t}_findNode(e){let t=this.root;for(let r=0;r<e.length&&t;r++)t=t.children.get(e[r]);return t}_buildPath(e){let t=this.root;for(let r=0;r<e.length;r++){const n=e[r];let i=t.children.get(n);i||(i={children:new Map,parent:t,childrenWithValue:0},t.children.set(n,i)),t=i}return t}_setNodeValue(e,t,r){if(e.value!==t){const r=void 0===t?-1:void 0===e.value?1:0;e.value=t,this._updateChildrenWithValue(e,r)}r&&this._runGc(e)}_updateChildrenWithValue(e,t){if(0!==t)for(let r=e.parent;r;r=r.parent)if(r.childrenWithValue+=t,r.childrenWithValue<0)throw new Error("Internal error: negative counter value!")}_runGc(e){void 0===e.value&&(0===e.childrenWithValue&&e.children.clear(),e.parent&&this._runGc(e.parent))}}t.Trie=r,r.StopFillToken=Symbol("Trie.StopFillToken")},5366:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncSubject=void 0;var i=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}return n(t,e),t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t._hasValue,i=t._value,o=t.thrownError,s=t.isStopped,a=t._isComplete;r?e.error(o):(s||a)&&(n&&e.next(i),e.complete())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.prototype.complete=function(){var t=this,r=t._hasValue,n=t._value;t._isComplete||(this._isComplete=!0,r&&e.prototype.next.call(this,n),e.prototype.complete.call(this))},t}(r(20).Subject);t.AsyncSubject=i},1222:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.BehaviorSubject=void 0;var i=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return n(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(r(20).Subject);t.BehaviorSubject=i},6145:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeNotification=t.Notification=t.NotificationKind=void 0;var n,i=r(7209),o=r(8743),s=r(6612),a=r(4717);(n=t.NotificationKind||(t.NotificationKind={})).NEXT="N",n.ERROR="E",n.COMPLETE="C";var u=function(){function e(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return e.prototype.observe=function(e){return c(this,e)},e.prototype.do=function(e,t,r){var n=this,i=n.kind,o=n.value,s=n.error;return"N"===i?null==e?void 0:e(o):"E"===i?null==t?void 0:t(s):null==r?void 0:r()},e.prototype.accept=function(e,t,r){var n;return a.isFunction(null===(n=e)||void 0===n?void 0:n.next)?this.observe(e):this.do(e,t,r)},e.prototype.toObservable=function(){var e=this,t=e.kind,r=e.value,n=e.error,a="N"===t?o.of(r):"E"===t?s.throwError((function(){return n})):"C"===t?i.EMPTY:0;if(!a)throw new TypeError("Unexpected notification kind "+t);return a},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();function c(e,t){var r,n,i,o=e,s=o.kind,a=o.value,u=o.error;if("string"!=typeof s)throw new TypeError('Invalid notification, missing "kind"');"N"===s?null===(r=t.next)||void 0===r||r.call(t,a):"E"===s?null===(n=t.error)||void 0===n||n.call(t,u):null===(i=t.complete)||void 0===i||i.call(t)}t.Notification=u,t.observeNotification=c},795:(e,t)=>{function r(e,t,r){return{kind:e,value:t,error:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.createNotification=t.nextNotification=t.errorNotification=t.COMPLETE_NOTIFICATION=void 0,t.COMPLETE_NOTIFICATION=r("C",void 0,void 0),t.errorNotification=function(e){return r("E",void 0,e)},t.nextNotification=function(e){return r("N",e,void 0)},t.createNotification=r},2023:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var n=r(4512),i=r(7491),o=r(2131),s=r(2393),a=r(7820),u=r(4717),c=r(9916),l=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var o,s=this,a=(o=e)&&o instanceof n.Subscriber||function(e){return e&&u.isFunction(e.next)&&u.isFunction(e.error)&&u.isFunction(e.complete)}(o)&&i.isSubscription(o)?e:new n.SafeSubscriber(e,t,r);return c.errorContext((function(){var e=s,t=e.operator,r=e.source;a.add(t?t.call(a,r):r?s._subscribe(a):s._trySubscribe(a))})),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=h(t))((function(t,i){var o=new n.SafeSubscriber({next:function(t){try{e(t)}catch(e){i(e),o.unsubscribe()}},error:i,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[o.observable]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.pipeFromArray(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=h(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function h(e){var t;return null!==(t=null!=e?e:a.config.Promise)&&void 0!==t?t:Promise}t.Observable=l},5129:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.ReplaySubject=void 0;var i=r(20),o=r(4575),s=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=o.dateTimestampProvider);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,r),i}return n(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,i=r._buffer,o=r._infiniteTimeWindow,s=r._timestampProvider,a=r._windowTime;n||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!e.closed;i+=r?1:2)e.next(n[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<n.length&&n.splice(0,n.length-o),!i){for(var s=r.now(),a=0,u=1;u<n.length&&n[u]<=s;u+=2)a=u;a&&n.splice(0,a+1)}},t}(i.Subject);t.ReplaySubject=s},469:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Scheduler=void 0;var n=r(4575),i=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=n.dateTimestampProvider.now,e}();t.Scheduler=i},20:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousSubject=t.Subject=void 0;var o=r(2023),s=r(7491),a=r(8083),u=r(7394),c=r(9916),l=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return n(t,e),t.prototype.lift=function(e){var t=new h(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new a.ObjectUnsubscribedError},t.prototype.next=function(e){var t=this;c.errorContext((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=i(t.currentObservers),s=o.next();!s.done;s=o.next())s.value.next(e)}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;c.errorContext((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;c.errorContext((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,i=r.isStopped,o=r.observers;return n||i?s.EMPTY_SUBSCRIPTION:(this.currentObservers=null,o.push(e),new s.Subscription((function(){t.currentObservers=null,u.arrRemove(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new o.Observable;return e.source=this,e},t.create=function(e,t){return new h(e,t)},t}(o.Observable);t.Subject=l;var h=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return n(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:s.EMPTY_SUBSCRIPTION},t}(l);t.AnonymousSubject=h},4512:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_OBSERVER=t.SafeSubscriber=t.Subscriber=void 0;var i=r(4717),o=r(7491),s=r(7820),a=r(4696),u=r(6129),c=r(795),l=r(6476),h=r(9916),d=function(e){function r(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,o.isSubscription(r)&&r.add(n)):n.destination=t.EMPTY_OBSERVER,n}return n(r,e),r.create=function(e,t,r){return new y(e,t,r)},r.prototype.next=function(e){this.isStopped?m(c.nextNotification(e),this):this._next(e)},r.prototype.error=function(e){this.isStopped?m(c.errorNotification(e),this):(this.isStopped=!0,this._error(e))},r.prototype.complete=function(){this.isStopped?m(c.COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(e){this.destination.next(e)},r.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(o.Subscription);t.Subscriber=d;var f=Function.prototype.bind;function p(e,t){return f.call(e,t)}var v=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){b(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){b(e)}else b(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){b(e)}},e}(),y=function(e){function t(t,r,n){var o,a,u=e.call(this)||this;return i.isFunction(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:u&&s.config.useDeprecatedNextContext?((a=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},o={next:t.next&&p(t.next,a),error:t.error&&p(t.error,a),complete:t.complete&&p(t.complete,a)}):o=t,u.destination=new v(o),u}return n(t,e),t}(d);function b(e){s.config.useDeprecatedSynchronousErrorHandling?h.captureError(e):a.reportUnhandledError(e)}function m(e,t){var r=s.config.onStoppedNotification;r&&l.timeoutProvider.setTimeout((function(){return r(e,t)}))}t.SafeSubscriber=y,t.EMPTY_OBSERVER={closed:!0,next:u.noop,error:function(e){throw e},complete:u.noop}},7491:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.isSubscription=t.EMPTY_SUBSCRIPTION=t.Subscription=void 0;var s=r(4717),a=r(665),u=r(7394),c=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,u,c;if(!this.closed){this.closed=!0;var h=this._parentage;if(h)if(this._parentage=null,Array.isArray(h))try{for(var d=n(h),f=d.next();!f.done;f=d.next())f.value.remove(this)}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}else h.remove(this);var p=this.initialTeardown;if(s.isFunction(p))try{p()}catch(e){c=e instanceof a.UnsubscriptionError?e.errors:[e]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=n(v),b=y.next();!b.done;b=y.next()){var m=b.value;try{l(m)}catch(e){c=null!=c?c:[],e instanceof a.UnsubscriptionError?c=o(o([],i(c)),i(e.errors)):c.push(e)}}}catch(e){r={error:e}}finally{try{b&&!b.done&&(u=y.return)&&u.call(y)}finally{if(r)throw r.error}}}if(c)throw new a.UnsubscriptionError(c)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)l(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&u.arrRemove(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&u.arrRemove(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function l(e){s.isFunction(e)?e():e.unsubscribe()}t.Subscription=c,t.EMPTY_SUBSCRIPTION=c.EMPTY,t.isSubscription=function(e){return e instanceof c||e&&"closed"in e&&s.isFunction(e.remove)&&s.isFunction(e.add)&&s.isFunction(e.unsubscribe)}},7820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.config=void 0,t.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},1507:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectableObservable=void 0;var i=r(2023),o=r(7491),s=r(5884),a=r(1266),u=r(5416),c=function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,u.hasLift(t)&&(n.lift=t.lift),n}return n(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new o.Subscription;var r=this.getSubject();t.add(this.source.subscribe(a.createOperatorSubscriber(r,void 0,(function(){e._teardown(),r.complete()}),(function(t){e._teardown(),r.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=o.Subscription.EMPTY)}return t},t.prototype.refCount=function(){return s.refCount()(this)},t}(i.Observable);t.ConnectableObservable=c},994:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestInit=t.combineLatest=void 0;var n=r(2023),i=r(3787),o=r(5294),s=r(9391),a=r(8240),u=r(1824),c=r(4950),l=r(1266),h=r(5031);function d(e,t,r){return void 0===r&&(r=s.identity),function(n){f(t,(function(){for(var i=e.length,s=new Array(i),a=i,u=i,c=function(i){f(t,(function(){var c=o.from(e[i],t),h=!1;c.subscribe(l.createOperatorSubscriber(n,(function(e){s[i]=e,h||(h=!0,u--),u||n.next(r(s.slice()))}),(function(){--a||n.complete()})))}),n)},h=0;h<i;h++)c(h)}),n)}}function f(e,t,r){e?h.executeSchedule(r,e,t):t()}t.combineLatest=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=u.popScheduler(e),l=u.popResultSelector(e),h=i.argsArgArrayOrObject(e),f=h.args,p=h.keys;if(0===f.length)return o.from([],r);var v=new n.Observable(d(f,r,p?function(e){return c.createObject(p,e)}:s.identity));return l?v.pipe(a.mapOneOrManyArgs(l)):v},t.combineLatestInit=d},2070:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concat=void 0;var n=r(861),i=r(1824),o=r(5294);t.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.concatAll()(o.from(e,i.popScheduler(e)))}},7209:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.empty=t.EMPTY=void 0;var n=r(2023);t.EMPTY=new n.Observable((function(e){return e.complete()})),t.empty=function(e){return e?function(e){return new n.Observable((function(t){return e.schedule((function(){return t.complete()}))}))}(e):t.EMPTY}},5294:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.from=void 0;var n=r(4463),i=r(2296);t.from=function(e,t){return t?n.scheduled(e,t):i.innerFrom(e)}},3123:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromSubscribable=void 0;var n=r(2023);t.fromSubscribable=function(e){return new n.Observable((function(t){return e.subscribe(t)}))}},2296:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof s?s(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,i,(t=e[r](t)).done,t.value)}))}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.fromReadableStreamLike=t.fromAsyncIterable=t.fromIterable=t.fromPromise=t.fromArrayLike=t.fromInteropObservable=t.innerFrom=void 0;var a=r(5547),u=r(452),c=r(2023),l=r(1801),h=r(9451),d=r(3533),f=r(6847),p=r(3026),v=r(4717),y=r(4696),b=r(2131);function m(e){return new c.Observable((function(t){var r=e[b.observable]();if(v.isFunction(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}))}function g(e){return new c.Observable((function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()}))}function _(e){return new c.Observable((function(t){e.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,y.reportUnhandledError)}))}function O(e){return new c.Observable((function(t){var r,n;try{for(var i=s(e),o=i.next();!o.done;o=i.next()){var a=o.value;if(t.next(a),t.closed)return}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()}))}function S(e){return new c.Observable((function(t){(function(e,t){var r,s,a,u;return n(this,void 0,void 0,(function(){var n,c;return i(this,(function(i){switch(i.label){case 0:i.trys.push([0,5,6,11]),r=o(e),i.label=1;case 1:return[4,r.next()];case 2:if((s=i.sent()).done)return[3,4];if(n=s.value,t.next(n),t.closed)return[2];i.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=i.sent(),a={error:c},[3,11];case 6:return i.trys.push([6,,9,10]),s&&!s.done&&(u=r.return)?[4,u.call(r)]:[3,8];case 7:i.sent(),i.label=8;case 8:return[3,10];case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function E(e){return S(p.readableStreamLikeToAsyncGenerator(e))}t.innerFrom=function(e){if(e instanceof c.Observable)return e;if(null!=e){if(l.isInteropObservable(e))return m(e);if(a.isArrayLike(e))return g(e);if(u.isPromise(e))return _(e);if(h.isAsyncIterable(e))return S(e);if(f.isIterable(e))return O(e);if(p.isReadableStreamLike(e))return E(e)}throw d.createInvalidObservableTypeError(e)},t.fromInteropObservable=m,t.fromArrayLike=g,t.fromPromise=_,t.fromIterable=O,t.fromAsyncIterable=S,t.fromReadableStreamLike=E},8767:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.interval=void 0;var n=r(4386),i=r(5461);t.interval=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=n.asyncScheduler),e<0&&(e=0),i.timer(e,e,t)}},8743:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.of=void 0;var n=r(1824),i=r(5294);t.of=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=n.popScheduler(e);return i.from(e,r)}},6467:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.onErrorResumeNext=void 0;var n=r(2023),i=r(160),o=r(1266),s=r(6129),a=r(2296);t.onErrorResumeNext=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=i.argsOrArgArray(e);return new n.Observable((function(e){var t=0,n=function(){if(t<r.length){var i=void 0;try{i=a.innerFrom(r[t++])}catch(e){return void n()}var u=new o.OperatorSubscriber(e,void 0,s.noop,s.noop);i.subscribe(u),u.add(n)}else e.complete()};n()}))}},4143:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.raceInit=t.race=void 0;var n=r(2023),i=r(2296),o=r(160),s=r(1266);function a(e){return function(t){for(var r=[],n=function(n){r.push(i.innerFrom(e[n]).subscribe(s.createOperatorSubscriber(t,(function(e){if(r){for(var i=0;i<r.length;i++)i!==n&&r[i].unsubscribe();r=null}t.next(e)}))))},o=0;r&&!t.closed&&o<e.length;o++)n(o)}}t.race=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===(e=o.argsOrArgArray(e)).length?i.innerFrom(e[0]):new n.Observable(a(e))},t.raceInit=a},6612:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throwError=void 0;var n=r(2023),i=r(4717);t.throwError=function(e,t){var r=i.isFunction(e)?e:function(){return e},o=function(e){return e.error(r())};return new n.Observable(t?function(e){return t.schedule(o,0,e)}:o)}},5461:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timer=void 0;var n=r(2023),i=r(4386),o=r(4568),s=r(6349);t.timer=function(e,t,r){void 0===e&&(e=0),void 0===r&&(r=i.async);var a=-1;return null!=t&&(o.isScheduler(t)?r=t:a=t),new n.Observable((function(t){var n=s.isValidDate(e)?+e-r.now():e;n<0&&(n=0);var i=0;return r.schedule((function(){t.closed||(t.next(i++),0<=a?this.schedule(void 0,a):t.complete())}),n)}))}},1763:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.zip=void 0;var o=r(2023),s=r(2296),a=r(160),u=r(7209),c=r(1266),l=r(1824);t.zip=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=l.popResultSelector(e),h=a.argsOrArgArray(e);return h.length?new o.Observable((function(e){var t=h.map((function(){return[]})),o=h.map((function(){return!1}));e.add((function(){t=o=null}));for(var a=function(a){s.innerFrom(h[a]).subscribe(c.createOperatorSubscriber(e,(function(s){if(t[a].push(s),t.every((function(e){return e.length}))){var u=t.map((function(e){return e.shift()}));e.next(r?r.apply(void 0,i([],n(u))):u),t.some((function(e,t){return!e.length&&o[t]}))&&e.complete()}}),(function(){o[a]=!0,!t[a].length&&e.complete()})))},u=0;!e.closed&&u<h.length;u++)a(u);return function(){t=o=null}})):u.EMPTY}},1266:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.OperatorSubscriber=t.createOperatorSubscriber=void 0;var i=r(4512);t.createOperatorSubscriber=function(e,t,r,n,i){return new o(e,t,r,n,i)};var o=function(e){function t(t,r,n,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return n(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(i.Subscriber);t.OperatorSubscriber=o},6993:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.audit=void 0;var n=r(5416),i=r(2296),o=r(1266);t.audit=function(e){return n.operate((function(t,r){var n=!1,s=null,a=null,u=!1,c=function(){if(null==a||a.unsubscribe(),a=null,n){n=!1;var e=s;s=null,r.next(e)}u&&r.complete()},l=function(){a=null,u&&r.complete()};t.subscribe(o.createOperatorSubscriber(r,(function(t){n=!0,s=t,a||i.innerFrom(e(t)).subscribe(a=o.createOperatorSubscriber(r,c,l))}),(function(){u=!0,(!n||!a||a.closed)&&r.complete()})))}))}},4116:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.auditTime=void 0;var n=r(4386),i=r(6993),o=r(5461);t.auditTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.audit((function(){return o.timer(e,t)}))}},7190:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.buffer=void 0;var n=r(5416),i=r(6129),o=r(1266),s=r(2296);t.buffer=function(e){return n.operate((function(t,r){var n=[];return t.subscribe(o.createOperatorSubscriber(r,(function(e){return n.push(e)}),(function(){r.next(n),r.complete()}))),s.innerFrom(e).subscribe(o.createOperatorSubscriber(r,(function(){var e=n;n=[],r.next(e)}),i.noop)),function(){n=null}}))}},6835:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferCount=void 0;var i=r(5416),o=r(1266),s=r(7394);t.bufferCount=function(e,t){return void 0===t&&(t=null),t=null!=t?t:e,i.operate((function(r,i){var a=[],u=0;r.subscribe(o.createOperatorSubscriber(i,(function(r){var o,c,l,h,d=null;u++%t==0&&a.push([]);try{for(var f=n(a),p=f.next();!p.done;p=f.next())(b=p.value).push(r),e<=b.length&&(d=null!=d?d:[]).push(b)}catch(e){o={error:e}}finally{try{p&&!p.done&&(c=f.return)&&c.call(f)}finally{if(o)throw o.error}}if(d)try{for(var v=n(d),y=v.next();!y.done;y=v.next()){var b=y.value;s.arrRemove(a,b),i.next(b)}}catch(e){l={error:e}}finally{try{y&&!y.done&&(h=v.return)&&h.call(v)}finally{if(l)throw l.error}}}),(function(){var e,t;try{for(var r=n(a),o=r.next();!o.done;o=r.next()){var s=o.value;i.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.complete()}),void 0,(function(){a=null})))}))}},5219:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferTime=void 0;var i=r(7491),o=r(5416),s=r(1266),a=r(7394),u=r(4386),c=r(1824),l=r(5031);t.bufferTime=function(e){for(var t,r,h=[],d=1;d<arguments.length;d++)h[d-1]=arguments[d];var f=null!==(t=c.popScheduler(h))&&void 0!==t?t:u.asyncScheduler,p=null!==(r=h[0])&&void 0!==r?r:null,v=h[1]||1/0;return o.operate((function(t,r){var o=[],u=!1,c=function(e){var t=e.buffer;e.subs.unsubscribe(),a.arrRemove(o,e),r.next(t),u&&h()},h=function(){if(o){var t=new i.Subscription;r.add(t);var n={buffer:[],subs:t};o.push(n),l.executeSchedule(t,f,(function(){return c(n)}),e)}};null!==p&&p>=0?l.executeSchedule(r,f,h,p,!0):u=!0,h();var d=s.createOperatorSubscriber(r,(function(e){var t,r,i=o.slice();try{for(var s=n(i),a=s.next();!a.done;a=s.next()){var u=a.value,l=u.buffer;l.push(e),v<=l.length&&c(u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}),(function(){for(;null==o?void 0:o.length;)r.next(o.shift().buffer);null==d||d.unsubscribe(),r.complete(),r.unsubscribe()}),void 0,(function(){return o=null}));t.subscribe(d)}))}},118:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferToggle=void 0;var i=r(7491),o=r(5416),s=r(2296),a=r(1266),u=r(6129),c=r(7394);t.bufferToggle=function(e,t){return o.operate((function(r,o){var l=[];s.innerFrom(e).subscribe(a.createOperatorSubscriber(o,(function(e){var r=[];l.push(r);var n=new i.Subscription;n.add(s.innerFrom(t(e)).subscribe(a.createOperatorSubscriber(o,(function(){c.arrRemove(l,r),o.next(r),n.unsubscribe()}),u.noop)))}),u.noop)),r.subscribe(a.createOperatorSubscriber(o,(function(e){var t,r;try{for(var i=n(l),o=i.next();!o.done;o=i.next())o.value.push(e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}),(function(){for(;l.length>0;)o.next(l.shift());o.complete()})))}))}},7514:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bufferWhen=void 0;var n=r(5416),i=r(6129),o=r(1266),s=r(2296);t.bufferWhen=function(e){return n.operate((function(t,r){var n=null,a=null,u=function(){null==a||a.unsubscribe();var t=n;n=[],t&&r.next(t),s.innerFrom(e()).subscribe(a=o.createOperatorSubscriber(r,u,i.noop))};u(),t.subscribe(o.createOperatorSubscriber(r,(function(e){return null==n?void 0:n.push(e)}),(function(){n&&r.next(n),r.complete()}),void 0,(function(){return n=a=null})))}))}},8251:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.catchError=void 0;var n=r(2296),i=r(1266),o=r(5416);t.catchError=function e(t){return o.operate((function(r,o){var s,a=null,u=!1;a=r.subscribe(i.createOperatorSubscriber(o,void 0,void 0,(function(i){s=n.innerFrom(t(i,e(t)(r))),a?(a.unsubscribe(),a=null,s.subscribe(o)):u=!0}))),u&&(a.unsubscribe(),a=null,s.subscribe(o))}))}},1424:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineAll=void 0;var n=r(2945);t.combineAll=n.combineLatestAll},2e3:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatest=void 0;var o=r(994),s=r(5416),a=r(160),u=r(8240),c=r(2393),l=r(1824);t.combineLatest=function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var h=l.popResultSelector(t);return h?c.pipe(e.apply(void 0,i([],n(t))),u.mapOneOrManyArgs(h)):s.operate((function(e,r){o.combineLatestInit(i([e],n(a.argsOrArgArray(t))))(r)}))}},2945:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestAll=void 0;var n=r(994),i=r(587);t.combineLatestAll=function(e){return i.joinAllInternals(n.combineLatest,e)}},3928:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestWith=void 0;var o=r(2e3);t.combineLatestWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.combineLatest.apply(void 0,i([],n(e)))}},1812:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.concat=void 0;var o=r(5416),s=r(861),a=r(1824),u=r(5294);t.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=a.popScheduler(e);return o.operate((function(t,o){s.concatAll()(u.from(i([t],n(e)),r)).subscribe(o)}))}},861:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatAll=void 0;var n=r(1867);t.concatAll=function(){return n.mergeAll(1)}},1012:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatMap=void 0;var n=r(1282),i=r(4717);t.concatMap=function(e,t){return i.isFunction(t)?n.mergeMap(e,t,1):n.mergeMap(e,1)}},1157:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatMapTo=void 0;var n=r(1012),i=r(4717);t.concatMapTo=function(e,t){return i.isFunction(t)?n.concatMap((function(){return e}),t):n.concatMap((function(){return e}))}},3692:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.concatWith=void 0;var o=r(1812);t.concatWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.concat.apply(void 0,i([],n(e)))}},2216:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.connect=void 0;var n=r(20),i=r(2296),o=r(5416),s=r(3123),a={connector:function(){return new n.Subject}};t.connect=function(e,t){void 0===t&&(t=a);var r=t.connector;return o.operate((function(t,n){var o=r();i.innerFrom(e(s.fromSubscribable(o))).subscribe(n),n.add(t.subscribe(o))}))}},8041:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.count=void 0;var n=r(3818);t.count=function(e){return n.reduce((function(t,r,n){return!e||e(r,n)?t+1:t}),0)}},2747:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0;var n=r(5416),i=r(6129),o=r(1266),s=r(2296);t.debounce=function(e){return n.operate((function(t,r){var n=!1,a=null,u=null,c=function(){if(null==u||u.unsubscribe(),u=null,n){n=!1;var e=a;a=null,r.next(e)}};t.subscribe(o.createOperatorSubscriber(r,(function(t){null==u||u.unsubscribe(),n=!0,a=t,u=o.createOperatorSubscriber(r,c,i.noop),s.innerFrom(e(t)).subscribe(u)}),(function(){c(),r.complete()}),void 0,(function(){a=u=null})))}))}},3870:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounceTime=void 0;var n=r(4386),i=r(5416),o=r(1266);t.debounceTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.operate((function(r,n){var i=null,s=null,a=null,u=function(){if(i){i.unsubscribe(),i=null;var e=s;s=null,n.next(e)}};function c(){var r=a+e,o=t.now();if(o<r)return i=this.schedule(void 0,r-o),void n.add(i);u()}r.subscribe(o.createOperatorSubscriber(n,(function(r){s=r,a=t.now(),i||(i=t.schedule(c,e),n.add(i))}),(function(){u(),n.complete()}),void 0,(function(){s=i=null})))}))}},7507:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultIfEmpty=void 0;var n=r(5416),i=r(1266);t.defaultIfEmpty=function(e){return n.operate((function(t,r){var n=!1;t.subscribe(i.createOperatorSubscriber(r,(function(e){n=!0,r.next(e)}),(function(){n||r.next(e),r.complete()})))}))}},2409:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0;var n=r(4386),i=r(5137),o=r(5461);t.delay=function(e,t){void 0===t&&(t=n.asyncScheduler);var r=o.timer(e,t);return i.delayWhen((function(){return r}))}},5137:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.delayWhen=void 0;var n=r(2070),i=r(6803),o=r(2507),s=r(1357),a=r(1282),u=r(2296);t.delayWhen=function e(t,r){return r?function(s){return n.concat(r.pipe(i.take(1),o.ignoreElements()),s.pipe(e(t)))}:a.mergeMap((function(e,r){return u.innerFrom(t(e,r)).pipe(i.take(1),s.mapTo(e))}))}},4126:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dematerialize=void 0;var n=r(6145),i=r(5416),o=r(1266);t.dematerialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){return n.observeNotification(e,t)})))}))}},5208:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinct=void 0;var n=r(5416),i=r(1266),o=r(6129),s=r(2296);t.distinct=function(e,t){return n.operate((function(r,n){var a=new Set;r.subscribe(i.createOperatorSubscriber(n,(function(t){var r=e?e(t):t;a.has(r)||(a.add(r),n.next(t))}))),t&&s.innerFrom(t).subscribe(i.createOperatorSubscriber(n,(function(){return a.clear()}),o.noop))}))}},9939:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilChanged=void 0;var n=r(9391),i=r(5416),o=r(1266);function s(e,t){return e===t}t.distinctUntilChanged=function(e,t){return void 0===t&&(t=n.identity),e=null!=e?e:s,i.operate((function(r,n){var i,s=!0;r.subscribe(o.createOperatorSubscriber(n,(function(r){var o=t(r);!s&&e(i,o)||(s=!1,i=o,n.next(r))})))}))}},183:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilKeyChanged=void 0;var n=r(9939);t.distinctUntilKeyChanged=function(e,t){return n.distinctUntilChanged((function(r,n){return t?t(r[e],n[e]):r[e]===n[e]}))}},1195:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.elementAt=void 0;var n=r(9148),i=r(2914),o=r(5956),s=r(7507),a=r(6803);t.elementAt=function(e,t){if(e<0)throw new n.ArgumentOutOfRangeError;var r=arguments.length>=2;return function(u){return u.pipe(i.filter((function(t,r){return r===e})),a.take(1),r?s.defaultIfEmpty(t):o.throwIfEmpty((function(){return new n.ArgumentOutOfRangeError})))}}},3723:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.endWith=void 0;var o=r(2070),s=r(8743);t.endWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return o.concat(t,s.of.apply(void 0,i([],n(e))))}}},1909:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.every=void 0;var n=r(5416),i=r(1266);t.every=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(i){e.call(t,i,o++,r)||(n.next(!1),n.complete())}),(function(){n.next(!0),n.complete()})))}))}},9228:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaust=void 0;var n=r(9765);t.exhaust=n.exhaustAll},9765:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustAll=void 0;var n=r(8748),i=r(9391);t.exhaustAll=function(){return n.exhaustMap(i.identity)}},8748:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustMap=void 0;var n=r(4828),i=r(2296),o=r(5416),s=r(1266);t.exhaustMap=function e(t,r){return r?function(o){return o.pipe(e((function(e,o){return i.innerFrom(t(e,o)).pipe(n.map((function(t,n){return r(e,t,o,n)})))})))}:o.operate((function(e,r){var n=0,o=null,a=!1;e.subscribe(s.createOperatorSubscriber(r,(function(e){o||(o=s.createOperatorSubscriber(r,void 0,(function(){o=null,a&&r.complete()})),i.innerFrom(t(e,n++)).subscribe(o))}),(function(){a=!0,!o&&r.complete()})))}))}},8324:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.expand=void 0;var n=r(5416),i=r(3754);t.expand=function(e,t,r){return void 0===t&&(t=1/0),t=(t||0)<1?1/0:t,n.operate((function(n,o){return i.mergeInternals(n,o,e,t,void 0,!0,r)}))}},2914:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.filter=void 0;var n=r(5416),i=r(1266);t.filter=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}},9822:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.finalize=void 0;var n=r(5416);t.finalize=function(e){return n.operate((function(t,r){try{t.subscribe(r)}finally{r.add(e)}}))}},2819:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createFind=t.find=void 0;var n=r(5416),i=r(1266);function o(e,t,r){var n="index"===r;return function(r,o){var s=0;r.subscribe(i.createOperatorSubscriber(o,(function(i){var a=s++;e.call(t,i,a,r)&&(o.next(n?a:i),o.complete())}),(function(){o.next(n?-1:void 0),o.complete()})))}}t.find=function(e,t){return n.operate(o(e,t,"value"))},t.createFind=o},3367:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findIndex=void 0;var n=r(5416),i=r(2819);t.findIndex=function(e,t){return n.operate(i.createFind(e,t,"index"))}},1432:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.first=void 0;var n=r(7676),i=r(2914),o=r(6803),s=r(7507),a=r(5956),u=r(9391);t.first=function(e,t){var r=arguments.length>=2;return function(c){return c.pipe(e?i.filter((function(t,r){return e(t,r,c)})):u.identity,o.take(1),r?s.defaultIfEmpty(t):a.throwIfEmpty((function(){return new n.EmptyError})))}}},6977:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.flatMap=void 0;var n=r(1282);t.flatMap=n.mergeMap},4956:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.groupBy=void 0;var n=r(2023),i=r(2296),o=r(20),s=r(5416),a=r(1266);t.groupBy=function(e,t,r,u){return s.operate((function(s,c){var l;t&&"function"!=typeof t?(r=t.duration,l=t.element,u=t.connector):l=t;var h=new Map,d=function(e){h.forEach(e),e(c)},f=function(e){return d((function(t){return t.error(e)}))},p=0,v=!1,y=new a.OperatorSubscriber(c,(function(t){try{var s=e(t),d=h.get(s);if(!d){h.set(s,d=u?u():new o.Subject);var b=(g=s,_=d,(O=new n.Observable((function(e){p++;var t=_.subscribe(e);return function(){t.unsubscribe(),0==--p&&v&&y.unsubscribe()}}))).key=g,O);if(c.next(b),r){var m=a.createOperatorSubscriber(d,(function(){d.complete(),null==m||m.unsubscribe()}),void 0,void 0,(function(){return h.delete(s)}));y.add(i.innerFrom(r(b)).subscribe(m))}}d.next(l?l(t):t)}catch(e){f(e)}var g,_,O}),(function(){return d((function(e){return e.complete()}))}),f,(function(){return h.clear()}),(function(){return v=!0,0===p}));s.subscribe(y)}))}},2507:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ignoreElements=void 0;var n=r(5416),i=r(1266),o=r(6129);t.ignoreElements=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,o.noop))}))}},6095:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var n=r(5416),i=r(1266);t.isEmpty=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,(function(){t.next(!1),t.complete()}),(function(){t.next(!0),t.complete()})))}))}},587:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.joinAllInternals=void 0;var n=r(9391),i=r(8240),o=r(2393),s=r(1282),a=r(2984);t.joinAllInternals=function(e,t){return o.pipe(a.toArray(),s.mergeMap((function(t){return e(t)})),t?i.mapOneOrManyArgs(t):n.identity)}},3484:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.last=void 0;var n=r(7676),i=r(2914),o=r(787),s=r(5956),a=r(7507),u=r(9391);t.last=function(e,t){var r=arguments.length>=2;return function(c){return c.pipe(e?i.filter((function(t,r){return e(t,r,c)})):u.identity,o.takeLast(1),r?a.defaultIfEmpty(t):s.throwIfEmpty((function(){return new n.EmptyError})))}}},4828:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.map=void 0;var n=r(5416),i=r(1266);t.map=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){n.next(e.call(t,r,o++))})))}))}},1357:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mapTo=void 0;var n=r(4828);t.mapTo=function(e){return n.map((function(){return e}))}},7967:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.materialize=void 0;var n=r(6145),i=r(5416),o=r(1266);t.materialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){t.next(n.Notification.createNext(e))}),(function(){t.next(n.Notification.createComplete()),t.complete()}),(function(e){t.next(n.Notification.createError(e)),t.complete()})))}))}},4388:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.max=void 0;var n=r(3818),i=r(4717);t.max=function(e){return n.reduce(i.isFunction(e)?function(t,r){return e(t,r)>0?t:r}:function(e,t){return e>t?e:t})}},1550:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;var o=r(5416),s=r(160),a=r(1867),u=r(1824),c=r(5294);t.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=u.popScheduler(e),l=u.popNumber(e,1/0);return e=s.argsOrArgArray(e),o.operate((function(t,o){a.mergeAll(l)(c.from(i([t],n(e)),r)).subscribe(o)}))}},1867:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=void 0;var n=r(1282),i=r(9391);t.mergeAll=function(e){return void 0===e&&(e=1/0),n.mergeMap(i.identity,e)}},3754:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeInternals=void 0;var n=r(2296),i=r(5031),o=r(1266);t.mergeInternals=function(e,t,r,s,a,u,c,l){var h=[],d=0,f=0,p=!1,v=function(){!p||h.length||d||t.complete()},y=function(e){return d<s?b(e):h.push(e)},b=function(e){u&&t.next(e),d++;var l=!1;n.innerFrom(r(e,f++)).subscribe(o.createOperatorSubscriber(t,(function(e){null==a||a(e),u?y(e):t.next(e)}),(function(){l=!0}),void 0,(function(){if(l)try{d--;for(var e=function(){var e=h.shift();c?i.executeSchedule(t,c,(function(){return b(e)})):b(e)};h.length&&d<s;)e();v()}catch(e){t.error(e)}})))};return e.subscribe(o.createOperatorSubscriber(t,y,(function(){p=!0,v()}))),function(){null==l||l()}}},1282:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMap=void 0;var n=r(4828),i=r(2296),o=r(5416),s=r(3754),a=r(4717);t.mergeMap=function e(t,r,u){return void 0===u&&(u=1/0),a.isFunction(r)?e((function(e,o){return n.map((function(t,n){return r(e,t,o,n)}))(i.innerFrom(t(e,o)))}),u):("number"==typeof r&&(u=r),o.operate((function(e,r){return s.mergeInternals(e,r,t,u)})))}},6295:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMapTo=void 0;var n=r(1282),i=r(4717);t.mergeMapTo=function(e,t,r){return void 0===r&&(r=1/0),i.isFunction(t)?n.mergeMap((function(){return e}),t,r):("number"==typeof t&&(r=t),n.mergeMap((function(){return e}),r))}},9527:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeScan=void 0;var n=r(5416),i=r(3754);t.mergeScan=function(e,t,r){return void 0===r&&(r=1/0),n.operate((function(n,o){var s=t;return i.mergeInternals(n,o,(function(t,r){return e(s,t,r)}),r,(function(e){s=e}),!1,void 0,(function(){return s=null}))}))}},5834:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.mergeWith=void 0;var o=r(1550);t.mergeWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.merge.apply(void 0,i([],n(e)))}},1306:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.min=void 0;var n=r(3818),i=r(4717);t.min=function(e){return n.reduce(i.isFunction(e)?function(t,r){return e(t,r)<0?t:r}:function(e,t){return e<t?e:t})}},9924:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.multicast=void 0;var n=r(1507),i=r(4717),o=r(2216);t.multicast=function(e,t){var r=i.isFunction(e)?e:function(){return e};return i.isFunction(t)?o.connect(t,{connector:r}):function(e){return new n.ConnectableObservable(e,r)}}},2803:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeOn=void 0;var n=r(5031),i=r(5416),o=r(1266);t.observeOn=function(e,t){return void 0===t&&(t=0),i.operate((function(r,i){r.subscribe(o.createOperatorSubscriber(i,(function(r){return n.executeSchedule(i,e,(function(){return i.next(r)}),t)}),(function(){return n.executeSchedule(i,e,(function(){return i.complete()}),t)}),(function(r){return n.executeSchedule(i,e,(function(){return i.error(r)}),t)})))}))}},1997:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.onErrorResumeNext=t.onErrorResumeNextWith=void 0;var o=r(160),s=r(6467);function a(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=o.argsOrArgArray(e);return function(e){return s.onErrorResumeNext.apply(void 0,i([e],n(r)))}}t.onErrorResumeNextWith=a,t.onErrorResumeNext=a},4492:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pairwise=void 0;var n=r(5416),i=r(1266);t.pairwise=function(){return n.operate((function(e,t){var r,n=!1;e.subscribe(i.createOperatorSubscriber(t,(function(e){var i=r;r=e,n&&t.next([i,e]),n=!0})))}))}},5352:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.partition=void 0;var n=r(1276),i=r(2914);t.partition=function(e,t){return function(r){return[i.filter(e,t)(r),i.filter(n.not(e,t))(r)]}}},3391:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pluck=void 0;var n=r(4828);t.pluck=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length;if(0===r)throw new Error("list of properties cannot be empty.");return n.map((function(t){for(var n=t,i=0;i<r;i++){var o=null==n?void 0:n[e[i]];if(void 0===o)return;n=o}return n}))}},297:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publish=void 0;var n=r(20),i=r(9924),o=r(2216);t.publish=function(e){return e?function(t){return o.connect(e)(t)}:function(e){return i.multicast(new n.Subject)(e)}}},6383:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishBehavior=void 0;var n=r(1222),i=r(1507);t.publishBehavior=function(e){return function(t){var r=new n.BehaviorSubject(e);return new i.ConnectableObservable(t,(function(){return r}))}}},8229:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishLast=void 0;var n=r(5366),i=r(1507);t.publishLast=function(){return function(e){var t=new n.AsyncSubject;return new i.ConnectableObservable(e,(function(){return t}))}}},8226:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishReplay=void 0;var n=r(5129),i=r(9924),o=r(4717);t.publishReplay=function(e,t,r,s){r&&!o.isFunction(r)&&(s=r);var a=o.isFunction(r)?r:void 0;return function(r){return i.multicast(new n.ReplaySubject(e,t,s),a)(r)}}},8973:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.race=void 0;var o=r(160),s=r(177);t.race=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.raceWith.apply(void 0,i([],n(o.argsOrArgArray(e))))}},177:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.raceWith=void 0;var o=r(4143),s=r(5416),a=r(9391);t.raceWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length?s.operate((function(t,r){o.raceInit(i([t],n(e)))(r)})):a.identity}},3818:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reduce=void 0;var n=r(7071),i=r(5416);t.reduce=function(e,t){return i.operate(n.scanInternals(e,t,arguments.length>=2,!1,!0))}},5884:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.refCount=void 0;var n=r(5416),i=r(1266);t.refCount=function(){return n.operate((function(e,t){var r=null;e._refCount++;var n=i.createOperatorSubscriber(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)r=null;else{var n=e._connection,i=r;r=null,!n||i&&n!==i||n.unsubscribe(),t.unsubscribe()}}));e.subscribe(n),n.closed||(r=e.connect())}))}},7775:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeat=void 0;var n=r(7209),i=r(5416),o=r(1266),s=r(2296),a=r(5461);t.repeat=function(e){var t,r,u=1/0;return null!=e&&("object"==typeof e?(t=e.count,u=void 0===t?1/0:t,r=e.delay):u=e),u<=0?function(){return n.EMPTY}:i.operate((function(e,t){var n,i=0,c=function(){if(null==n||n.unsubscribe(),n=null,null!=r){var e="number"==typeof r?a.timer(r):s.innerFrom(r(i)),u=o.createOperatorSubscriber(t,(function(){u.unsubscribe(),l()}));e.subscribe(u)}else l()},l=function(){var r=!1;n=e.subscribe(o.createOperatorSubscriber(t,void 0,(function(){++i<u?n?c():r=!0:t.complete()}))),r&&c()};l()}))}},5567:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeatWhen=void 0;var n=r(2296),i=r(20),o=r(5416),s=r(1266);t.repeatWhen=function(e){return o.operate((function(t,r){var o,a,u=!1,c=!1,l=!1,h=function(){return l&&c&&(r.complete(),!0)},d=function(){l=!1,o=t.subscribe(s.createOperatorSubscriber(r,void 0,(function(){l=!0,!h()&&(a||(a=new i.Subject,n.innerFrom(e(a)).subscribe(s.createOperatorSubscriber(r,(function(){o?d():u=!0}),(function(){c=!0,h()})))),a).next()}))),u&&(o.unsubscribe(),o=null,u=!1,d())};d()}))}},4740:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retry=void 0;var n=r(5416),i=r(1266),o=r(9391),s=r(5461),a=r(2296);t.retry=function(e){var t;void 0===e&&(e=1/0);var r=(t=e&&"object"==typeof e?e:{count:e}).count,u=void 0===r?1/0:r,c=t.delay,l=t.resetOnSuccess,h=void 0!==l&&l;return u<=0?o.identity:n.operate((function(e,t){var r,n=0,o=function(){var l=!1;r=e.subscribe(i.createOperatorSubscriber(t,(function(e){h&&(n=0),t.next(e)}),void 0,(function(e){if(n++<u){var h=function(){r?(r.unsubscribe(),r=null,o()):l=!0};if(null!=c){var d="number"==typeof c?s.timer(c):a.innerFrom(c(e,n)),f=i.createOperatorSubscriber(t,(function(){f.unsubscribe(),h()}),(function(){t.complete()}));d.subscribe(f)}else h()}else t.error(e)}))),l&&(r.unsubscribe(),r=null,o())};o()}))}},264:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retryWhen=void 0;var n=r(2296),i=r(20),o=r(5416),s=r(1266);t.retryWhen=function(e){return o.operate((function(t,r){var o,a,u=!1,c=function(){o=t.subscribe(s.createOperatorSubscriber(r,void 0,void 0,(function(t){a||(a=new i.Subject,n.innerFrom(e(a)).subscribe(s.createOperatorSubscriber(r,(function(){return o?c():u=!0})))),a&&a.next(t)}))),u&&(o.unsubscribe(),o=null,u=!1,c())};c()}))}},6870:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sample=void 0;var n=r(2296),i=r(5416),o=r(6129),s=r(1266);t.sample=function(e){return i.operate((function(t,r){var i=!1,a=null;t.subscribe(s.createOperatorSubscriber(r,(function(e){i=!0,a=e}))),n.innerFrom(e).subscribe(s.createOperatorSubscriber(r,(function(){if(i){i=!1;var e=a;a=null,r.next(e)}}),o.noop))}))}},5411:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sampleTime=void 0;var n=r(4386),i=r(6870),o=r(8767);t.sampleTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.sample(o.interval(e,t))}},2457:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scan=void 0;var n=r(5416),i=r(7071);t.scan=function(e,t){return n.operate(i.scanInternals(e,t,arguments.length>=2,!0))}},7071:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scanInternals=void 0;var n=r(1266);t.scanInternals=function(e,t,r,i,o){return function(s,a){var u=r,c=t,l=0;s.subscribe(n.createOperatorSubscriber(a,(function(t){var r=l++;c=u?e(c,t,r):(u=!0,t),i&&a.next(c)}),o&&function(){u&&a.next(c),a.complete()}))}}},5109:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sequenceEqual=void 0;var n=r(5416),i=r(1266),o=r(2296);t.sequenceEqual=function(e,t){return void 0===t&&(t=function(e,t){return e===t}),n.operate((function(r,n){var s={buffer:[],complete:!1},a={buffer:[],complete:!1},u=function(e){n.next(e),n.complete()},c=function(e,r){var o=i.createOperatorSubscriber(n,(function(n){var i=r.buffer,o=r.complete;0===i.length?o?u(!1):e.buffer.push(n):!t(n,i.shift())&&u(!1)}),(function(){e.complete=!0;var t=r.complete,n=r.buffer;t&&u(0===n.length),null==o||o.unsubscribe()}));return o};r.subscribe(c(s,a)),o.innerFrom(e).subscribe(c(a,s))}))}},3329:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.share=void 0;var o=r(2296),s=r(20),a=r(4512),u=r(5416);function c(e,t){for(var r=[],s=2;s<arguments.length;s++)r[s-2]=arguments[s];if(!0!==t){if(!1!==t){var u=new a.SafeSubscriber({next:function(){u.unsubscribe(),e()}});return o.innerFrom(t.apply(void 0,i([],n(r)))).subscribe(u)}}else e()}t.share=function(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new s.Subject}:t,n=e.resetOnError,i=void 0===n||n,l=e.resetOnComplete,h=void 0===l||l,d=e.resetOnRefCountZero,f=void 0===d||d;return function(e){var t,n,s,l=0,d=!1,p=!1,v=function(){null==n||n.unsubscribe(),n=void 0},y=function(){v(),t=s=void 0,d=p=!1},b=function(){var e=t;y(),null==e||e.unsubscribe()};return u.operate((function(e,u){l++,p||d||v();var m=s=null!=s?s:r();u.add((function(){0!=--l||p||d||(n=c(b,f))})),m.subscribe(u),!t&&l>0&&(t=new a.SafeSubscriber({next:function(e){return m.next(e)},error:function(e){p=!0,v(),n=c(y,i,e),m.error(e)},complete:function(){d=!0,v(),n=c(y,h),m.complete()}}),o.innerFrom(e).subscribe(t))}))(e)}}},1738:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.shareReplay=void 0;var n=r(5129),i=r(3329);t.shareReplay=function(e,t,r){var o,s,a,u,c=!1;return e&&"object"==typeof e?(o=e.bufferSize,u=void 0===o?1/0:o,s=e.windowTime,t=void 0===s?1/0:s,c=void 0!==(a=e.refCount)&&a,r=e.scheduler):u=null!=e?e:1/0,i.share({connector:function(){return new n.ReplaySubject(u,t,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:c})}},884:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.single=void 0;var n=r(7676),i=r(8168),o=r(2318),s=r(5416),a=r(1266);t.single=function(e){return s.operate((function(t,r){var s,u=!1,c=!1,l=0;t.subscribe(a.createOperatorSubscriber(r,(function(n){c=!0,e&&!e(n,l++,t)||(u&&r.error(new i.SequenceError("Too many matching values")),u=!0,s=n)}),(function(){u?(r.next(s),r.complete()):r.error(c?new o.NotFoundError("No matching values"):new n.EmptyError)})))}))}},4411:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skip=void 0;var n=r(2914);t.skip=function(e){return n.filter((function(t,r){return e<=r}))}},9355:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipLast=void 0;var n=r(9391),i=r(5416),o=r(1266);t.skipLast=function(e){return e<=0?n.identity:i.operate((function(t,r){var n=new Array(e),i=0;return t.subscribe(o.createOperatorSubscriber(r,(function(t){var o=i++;if(o<e)n[o]=t;else{var s=o%e,a=n[s];n[s]=t,r.next(a)}}))),function(){n=null}}))}},2947:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipUntil=void 0;var n=r(5416),i=r(1266),o=r(2296),s=r(6129);t.skipUntil=function(e){return n.operate((function(t,r){var n=!1,a=i.createOperatorSubscriber(r,(function(){null==a||a.unsubscribe(),n=!0}),s.noop);o.innerFrom(e).subscribe(a),t.subscribe(i.createOperatorSubscriber(r,(function(e){return n&&r.next(e)})))}))}},9842:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipWhile=void 0;var n=r(5416),i=r(1266);t.skipWhile=function(e){return n.operate((function(t,r){var n=!1,o=0;t.subscribe(i.createOperatorSubscriber(r,(function(t){return(n||(n=!e(t,o++)))&&r.next(t)})))}))}},2778:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.startWith=void 0;var n=r(2070),i=r(1824),o=r(5416);t.startWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=i.popScheduler(e);return o.operate((function(t,i){(r?n.concat(e,t,r):n.concat(e,t)).subscribe(i)}))}},4027:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.subscribeOn=void 0;var n=r(5416);t.subscribeOn=function(e,t){return void 0===t&&(t=0),n.operate((function(r,n){n.add(e.schedule((function(){return r.subscribe(n)}),t))}))}},9061:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchAll=void 0;var n=r(6300),i=r(9391);t.switchAll=function(){return n.switchMap(i.identity)}},6300:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchMap=void 0;var n=r(2296),i=r(5416),o=r(1266);t.switchMap=function(e,t){return i.operate((function(r,i){var s=null,a=0,u=!1,c=function(){return u&&!s&&i.complete()};r.subscribe(o.createOperatorSubscriber(i,(function(r){null==s||s.unsubscribe();var u=0,l=a++;n.innerFrom(e(r,l)).subscribe(s=o.createOperatorSubscriber(i,(function(e){return i.next(t?t(r,e,l,u++):e)}),(function(){s=null,c()})))}),(function(){u=!0,c()})))}))}},1933:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchMapTo=void 0;var n=r(6300),i=r(4717);t.switchMapTo=function(e,t){return i.isFunction(t)?n.switchMap((function(){return e}),t):n.switchMap((function(){return e}))}},1689:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchScan=void 0;var n=r(6300),i=r(5416);t.switchScan=function(e,t){return i.operate((function(r,i){var o=t;return n.switchMap((function(t,r){return e(o,t,r)}),(function(e,t){return o=t,t}))(r).subscribe(i),function(){o=null}}))}},6803:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.take=void 0;var n=r(7209),i=r(5416),o=r(1266);t.take=function(e){return e<=0?function(){return n.EMPTY}:i.operate((function(t,r){var n=0;t.subscribe(o.createOperatorSubscriber(r,(function(t){++n<=e&&(r.next(t),e<=n&&r.complete())})))}))}},787:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.takeLast=void 0;var i=r(7209),o=r(5416),s=r(1266);t.takeLast=function(e){return e<=0?function(){return i.EMPTY}:o.operate((function(t,r){var i=[];t.subscribe(s.createOperatorSubscriber(r,(function(t){i.push(t),e<i.length&&i.shift()}),(function(){var e,t;try{for(var o=n(i),s=o.next();!s.done;s=o.next()){var a=s.value;r.next(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}r.complete()}),void 0,(function(){i=null})))}))}},4811:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.takeUntil=void 0;var n=r(5416),i=r(1266),o=r(2296),s=r(6129);t.takeUntil=function(e){return n.operate((function(t,r){o.innerFrom(e).subscribe(i.createOperatorSubscriber(r,(function(){return r.complete()}),s.noop)),!r.closed&&t.subscribe(r)}))}},7770:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.takeWhile=void 0;var n=r(5416),i=r(1266);t.takeWhile=function(e,t){return void 0===t&&(t=!1),n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){var i=e(r,o++);(i||t)&&n.next(r),!i&&n.complete()})))}))}},9967:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tap=void 0;var n=r(4717),i=r(5416),o=r(1266),s=r(9391);t.tap=function(e,t,r){var a=n.isFunction(e)||t||r?{next:e,error:t,complete:r}:e;return a?i.operate((function(e,t){var r;null===(r=a.subscribe)||void 0===r||r.call(a);var n=!0;e.subscribe(o.createOperatorSubscriber(t,(function(e){var r;null===(r=a.next)||void 0===r||r.call(a,e),t.next(e)}),(function(){var e;n=!1,null===(e=a.complete)||void 0===e||e.call(a),t.complete()}),(function(e){var r;n=!1,null===(r=a.error)||void 0===r||r.call(a,e),t.error(e)}),(function(){var e,t;n&&(null===(e=a.unsubscribe)||void 0===e||e.call(a)),null===(t=a.finalize)||void 0===t||t.call(a)})))})):s.identity}},6516:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=void 0;var n=r(5416),i=r(1266),o=r(2296);t.throttle=function(e,t){return n.operate((function(r,n){var s=null!=t?t:{},a=s.leading,u=void 0===a||a,c=s.trailing,l=void 0!==c&&c,h=!1,d=null,f=null,p=!1,v=function(){null==f||f.unsubscribe(),f=null,l&&(m(),p&&n.complete())},y=function(){f=null,p&&n.complete()},b=function(t){return f=o.innerFrom(e(t)).subscribe(i.createOperatorSubscriber(n,v,y))},m=function(){if(h){h=!1;var e=d;d=null,n.next(e),!p&&b(e)}};r.subscribe(i.createOperatorSubscriber(n,(function(e){h=!0,d=e,(!f||f.closed)&&(u?m():b(e))}),(function(){p=!0,(!(l&&h&&f)||f.closed)&&n.complete()})))}))}},5945:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throttleTime=void 0;var n=r(4386),i=r(6516),o=r(5461);t.throttleTime=function(e,t,r){void 0===t&&(t=n.asyncScheduler);var s=o.timer(e,t);return i.throttle((function(){return s}),r)}},5956:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfEmpty=void 0;var n=r(7676),i=r(5416),o=r(1266);function s(){return new n.EmptyError}t.throwIfEmpty=function(e){return void 0===e&&(e=s),i.operate((function(t,r){var n=!1;t.subscribe(o.createOperatorSubscriber(r,(function(e){n=!0,r.next(e)}),(function(){return n?r.complete():r.error(e())})))}))}},9712:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeInterval=t.timeInterval=void 0;var n=r(4386),i=r(5416),o=r(1266);t.timeInterval=function(e){return void 0===e&&(e=n.asyncScheduler),i.operate((function(t,r){var n=e.now();t.subscribe(o.createOperatorSubscriber(r,(function(t){var i=e.now(),o=i-n;n=i,r.next(new s(t,o))})))}))};var s=function(e,t){this.value=e,this.interval=t};t.TimeInterval=s},7517:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeout=t.TimeoutError=void 0;var n=r(4386),i=r(6349),o=r(5416),s=r(2296),a=r(6871),u=r(1266),c=r(5031);function l(e){throw new t.TimeoutError(e)}t.TimeoutError=a.createErrorClass((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}})),t.timeout=function(e,t){var r=i.isValidDate(e)?{first:e}:"number"==typeof e?{each:e}:e,a=r.first,h=r.each,d=r.with,f=void 0===d?l:d,p=r.scheduler,v=void 0===p?null!=t?t:n.asyncScheduler:p,y=r.meta,b=void 0===y?null:y;if(null==a&&null==h)throw new TypeError("No timeout provided.");return o.operate((function(e,t){var r,n,i=null,o=0,l=function(e){n=c.executeSchedule(t,v,(function(){try{r.unsubscribe(),s.innerFrom(f({meta:b,lastValue:i,seen:o})).subscribe(t)}catch(e){t.error(e)}}),e)};r=e.subscribe(u.createOperatorSubscriber(t,(function(e){null==n||n.unsubscribe(),o++,t.next(i=e),h>0&&l(h)}),void 0,void 0,(function(){(null==n?void 0:n.closed)||null==n||n.unsubscribe(),i=null}))),!o&&l(null!=a?"number"==typeof a?a:+a-v.now():h)}))}},2001:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutWith=void 0;var n=r(4386),i=r(6349),o=r(7517);t.timeoutWith=function(e,t,r){var s,a,u;if(r=null!=r?r:n.async,i.isValidDate(e)?s=e:"number"==typeof e&&(a=e),!t)throw new TypeError("No observable provided to switch to");if(u=function(){return t},null==s&&null==a)throw new TypeError("No timeout provided.");return o.timeout({first:s,each:a,scheduler:r,with:u})}},8158:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timestamp=void 0;var n=r(4575),i=r(4828);t.timestamp=function(e){return void 0===e&&(e=n.dateTimestampProvider),i.map((function(t){return{value:t,timestamp:e.now()}}))}},2984:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toArray=void 0;var n=r(3818),i=r(5416),o=function(e,t){return e.push(t),e};t.toArray=function(){return i.operate((function(e,t){n.reduce(o,[])(e).subscribe(t)}))}},5492:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.window=void 0;var n=r(20),i=r(5416),o=r(1266),s=r(6129),a=r(2296);t.window=function(e){return i.operate((function(t,r){var i=new n.Subject;r.next(i.asObservable());var u=function(e){i.error(e),r.error(e)};return t.subscribe(o.createOperatorSubscriber(r,(function(e){return null==i?void 0:i.next(e)}),(function(){i.complete(),r.complete()}),u)),a.innerFrom(e).subscribe(o.createOperatorSubscriber(r,(function(){i.complete(),r.next(i=new n.Subject)}),s.noop,u)),function(){null==i||i.unsubscribe(),i=null}}))}},6817:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.windowCount=void 0;var i=r(20),o=r(5416),s=r(1266);t.windowCount=function(e,t){void 0===t&&(t=0);var r=t>0?t:e;return o.operate((function(t,o){var a=[new i.Subject],u=0;o.next(a[0].asObservable()),t.subscribe(s.createOperatorSubscriber(o,(function(t){var s,c;try{for(var l=n(a),h=l.next();!h.done;h=l.next())h.value.next(t)}catch(e){s={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(s)throw s.error}}var d=u-e+1;if(d>=0&&d%r==0&&a.shift().complete(),++u%r==0){var f=new i.Subject;a.push(f),o.next(f.asObservable())}}),(function(){for(;a.length>0;)a.shift().complete();o.complete()}),(function(e){for(;a.length>0;)a.shift().error(e);o.error(e)}),(function(){a=null})))}))}},6841:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.windowTime=void 0;var n=r(20),i=r(4386),o=r(7491),s=r(5416),a=r(1266),u=r(7394),c=r(1824),l=r(5031);t.windowTime=function(e){for(var t,r,h=[],d=1;d<arguments.length;d++)h[d-1]=arguments[d];var f=null!==(t=c.popScheduler(h))&&void 0!==t?t:i.asyncScheduler,p=null!==(r=h[0])&&void 0!==r?r:null,v=h[1]||1/0;return s.operate((function(t,r){var i=[],s=!1,c=function(e){var t=e.window,r=e.subs;t.complete(),r.unsubscribe(),u.arrRemove(i,e),s&&h()},h=function(){if(i){var t=new o.Subscription;r.add(t);var s=new n.Subject,a={window:s,subs:t,seen:0};i.push(a),r.next(s.asObservable()),l.executeSchedule(t,f,(function(){return c(a)}),e)}};null!==p&&p>=0?l.executeSchedule(r,f,h,p,!0):s=!0,h();var d=function(e){return i.slice().forEach(e)},y=function(e){d((function(t){var r=t.window;return e(r)})),e(r),r.unsubscribe()};return t.subscribe(a.createOperatorSubscriber(r,(function(e){d((function(t){t.window.next(e),v<=++t.seen&&c(t)}))}),(function(){return y((function(e){return e.complete()}))}),(function(e){return y((function(t){return t.error(e)}))}))),function(){i=null}}))}},4880:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.windowToggle=void 0;var i=r(20),o=r(7491),s=r(5416),a=r(2296),u=r(1266),c=r(6129),l=r(7394);t.windowToggle=function(e,t){return s.operate((function(r,s){var h=[],d=function(e){for(;0<h.length;)h.shift().error(e);s.error(e)};a.innerFrom(e).subscribe(u.createOperatorSubscriber(s,(function(e){var r=new i.Subject;h.push(r);var n,f=new o.Subscription;try{n=a.innerFrom(t(e))}catch(e){return void d(e)}s.next(r.asObservable()),f.add(n.subscribe(u.createOperatorSubscriber(s,(function(){l.arrRemove(h,r),r.complete(),f.unsubscribe()}),c.noop,d)))}),c.noop)),r.subscribe(u.createOperatorSubscriber(s,(function(e){var t,r,i=h.slice();try{for(var o=n(i),s=o.next();!s.done;s=o.next())s.value.next(e)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}),(function(){for(;0<h.length;)h.shift().complete();s.complete()}),d,(function(){for(;0<h.length;)h.shift().unsubscribe()})))}))}},3016:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.windowWhen=void 0;var n=r(20),i=r(5416),o=r(1266),s=r(2296);t.windowWhen=function(e){return i.operate((function(t,r){var i,a,u=function(e){i.error(e),r.error(e)},c=function(){var t;null==a||a.unsubscribe(),null==i||i.complete(),i=new n.Subject,r.next(i.asObservable());try{t=s.innerFrom(e())}catch(e){return void u(e)}t.subscribe(a=o.createOperatorSubscriber(r,c,c,u))};c(),t.subscribe(o.createOperatorSubscriber(r,(function(e){return i.next(e)}),(function(){i.complete(),r.complete()}),u,(function(){null==a||a.unsubscribe(),i=null})))}))}},9163:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.withLatestFrom=void 0;var o=r(5416),s=r(1266),a=r(2296),u=r(9391),c=r(6129),l=r(1824);t.withLatestFrom=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=l.popResultSelector(e);return o.operate((function(t,o){for(var l=e.length,h=new Array(l),d=e.map((function(){return!1})),f=!1,p=function(t){a.innerFrom(e[t]).subscribe(s.createOperatorSubscriber(o,(function(e){h[t]=e,f||d[t]||(d[t]=!0,(f=d.every(u.identity))&&(d=null))}),c.noop))},v=0;v<l;v++)p(v);t.subscribe(s.createOperatorSubscriber(o,(function(e){if(f){var t=i([e],n(h));o.next(r?r.apply(void 0,i([],n(t))):t)}})))}))}},2681:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.zip=void 0;var o=r(1763),s=r(5416);t.zip=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.operate((function(t,r){o.zip.apply(void 0,i([t],n(e))).subscribe(r)}))}},5606:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.zipAll=void 0;var n=r(1763),i=r(587);t.zipAll=function(e){return i.joinAllInternals(n.zip,e)}},973:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.zipWith=void 0;var o=r(2681);t.zipWith=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.zip.apply(void 0,i([],n(e)))}},8762:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleArray=void 0;var n=r(2023);t.scheduleArray=function(e,t){return new n.Observable((function(r){var n=0;return t.schedule((function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())}))}))}},3741:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleAsyncIterable=void 0;var n=r(2023),i=r(5031);t.scheduleAsyncIterable=function(e,t){if(!e)throw new Error("Iterable cannot be null");return new n.Observable((function(r){i.executeSchedule(r,t,(function(){var n=e[Symbol.asyncIterator]();i.executeSchedule(r,t,(function(){n.next().then((function(e){e.done?r.complete():r.next(e.value)}))}),0,!0)}))}))}},3585:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleIterable=void 0;var n=r(2023),i=r(3967),o=r(4717),s=r(5031);t.scheduleIterable=function(e,t){return new n.Observable((function(r){var n;return s.executeSchedule(r,t,(function(){n=e[i.iterator](),s.executeSchedule(r,t,(function(){var e,t,i;try{t=(e=n.next()).value,i=e.done}catch(e){return void r.error(e)}i?r.complete():r.next(t)}),0,!0)})),function(){return o.isFunction(null==n?void 0:n.return)&&n.return()}}))}},4502:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleObservable=void 0;var n=r(2296),i=r(2803),o=r(4027);t.scheduleObservable=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},2366:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.schedulePromise=void 0;var n=r(2296),i=r(2803),o=r(4027);t.schedulePromise=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},9136:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleReadableStreamLike=void 0;var n=r(3741),i=r(3026);t.scheduleReadableStreamLike=function(e,t){return n.scheduleAsyncIterable(i.readableStreamLikeToAsyncGenerator(e),t)}},4463:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduled=void 0;var n=r(4502),i=r(2366),o=r(8762),s=r(3585),a=r(3741),u=r(1801),c=r(452),l=r(5547),h=r(6847),d=r(9451),f=r(3533),p=r(3026),v=r(9136);t.scheduled=function(e,t){if(null!=e){if(u.isInteropObservable(e))return n.scheduleObservable(e,t);if(l.isArrayLike(e))return o.scheduleArray(e,t);if(c.isPromise(e))return i.schedulePromise(e,t);if(d.isAsyncIterable(e))return a.scheduleAsyncIterable(e,t);if(h.isIterable(e))return s.scheduleIterable(e,t);if(p.isReadableStreamLike(e))return v.scheduleReadableStreamLike(e,t)}throw f.createInvalidObservableTypeError(e)}},7638:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.Action=void 0;var i=function(e){function t(t,r){return e.call(this)||this}return n(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(r(7491).Subscription);t.Action=i},1080:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncAction=void 0;var i=r(7638),o=r(2320),s=r(7394),a=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return n(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,i=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(i,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),o.intervalProvider.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&o.intervalProvider.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,s.arrRemove(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(i.Action);t.AsyncAction=a},1017:function(e,t,r){var n=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncScheduler=void 0;var i=r(469),o=function(e){function t(t,r){void 0===r&&(r=i.Scheduler.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return n(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(i.Scheduler);t.AsyncScheduler=o},4386:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.async=t.asyncScheduler=void 0;var n=r(1080),i=r(1017);t.asyncScheduler=new i.AsyncScheduler(n.AsyncAction),t.async=t.asyncScheduler},4575:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dateTimestampProvider=void 0,t.dateTimestampProvider={now:function(){return(t.dateTimestampProvider.delegate||Date).now()},delegate:void 0}},2320:function(e,t){var r=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.intervalProvider=void 0,t.intervalProvider={setInterval:function(e,i){for(var o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];var a=t.intervalProvider.delegate;return(null==a?void 0:a.setInterval)?a.setInterval.apply(a,n([e,i],r(o))):setInterval.apply(void 0,n([e,i],r(o)))},clearInterval:function(e){var r=t.intervalProvider.delegate;return((null==r?void 0:r.clearInterval)||clearInterval)(e)},delegate:void 0}},6476:function(e,t){var r=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutProvider=void 0,t.timeoutProvider={setTimeout:function(e,i){for(var o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];var a=t.timeoutProvider.delegate;return(null==a?void 0:a.setTimeout)?a.setTimeout.apply(a,n([e,i],r(o))):setTimeout.apply(void 0,n([e,i],r(o)))},clearTimeout:function(e){var r=t.timeoutProvider.delegate;return((null==r?void 0:r.clearTimeout)||clearTimeout)(e)},delegate:void 0}},3967:(e,t)=>{function r(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}Object.defineProperty(t,"__esModule",{value:!0}),t.iterator=t.getSymbolIterator=void 0,t.getSymbolIterator=r,t.iterator=r()},2131:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observable=void 0,t.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},9148:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentOutOfRangeError=void 0;var n=r(6871);t.ArgumentOutOfRangeError=n.createErrorClass((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}}))},7676:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyError=void 0;var n=r(6871);t.EmptyError=n.createErrorClass((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}))},2318:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NotFoundError=void 0;var n=r(6871);t.NotFoundError=n.createErrorClass((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}}))},8083:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectUnsubscribedError=void 0;var n=r(6871);t.ObjectUnsubscribedError=n.createErrorClass((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}))},8168:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SequenceError=void 0;var n=r(6871);t.SequenceError=n.createErrorClass((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}))},665:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnsubscriptionError=void 0;var n=r(6871);t.UnsubscriptionError=n.createErrorClass((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}))},1824:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.popNumber=t.popScheduler=t.popResultSelector=void 0;var n=r(4717),i=r(4568);function o(e){return e[e.length-1]}t.popResultSelector=function(e){return n.isFunction(o(e))?e.pop():void 0},t.popScheduler=function(e){return i.isScheduler(o(e))?e.pop():void 0},t.popNumber=function(e,t){return"number"==typeof o(e)?e.pop():t}},3787:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.argsArgArrayOrObject=void 0;var r=Array.isArray,n=Object.getPrototypeOf,i=Object.prototype,o=Object.keys;t.argsArgArrayOrObject=function(e){if(1===e.length){var t=e[0];if(r(t))return{args:t,keys:null};if((a=t)&&"object"==typeof a&&n(a)===i){var s=o(t);return{args:s.map((function(e){return t[e]})),keys:s}}}var a;return{args:e,keys:null}}},160:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.argsOrArgArray=void 0;var r=Array.isArray;t.argsOrArgArray=function(e){return 1===e.length&&r(e[0])?e[0]:e}},7394:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.arrRemove=void 0,t.arrRemove=function(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}},6871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createErrorClass=void 0,t.createErrorClass=function(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}},4950:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createObject=void 0,t.createObject=function(e,t){return e.reduce((function(e,r,n){return e[r]=t[n],e}),{})}},9916:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.captureError=t.errorContext=void 0;var n=r(7820),i=null;t.errorContext=function(e){if(n.config.useDeprecatedSynchronousErrorHandling){var t=!i;if(t&&(i={errorThrown:!1,error:null}),e(),t){var r=i,o=r.errorThrown,s=r.error;if(i=null,o)throw s}}else e()},t.captureError=function(e){n.config.useDeprecatedSynchronousErrorHandling&&i&&(i.errorThrown=!0,i.error=e)}},5031:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.executeSchedule=void 0,t.executeSchedule=function(e,t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var o=t.schedule((function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()}),n);if(e.add(o),!i)return o}},9391:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.identity=void 0,t.identity=function(e){return e}},5547:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayLike=void 0,t.isArrayLike=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},9451:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isAsyncIterable=void 0;var n=r(4717);t.isAsyncIterable=function(e){return Symbol.asyncIterator&&n.isFunction(null==e?void 0:e[Symbol.asyncIterator])}},6349:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isValidDate=void 0,t.isValidDate=function(e){return e instanceof Date&&!isNaN(e)}},4717:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e}},1801:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isInteropObservable=void 0;var n=r(2131),i=r(4717);t.isInteropObservable=function(e){return i.isFunction(e[n.observable])}},6847:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isIterable=void 0;var n=r(3967),i=r(4717);t.isIterable=function(e){return i.isFunction(null==e?void 0:e[n.iterator])}},452:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isPromise=void 0;var n=r(4717);t.isPromise=function(e){return n.isFunction(null==e?void 0:e.then)}},3026:function(e,t,r){var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=this&&this.__await||function(e){return this instanceof i?(this.v=e,this):new i(e)},o=this&&this.__asyncGenerator||function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){s.push([e,t,r,n])>1||u(e,t)}))})}function u(e,t){try{(r=o[e](t)).value instanceof i?Promise.resolve(r.value.v).then(c,l):h(s[0][2],r)}catch(e){h(s[0][3],e)}var r}function c(e){u("next",e)}function l(e){u("throw",e)}function h(e,t){e(t),s.shift(),s.length&&u(s[0][0],s[0][1])}};Object.defineProperty(t,"__esModule",{value:!0}),t.isReadableStreamLike=t.readableStreamLikeToAsyncGenerator=void 0;var s=r(4717);t.readableStreamLikeToAsyncGenerator=function(e){return o(this,arguments,(function(){var t,r,o;return n(this,(function(n){switch(n.label){case 0:t=e.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,i(t.read())];case 3:return r=n.sent(),o=r.value,r.done?[4,i(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,i(o)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))},t.isReadableStreamLike=function(e){return s.isFunction(null==e?void 0:e.getReader)}},4568:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isScheduler=void 0;var n=r(4717);t.isScheduler=function(e){return e&&n.isFunction(e.schedule)}},5416:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.operate=t.hasLift=void 0;var n=r(4717);function i(e){return n.isFunction(null==e?void 0:e.lift)}t.hasLift=i,t.operate=function(e){return function(t){if(i(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}},8240:function(e,t,r){var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.mapOneOrManyArgs=void 0;var o=r(4828),s=Array.isArray;t.mapOneOrManyArgs=function(e){return o.map((function(t){return function(e,t){return s(t)?e.apply(void 0,i([],n(t))):e(t)}(e,t)}))}},6129:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.noop=void 0,t.noop=function(){}},1276:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.not=void 0,t.not=function(e,t){return function(r,n){return!e.call(t,r,n)}}},2393:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pipeFromArray=t.pipe=void 0;var n=r(9391);function i(e){return 0===e.length?n.identity:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}t.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(e)},t.pipeFromArray=i},4696:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reportUnhandledError=void 0;var n=r(7820),i=r(6476);t.reportUnhandledError=function(e){i.timeoutProvider.setTimeout((function(){var t=n.config.onUnhandledError;if(!t)throw e;t(e)}))}},3533:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createInvalidObservableTypeError=void 0,t.createInvalidObservableTypeError=function(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}},6022:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=t.merge=t.max=t.materialize=t.mapTo=t.map=t.last=t.isEmpty=t.ignoreElements=t.groupBy=t.first=t.findIndex=t.find=t.finalize=t.filter=t.expand=t.exhaustMap=t.exhaustAll=t.exhaust=t.every=t.endWith=t.elementAt=t.distinctUntilKeyChanged=t.distinctUntilChanged=t.distinct=t.dematerialize=t.delayWhen=t.delay=t.defaultIfEmpty=t.debounceTime=t.debounce=t.count=t.connect=t.concatWith=t.concatMapTo=t.concatMap=t.concatAll=t.concat=t.combineLatestWith=t.combineLatest=t.combineLatestAll=t.combineAll=t.catchError=t.bufferWhen=t.bufferToggle=t.bufferTime=t.bufferCount=t.buffer=t.auditTime=t.audit=void 0,t.timeInterval=t.throwIfEmpty=t.throttleTime=t.throttle=t.tap=t.takeWhile=t.takeUntil=t.takeLast=t.take=t.switchScan=t.switchMapTo=t.switchMap=t.switchAll=t.subscribeOn=t.startWith=t.skipWhile=t.skipUntil=t.skipLast=t.skip=t.single=t.shareReplay=t.share=t.sequenceEqual=t.scan=t.sampleTime=t.sample=t.refCount=t.retryWhen=t.retry=t.repeatWhen=t.repeat=t.reduce=t.raceWith=t.race=t.publishReplay=t.publishLast=t.publishBehavior=t.publish=t.pluck=t.partition=t.pairwise=t.onErrorResumeNext=t.observeOn=t.multicast=t.min=t.mergeWith=t.mergeScan=t.mergeMapTo=t.mergeMap=t.flatMap=void 0,t.zipWith=t.zipAll=t.zip=t.withLatestFrom=t.windowWhen=t.windowToggle=t.windowTime=t.windowCount=t.window=t.toArray=t.timestamp=t.timeoutWith=t.timeout=void 0;var n=r(6993);Object.defineProperty(t,"audit",{enumerable:!0,get:function(){return n.audit}});var i=r(4116);Object.defineProperty(t,"auditTime",{enumerable:!0,get:function(){return i.auditTime}});var o=r(7190);Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return o.buffer}});var s=r(6835);Object.defineProperty(t,"bufferCount",{enumerable:!0,get:function(){return s.bufferCount}});var a=r(5219);Object.defineProperty(t,"bufferTime",{enumerable:!0,get:function(){return a.bufferTime}});var u=r(118);Object.defineProperty(t,"bufferToggle",{enumerable:!0,get:function(){return u.bufferToggle}});var c=r(7514);Object.defineProperty(t,"bufferWhen",{enumerable:!0,get:function(){return c.bufferWhen}});var l=r(8251);Object.defineProperty(t,"catchError",{enumerable:!0,get:function(){return l.catchError}});var h=r(1424);Object.defineProperty(t,"combineAll",{enumerable:!0,get:function(){return h.combineAll}});var d=r(2945);Object.defineProperty(t,"combineLatestAll",{enumerable:!0,get:function(){return d.combineLatestAll}});var f=r(2e3);Object.defineProperty(t,"combineLatest",{enumerable:!0,get:function(){return f.combineLatest}});var p=r(3928);Object.defineProperty(t,"combineLatestWith",{enumerable:!0,get:function(){return p.combineLatestWith}});var v=r(1812);Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return v.concat}});var y=r(861);Object.defineProperty(t,"concatAll",{enumerable:!0,get:function(){return y.concatAll}});var b=r(1012);Object.defineProperty(t,"concatMap",{enumerable:!0,get:function(){return b.concatMap}});var m=r(1157);Object.defineProperty(t,"concatMapTo",{enumerable:!0,get:function(){return m.concatMapTo}});var g=r(3692);Object.defineProperty(t,"concatWith",{enumerable:!0,get:function(){return g.concatWith}});var _=r(2216);Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return _.connect}});var O=r(8041);Object.defineProperty(t,"count",{enumerable:!0,get:function(){return O.count}});var S=r(2747);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return S.debounce}});var E=r(3870);Object.defineProperty(t,"debounceTime",{enumerable:!0,get:function(){return E.debounceTime}});var w=r(7507);Object.defineProperty(t,"defaultIfEmpty",{enumerable:!0,get:function(){return w.defaultIfEmpty}});var T=r(2409);Object.defineProperty(t,"delay",{enumerable:!0,get:function(){return T.delay}});var I=r(5137);Object.defineProperty(t,"delayWhen",{enumerable:!0,get:function(){return I.delayWhen}});var A=r(4126);Object.defineProperty(t,"dematerialize",{enumerable:!0,get:function(){return A.dematerialize}});var M=r(5208);Object.defineProperty(t,"distinct",{enumerable:!0,get:function(){return M.distinct}});var F=r(9939);Object.defineProperty(t,"distinctUntilChanged",{enumerable:!0,get:function(){return F.distinctUntilChanged}});var k=r(183);Object.defineProperty(t,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return k.distinctUntilKeyChanged}});var D=r(1195);Object.defineProperty(t,"elementAt",{enumerable:!0,get:function(){return D.elementAt}});var j=r(3723);Object.defineProperty(t,"endWith",{enumerable:!0,get:function(){return j.endWith}});var x=r(1909);Object.defineProperty(t,"every",{enumerable:!0,get:function(){return x.every}});var P=r(9228);Object.defineProperty(t,"exhaust",{enumerable:!0,get:function(){return P.exhaust}});var N=r(9765);Object.defineProperty(t,"exhaustAll",{enumerable:!0,get:function(){return N.exhaustAll}});var C=r(8748);Object.defineProperty(t,"exhaustMap",{enumerable:!0,get:function(){return C.exhaustMap}});var R=r(8324);Object.defineProperty(t,"expand",{enumerable:!0,get:function(){return R.expand}});var q=r(2914);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return q.filter}});var L=r(9822);Object.defineProperty(t,"finalize",{enumerable:!0,get:function(){return L.finalize}});var B=r(2819);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return B.find}});var Q=r(3367);Object.defineProperty(t,"findIndex",{enumerable:!0,get:function(){return Q.findIndex}});var V=r(1432);Object.defineProperty(t,"first",{enumerable:!0,get:function(){return V.first}});var U=r(4956);Object.defineProperty(t,"groupBy",{enumerable:!0,get:function(){return U.groupBy}});var z=r(2507);Object.defineProperty(t,"ignoreElements",{enumerable:!0,get:function(){return z.ignoreElements}});var Y=r(6095);Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return Y.isEmpty}});var W=r(3484);Object.defineProperty(t,"last",{enumerable:!0,get:function(){return W.last}});var $=r(4828);Object.defineProperty(t,"map",{enumerable:!0,get:function(){return $.map}});var G=r(1357);Object.defineProperty(t,"mapTo",{enumerable:!0,get:function(){return G.mapTo}});var H=r(7967);Object.defineProperty(t,"materialize",{enumerable:!0,get:function(){return H.materialize}});var K=r(4388);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return K.max}});var J=r(1550);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return J.merge}});var X=r(1867);Object.defineProperty(t,"mergeAll",{enumerable:!0,get:function(){return X.mergeAll}});var Z=r(6977);Object.defineProperty(t,"flatMap",{enumerable:!0,get:function(){return Z.flatMap}});var ee=r(1282);Object.defineProperty(t,"mergeMap",{enumerable:!0,get:function(){return ee.mergeMap}});var te=r(6295);Object.defineProperty(t,"mergeMapTo",{enumerable:!0,get:function(){return te.mergeMapTo}});var re=r(9527);Object.defineProperty(t,"mergeScan",{enumerable:!0,get:function(){return re.mergeScan}});var ne=r(5834);Object.defineProperty(t,"mergeWith",{enumerable:!0,get:function(){return ne.mergeWith}});var ie=r(1306);Object.defineProperty(t,"min",{enumerable:!0,get:function(){return ie.min}});var oe=r(9924);Object.defineProperty(t,"multicast",{enumerable:!0,get:function(){return oe.multicast}});var se=r(2803);Object.defineProperty(t,"observeOn",{enumerable:!0,get:function(){return se.observeOn}});var ae=r(1997);Object.defineProperty(t,"onErrorResumeNext",{enumerable:!0,get:function(){return ae.onErrorResumeNext}});var ue=r(4492);Object.defineProperty(t,"pairwise",{enumerable:!0,get:function(){return ue.pairwise}});var ce=r(5352);Object.defineProperty(t,"partition",{enumerable:!0,get:function(){return ce.partition}});var le=r(3391);Object.defineProperty(t,"pluck",{enumerable:!0,get:function(){return le.pluck}});var he=r(297);Object.defineProperty(t,"publish",{enumerable:!0,get:function(){return he.publish}});var de=r(6383);Object.defineProperty(t,"publishBehavior",{enumerable:!0,get:function(){return de.publishBehavior}});var fe=r(8229);Object.defineProperty(t,"publishLast",{enumerable:!0,get:function(){return fe.publishLast}});var pe=r(8226);Object.defineProperty(t,"publishReplay",{enumerable:!0,get:function(){return pe.publishReplay}});var ve=r(8973);Object.defineProperty(t,"race",{enumerable:!0,get:function(){return ve.race}});var ye=r(177);Object.defineProperty(t,"raceWith",{enumerable:!0,get:function(){return ye.raceWith}});var be=r(3818);Object.defineProperty(t,"reduce",{enumerable:!0,get:function(){return be.reduce}});var me=r(7775);Object.defineProperty(t,"repeat",{enumerable:!0,get:function(){return me.repeat}});var ge=r(5567);Object.defineProperty(t,"repeatWhen",{enumerable:!0,get:function(){return ge.repeatWhen}});var _e=r(4740);Object.defineProperty(t,"retry",{enumerable:!0,get:function(){return _e.retry}});var Oe=r(264);Object.defineProperty(t,"retryWhen",{enumerable:!0,get:function(){return Oe.retryWhen}});var Se=r(5884);Object.defineProperty(t,"refCount",{enumerable:!0,get:function(){return Se.refCount}});var Ee=r(6870);Object.defineProperty(t,"sample",{enumerable:!0,get:function(){return Ee.sample}});var we=r(5411);Object.defineProperty(t,"sampleTime",{enumerable:!0,get:function(){return we.sampleTime}});var Te=r(2457);Object.defineProperty(t,"scan",{enumerable:!0,get:function(){return Te.scan}});var Ie=r(5109);Object.defineProperty(t,"sequenceEqual",{enumerable:!0,get:function(){return Ie.sequenceEqual}});var Ae=r(3329);Object.defineProperty(t,"share",{enumerable:!0,get:function(){return Ae.share}});var Me=r(1738);Object.defineProperty(t,"shareReplay",{enumerable:!0,get:function(){return Me.shareReplay}});var Fe=r(884);Object.defineProperty(t,"single",{enumerable:!0,get:function(){return Fe.single}});var ke=r(4411);Object.defineProperty(t,"skip",{enumerable:!0,get:function(){return ke.skip}});var De=r(9355);Object.defineProperty(t,"skipLast",{enumerable:!0,get:function(){return De.skipLast}});var je=r(2947);Object.defineProperty(t,"skipUntil",{enumerable:!0,get:function(){return je.skipUntil}});var xe=r(9842);Object.defineProperty(t,"skipWhile",{enumerable:!0,get:function(){return xe.skipWhile}});var Pe=r(2778);Object.defineProperty(t,"startWith",{enumerable:!0,get:function(){return Pe.startWith}});var Ne=r(4027);Object.defineProperty(t,"subscribeOn",{enumerable:!0,get:function(){return Ne.subscribeOn}});var Ce=r(9061);Object.defineProperty(t,"switchAll",{enumerable:!0,get:function(){return Ce.switchAll}});var Re=r(6300);Object.defineProperty(t,"switchMap",{enumerable:!0,get:function(){return Re.switchMap}});var qe=r(1933);Object.defineProperty(t,"switchMapTo",{enumerable:!0,get:function(){return qe.switchMapTo}});var Le=r(1689);Object.defineProperty(t,"switchScan",{enumerable:!0,get:function(){return Le.switchScan}});var Be=r(6803);Object.defineProperty(t,"take",{enumerable:!0,get:function(){return Be.take}});var Qe=r(787);Object.defineProperty(t,"takeLast",{enumerable:!0,get:function(){return Qe.takeLast}});var Ve=r(4811);Object.defineProperty(t,"takeUntil",{enumerable:!0,get:function(){return Ve.takeUntil}});var Ue=r(7770);Object.defineProperty(t,"takeWhile",{enumerable:!0,get:function(){return Ue.takeWhile}});var ze=r(9967);Object.defineProperty(t,"tap",{enumerable:!0,get:function(){return ze.tap}});var Ye=r(6516);Object.defineProperty(t,"throttle",{enumerable:!0,get:function(){return Ye.throttle}});var We=r(5945);Object.defineProperty(t,"throttleTime",{enumerable:!0,get:function(){return We.throttleTime}});var $e=r(5956);Object.defineProperty(t,"throwIfEmpty",{enumerable:!0,get:function(){return $e.throwIfEmpty}});var Ge=r(9712);Object.defineProperty(t,"timeInterval",{enumerable:!0,get:function(){return Ge.timeInterval}});var He=r(7517);Object.defineProperty(t,"timeout",{enumerable:!0,get:function(){return He.timeout}});var Ke=r(2001);Object.defineProperty(t,"timeoutWith",{enumerable:!0,get:function(){return Ke.timeoutWith}});var Je=r(8158);Object.defineProperty(t,"timestamp",{enumerable:!0,get:function(){return Je.timestamp}});var Xe=r(2984);Object.defineProperty(t,"toArray",{enumerable:!0,get:function(){return Xe.toArray}});var Ze=r(5492);Object.defineProperty(t,"window",{enumerable:!0,get:function(){return Ze.window}});var et=r(6817);Object.defineProperty(t,"windowCount",{enumerable:!0,get:function(){return et.windowCount}});var tt=r(6841);Object.defineProperty(t,"windowTime",{enumerable:!0,get:function(){return tt.windowTime}});var rt=r(4880);Object.defineProperty(t,"windowToggle",{enumerable:!0,get:function(){return rt.windowToggle}});var nt=r(3016);Object.defineProperty(t,"windowWhen",{enumerable:!0,get:function(){return nt.windowWhen}});var it=r(9163);Object.defineProperty(t,"withLatestFrom",{enumerable:!0,get:function(){return it.withLatestFrom}});var ot=r(2681);Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return ot.zip}});var st=r(5606);Object.defineProperty(t,"zipAll",{enumerable:!0,get:function(){return st.zipAll}});var at=r(973);Object.defineProperty(t,"zipWith",{enumerable:!0,get:function(){return at.zipWith}})},573:e=>{e.exports=require("rxjs")},5086:e=>{e.exports=require("ws")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{AI_CHAT_MODEL_NAMES:()=>Fe,AI_EMBEDDINGS_MODEL_NAMES:()=>De,AI_IMAGE_MODEL_NAMES:()=>Pe,ALL_OPERATORS:()=>ze,ANTHROPIC_CHAT_MODEL_NAMES:()=>Me,AiAssistantClient:()=>i,AiChatbotChatContext:()=>Ne,AiChatbotClient:()=>G,AiChatbotClientFactory:()=>X,AiChatbotContextReference:()=>K,AiChatbotInstructionReference:()=>J,AiChatbotProfileReference:()=>H,AiClient:()=>ee,AiImageClient:()=>Z,ApiClient:()=>re,ApiKeysSecretClient:()=>Vu,AuthManager:()=>ne,BackendFunctionManager:()=>Se,BaseQueryBuilder:()=>et,Changes:()=>nt,ClientConnectionState:()=>$e,ClientIdService:()=>Te,CollectionReference:()=>ht,CollectionReferenceFactory:()=>ft,ConnectionDetails:()=>pt,CronExpression:()=>Ce,DEFAULT_SHORT_ID_LENGTH:()=>z,DataManager:()=>Ot,DestructManager:()=>Et,DistributedLockImpl:()=>Tt,DistributedLockManager:()=>wt,DocumentReference:()=>Je,DocumentReferenceFactory:()=>At,DocumentStore:()=>Mt,ENVIRONMENT_IDS:()=>Re,ExtractionClient:()=>Ku,FETCH_BEYOND_LIMIT:()=>Iu,GEMINI_CHAT_MODEL_NAMES:()=>Ae,GraphQLClient:()=>nu,GraphQLClientFactory:()=>iu,HttpStatus:()=>Le,IntegrationSchemaType:()=>Qe,IntegrationType:()=>Be,JoinQueryBuilder:()=>it,LIMIT_UNDERFLOW_TRIGGER:()=>Au,LimitUnderflowState:()=>Ou,LocalQueryManager:()=>mu,METRIC_TYPES:()=>Ve,MutationSender:()=>ou,NOOP_FN:()=>Uu,NativeQueryManager:()=>su,OPENAI_CHAT_MODEL_NAMES:()=>Ie,OPENAI_EMBEDDINGS_MODEL_NAMES:()=>ke,OPENAI_IMAGE_MODEL_NAMES:()=>je,ObservabilityClient:()=>Bu,Pagination:()=>Xe,QueryBuilder:()=>rt,QueryBuilderFactory:()=>Ze,QuerySender:()=>_u,QuerySubscriptionManager:()=>Mu,QueueManagerFactory:()=>ju,QueueManagerImpl:()=>Pu,RateLimiter:()=>Nu,RpcError:()=>Cu,RpcManager:()=>Lu,SQUID_REGIONS:()=>Ye,STABLE_DIFFUSION_MODEL_NAMES:()=>xe,SUPPORTED_SQUID_REGIONS:()=>We,SecretClient:()=>Qu,SocketManager:()=>$u,Squid:()=>Ju,StorageClient:()=>Hu,allEnvironmentIds:()=>qe,deserializeQuery:()=>au,generateId:()=>U,generateShortId:()=>W,isSimpleCondition:()=>Ue,rawSquidHttpPost:()=>Ru,tryDeserializing:()=>qu});class i{constructor(e){this.rpcManager=e}async createAssistant(e,t,r,n){const i={name:e,instructions:t,functions:r,toolTypes:n};return(await this.rpcManager.post("ai/assistant/createAssistant",i)).assistantId}async deleteAssistant(e){const t={assistantId:e};await this.rpcManager.post("ai/assistant/deleteAssistant",t)}async createThread(e){const t={assistantId:e};return(await this.rpcManager.post("ai/assistant/createThread",t)).threadId}async deleteThread(e){const t={threadId:e};await this.rpcManager.post("ai/assistant/deleteThread",t)}async queryAssistant(e,t,r,n,i){const o={assistantId:e,threadId:t,prompt:r,fileIds:n,options:i};return(await this.rpcManager.post("ai/assistant/queryAssistant",o)).answer}async addFileToAssistant(e,t){const r={assistantId:e};return(await this.rpcManager.post("ai/assistant/addFileToAssistant",r,[t],"file")).fileId}async removeFileFromAssistant(e,t){const r={assistantId:e,fileId:t};await this.rpcManager.post("ai/assistant/removeFileFromAssistant",r)}async addFileToThread(e,t){const r={threadId:e};return(await this.rpcManager.post("ai/assistant/addFileToThread",r,[t],"file")).fileId}}var o=r(573);function s(e){return"function"==typeof e}function a(e){return function(t){if(function(e){return s(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}var u=function(e,t){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},u(e,t)};function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var l=function(){return l=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},l.apply(this,arguments)};function h(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function d(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}function f(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function y(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var b,m,g=(b=function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}},(m=b((function(e){Error.call(e),e.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),m.prototype.constructor=m,m);function _(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var O=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=p(o),u=a.next();!u.done;u=a.next())u.value.remove(this)}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(s(c))try{c()}catch(e){i=e instanceof g?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var h=p(l),d=h.next();!d.done;d=h.next()){var f=d.value;try{S(f)}catch(e){i=null!=i?i:[],e instanceof g?i=y(y([],v(i)),v(e.errors)):i.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(i)throw new g(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)S(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&_(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&_(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function S(e){s(e)?e():e.unsubscribe()}O.EMPTY;var E=null,w=null,T=!1,I=!1,A={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=A.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,y([e,t],v(r))):setTimeout.apply(void 0,y([e,t],v(r)))},clearTimeout:function(e){var t=A.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function M(){}var F=k("C",void 0,void 0);function k(e,t,r){return{kind:e,value:t,error:r}}var D=function(e){function t(t){var r,n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,((r=t)instanceof O||r&&"closed"in r&&s(r.remove)&&s(r.add)&&s(r.unsubscribe))&&t.add(n)):n.destination=q,n}return c(t,e),t.create=function(e,t,r){return new N(e,t,r)},t.prototype.next=function(e){this.isStopped?R(function(e){return k("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?R(k("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?R(F,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(O),j=Function.prototype.bind;function x(e,t){return j.call(e,t)}var P=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){C(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){C(e)}else C(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){C(e)}},e}(),N=function(e){function t(t,r,n){var i,o,a=e.call(this)||this;return s(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:a&&I?((o=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},i={next:t.next&&x(t.next,o),error:t.error&&x(t.error,o),complete:t.complete&&x(t.complete,o)}):i=t,a.destination=new P(i),a}return c(t,e),t}(D);function C(e){T||function(e){A.setTimeout((function(){if(!E)throw e;E(e)}))}(e)}function R(e,t){var r=w;r&&A.setTimeout((function(){return r(e,t)}))}var q={closed:!0,next:M,error:function(e){throw e},complete:M};function L(e,t,r,n,i){return new B(e,t,r,n,i)}var B=function(e){function t(t,r,n,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return c(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(D);function Q(e,t){return a((function(r,n){var i=0;r.subscribe(L(n,(function(r){n.next(e.call(t,r,i++))})))}))}var V=r(5036);function U(){let e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){const r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}const z=18,Y="abcdefghijklmnopqrstuvwxyz0123456789";function W(e=z,t=""){(0,V.assertTruthy)(t.length<e,"ID prefix is too long");let r="";for(let t=0;t<e;t++)r+=Y.charAt(Math.floor(Math.random()*Y.length));return t.length>0&&(r=t+r.substring(t.length)),r}const $={smoothTyping:!0,disableHistory:!1,includeReference:!1,responseFormat:"text"};class G{constructor(e,t,r){this.rpcManager=e,this.socketManager=t,this.integrationId=r,this.ongoingChatSequences={},this.socketManager.observeNotifications().pipe((0,o.filter)((e=>"aiChatbot"===e.type)),Q((e=>e))).subscribe((e=>{this.handleChatResponse(e).then()}))}profile(e){return new H(this,this.integrationId,e)}async mutate(e,t){await this.rpcManager.post("ai/chatbot/mutate",e,t?[t]:[])}chat(e,t,r){const n=U(),i=void 0===(r=Object.assign(Object.assign({},$),r||{})).smoothTyping||r.smoothTyping;let s="";const a=new o.Subject,u=new o.Subject;this.ongoingChatSequences[n]=u;let c=-1;u.pipe((0,o.tap)((({tokenIndex:e})=>{void 0!==e&&e<c&&console.warn("Received token index out of order",e,c),void 0!==e&&(c=e)})),(0,o.concatMap)((({value:e,complete:t})=>t?(0,o.of)({value:e,complete:t}):(0,o.of)(e).pipe(i?(0,o.delay)(5):(0,o.tap)(),Q((e=>({value:e,complete:!1})))))),(0,o.takeWhile)((({complete:e})=>!e),!0)).subscribe({next:({value:e})=>{s+=e,a.next(s)},error:e=>{console.error(e)},complete:()=>{a.complete()}});const l={profileId:e,prompt:t,options:r,integrationId:this.integrationId,clientRequestId:n};return this.rpcManager.post("ai/chatbot/chat",l).catch((e=>{a.error(e),a.complete()})),a.pipe((0,o.finalize)((()=>{delete this.ongoingChatSequences[n]})),(0,o.share)())}ask(e,t,r){return(0,o.lastValueFrom)(this.chat(e,t,Object.assign(Object.assign({},r||{}),{smoothTyping:!1})))}async handleChatResponse(e){const t=this.ongoingChatSequences[e.clientRequestId];if(!t)return;const{token:r,complete:n,tokenIndex:i}=e.payload;if(n&&!r.length)t.next({value:"",complete:!0,tokenIndex:void 0});else if(r.match(/\[.*?]\((.*?)\)/g))t.next({value:r,complete:n,tokenIndex:void 0===i?void 0:i});else for(let e=0;e<r.length;e++)t.next({value:r[e],complete:n&&e===r.length-1,tokenIndex:void 0===i?void 0:i})}}class H{constructor(e,t,r){this.client=e,this.integrationId=t,this.profileId=r}chat(e,t){return this.client.chat(this.profileId,e,t)}ask(e,t){return this.client.ask(this.profileId,e,t)}context(e){return new K(this.client,this.integrationId,this.profileId,e)}instruction(e){return new J(this.client,this.integrationId,this.profileId,e)}insert(e){const{modelName:t,isPublic:r=!1}=e,n={type:"insert",resource:"profile",profileId:this.profileId,payload:{modelName:t,isPublic:r,strictContext:!1},integrationId:this.integrationId};return this.client.mutate(n)}update(e){const{modelName:t,isPublic:r}=e,n={type:"update",resource:"profile",profileId:this.profileId,payload:{modelName:t,isPublic:r,strictContext:!1},integrationId:this.integrationId};return this.client.mutate(n)}delete(){const e={type:"delete",resource:"profile",profileId:this.profileId,integrationId:this.integrationId,payload:{}};return this.client.mutate(e)}}class K{constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||U()}insert(e,t){const{title:r,context:n}=e,i={type:"insert",resource:"context",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id,title:r,context:n}};return this.client.mutate(i,t)}update(e){const{title:t,context:r}=e,n={type:"update",resource:"context",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id,title:t,context:r}};return this.client.mutate(n)}delete(){const e={type:"delete",resource:"context",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id}};return this.client.mutate(e)}}class J{constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||U()}insert(e){const{instruction:t}=e,r={type:"insert",resource:"instruction",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id,instruction:t}};return this.client.mutate(r)}update(e){const{instruction:t}=e,r={type:"update",resource:"instruction",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id,instruction:t}};return this.client.mutate(r)}delete(){const e={type:"delete",resource:"instruction",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id}};return this.client.mutate(e)}}class X{constructor(e,t){this.rpcManager=e,this.socketManager=t,this.chatbotsMap=new Map}getChatbot(e){let t=this.chatbotsMap.get(e);return t||(t=new G(this.rpcManager,this.socketManager,e),this.chatbotsMap.set(e,t),t)}}class Z{constructor(e){this.rpcManager=e}async generate(e,t){const r={prompt:e,options:t};return this.rpcManager.post("ai/image/generate",r)}}class ee{constructor(e,t){this.aiChatbotClientFactory=e,this.rpcManager=t,this.aiAssistantClient=new i(this.rpcManager)}chatbot(e){return this.aiChatbotClientFactory.getChatbot(e)}assistant(){return this.aiAssistantClient}image(){return new Z(this.rpcManager)}executeAiQuery(e,t){const r={integrationId:e,prompt:t};return this.rpcManager.post("aiData/executeAiQuery",r)}}const te={headers:{},queryParams:{},pathParams:{}};class re{constructor(e){this.rpcManager=e}async get(e,t,r){return this.request(e,t,void 0,r,"get")}async post(e,t,r,n){return this.request(e,t,r,n,"post")}async delete(e,t,r,n){return this.request(e,t,r,n,"delete")}async patch(e,t,r,n){return this.request(e,t,r,n,"patch")}async put(e,t,r,n){return this.request(e,t,r,n,"put")}async request(e,t,r,n,i){const o={integrationId:e,endpointId:t,body:r,options:Object.assign(Object.assign({},te),this.convertOptionsToStrings(n||{})),overrideMethod:i};return await this.rpcManager.rawPost("api/callApi",o,void 0,void 0,!1)}convertOptionsToStrings(e){return{headers:this.convertToStrings(e.headers),queryParams:this.convertToStrings(e.queryParams),pathParams:this.convertToStrings(e.pathParams)}}convertToStrings(e){if(!e)return{};const t=Object.entries(e).filter((([,e])=>void 0!==e)).map((([e,t])=>[e,String(t)]));return Object.fromEntries(t)}}class ne{constructor(e,t){this.apiKey=e,this.authProvider=t}setAuthProvider(e){this.authProvider=e}async getAuthData(){var e;return{token:await this.getTokenFromAuthProvider(),integrationId:null===(e=this.authProvider)||void 0===e?void 0:e.integrationId}}async getTokenFromAuthProvider(){var e;const t=null===(e=this.authProvider)||void 0===e?void 0:e.getToken();return"object"==typeof t?await t:t}getApiKey(){return this.apiKey}async getToken(){var e;if(this.apiKey)return{type:"ApiKey",token:this.apiKey};const t=await this.getTokenFromAuthProvider();return t?{type:"Bearer",token:t,integrationId:null===(e=this.authProvider)||void 0===e?void 0:e.integrationId}:void 0}}const ie=/[.\[\]]/;function oe(e,t){if(!e)return;const r=t.split(ie);let n,i=e;for(;i&&r.length;){const e=r.shift();if(e){if("object"!=typeof i||!(e in i))return;n=i[e],i=n}}return n}function se(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ae(e,t,r,n="."){var i;const o=t.split(n);let s=e;for(;o.length;){const e=(0,V.truthy)(o.shift());if(o.length){const t=s[e],r=se(t)&&null!==(i=pe(t))&&void 0!==i?i:{};s[e]=r,s=r}else s[e]=r}}function ue(e,t,r="."){var n;const i=t.split(r);let o=e;for(;i.length;){const e=(0,V.truthy)(i.shift());if(i.length){const t=se(o[e])&&null!==(n=pe(o[e]))&&void 0!==n?n:{};o[e]=t,o=t}else delete o[e]}}function ce(e,t,r){if(e.has(t)){const n=e.get(t);e.delete(t),e.set(r,n)}}function le(e){return null==e}function he(e,t){if(e===t)return!0;if(null===e||null===t)return!1;const r=typeof e;if(r!==typeof t)return!1;if("object"!==r)return e===t;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n)if(!i.includes(r)||!he(e[r],t[r]))return!1;return!0}function de(e,t){const r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=fe(e[n],t);return r}function fe(e,t){const r=t?t(e):void 0;if(void 0!==r)return r;if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return de(e,t);if(e instanceof Map)return new Map(de(Array.from(e),t));if(e instanceof Set)return new Set(de(Array.from(e),t));if(ArrayBuffer.isView(e))return(n=e)instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length);var n;const i={};for(const r in e)Object.hasOwnProperty.call(e,r)&&(i[r]=fe(e[r],t));return i}function pe(e){return"object"!=typeof e||null===e?e:e instanceof Date?new Date(e):Array.isArray(e)?[...e]:e instanceof Map?new Map(Array.from(e)):e instanceof Set?new Set(Array.from(e)):Object.assign({},e)}function ve(e,t){if(e===t||le(e)&&le(t))return 0;if(le(e))return-1;if(le(t))return 1;const r=typeof e,n=typeof t;return r!==n?r<n?-1:1:"number"==typeof e?((0,V.assertTruthy)("number"==typeof t),isNaN(e)&&isNaN(t)?0:isNaN(e)?-1:isNaN(t)?1:e<t?-1:1):"boolean"==typeof e?((0,V.assertTruthy)("boolean"==typeof t),e<t?-1:1):"bigint"==typeof e?((0,V.assertTruthy)("bigint"==typeof t),e<t?-1:1):"string"==typeof e?((0,V.assertTruthy)("string"==typeof t),e<t?-1:1):e instanceof Date&&t instanceof Date?Math.sign(e.getTime()-t.getTime()):0}function ye(e,t){return e.reduce(((e,r)=>{const n=t(r);return e[n]?e[n].push(r):e[n]=[r],e}),{})}function be(e){if(Array.isArray(e))return e.map((e=>be(e)));if("object"!=typeof e||null===e||e instanceof Date)return e;const t=Object.keys(e),r={};return t.sort().forEach((t=>{r[t]=be(e[t])})),r}function me(e){return ge(be(e))}function ge(e){if(void 0===e)return null;const t=fe(e,(e=>function(e){return"[object Date]"===Object.prototype.toString.call(e)}(e)?{$date:e.toISOString()}:void 0));return JSON.stringify(t)}function _e(e){return fe(JSON.parse(e),(e=>{if(null===e||"object"!=typeof e)return;const t=e,r=t.$date;return r&&1===Object.keys(t).length?new Date(r):void 0}))}function Oe(e){if(void 0===e)throw new Error("INVALID_ENCODE_VALUE");const t=ge(e);if("undefined"!=typeof Buffer)return Buffer.from(t,"utf8").toString("base64");{const e=(new TextEncoder).encode(t);let r="";for(let t=0;t<e.length;t++)r+=String.fromCharCode(e[t]);return btoa(r)}}class Se{constructor(e,t){this.clientIdService=e,this.rpcManager=t}executeFunctionAndSubscribe(e,...t){const r=[],n=[];t.forEach((e=>{"undefined"!=typeof File&&e instanceof File?r.push(e):n.push(e)}));const i={functionName:e,paramsArrayStr:ge(n)},s=`backend-function/execute?${encodeURIComponent(e)}`;return(0,o.race)((0,o.from)(this.rpcManager.post(s,i,r.length>0?r:[])).pipe(Q((e=>{if(!e.success)throw new Error(e.payload);return _e(e.payload)}))),this.clientIdService.observeClientTooOld().pipe(Q((()=>{throw new Error("CLIENT_NOT_CONNECTED")}))))}}function Ee(){if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;if("undefined"!=typeof self)return self;throw new Error("Unable to locate global object")}class we{static log(...e){we.info(...e)}static info(...e){console.log(`%c[${we.getTimestampString()}] INFO`,"color:green",...e)}static warn(...e){console.warn(`%c[${we.getTimestampString()}] WARN`,"color:yellow",...e)}static error(...e){console.error(`%c[${we.getTimestampString()}] ERROR`,"color:red",...e)}static debug(...e){(function(){const e=Ee();return e&&e.SQUID_DEBUG_ENABLED})()&&console.log(`%c[${we.getTimestampString()}] DEBUG`,"color:cyan",...e)}static getTimestampString(){const e=new Date;return`${e.toLocaleTimeString()}.${e.getMilliseconds()}`}}class Te{constructor(e){this.destructManager=e,this.clientTooOldSubject=new o.BehaviorSubject(!1),this.isTenant=!0===Ee().squidTenant,this.clientIdSubject=new o.BehaviorSubject(this.generateClientId()),this.destructManager.onDestruct((()=>{this.clientTooOldSubject.complete(),this.clientIdSubject.complete()}))}observeClientId(){return this.clientIdSubject}observeClientTooOld(){return this.clientTooOldSubject.pipe((0,o.filter)((e=>e)),(0,o.map)((()=>{})))}notifyClientTooOld(){this.clientTooOldSubject.next(!0),this.clientIdSubject.next(this.generateClientId())}notifyClientNotTooOld(){this.clientTooOldSubject.next(!1)}observeClientReadyToBeRegenerated(){return this.clientTooOldSubject.pipe((0,o.skip)(1),(0,o.filter)((e=>!e)),(0,o.map)((()=>{})))}getClientId(){return this.clientIdSubject.value}isClientTooOld(){return this.clientTooOldSubject.value}generateClientId(){return`${this.isTenant?"tenant-":""}${U()}`}}const Ie=["gpt-3.5-turbo","gpt-3.5-turbo-1106","gpt-4","gpt-4-turbo-preview","gpt-4o","gpt-4-turbo"],Ae=["gemini-pro"],Me=["claude-3-opus-20240229","claude-3-sonnet-20240229","claude-3-haiku-20240307","claude-3-5-sonnet-20240620"],Fe=[...Ie,...Me,...Ae],ke=["text-embedding-3-small","text-embedding-3-large","text-embedding-ada-002"],De=[...ke],je=["dall-e-3"],xe=["stable-diffusion-core"],Pe=[...je,...xe];class Ne{constructor(e){this.profileId=e.profileId,this.prompt=e.prompt}}var Ce;!function(e){e.EVERY_SECOND="* * * * * *",e.EVERY_5_SECONDS="*/5 * * * * *",e.EVERY_10_SECONDS="*/10 * * * * *",e.EVERY_30_SECONDS="*/30 * * * * *",e.EVERY_MINUTE="*/1 * * * *",e.EVERY_5_MINUTES="0 */5 * * * *",e.EVERY_10_MINUTES="0 */10 * * * *",e.EVERY_30_MINUTES="0 */30 * * * *",e.EVERY_HOUR="0 0-23/1 * * *",e.EVERY_2_HOURS="0 0-23/2 * * *",e.EVERY_3_HOURS="0 0-23/3 * * *",e.EVERY_4_HOURS="0 0-23/4 * * *",e.EVERY_5_HOURS="0 0-23/5 * * *",e.EVERY_6_HOURS="0 0-23/6 * * *",e.EVERY_7_HOURS="0 0-23/7 * * *",e.EVERY_8_HOURS="0 0-23/8 * * *",e.EVERY_9_HOURS="0 0-23/9 * * *",e.EVERY_10_HOURS="0 0-23/10 * * *",e.EVERY_11_HOURS="0 0-23/11 * * *",e.EVERY_12_HOURS="0 0-23/12 * * *",e.EVERY_DAY_AT_1AM="0 01 * * *",e.EVERY_DAY_AT_2AM="0 02 * * *",e.EVERY_DAY_AT_3AM="0 03 * * *",e.EVERY_DAY_AT_4AM="0 04 * * *",e.EVERY_DAY_AT_5AM="0 05 * * *",e.EVERY_DAY_AT_6AM="0 06 * * *",e.EVERY_DAY_AT_7AM="0 07 * * *",e.EVERY_DAY_AT_8AM="0 08 * * *",e.EVERY_DAY_AT_9AM="0 09 * * *",e.EVERY_DAY_AT_10AM="0 10 * * *",e.EVERY_DAY_AT_11AM="0 11 * * *",e.EVERY_DAY_AT_NOON="0 12 * * *",e.EVERY_DAY_AT_1PM="0 13 * * *",e.EVERY_DAY_AT_2PM="0 14 * * *",e.EVERY_DAY_AT_3PM="0 15 * * *",e.EVERY_DAY_AT_4PM="0 16 * * *",e.EVERY_DAY_AT_5PM="0 17 * * *",e.EVERY_DAY_AT_6PM="0 18 * * *",e.EVERY_DAY_AT_7PM="0 19 * * *",e.EVERY_DAY_AT_8PM="0 20 * * *",e.EVERY_DAY_AT_9PM="0 21 * * *",e.EVERY_DAY_AT_10PM="0 22 * * *",e.EVERY_DAY_AT_11PM="0 23 * * *",e.EVERY_DAY_AT_MIDNIGHT="0 0 * * *",e.EVERY_WEEK="0 0 * * 7",e.EVERY_WEEKDAY="0 0 * * 1-5",e.EVERY_WEEKEND="0 0 * * 6,7",e.EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT="0 0 1 * *",e.EVERY_1ST_DAY_OF_MONTH_AT_NOON="0 12 1 * *",e.EVERY_2ND_HOUR="0 */2 * * *",e.EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM="0 1-23/2 * * *",e.EVERY_2ND_MONTH="0 0 1 */2 *",e.EVERY_QUARTER="0 0 1 */3 *",e.EVERY_6_MONTHS="0 0 1 */6 *",e.EVERY_YEAR="0 0 1 1 *",e.EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM="0 */30 9-17 * * *",e.EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM="0 */30 9-18 * * *",e.EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM="0 */30 10-19 * * *",e.MONDAY_TO_FRIDAY_AT_1AM="0 0 01 * * 1-5",e.MONDAY_TO_FRIDAY_AT_2AM="0 0 02 * * 1-5",e.MONDAY_TO_FRIDAY_AT_3AM="0 0 03 * * 1-5",e.MONDAY_TO_FRIDAY_AT_4AM="0 0 04 * * 1-5",e.MONDAY_TO_FRIDAY_AT_5AM="0 0 05 * * 1-5",e.MONDAY_TO_FRIDAY_AT_6AM="0 0 06 * * 1-5",e.MONDAY_TO_FRIDAY_AT_7AM="0 0 07 * * 1-5",e.MONDAY_TO_FRIDAY_AT_8AM="0 0 08 * * 1-5",e.MONDAY_TO_FRIDAY_AT_9AM="0 0 09 * * 1-5",e.MONDAY_TO_FRIDAY_AT_09_30AM="0 30 09 * * 1-5",e.MONDAY_TO_FRIDAY_AT_10AM="0 0 10 * * 1-5",e.MONDAY_TO_FRIDAY_AT_11AM="0 0 11 * * 1-5",e.MONDAY_TO_FRIDAY_AT_11_30AM="0 30 11 * * 1-5",e.MONDAY_TO_FRIDAY_AT_12PM="0 0 12 * * 1-5",e.MONDAY_TO_FRIDAY_AT_1PM="0 0 13 * * 1-5",e.MONDAY_TO_FRIDAY_AT_2PM="0 0 14 * * 1-5",e.MONDAY_TO_FRIDAY_AT_3PM="0 0 15 * * 1-5",e.MONDAY_TO_FRIDAY_AT_4PM="0 0 16 * * 1-5",e.MONDAY_TO_FRIDAY_AT_5PM="0 0 17 * * 1-5",e.MONDAY_TO_FRIDAY_AT_6PM="0 0 18 * * 1-5",e.MONDAY_TO_FRIDAY_AT_7PM="0 0 19 * * 1-5",e.MONDAY_TO_FRIDAY_AT_8PM="0 0 20 * * 1-5",e.MONDAY_TO_FRIDAY_AT_9PM="0 0 21 * * 1-5",e.MONDAY_TO_FRIDAY_AT_10PM="0 0 22 * * 1-5",e.MONDAY_TO_FRIDAY_AT_11PM="0 0 23 * * 1-5"}(Ce||(Ce={}));const Re=["dev","prod"],qe=[...Re];var Le,Be,Qe;!function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLYHINTS=103]="EARLYHINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.AMBIGUOUS=300]="AMBIGUOUS",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",e[e.MISDIRECTED=421]="MISDIRECTED",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED"}(Le||(Le={})),function(e){e.built_in_db="built_in_db",e.mongo="mongo",e.mysql="mysql",e.clickhouse="clickhouse",e.mssql="mssql",e.postgres="postgres",e.cockroach="cockroach",e.api="api",e.graphql="graphql",e.snowflake="snowflake",e.datadog="datadog",e.newrelic="newrelic",e.auth0="auth0",e.jwt_rsa="jwt_rsa",e.jwt_hmac="jwt_hmac",e.ai_chatbot="ai_chatbot",e.cognito="cognito",e.okta="okta",e.descope="descope",e.firebase_auth="firebase_auth",e.kafka="kafka",e.confluent="confluent",e.built_in_queue="built_in_queue",e.s3="s3",e.gcs="gcs",e.built_in_s3="built_in_s3",e.built_in_gcs="built_in_gcs",e.algolia="algolia",e.elastic_observability="elastic_observability",e.elastic_search="elastic_search",e.elastic_enterprise_search="elastic_enterprise_search",e.sentry="sentry",e.sap_hana="sap_hana",e.salesforce_crm="salesforce_crm",e.documentdb="documentdb",e.dynamodb="dynamodb",e.cassandra="cassandra",e.alloydb="alloydb",e.spanner="spanner",e.db2="db2",e.mariadb="mariadb",e.oracledb="oracledb",e.redis="redis",e.xata="xata",e.azure_sql="azure_sql",e.azure_postgresql="azure_postgresql",e.azure_cosmosdb="azure_cosmosdb",e.firestore="firestore",e.bigquery="bigquery",e.cloudsql="cloudsql"}(Be||(Be={})),function(e){e.data="data",e.api="api",e.graphql="graphql"}(Qe||(Qe={}));const Ve=["gauge","count"];function Ue(e){return"fieldName"in e}const ze=["==","!=",">=","<=",">","<","like","not like","like_cs","not like_cs","array_includes_some","array_includes_all","array_not_includes"],Ye=["us-east-1.aws","ap-south-1.aws","us-central1.gcp"],We=Ye;var $e;!function(e){e.CONNECTED="CONNECTED",e.DISCONNECTED="DISCONNECTED",e.REMOVED="REMOVED"}($e||($e={}));const Ge="__squidId";function He(e){return _e(e)}function Ke(...e){const[t,r,n]=e,i="object"==typeof t?t:{docId:t,collectionName:r,integrationId:n};return i.integrationId||(i.integrationId=void 0),me(i)}class Je{constructor(e,t,r){this._squidDocId=e,this.dataManager=t,this.queryBuilderFactory=r,this.refId=U()}get squidDocId(){return this._squidDocId}get data(){return fe(this.dataRef)}get dataRef(){return(0,V.truthy)(this.dataManager.getProperties(this.squidDocId),(()=>{const{collectionName:e,integrationId:t,docId:r}=He(this.squidDocId);return`No data found for document reference: ${JSON.stringify({docId:r,collectionName:e,integrationId:t},null,2)}`}))}get hasData(){return!!this.dataManager.getProperties(this.squidDocId)}async snapshot(){if(this.hasSquidPlaceholderId())throw new Error("Cannot invoke snapshot of a document that was created locally without storing it on the server.");if(this.isTracked()&&this.hasData)return this.data;const e=await this.queryBuilderFactory.getForDocument(this.squidDocId).dereference().snapshot();return(0,V.truthy)(e.length<=1,"Got more than one doc for the same id:"+this.squidDocId),e.length?e[0]:void 0}snapshots(){return this.queryBuilderFactory.getForDocument(this.squidDocId).dereference().snapshots().pipe((0,o.map)((e=>((0,V.truthy)(e.length<=1,"Got more than one doc for the same id:"+this.squidDocId),e.length?e[0]:void 0))))}peek(){return this.isTracked()&&this.hasData?this.data:void 0}isDirty(){return this.dataManager.isDirty(this.squidDocId)}isTracked(){return this.dataManager.isTracked(this.squidDocId)}async update(e,t){const r={};Object.entries(e).forEach((([e,t])=>{const n=void 0!==t?{type:"update",value:t}:{type:"removeProperty"};r[e]=[n]}));const n={type:"update",squidDocIdObj:He(this.squidDocId),properties:r};return this.dataManager.applyOutgoingMutation(n,t)}async setInPath(e,t,r){return this.update({[e]:fe(t)},r)}async deleteInPath(e,t){return this.update({[e]:void 0},t)}incrementInPath(e,t,r){const n={type:"applyNumericFn",fn:"increment",value:t},i={type:"update",squidDocIdObj:He(this.squidDocId),properties:{[e]:[n]}};return this.dataManager.applyOutgoingMutation(i,r)}decrementInPath(e,t,r){return this.incrementInPath(e,-t,r)}async insert(e,t){const r=He(this.squidDocId),n=r.integrationId;let i=_e(r.docId);if(i[Ge]&&(i={}),n===Be.built_in_db&&i.__id)try{const e=_e(i.__id);i=Object.assign(Object.assign({},i),e)}catch(e){}const o={type:"insert",squidDocIdObj:r,properties:Object.assign(Object.assign(Object.assign({},e),{__docId__:r.docId}),i)};return this.dataManager.applyOutgoingMutation(o,t)}async delete(e){const t={type:"delete",squidDocIdObj:He(this.squidDocId)};return this.dataManager.applyOutgoingMutation(t,e)}migrateDocIds(e){const t=e[this.squidDocId];t&&(this._squidDocId=t)}hasSquidPlaceholderId(){const e=_e(this._squidDocId);if("object"==typeof e&&e.docId){const t=_e(e.docId);if("object"==typeof t&&Object.keys(t).includes(Ge))return!0}return!1}}Error;class Xe{constructor(e,t={}){this.internalStateObserver=new o.BehaviorSubject(null),this.firstElement=null,this.isDestroyed=new o.BehaviorSubject(!1),this.snapshotSubject=new o.Subject,this.onFirstPage=!0,this.navigatingToLastPage=!1,this.lastElement=null,(0,V.assertTruthy)(e.getSortOrders().length>0,"Unable to paginate results. Please specify a sort order."),this.snapshotSubject.pipe((0,o.switchAll)()).subscribe((e=>this.dataReceived(e))),this.templateSnapshotEmitter=e.clone(),this.paginateOptions=Object.assign({pageSize:100,subscribe:!0},t),this.goToFirstPage()}goToFirstPage(){this.onFirstPage=!0;const e=this.templateSnapshotEmitter.clone().limit(3*this.paginateOptions.pageSize).snapshots(this.paginateOptions.subscribe);this.snapshotSubject.next(e)}compareObjects(e,t){if(e===t||le(e)&&le(t))return 0;if(le(e))return-1;if(le(t))return 1;const r=this.templateSnapshotEmitter.getSortOrders();for(const{fieldName:n,asc:i}of r){const r=ve(oe(e,n),oe(t,n));if(0!==r)return i?r:-r}return 0}async dataReceived(e){const t=e.map((e=>this.templateSnapshotEmitter.extractData(e)));if(0===e.length)return void(this.onFirstPage?this.internalStateObserver.next({numBefore:0,numAfter:0,data:e,extractedData:t}):this.goToFirstPage());if(null===this.firstElement)if(null!==this.lastElement){const r=t.filter((e=>1===this.compareObjects(e,this.lastElement))).length;this.firstElement=t[e.length-r-this.paginateOptions.pageSize],this.lastElement=null}else this.navigatingToLastPage&&(this.firstElement=t[e.length-this.paginateOptions.pageSize],this.navigatingToLastPage=!1);const r=t.filter((e=>-1===this.compareObjects(e,this.firstElement))).length,n=Math.max(0,e.length-r-this.paginateOptions.pageSize);r!==e.length?this.internalStateObserver.next({numBefore:r,numAfter:n,data:e,extractedData:t}):this.prevInternal({numBefore:r,numAfter:n,data:e,extractedData:t})}doNewQuery(e,t){if(this.onFirstPage=!1,t){const t=this.templateSnapshotEmitter.clone().limit(3*this.paginateOptions.pageSize).flipSortOrder();e&&t.addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((t=>({fieldName:t.fieldName,operator:t.asc?"<=":">=",value:oe(e,t.fieldName)||null})))),this.snapshotSubject.next(t.snapshots(this.paginateOptions.subscribe).pipe((0,o.map)((e=>e.reverse()))))}else{const t=this.templateSnapshotEmitter.clone().limit(3*this.paginateOptions.pageSize);e&&t.addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((t=>({fieldName:t.fieldName,operator:t.asc?">=":"<=",value:oe(e,t.fieldName)||null})))),this.snapshotSubject.next(t.snapshots(this.paginateOptions.subscribe))}}async waitForInternalState(){const e=this.internalStateObserver.value;return null!==e?e:await(0,o.firstValueFrom)((0,o.race)(this.isDestroyed.pipe((0,o.filter)(Boolean),(0,o.map)((()=>({data:[],extractedData:[],numBefore:0,numAfter:0})))),this.internalStateObserver.pipe((0,o.filter)((e=>null!==e)),(0,o.take)(1))))}internalStateToState(e){const{data:t,numBefore:r,numAfter:n,extractedData:i}=e;return{data:t.filter(((e,t)=>-1!==this.compareObjects(i[t],this.firstElement))).slice(0,this.paginateOptions.pageSize),hasNext:n>0,hasPrev:r>0}}unsubscribe(){this.isDestroyed.next(!0),this.isDestroyed.complete(),this.internalStateObserver.complete(),this.snapshotSubject.complete()}prevInternal(e){const{numBefore:t,numAfter:r,extractedData:n}=e;this.firstElement=null,this.lastElement=n[t-1],this.internalStateObserver.next(null),this.doNewQuery(n[n.length-r-1],!0)}async prev(){return this.prevInternal(await this.waitForInternalState()),await this.waitForData()}async next(){const{numBefore:e,extractedData:t}=await this.waitForInternalState();return e+this.paginateOptions.pageSize<t.length&&(this.firstElement=t[e+this.paginateOptions.pageSize]),this.internalStateObserver.next(null),this.doNewQuery(t[e],!1),await this.waitForData()}async waitForData(){return this.internalStateToState(await this.waitForInternalState())}observeState(){return this.internalStateObserver.pipe((0,o.filter)((e=>null!==e)),(0,o.map)((e=>this.internalStateToState(e))))}async first(){return await this.waitForInternalState(),this.internalStateObserver.next(null),this.firstElement=null,this.lastElement=null,this.goToFirstPage(),await this.waitForData()}async refreshPage(){const{extractedData:e}=await this.waitForInternalState();return this.internalStateObserver.next(null),this.onFirstPage?this.goToFirstPage():this.doNewQuery(e[0],!1),await this.waitForData()}async last(){await this.waitForInternalState(),this.internalStateObserver.next(null),this.firstElement=null,this.lastElement=null,this.navigatingToLastPage=!0;const e=this.templateSnapshotEmitter.clone().limit(3*this.paginateOptions.pageSize).flipSortOrder().snapshots(this.paginateOptions.subscribe).pipe((0,o.map)((e=>e.reverse())));return this.snapshotSubject.next(e),await this.waitForData()}}class Ze{constructor(e,t,r,n){this.querySubscriptionManager=e,this.localQueryManager=t,this.documentReferenceFactory=r,this.documentIdentityService=n}getForDocument(e){const{collectionName:t,integrationId:r,docId:n}=He(e),i=_e(n),o=this.get(t,r);for(const[e,t]of Object.entries(i))o.where(e,"==",t);return o}get(e,t){return new rt(e,t,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this,this.documentIdentityService)}}class et{constructor(){this.containsEmptyInCondition=!1}eq(e,t){return this.where(e,"==",t)}neq(e,t){return this.where(e,"!=",t)}in(e,t){return this.where(e,"in",t)}nin(e,t){return this.where(e,"not in",t)}gt(e,t){return this.where(e,">",t)}gte(e,t){return this.where(e,">=",t)}lt(e,t){return this.where(e,"<",t)}lte(e,t){return this.where(e,"<=",t)}like(e,t,r){return this.throwIfInvalidLikePattern(t),this.where(e,r?"like_cs":"like",t)}notLike(e,t,r){return this.throwIfInvalidLikePattern(t),this.where(e,r?"not like_cs":"not like",t)}arrayIncludesSome(e,t){return this.where(e,"array_includes_some",t)}arrayIncludesAll(e,t){return this.where(e,"array_includes_all",t)}arrayNotIncludes(e,t){return this.where(e,"array_not_includes",t)}throwIfInvalidLikePattern(e){if(/\\(?![%_\\])/.test(e))throw new Error("Invalid pattern. Cannot have any \\ which are not followed by _, % or \\")}}class tt{constructor(e){this.queryBuilder=e}peek(){return this.queryBuilder.peek().map((e=>e.data))}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1).pipe((0,o.defaultIfEmpty)([])))}snapshots(e){return this.queryBuilder.snapshots(e).pipe(Q((e=>e.map((e=>e.data)))))}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){return new tt(this.queryBuilder.clone())}addCompositeCondition(e){return this.queryBuilder.addCompositeCondition(e),this}limit(e){return this.queryBuilder.limit(e),this}getLimit(){return this.queryBuilder.getLimit()}flipSortOrder(){return this.queryBuilder.flipSortOrder(),this}extractData(e){return e}serialize(){return Object.assign(Object.assign({},this.queryBuilder.serialize()),{dereference:!0})}paginate(e){return new Xe(this,e)}}class rt extends et{constructor(e,t,r,n,i,o,s){super(),this.collectionName=e,this.integrationId=t,this.querySubscriptionManager=r,this.localQueryManager=n,this.documentReferenceFactory=i,this.queryBuilderFactory=o,this.documentIdentityService=s,this.forceFetchFromServer=!1,this.query={integrationId:t,collectionName:e,conditions:[],limit:-1,sortOrder:[]}}where(e,t,r){if("in"===t||"not in"===t){const n=Array.isArray(r)?[...r]:[r];"in"===t&&0===n.length&&(this.containsEmptyInCondition=!0);for(const r of n)this.query.conditions.push({fieldName:e,operator:"in"===t?"==":"!=",value:r});return this}return this.query.conditions.push({fieldName:e,operator:t,value:r}),this}limit(e){return function(e){(0,V.assertNumber)(e,"Limit needs to be a number"),-1!==e&&((0,V.assertTruthy)(e>0,"query limit has to be greater than 0"),(0,V.assertTruthy)(Math.floor(e)===e,"query limit has to be an integer"),(0,V.assertTruthy)(e<=2e4,"Limit can be maximum 20000"))}(e),this.query.limit=e,this}getLimit(){return this.query.limit}limitBy(e,...t){const r=this.query.sortOrder.map((e=>e.fieldName));return(0,V.assertTruthy)(he(t.sort(),r.slice(0,t.length).sort()),"All fields in limitBy must be appear in the first fields in the sortBy list."),this.query.limitBy={limit:e,fields:t,reverseSort:!1},this}sortBy(e,t=!0){const r={asc:t,fieldName:e};return function(e){if(!(e instanceof Object))throw new Error("Field sort has to be an object");const t=e;var r,n,i,o;(0,V.assertTruthy)((r=t,n=["fieldName","asc"],!Array.isArray(r)&&[...Object.keys(r)].every((e=>n.includes(e)))),"Field sort should only contain a fieldName and asc"),(0,V.assertTruthy)((i=t.asc,o="boolean",Array.isArray(i)?i.every((e=>typeof e===o)):typeof i===o),"Asc needs to be boolean")}(r),(0,V.assertTruthy)(!this.query.sortOrder.some((t=>t.fieldName===e)),`${e} already in the sort list.`),this.query.sortOrder.push(r),this}build(){const e=this.mergeConditions();return Object.assign(Object.assign({},this.query),{conditions:e})}mergeConditions(){const e=[],t=ye(this.query.conditions.filter(Ue)||[],(e=>e.fieldName));for(const r of Object.values(t)){const t=ye(r,(e=>e.operator));for(const[r,n]of Object.entries(t)){if("=="===r||"!="===r){e.push(...n);continue}const t=[...n];t.sort(((e,t)=>ve(e.value,t.value))),">"===r||">="===r?e.push(t[t.length-1]):e.push(t[0])}}return[...this.query.conditions.filter((e=>!Ue(e))),...e]}getSortOrder(){return this.query.sortOrder}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1).pipe((0,o.defaultIfEmpty)([])))}setForceFetchFromServer(){return this.forceFetchFromServer=!0,this}peek(){return this.localQueryManager.peek(this.build())}snapshots(e=!0){if(this.containsEmptyInCondition)return new o.BehaviorSubject([]);const t=this.build();return this.querySubscriptionManager.processQuery(t,this.collectionName,{},{},e,this.forceFetchFromServer).pipe(Q((e=>e.map((e=>{(0,V.assertTruthy)(1===Object.keys(e).length);const t=e[this.collectionName],r=Ke((0,V.truthy)(t).__docId__,this.collectionName,this.integrationId);return this.documentReferenceFactory.create(r,this.queryBuilderFactory)})))))}changes(){let e,t=new Set;return this.snapshots().pipe((0,o.combineLatestWith)(this.documentIdentityService.observeChanges().pipe((0,o.switchMap)((t=>(Object.entries(t).forEach((([t,r])=>{!function(e,t,r){const n=e[t];void 0!==n&&(e[r]=n,delete e[t])}(e||{},t,r)})),o.NEVER))),(0,o.startWith)({}))),Q((([r])=>{let n=[];const i=[],o=[];if(e){for(const o of r){const r=o.squidDocId,s=o.dataRef;if(t.has(s))delete e[r],t.delete(s);else if(e[r]){i.push(o);const n=e[r];delete e[r],t.delete(n)}else n.push(o)}for(const e of t)o.push(e)}else n=r;e={},t=new Set;for(const n of r){const r=n.dataRef;e[n.squidDocId]=r,t.add(r)}return new nt(n,i,o)})))}get hash(){return Oe(this.build())}dereference(){return new tt(this)}getSortOrders(){return this.query.sortOrder}clone(){const e=new rt(this.collectionName,this.integrationId,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.queryBuilderFactory,this.documentIdentityService);return e.query=fe(this.query),e.containsEmptyInCondition=this.containsEmptyInCondition,e}addCompositeCondition(e){return e.length?(this.query.conditions.push({fields:e}),this):this}flipSortOrder(){return this.query.sortOrder=this.query.sortOrder.map((e=>Object.assign(Object.assign({},e),{asc:!e.asc}))),this.query.limitBy&&(this.query.limitBy.reverseSort=!this.query.limitBy.reverseSort),this}serialize(){return{type:"simple",dereference:!1,query:this.build()}}extractData(e){return e.dataRef}paginate(e){return new Xe(this,e)}}class nt{constructor(e,t,r){this.inserts=e,this.updates=t,this.deletes=r}}class it extends et{constructor(e,t,r,n,i,o,s,a,u,c,l){super(),this.collectionName=e,this.integrationId=t,this.querySubscriptionManager=r,this.documentReferenceFactory=n,this.queryBuilderFactory=i,this.rootAlias=o,this.latestAlias=s,this.leftToRight=a,this.joins=u,this.joinConditions=c,this.queryBuilder=l}where(e,t,r){return this.queryBuilder.where(e,t,r),this}limit(e){return this.queryBuilder.limit(e),this}getLimit(){return this.queryBuilder.getLimit()}sortBy(e,t=!0){return this.queryBuilder.sortBy(e,t),this}join(e,t,r,n){var i,o;const s=null!==(i=null==n?void 0:n.leftAlias)&&void 0!==i?i:this.latestAlias,a=Object.assign(Object.assign({},r),{leftAlias:s,isInner:null!==(o=null==n?void 0:n.isInner)&&void 0!==o&&o}),u=Object.assign(Object.assign({},this.leftToRight),{[t]:[]});return u[s].push(t),new it(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,this.rootAlias,t,u,Object.assign(Object.assign({},this.joins),{[t]:e.build()}),Object.assign(Object.assign({},this.joinConditions),{[t]:a}),this.queryBuilder)}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1))}snapshots(e=!0){return this.containsEmptyInCondition?new o.BehaviorSubject([]):this.querySubscriptionManager.processQuery(this.build(),this.rootAlias,fe(this.joins),fe(this.joinConditions),e,!1).pipe(Q((e=>e.map((e=>{const t={};for(const[r,n]of Object.entries(e)){const e=r===this.rootAlias?this.collectionName:this.joins[r].collectionName,i=r===this.rootAlias?this.integrationId:this.joins[r].integrationId,o=n?Ke(n.__docId__,e,i):void 0;t[r]=o?this.documentReferenceFactory.create(o,this.queryBuilderFactory):void 0}return t})))))}peek(){throw new Error("peek is not currently supported for join queries")}grouped(){return new at(this)}dereference(){return new ot(this)}build(){return this.queryBuilder.build()}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){const e=new it(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,this.rootAlias,this.latestAlias,fe(this.leftToRight),fe(this.joins),fe(this.joinConditions),this.queryBuilder.clone());return e.containsEmptyInCondition=this.containsEmptyInCondition,e}addCompositeCondition(e){return this.queryBuilder.addCompositeCondition(e),this}flipSortOrder(){return this.queryBuilder.flipSortOrder(),this}extractData(e){return e[this.rootAlias].dataRef}serialize(){return{type:"join",grouped:!1,dereference:!1,root:{alias:this.rootAlias,query:this.build()},leftToRight:this.leftToRight,joins:this.joins,joinConditions:this.joinConditions}}paginate(e){return new Xe(this,e)}}class ot{constructor(e){this.joinQueryBuilder=e}grouped(){return this.joinQueryBuilder.grouped().dereference()}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(Q((e=>e.map((e=>function(e,t){const r={},n=Object.keys(e);for(const t of n){const n=e[t];r[t]=null==(i=n)?void 0:i.data}var i;return r}(e))))))}peek(){throw new Error("peek is not currently supported for join queries")}getSortOrders(){return this.joinQueryBuilder.getSortOrders()}clone(){return new ot(this.joinQueryBuilder.clone())}addCompositeCondition(e){return this.joinQueryBuilder.addCompositeCondition(e),this}flipSortOrder(){return this.joinQueryBuilder.flipSortOrder(),this}limit(e){return this.joinQueryBuilder.limit(e),this}extractData(e){return e[this.joinQueryBuilder.rootAlias]}paginate(e){return new Xe(this,e)}serialize(){return Object.assign(Object.assign({},this.joinQueryBuilder.serialize()),{dereference:!0})}getLimit(){return this.joinQueryBuilder.getLimit()}}class st{constructor(e){this.groupedJoin=e}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.groupedJoin.snapshots(e).pipe(Q((e=>e.map((e=>this.dereference(e,this.groupedJoin.joinQueryBuilder.rootAlias))))))}peek(){throw new Error("peek is not currently supported for join queries")}dereference(e,t){const r=this.groupedJoin.joinQueryBuilder.leftToRight[t];if(r.length){const n={[t]:e[t].data};for(const t of r)n[t]=e[t].map((e=>this.dereference(e,t)));return n}return e.data}getSortOrders(){return this.groupedJoin.getSortOrders()}clone(){return new st(this.groupedJoin.clone())}addCompositeCondition(e){return this.groupedJoin.addCompositeCondition(e),this}flipSortOrder(){return this.groupedJoin.flipSortOrder(),this}limit(e){return this.groupedJoin.limit(e),this}getLimit(){return this.groupedJoin.getLimit()}extractData(e){return e[this.groupedJoin.joinQueryBuilder.rootAlias]}serialize(){return Object.assign(Object.assign({},this.groupedJoin.joinQueryBuilder.serialize()),{dereference:!0,grouped:!0})}paginate(e){return new Xe(this,e)}}class at{constructor(e){this.joinQueryBuilder=e}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(Q((e=>this.groupData(e,this.joinQueryBuilder.rootAlias))))}peek(){throw new Error("peek is not currently supported for join queries")}dereference(){return new st(this)}groupData(e,t){const r=ye(e,(e=>{var r;return null===(r=e[t])||void 0===r?void 0:r.squidDocId}));return Object.values(r).filter((e=>void 0!==e[0][t])).map((e=>{const r=this.joinQueryBuilder.leftToRight[t],n=e[0][t];if(0===r.length)return n;const i={[t]:n};for(const t of r)i[t]=this.groupData(e,t);return i}))}getSortOrders(){return this.joinQueryBuilder.getSortOrders()}clone(){return new at(this.joinQueryBuilder.clone())}addCompositeCondition(e){return this.joinQueryBuilder.addCompositeCondition(e),this}flipSortOrder(){return this.joinQueryBuilder.flipSortOrder(),this}limit(e){return this.joinQueryBuilder.limit(e),this}getLimit(){return this.joinQueryBuilder.getLimit()}extractData(e){return Object.keys(this.joinQueryBuilder.leftToRight).length>1?e[this.joinQueryBuilder.rootAlias].dataRef:e.dataRef}serialize(){return Object.assign(Object.assign({},this.joinQueryBuilder.serialize()),{grouped:!0})}paginate(e){return new Xe(this,e)}}function ut(e,t,r){if(e=e instanceof Date?e.getTime():null!=e?e:null,t=t instanceof Date?t.getTime():null!=t?t:null,"=="===r)return he(e,t);if("!="===r)return!he(e,t);switch(r){case"<":return!le(e)&&(!!le(t)||t<e);case"<=":return!!le(t)||!le(e)&&t<=e;case">":return!le(t)&&(!!le(e)||t>e);case">=":return!!le(e)||!le(t)&&t>=e;case"like":return"string"==typeof t&&"string"==typeof e&&ct(t,e,!1);case"not like":return!("string"==typeof t&&"string"==typeof e&&ct(t,e,!1));case"like_cs":return"string"==typeof t&&"string"==typeof e&&ct(t,e,!0);case"not like_cs":return!("string"==typeof t&&"string"==typeof e&&ct(t,e,!0));case"array_includes_some":{const r=t;return Array.isArray(t)&&Array.isArray(e)&&e.some((e=>(0,V.truthy)(r,"VALUE_CANNOT_BE_NULL").some((t=>he(t,e)))))}case"array_includes_all":{const r=t;return Array.isArray(e)&&Array.isArray(t)&&e.every((e=>(0,V.truthy)(r,"VALUE_CANNOT_BE_NULL").some((t=>he(t,e)))))}case"array_not_includes":{const r=t;return Array.isArray(t)&&Array.isArray(e)&&e.every((e=>!(0,V.truthy)(r,"VALUE_CANNOT_BE_NULL").some((t=>he(t,e)))))}default:throw new Error(`Unsupported operator comparison: ${r}`)}}function ct(e,t,r){r||(e=e.toLowerCase(),t=t.toLowerCase());const n=function(e){let t="";for(let r=0;r<e.length;++r)"\\"===e[r]?r+1<e.length&&["%","_"].includes(e[r+1])?(t+=e[r+1],r++):r+1<e.length&&"\\"===e[r+1]?(t+="\\\\",r++):t+="\\":"%"===e[r]?t+="[\\s\\S]*":"_"===e[r]?t+="[\\s\\S]":("/-\\^$*+?.()[]{}|".includes(e[r])&&(t+="\\"),t+=e[r]);return t}(t);return new RegExp(`^${n}$`).test(e)}function lt(e,t){return`${e}_${t}`}class ht{constructor(e,t,r,n,i,o){this.collectionName=e,this.integrationId=t,this.documentReferenceFactory=r,this.queryBuilderFactory=n,this.querySubscriptionManager=i,this.dataManager=o,this.refId=U()}doc(e){if(e&&"string"!=typeof e&&"object"!=typeof e&&!Array.isArray(e))throw new Error("Invalid doc id. Can be only object or string.");if(this.integrationId!==Be.built_in_db)if(e){if("object"!=typeof e)throw new Error("Invalid doc id. String doc ids are only supported for the built_in_db integration. For all other integrations, the doc id must be an object.")}else e={[Ge]:U()};else e=e&&"string"!=typeof e?{__id:me(e)}:{__id:e||U()};const t=Ke(me(e),this.collectionName,this.integrationId);return this.documentReferenceFactory.create(t,this.queryBuilderFactory)}async insertMany(e,t){await this.dataManager.runInTransaction((async t=>{for(const r of e)await this.doc(r.id).insert(r.data,t)}),t)}async deleteMany(e,t){await this.dataManager.runInTransaction((async t=>{for(const r of e)r instanceof Je?await r.delete(t):await this.doc(r).delete(t)}),t)}query(){return this.queryBuilderFactory.get(this.collectionName,this.integrationId)}joinQuery(e){return new it(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,e,e,{[e]:[]},{},{},this.query())}or(...e){return new dt(...e)}}class dt{constructor(...e){if(0===e.length)throw new Error("At least one query builder must be provided");this.snapshotEmitters=e.map((e=>e.clone()));const t=Math.max(...this.snapshotEmitters.map((e=>{const t=e.getLimit();return-1===t?1e3:t})));this.snapshotEmitters.forEach((e=>e.limit(t)));const r=this.snapshotEmitters[0].getSortOrders();for(const e of this.snapshotEmitters){const t=e.getSortOrders();if(t.length!==r.length)throw new Error("All the queries must have the same sort order");for(let e=0;e<r.length;e++)if(t[e].fieldName!==r[e].fieldName||t[e].asc!==r[e].asc)throw new Error("All the queries must have the same sort order")}}snapshot(){return(0,o.firstValueFrom)(this.snapshots(!1))}snapshots(e=!0){const t=this.snapshotEmitters.map((t=>t.snapshots(e)));return this.or(this.snapshotEmitters[0].getSortOrders(),...t)}peek(){throw new Error("peek is not currently supported for merged queries")}or(e,...t){return(0,o.combineLatest)([...t]).pipe((0,o.map)((t=>{const r=new Set,n=t.flat(),i=[];for(const e of n)r.has(this.extractData(e))||(r.add(this.extractData(e)),i.push(e));return i.sort(((t,r)=>{for(const{fieldName:n,asc:i}of e){const e=oe(this.extractData(t),n),o=oe(this.extractData(r),n);if(!ut(e,o,"=="))return ut(o,e,"<")?i?-1:1:i?1:-1}return 0})).slice(0,this.getLimit())})))}clone(){return new dt(...this.snapshotEmitters.map((e=>e.clone())))}getSortOrders(){return this.snapshotEmitters[0].getSortOrders()}addCompositeCondition(e){for(const t of this.snapshotEmitters)t.addCompositeCondition(e);return this}limit(e){return this.snapshotEmitters.forEach((t=>t.limit(e))),this}getLimit(){return this.snapshotEmitters[0].getLimit()}flipSortOrder(){return this.snapshotEmitters.forEach((e=>e.flipSortOrder())),this}serialize(){return{type:"merged",queries:this.snapshotEmitters.map((e=>e.serialize()))}}extractData(e){return this.snapshotEmitters[0].extractData(e)}paginate(e){return new Xe(this,e)}}class ft{constructor(e,t,r,n){this.documentReferenceFactory=e,this.queryBuilderFactory=t,this.querySubscriptionManager=r,this.dataManager=n,this.collections=new Map}get(e,t){let r=this.collections.get(t);r||(r=new Map,this.collections.set(t,r));let n=r.get(e);return n||(n=new ht(e,t,this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager,this.dataManager),r.set(e,n)),n}}class pt{constructor(e,t){this.clientIdService=e,this.socketManager=t,this.isConnected=!1,this.socketManager.observeConnectionReady().subscribe((e=>{this.isConnected=e}))}get connected(){return this.isConnected}get clientId(){return this.clientIdService.getClientId()}observeConnected(){return this.socketManager.observeConnectionReady()}}var vt=r(5150);function yt(e,t){switch(t.type){case"applyNumericFn":return function(e,t){if("increment"===t.fn)return null==e?t.value:e+t.value;throw new Error("Unknown numeric function: "+JSON.stringify(t))}(e,t);case"applyStringFn":return function(e,t){switch(t.fn){case"trim":return"string"!=typeof e?e:e.trim();case"extendString":return null==e?t.value:e+t.value;default:throw new Error("Unknown string function: "+JSON.stringify(t))}}(e,t);case"update":return"object"==typeof t.value?fe(t.value):t.value;case"removeProperty":return;default:throw new Error("Unknown property mutation type: "+JSON.stringify(t))}}function bt(e){return Object.entries(e.properties).sort((([e],[t])=>e.split(".").length-t.split(".").length))}function mt(e){let t=0;for(;t+1<e.length;){const i=(r=e[t],"removeProperty"===(n=e[t+1]).type||"update"===n.type?n:"applyNumericFn"===n.type?((0,V.assertTruthy)("increment"===n.fn,"Unrecognized applyNumericFn"),"applyNumericFn"===r.type?((0,V.assertTruthy)("increment"===r.fn,"Unrecognized applyNumericFn"),{type:"applyNumericFn",fn:"increment",value:r.value+n.value}):"update"===r.type?{type:"update",value:r.value+n.value}:n):"extendString"===n.fn?"update"===r.type?{type:"update",value:r.value+n.value}:"applyStringFn"===r.type?"trim"===r.fn?null:{type:"applyStringFn",fn:"extendString",value:r.value+n.value}:n:null);i?e.splice(t,2,i):++t}var r,n;return e}function gt(e){let t=[];return(0,o.from)(e).pipe((0,o.groupBy)((e=>`${e.squidDocIdObj.integrationId}${e.squidDocIdObj.collectionName}/${e.squidDocIdObj.docId}`)),(0,o.mergeMap)((e=>e.pipe((0,o.reduce)(((e,t)=>function(e,t){if("insert"===t.type)return t;if("delete"===t.type)return t;if("delete"===e.type)throw new Error("Cannot delete and then update");if((0,V.assertTruthy)("update"===t.type,"Invalid mutation type"),"update"===e.type)return function(e,t){const r=fe(e);t=fe(t);for(const[e]of bt(r)){const n=e.split(".").length;Object.entries(t.properties).some((([t])=>e.startsWith(t+".")&&n>t.split(".").length))&&delete r.properties[e]}for(const[e,n]of bt(t))r.properties[e]=mt([...r.properties[e]||[],...n]);return r}(e,t);const r=fe(e);for(const[e,n]of bt(t)){const t=n;for(const n of t){const t=yt(oe(r.properties,e),n);void 0===t?ue(r.properties,e):ae(r.properties,e,t)}}return r}(e,t)))))),(0,o.toArray)()).subscribe((e=>{t=e})),t}const _t="dataManager_runInTransaction";class Ot{constructor(e,t,r,n,i,s,a,u,c){this.documentStore=e,this.mutationSender=t,this.socketManager=r,this.querySubscriptionManager=n,this.queryBuilderFactory=i,this.lockManager=s,this.destructManager=a,this.documentIdentityService=u,this.querySender=c,this.docIdToLocalTimestamp=new Map,this.batchClientRequestIds=new Set,this.docIdToServerTimestamp=new Map,this.pendingIncomingUpdates=new Map,this.pendingOutgoingMutations=new Map,this.pendingOutgoingMutationsChanged=new o.Subject,this.outgoingMutationsEmpty=new o.BehaviorSubject(!0),this.knownDirtyDocs=new Set,this.failedDocsToResync=[],this.refreshDocIdToTimestamp=new Map,this.handleIncomingMessagesForTests=!0,this.destructManager.onDestruct((()=>{this.destruct()})),this.documentIdentityService.observeChanges().subscribe(this.migrateDocIds.bind(this)),this.handleNotifications(),this.startDeleteExpiredTimestampsJob(),this.handleOrphanDocs(),this.outgoingMutationsEmpty.subscribe((e=>{this.querySender.safeToSendQueriesToServer.next(e)}))}getProperties(e){return this.documentStore.getDocumentOrUndefined(e)}isDirty(e){var t;if(this.knownDirtyDocs.has(e))return!0;if(null===(t=this.pendingOutgoingMutations.get(e))||void 0===t?void 0:t.length)return!0;const r=this.docIdToServerTimestamp.get(e),n=r&&!r.expireTimestamp?r.timestamp:void 0,i=this.docIdToLocalTimestamp.get(e);return!((!i||n)&&!this.isForgotten(e)&&!this.isLocalOnly(e)&&i===n)}async runInTransaction(e,t){if(t)return(0,V.assertTruthy)(t===this.currentTransactionId,"Transaction already ended."),e(t).then((e=>Promise.resolve(e)));this.lockManager.canGetLock(_t)?this.lockManager.lockSync(_t):await this.lockManager.lock(_t);let r=St;const n=()=>r!==St;return new Promise((async(t,i)=>{try{let o;this.currentTransactionId=U();try{o=await e(this.currentTransactionId)}catch(e){r=e}finally{this.finishTransaction(n()?void 0:{resolve:()=>t(o),reject:i})}}catch(e){r=n()?r:e}finally{try{this.lockManager.release(_t)}catch(e){r=n()?r:e}}n()&&i(r)}))}async applyOutgoingMutation(e,t){var r;const n=Ke(e.squidDocIdObj);this.knownDirtyDocs.add(n),t||this.lockManager.canGetLock(_t)||(await this.lockManager.lock(_t),this.lockManager.release(_t)),this.knownDirtyDocs.delete(n);const i=null===(r=this.pendingOutgoingMutations.get(n))||void 0===r?void 0:r.slice(-1)[0];if(i&&!i.sentToServer)i.mutation=gt([i.mutation,e])[0],this.outgoingMutationsEmpty.next(!1);else{const t={mutation:this.removeInternalProperties(e),sentToServer:!1},r=this.pendingOutgoingMutations.get(n)||[];r.push(t),this.pendingOutgoingMutations.set(n,r),this.outgoingMutationsEmpty.next(!1),this.pendingOutgoingMutationsChanged.next()}return this.runInTransaction((async()=>{const t=this.documentStore.getDocumentOrUndefined(n),r="delete"===e.type?void 0:"update"===e.type?function(e,t){if(!e)return;const r=Object.assign({},e),n=bt(t);for(const[e,t]of n){const n=t;for(const t of n){const n=yt(oe(r,e),t);void 0===n?ue(r,e):ae(r,e,n)}}return r}(t,e):Object.assign({},e.properties);this.updateDocumentFromSnapshot(n,r)&&("insert"===e.type&&this.docIdToLocalTimestamp.set(n,(new Date).getTime()),this.querySubscriptionManager.setClientRequestIdsForLocalDoc(n,r).forEach((e=>this.batchClientRequestIds.add(e))))}),t)}async runInTransactionSync(e,t){if(t)return(0,V.assertTruthy)(t===this.currentTransactionId,"Transaction already ended."),void e(t);await this.lockManager.lock(_t);try{this.currentTransactionId=U();try{return e(this.currentTransactionId)}catch(e){console.error("error while executing callback function in transaction",e)}finally{this.finishTransaction()}}catch(e){console.error("error while executing transaction",e)}finally{this.lockManager.release(_t)}}removeInternalProperties(e){if("delete"===e.type)return e;const t=Object.assign(Object.assign({},e),{properties:Object.assign({},e.properties)});return delete t.properties.__docId__,delete t.properties.__ts__,t}handleNotifications(){this.socketManager.observeNotifications().pipe((0,o.filter)((e=>"mutations"===e.type)),Q((e=>e))).subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,o.filter)(Boolean),(0,o.take)(1)).subscribe((()=>{this.handleIncomingMutations(e.payload)}))})),this.querySubscriptionManager.observeQueryResults().subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,o.filter)(Boolean),(0,o.take)(1)).subscribe((()=>{this.handleIncomingQuerySnapshots(e)}))}))}handleIncomingMutations(e){if(!this.handleIncomingMessagesForTests)return;const t=e.reduce(((e,t)=>this.querySubscriptionManager.hasOngoingQuery(t.clientRequestId)?(e[t.squidDocId]={properties:t.doc,timestamp:t.mutationTimestamp},e):e),{});this.applyIncomingUpdates(t)}handleIncomingQuerySnapshots(e){if(!this.handleIncomingMessagesForTests)return;if(!this.querySubscriptionManager.hasOngoingQuery(e.clientRequestId))return;const t=this.querySubscriptionManager.getQuery(e.clientRequestId),r={};for(const n of e.docs){const e=Ke(n.__docId__,t.collectionName,t.integrationId);r[e]={properties:n,timestamp:n.__ts__}}this.runInTransactionSync((t=>{this.querySubscriptionManager.setGotInitialResult(e.clientRequestId),this.batchClientRequestIds.add(e.clientRequestId),this.applyIncomingUpdates(r,t)&&this.querySubscriptionManager.hasSubscription(e.clientRequestId)&&this.batchClientRequestIds.delete(e.clientRequestId)})).then()}applyIncomingUpdates(e,t){let r=!1;const n=new Set,i=new Set;for(const[t,o]of Object.entries(e)){const e=this.pendingIncomingUpdates.get(t),s=this.docIdToServerTimestamp.get(t);e&&e.timestamp>o.timestamp?r=!0:s&&s.timestamp>o.timestamp?i.add(t):(this.pendingIncomingUpdates.set(t,o),n.add(t))}return this.runInTransactionSync((()=>{for(const e of n)this.maybeApplyIncomingUpdate(e);for(const e of i)this.refreshQueryMapping(e)}),t).then(),r}maybeApplyIncomingUpdate(e){const t=this.pendingIncomingUpdates.get(e);if(!t)return;const r=this.pendingOutgoingMutations.get(e);r&&r.length||(this.updateDocumentFromSnapshot(e,t.properties),this.acknowledgeDocument(e,t.timestamp,!t.properties),this.docIdToLocalTimestamp.set(e,t.timestamp),this.pendingIncomingUpdates.delete(e),this.refreshQueryMapping(e))}refreshQueryMapping(e){const t=this.documentStore.getDocumentOrUndefined(e);this.querySubscriptionManager.setClientRequestIdsForLocalDoc(e,t).forEach((e=>{this.batchClientRequestIds.add(e)})),t&&(this.querySubscriptionManager.findQueriesForDocument(t,e).length||this.forgetDocument(e))}destruct(){this.stopDeleteExpiredTimestampsJob()}stopDeleteExpiredTimestampsJob(){void 0!==this.deleteExpiredTimestampsInterval&&(clearInterval(this.deleteExpiredTimestampsInterval),this.deleteExpiredTimestampsInterval=void 0)}startDeleteExpiredTimestampsJob(){this.deleteExpiredTimestampsInterval=setInterval((()=>{const e=[...this.docIdToServerTimestamp.entries()].filter((([e,t])=>!(!t.expireTimestamp||t.expireTimestamp>Date.now()||this.isTracked(e))));for(const[t]of e)this.docIdToServerTimestamp.delete(t),this.forgetDocument(t)}),1e4)}isTracked(e){if(this.pendingIncomingUpdates.get(e))return!0;const t=this.pendingOutgoingMutations.get(e);return!(!t||!t.length)||this.querySubscriptionManager.hasOngoingQueryForDocId(e)}isForgotten(e){return this.documentStore.hasData(e)&&!this.isTracked(e)}isLocalOnly(e){return!this.hasBeenAcknowledged(e)&&this.documentStore.hasData(e)}hasBeenAcknowledged(e){return this.docIdToServerTimestamp.has(e)}updateDocumentFromSnapshot(e,t){const r=this.documentStore.getDocumentOrUndefined(e);return!(!r&&!t||r===t)&&((!r||!t||me(Object.assign(Object.assign({},t),{__ts__:void 0}))!==me(r))&&(this.documentStore.saveDocument(e,t),!0))}finishTransaction(e){this.currentTransactionId=void 0;const t=[...this.batchClientRequestIds.values()];this.batchClientRequestIds.clear(),this.querySubscriptionManager.notifyAllSubscriptions(t),this.sendAllUnsentOutgoingMutations(e).then()}async sendAllUnsentOutgoingMutations(e){const t=this.groupOutgoingMutationsByIntegrationId();try{await vt.PromisePool.for(t).withConcurrency(t.length||1).handleError((e=>{throw e})).process((async([e,t])=>{await this.sendMutationsForIntegration([...t],e)})),this.pendingOutgoingMutations.size||this.outgoingMutationsEmpty.next(!0),await this.refreshUpdatedDocuments(),this.hasPendingSentMutations()?(await(0,o.firstValueFrom)(this.pendingOutgoingMutationsChanged.pipe((0,o.filter)((()=>!this.hasPendingSentMutations())))),null==e||e.resolve()):null==e||e.resolve()}catch(t){this.pendingOutgoingMutations.size||(this.outgoingMutationsEmpty.next(!0),await this.resyncFailedUpdates()),null==e||e.reject(t)}}async sendMutationsForIntegration(e,t){try{const{timestamp:r,idResolutionMap:n={},refreshList:i=[]}=await this.mutationSender.sendMutations(e.map((e=>e.mutation)),t);this.documentIdentityService.migrate(n),i.forEach((e=>{this.refreshDocIdToTimestamp.set(n[e]||e,r)}));for(const t of e){let e=this.removeOutgoingMutation(t);n[e]&&(e=n[e]),this.acknowledgeDocument(e,r),this.isTracked(e)||(this.setExpiration(e,!0),this.forgetDocument(e))}}catch(t){for(const t of e){const e=this.removeOutgoingMutation(t);this.forgetDocument(e),(this.hasBeenAcknowledged(e)||"insert"===t.mutation.type)&&this.failedDocsToResync.push(e)}throw t}}removeOutgoingMutation(e){const t=Ke(e.mutation.squidDocIdObj),r=(0,V.truthy)(this.pendingOutgoingMutations.get(t));return r.splice(r.indexOf(e),1),r.length||this.pendingOutgoingMutations.delete(t),this.pendingOutgoingMutationsChanged.next(),t}async resyncFailedUpdates(){const e=[...this.failedDocsToResync];this.failedDocsToResync.splice(0);for(const t of e){const{docId:e}=He(t);this.setExpiration(t,!0);try{const r=e.includes(Ge)?[]:await this.queryBuilderFactory.getForDocument(t).setForceFetchFromServer().snapshot();if((0,V.truthy)(r.length<=1,"Got more than one doc for the same id:"+t),!r.length){this.forgetDocument(t);const e=this.querySubscriptionManager.setClientRequestIdsForLocalDoc(t,void 0);this.querySubscriptionManager.notifyAllSubscriptions(e)}}catch(e){this.querySubscriptionManager.errorOutAllQueries(t,e)}}}async refreshUpdatedDocuments(){var e;const t=[];for(const[r,n]of this.refreshDocIdToTimestamp.entries()){const i=null===(e=this.docIdToServerTimestamp.get(r))||void 0===e?void 0:e.timestamp;i&&i>n||t.push(r)}this.refreshDocIdToTimestamp.clear(),await Promise.allSettled(t.map((e=>this.queryBuilderFactory.getForDocument(e).snapshot())))}groupOutgoingMutationsByIntegrationId(){const e={};for(const[,t]of[...this.pendingOutgoingMutations.entries()]){const r=t[t.length-1];if(r&&!r.sentToServer){const t=r.mutation.squidDocIdObj.integrationId;(e[t]||(e[t]=[])).push(r),r.sentToServer=!0}}return Object.entries(e)}handleOrphanDocs(){this.querySubscriptionManager.onOrphanDocuments.subscribe((e=>{for(const t of e)this.isTracked(t)||this.forgetDocument(t)}))}acknowledgeDocument(e,t,r=!1){this.docIdToServerTimestamp.set(e,{timestamp:t}),this.setExpiration(e,r)}setExpiration(e,t){const r=this.docIdToServerTimestamp.get(e);r&&(r.expireTimestamp=t?Date.now()+2e4:void 0)}forgetDocument(e){this.docIdToLocalTimestamp.delete(e),this.setExpiration(e,!0)}migrateDocIds(e){this.pendingOutgoingMutations.forEach((t=>{t.forEach((t=>{const r=Ke(t.mutation.squidDocIdObj),n=e[r];n&&(t.mutation.squidDocIdObj=He(n))}))})),Object.entries(e).forEach((([e,t])=>{ce(this.pendingOutgoingMutations,e,t),ce(this.docIdToLocalTimestamp,e,t),ce(this.docIdToServerTimestamp,e,t)}))}hasPendingSentMutations(){for(const e of this.pendingOutgoingMutations.values())for(const t of e)if(t.sentToServer)return!0;return!1}}const St=Symbol("undefined");class Et{constructor(){this.preDestructors=[],this.destructors=[],this.isDestructedSubject=new o.BehaviorSubject(!1)}get isDestructing(){return this.isDestructedSubject.value}observeIsDestructing(){return this.isDestructedSubject.asObservable().pipe((0,o.filter)(Boolean),Q((()=>{})))}onPreDestruct(e){this.preDestructors.push(e)}onDestruct(e){this.destructors.push(e)}async destruct(){this.reportDestructed();const e=this.preDestructors.concat(this.destructors);let t=e.shift();for(;t;){try{await t()}catch(e){console.error("Error while destructing Squid",e)}t=e.shift()}}reportDestructed(){this.isDestructing||this.isDestructedSubject.next(!0)}}class wt{constructor(e,t){this.socketManager=e,this.destructManager=t,this.ongoingLocks={},this.acquireLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,o.filter)((e=>"lockAcquired"===e.type))),this.releaseLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,o.filter)((e=>"lockReleased"===e.type))),this.lockWaitForConnectionThreshold=2e3,t.onPreDestruct((()=>{this.releaseAllLocks()})),this.socketManager.observeConnectionReady().subscribe((e=>{e||this.releaseAllLocks()})),this.releaseLockMessagesFromServer.subscribe((e=>{const t=this.ongoingLocks[e.payload.clientRequestId];void 0!==t&&t.release()}))}async lock(e,t=1e3){if(!await(0,o.firstValueFrom)((0,o.race)((0,o.timer)(this.lockWaitForConnectionThreshold).pipe(Q((()=>!1))),this.socketManager.observeConnectionReady().pipe((0,o.filter)(Boolean)),this.destructManager.observeIsDestructing())))return Promise.reject("CLIENT_NOT_CONNECTED");const r=U(),n={type:"acquireLock",payload:{mutex:e,timeoutMillis:t,clientRequestId:r}};this.socketManager.sendMessage(n);const i=await(0,o.firstValueFrom)((0,o.race)((0,o.timer)(t+4e3).pipe((0,o.take)(1),Q((()=>({payload:{error:"TIMEOUT_GETTING_LOCK",lockId:void 0}})))),this.acquireLockMessagesFromServer.pipe((0,o.filter)((e=>e.payload.clientRequestId===r)))));if(this.destructManager.isDestructing)throw new Error("Destructing");if(!i.payload.lockId)throw new Error(`Failed to acquire lock: ${i.payload.error}`);const s=i.payload.lockId,a=new Tt(s,r,this.ongoingLocks,this.socketManager);return this.ongoingLocks[s]=a,a}releaseAllLocks(){for(const[e,t]of Object.entries(this.ongoingLocks))t.release(),delete this.ongoingLocks[e]}}class Tt{constructor(e,t,r,n){this.lockId=e,this.clientRequestId=t,this.ongoingLocks=r,this.socketManager=n,this.released=!1,this.onReleaseSubject=new o.Subject}release(){if(this.released)return;this.released=!0,delete this.ongoingLocks[this.lockId];const e={type:"releaseLock",payload:{lockId:this.lockId,clientRequestId:this.clientRequestId}};this.socketManager.sendMessage(e),this.onReleaseSubject.next()}observeRelease(){return this.onReleaseSubject.asObservable()}isReleased(){return this.released}}class It{constructor(e,t){this.documentStore=e,this.destructManager=t,this.changeNotifier=new o.BehaviorSubject({}),this.destructManager.onDestruct((()=>{this.changeNotifier.complete()}))}migrate(e){Object.entries(e).forEach((([e,t])=>{this.documentStore.migrateDocId(e,t)})),this.changeNotifier.next(e)}observeChanges(){return this.changeNotifier.asObservable()}}class At{constructor(e){this.documentIdentityService=e,this.documents=new Map,this.documentsForCollection=new Map,this.documentIdentityService.observeChanges().subscribe(this.migrateDocIds.bind(this))}create(e,t){let r=this.documents.get(e);if(r)return r;r=new Je(e,(0,V.truthy)(this.dataManager,"dataManager not found"),t);const{integrationId:n,collectionName:i}=He(e);this.documents.set(e,r);const o=this.getCollectionKey(n,i),s=this.documentsForCollection.get(o)||[];return this.documentsForCollection.set(o,s.concat(r)),r}setDataManager(e){this.dataManager=e}getDocumentsForCollection(e,t){const r=this.getCollectionKey(e,t);return(this.documentsForCollection.get(r)||[]).filter((e=>e.hasData))}migrateDocIds(e){for(const[,t]of this.documents)t.migrateDocIds(e);Object.entries(e).forEach((([e,t])=>{const r=He(e),n=He(t);ce(this.documents,r.docId,n.docId)}))}getCollectionKey(e,t){return`${e}_${t}`}}class Mt{constructor(){this.squidDocIdToDoc=new Map}saveDocument(e,t){const r=this.squidDocIdToDoc.get(e);if(void 0===r&&!t)return;if(void 0!==r){if(t){const r=fe(t),n=this.removeInternalProperties(r);return this.squidDocIdToDoc.set(e,n),n}return void this.squidDocIdToDoc.delete(e)}const n=this.removeInternalProperties(t);return this.squidDocIdToDoc.set(e,n),t}hasData(e){return void 0!==this.squidDocIdToDoc.get(e)}getDocument(e){return(0,V.truthy)(this.getDocumentOrUndefined(e))}getDocumentOrUndefined(e){return this.squidDocIdToDoc.get(e)}compareSquidDocs(e,t,r){for(const{fieldName:n,asc:i}of r){const r=ve(oe(e,n),oe(t,n));if(0!==r)return i?r:-r}return 0}group(e,t){return Object.values(ye(e,(e=>me(t.map((t=>oe(e,t)))))))}sortAndLimitDocs(e,t){if(0===e.size)return[];const r=[...e].map((e=>this.squidDocIdToDoc.get(e))).filter(V.isNonNullable),{sortOrder:n,limitBy:i}=t,o=r.sort(((e,t)=>this.compareSquidDocs(e,t,n))),s=t.limit<0?2e3:t.limit;if(!i)return o.slice(0,s);const{limit:a,fields:u,reverseSort:c}=i,l=this.group(o,u);let h;return h=c?l.map((e=>e.slice(-a))):l.map((e=>e.slice(0,a))),h.flat().slice(0,s)}removeInternalProperties(e){if(!e)return;const t=Object.assign({},e);return delete t.__ts__,t}migrateDocId(e,t){const r=this.getDocumentOrUndefined(e);if(!r)return;ce(this.squidDocIdToDoc,e,t);const n=He(t),i=_e(n.docId);this.saveDocument(t,Object.assign(Object.assign(Object.assign({},r),i),{__docId__:n.docId}))}}var Ft="Invariant Violation",kt=Object.setPrototypeOf,Dt=void 0===kt?function(e,t){return e.__proto__=t,e}:kt,jt=function(e){function t(r){void 0===r&&(r=Ft);var n=e.call(this,"number"==typeof r?Ft+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=Ft,Dt(n,t.prototype),n}return c(t,e),t}(Error);function xt(e,t){if(!e)throw new jt(t)}var Pt,Nt=["debug","log","warn","error","silent"],Ct=Nt.indexOf("log");function Rt(e){return function(){if(Nt.indexOf(e)>=Ct)return(console[e]||console.log).apply(console,arguments)}}(Pt=xt||(xt={})).debug=Rt("debug"),Pt.log=Rt("log"),Pt.warn=Rt("warn"),Pt.error=Rt("error");var qt="3.8.9";function Lt(e){try{return e()}catch(e){}}const Bt=Lt((function(){return globalThis}))||Lt((function(){return window}))||Lt((function(){return self}))||Lt((function(){return global}))||Lt((function(){return Lt.constructor("return this")()}));var Qt=new Map;function Vt(e){var t=Qt.get(e)||1;return Qt.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function Ut(e,t){void 0===t&&(t=0);var r=Vt("stringifyForDisplay");return JSON.stringify(e,(function(e,t){return void 0===t?r:t}),t).split(JSON.stringify(r)).join("<undefined>")}function zt(e){return function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if("number"==typeof t){var i=t;(t=Ht(i))||(t=Kt(i,r),r=[])}e.apply(void 0,[t].concat(r))}}var Yt=Object.assign((function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];e||xt(e,Ht(t,r)||Kt(t,r))}),{debug:zt(xt.debug),log:zt(xt.log),warn:zt(xt.warn),error:zt(xt.error)});function Wt(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new jt(Ht(e,t)||Kt(e,t))}var $t=Symbol.for("ApolloErrorMessageHandler_"+qt);function Gt(e){return"string"==typeof e?e:Ut(e,2).slice(0,1e3)}function Ht(e,t){if(void 0===t&&(t=[]),e)return Bt[$t]&&Bt[$t](e,t.map(Gt))}function Kt(e,t){if(void 0===t&&(t=[]),e)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:qt,message:e,args:t.map(Gt)})))}function Jt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Xt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Zt(e,t,r){return t&&Xt(e.prototype,t),r&&Xt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}globalThis.__DEV__;var er=function(){return"function"==typeof Symbol},tr=function(e){return er()&&Boolean(Symbol[e])},rr=function(e){return tr(e)?Symbol[e]:"@@"+e};er()&&!tr("observable")&&(Symbol.observable=Symbol("observable"));var nr=rr("iterator"),ir=rr("observable"),or=rr("species");function sr(e,t){var r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function ar(e){var t=e.constructor;return void 0!==t&&null===(t=t[or])&&(t=void 0),void 0!==t?t:br}function ur(e){return e instanceof br}function cr(e){cr.log?cr.log(e):setTimeout((function(){throw e}))}function lr(e){Promise.resolve().then((function(){try{e()}catch(e){cr(e)}}))}function hr(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var r=sr(t,"unsubscribe");r&&r.call(t)}}catch(e){cr(e)}}function dr(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function fr(e,t,r){e._state="running";var n=e._observer;try{var i=sr(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(dr(e),!i)throw r;i.call(n,r);break;case"complete":dr(e),i&&i.call(n)}}catch(e){cr(e)}"closed"===e._state?hr(e):"running"===e._state&&(e._state="ready")}function pr(e,t,r){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void lr((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(fr(e,t[r].type,t[r].value),"closed"!==e._state);++r);}}(e)}))):void fr(e,t,r);e._queue.push({type:t,value:r})}}var vr=function(){function e(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";var r=new yr(this);try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}return e.prototype.unsubscribe=function(){"closed"!==this._state&&(dr(this),hr(this))},Zt(e,[{key:"closed",get:function(){return"closed"===this._state}}]),e}(),yr=function(){function e(e){this._subscription=e}var t=e.prototype;return t.next=function(e){pr(this._subscription,"next",e)},t.error=function(e){pr(this._subscription,"error",e)},t.complete=function(){pr(this._subscription,"complete")},Zt(e,[{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),br=function(){function e(t){if(!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}var t=e.prototype;return t.subscribe=function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new vr(e,this._subscriber)},t.forEach=function(e){var t=this;return new Promise((function(r,n){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,o)}catch(e){n(e),i.unsubscribe()}},error:n,complete:r});else n(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),r()}}))},t.map=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(ar(this))((function(r){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})}))},t.filter=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(ar(this))((function(r){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})}))},t.reduce=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=ar(this),n=arguments.length>1,i=!1,o=arguments[1];return new r((function(r){return t.subscribe({next:function(t){var s=!i;if(i=!0,!s||n)try{o=e(o,t)}catch(e){return r.error(e)}else o=t},error:function(e){r.error(e)},complete:function(){if(!i&&!n)return r.error(new TypeError("Cannot reduce an empty sequence"));r.next(o),r.complete()}})}))},t.concat=function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=ar(this);return new i((function(t){var n,o=0;return function e(s){n=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===r.length?(n=void 0,t.complete()):e(i.from(r[o++]))}})}(e),function(){n&&(n.unsubscribe(),n=void 0)}}))},t.flatMap=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=ar(this);return new r((function(n){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return n.error(e)}var o=r.from(t).subscribe({next:function(e){n.next(e)},error:function(e){n.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error:function(e){n.error(e)},complete:function(){s()}});function s(){o.closed&&0===i.length&&n.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))},t[ir]=function(){return this},e.from=function(t){var r="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var n=sr(t,ir);if(n){var i=n.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return ur(i)&&i.constructor===r?i:new r((function(e){return i.subscribe(e)}))}if(tr("iterator")&&(n=sr(t,nr)))return new r((function(e){lr((function(){if(!e.closed){for(var r,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Jt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jt(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(n.call(t));!(r=i()).done;){var o=r.value;if(e.next(o),e.closed)return}e.complete()}}))}));if(Array.isArray(t))return new r((function(e){lr((function(){if(!e.closed){for(var r=0;r<t.length;++r)if(e.next(t[r]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")},e.of=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return new("function"==typeof this?this:e)((function(e){lr((function(){if(!e.closed){for(var t=0;t<r.length;++t)if(e.next(r[t]),e.closed)return;e.complete()}}))}))},Zt(e,null,[{key:or,get:function(){return this}}]),e}();function mr(e){return null!==e&&"object"==typeof e}function gr(e,t){var r=t,n=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw Wt(70,e.operation,e.name?" named '".concat(e.name.value,"'"):"");"FragmentDefinition"===e.kind&&n.push(e)})),void 0===r&&(Yt(1===n.length,71,n.length),r=n[0].name.value),l(l({},e),{definitions:y([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],e.definitions,!0)})}function _r(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function Or(e,t){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var r=e.name.value;if("function"==typeof t)return t(r);var n=t&&t[r];return Yt(n,72,r),n||null;default:return null}}function Sr(e){return{__ref:String(e)}}function Er(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function wr(e,t,r,n){if(function(e){return"IntValue"===e.kind}(r)||function(e){return"FloatValue"===e.kind}(r))e[t.value]=Number(r.value);else if(function(e){return"BooleanValue"===e.kind}(r)||function(e){return"StringValue"===e.kind}(r))e[t.value]=r.value;else if(function(e){return"ObjectValue"===e.kind}(r)){var i={};r.fields.map((function(e){return wr(i,e.name,e.value,n)})),e[t.value]=i}else if(function(e){return"Variable"===e.kind}(r)){var o=(n||{})[r.name.value];e[t.value]=o}else if(function(e){return"ListValue"===e.kind}(r))e[t.value]=r.values.map((function(e){var r={};return wr(r,t,e,n),r[t.value]}));else if(function(e){return"EnumValue"===e.kind}(r))e[t.value]=r.value;else{if(!function(e){return"NullValue"===e.kind}(r))throw Wt(81,t.value,r.kind);e[t.value]=null}}er()&&Object.defineProperty(br,Symbol("extensions"),{value:{symbol:ir,hostReportError:cr},configurable:!0});var Tr=["connection","include","skip","client","rest","export","nonreactive"],Ir=Object.assign((function(e,t,r){if(t&&r&&r.connection&&r.connection.key){if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach((function(e){i[e]=t[e]})),"".concat(r.connection.key,"(").concat(Ar(i),")")}return r.connection.key}var o=e;if(t){var s=Ar(t);o+="(".concat(s,")")}return r&&Object.keys(r).forEach((function(e){-1===Tr.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@".concat(e,"(").concat(Ar(r[e]),")"):o+="@".concat(e))})),o}),{setStringify:function(e){var t=Ar;return Ar=e,t}}),Ar=function(e){return JSON.stringify(e,Mr)};function Mr(e,t){return mr(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function Fr(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return wr(r,n,i,t)})),r}return null}function kr(e){return e.alias?e.alias.value:e.name.value}function Dr(e,t,r){for(var n,i=0,o=t.selections;i<o.length;i++)if(jr(u=o[i])){if("__typename"===u.name.value)return e[kr(u)]}else n?n.push(u):n=[u];if("string"==typeof e.__typename)return e.__typename;if(n)for(var s=0,a=n;s<a.length;s++){var u,c=Dr(e,Or(u=a[s],r).selectionSet,r);if("string"==typeof c)return c}}function jr(e){return"Field"===e.kind}function xr(e){Yt(e&&"Document"===e.kind,73);var t=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw Wt(74,e.kind);return e}));return Yt(t.length<=1,75,t.length),e}function Pr(e){return xr(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function Nr(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&!!e.name})).map((function(e){return e.name.value}))[0]||null}function Cr(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function Rr(e){var t=Pr(e);return Yt(t&&"query"===t.operation,76),t}function qr(e){var t;xr(e);for(var r=0,n=e.definitions;r<n.length;r++){var i=n[r];if("OperationDefinition"===i.kind){var o=i.operation;if("query"===o||"mutation"===o||"subscription"===o)return i}"FragmentDefinition"!==i.kind||t||(t=i)}if(t)return t;throw Wt(80)}function Lr(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&wr(t,e.variable.name,e.defaultValue)})),t}function Br(e,t){return t?t(e):br.of()}function Qr(e){return"function"==typeof e?new Ur(e):e}function Vr(e){return e.request.length<=1}var Ur=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return br.of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(Qr).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,r,n){var i=Qr(r),o=Qr(n||new e(Br));return Vr(i)&&Vr(o)?new e((function(e){return t(e)?i.request(e)||br.of():o.request(e)||br.of()})):new e((function(e,r){return t(e)?i.request(e,r)||br.of():o.request(e,r)||br.of()}))},e.execute=function(e,t){return e.request(function(e,t){var r=l({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){r=l(l({},r),"function"==typeof e?e(r):e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return l({},r)}}),t}(t.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?Nr(t.query)||void 0:""),t}(function(e){for(var t=["query","operationName","variables","extensions","context"],r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];if(t.indexOf(i)<0)throw Wt(43,i)}return e}(t))))||br.of()},e.concat=function(t,r){var n=Qr(t);if(Vr(n))return!1!==globalThis.__DEV__&&Yt.warn(35,n),n;var i=Qr(r);return Vr(i)?new e((function(e){return n.request(e,(function(e){return i.request(e)||br.of()}))||br.of()})):new e((function(e,t){return n.request(e,(function(e){return i.request(e,t)||br.of()}))||br.of()}))},e.prototype.split=function(t,r,n){return this.concat(e.split(t,r,n||new e(Br)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw Wt(36)},e.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}(),zr=Ur.execute;function Yr(e,t){if(!Boolean(e))throw new Error(t)}const Wr=10,$r=2;function Gr(e){return Hr(e,[])}function Hr(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const r=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:Hr(t,r)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>$r)return"[Array]";const r=Math.min(Wr,e.length),n=e.length-r,i=[];for(let n=0;n<r;++n)i.push(Hr(e[n],t));return 1===n?i.push("... 1 more item"):n>1&&i.push(`... ${n} more items`),"["+i.join(", ")+"]"}(e,r);return function(e,t){const r=Object.entries(e);if(0===r.length)return"{}";if(t.length>$r)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const n=r.map((([e,r])=>e+": "+Hr(r,t)));return"{ "+n.join(", ")+" }"}(e,r)}(e,t);default:return String(e)}}class Kr{constructor(e,t,r){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class Jr{constructor(e,t,r,n,i,o){this.kind=e,this.start=t,this.end=r,this.line=n,this.column=i,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const Xr={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Zr=new Set(Object.keys(Xr));function en(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&Zr.has(t)}var tn,rn,nn;!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(tn||(tn={})),(nn=rn||(rn={})).NAME="Name",nn.DOCUMENT="Document",nn.OPERATION_DEFINITION="OperationDefinition",nn.VARIABLE_DEFINITION="VariableDefinition",nn.SELECTION_SET="SelectionSet",nn.FIELD="Field",nn.ARGUMENT="Argument",nn.FRAGMENT_SPREAD="FragmentSpread",nn.INLINE_FRAGMENT="InlineFragment",nn.FRAGMENT_DEFINITION="FragmentDefinition",nn.VARIABLE="Variable",nn.INT="IntValue",nn.FLOAT="FloatValue",nn.STRING="StringValue",nn.BOOLEAN="BooleanValue",nn.NULL="NullValue",nn.ENUM="EnumValue",nn.LIST="ListValue",nn.OBJECT="ObjectValue",nn.OBJECT_FIELD="ObjectField",nn.DIRECTIVE="Directive",nn.NAMED_TYPE="NamedType",nn.LIST_TYPE="ListType",nn.NON_NULL_TYPE="NonNullType",nn.SCHEMA_DEFINITION="SchemaDefinition",nn.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",nn.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",nn.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",nn.FIELD_DEFINITION="FieldDefinition",nn.INPUT_VALUE_DEFINITION="InputValueDefinition",nn.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",nn.UNION_TYPE_DEFINITION="UnionTypeDefinition",nn.ENUM_TYPE_DEFINITION="EnumTypeDefinition",nn.ENUM_VALUE_DEFINITION="EnumValueDefinition",nn.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",nn.DIRECTIVE_DEFINITION="DirectiveDefinition",nn.SCHEMA_EXTENSION="SchemaExtension",nn.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",nn.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",nn.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",nn.UNION_TYPE_EXTENSION="UnionTypeExtension",nn.ENUM_TYPE_EXTENSION="EnumTypeExtension",nn.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension";const on=Object.freeze({});function sn(e,t,r=Xr){const n=new Map;for(const e of Object.values(rn))n.set(e,an(t,e));let i,o,s,a=Array.isArray(e),u=[e],c=-1,l=[],h=e;const d=[],f=[];do{c++;const e=c===u.length,b=e&&0!==l.length;if(e){if(o=0===f.length?void 0:d[d.length-1],h=s,s=f.pop(),b)if(a){h=h.slice();let e=0;for(const[t,r]of l){const n=t-e;null===r?(h.splice(n,1),e++):h[n]=r}}else{h=Object.defineProperties({},Object.getOwnPropertyDescriptors(h));for(const[e,t]of l)h[e]=t}c=i.index,u=i.keys,l=i.edits,a=i.inArray,i=i.prev}else if(s){if(o=a?c:u[c],h=s[o],null==h)continue;d.push(o)}let m;if(!Array.isArray(h)){var p,v;en(h)||Yr(!1,`Invalid AST Node: ${Gr(h)}.`);const r=e?null===(p=n.get(h.kind))||void 0===p?void 0:p.leave:null===(v=n.get(h.kind))||void 0===v?void 0:v.enter;if(m=null==r?void 0:r.call(t,h,o,s,d,f),m===on)break;if(!1===m){if(!e){d.pop();continue}}else if(void 0!==m&&(l.push([o,m]),!e)){if(!en(m)){d.pop();continue}h=m}}var y;void 0===m&&b&&l.push([o,h]),e?d.pop():(i={inArray:a,index:c,keys:u,edits:l,prev:i},a=Array.isArray(h),u=a?h:null!==(y=r[h.kind])&&void 0!==y?y:[],c=-1,l=[],s&&f.push(s),s=h)}while(void 0!==i);return 0!==l.length?l[l.length-1][1]:e}function an(e,t){const r=e[t];return"object"==typeof r?r:"function"==typeof r?{enter:r,leave:void 0}:{enter:e.enter,leave:e.leave}}function un(e,t){var r=e.directives;return!r||!r.length||function(e){var t=[];return e&&e.length&&e.forEach((function(e){if(function(e){var t=e.name.value;return"skip"===t||"include"===t}(e)){var r=e.arguments,n=e.name.value;Yt(r&&1===r.length,67,n);var i=r[0];Yt(i.name&&"if"===i.name.value,68,n);var o=i.value;Yt(o&&("Variable"===o.kind||"BooleanValue"===o.kind),69,n),t.push({directive:e,ifArgument:i})}})),t}(r).every((function(e){var r=e.directive,n=e.ifArgument,i=!1;return"Variable"===n.value.kind?(i=t&&t[n.value.name.value],Yt(void 0!==i,66,r.name.value)):i=n.value.value,"skip"===r.name.value?!i:i}))}function cn(e,t,r){var n=new Set(e),i=n.size;return sn(t,{Directive:function(e){if(n.delete(e.name.value)&&(!r||!n.size))return on}}),r?!n.size:n.size<i}function ln(e){return e&&cn(["client","export"],e,!0)}var hn=function(e,t){var r;try{r=JSON.stringify(e)}catch(e){var n=Wt(39,t,e.message);throw n.parseError=e,n}return r},dn="function"==typeof WeakMap&&"ReactNative"!==Lt((function(){return navigator.product})),fn="function"==typeof WeakSet,pn="function"==typeof Symbol&&"function"==typeof Symbol.for,vn=pn&&Symbol.asyncIterator;function yn(e){var t={next:function(){return e.read()}};return vn&&(t[Symbol.asyncIterator]=function(){return this}),t}function bn(e){var t,r,n,i,o=e;if(e.body&&(o=e.body),i=o,vn&&i[Symbol.asyncIterator])return function(e){var t,r=e[Symbol.asyncIterator]();return(t={next:function(){return r.next()}})[Symbol.asyncIterator]=function(){return this},t}(o);if(function(e){return!!e.getReader}(o))return yn(o.getReader());if(function(e){return!!e.stream}(o))return yn(o.stream().getReader());if(function(e){return!!e.arrayBuffer}(o))return t=o.arrayBuffer(),r=!1,n={next:function(){return r?Promise.resolve({value:void 0,done:!0}):(r=!0,new Promise((function(e,r){t.then((function(t){e({value:t,done:!1})})).catch(r)})))}},vn&&(n[Symbol.asyncIterator]=function(){return this}),n;if(function(e){return!!e.pipe}(o))return function(e){var t=null,r=null,n=!1,i=[],o=[];function s(e){if(!r){if(o.length){var t=o.shift();if(Array.isArray(t)&&t[0])return t[0]({value:e,done:!1})}i.push(e)}}function a(e){r=e,o.slice().forEach((function(t){t[1](e)})),!t||t()}function u(){n=!0,o.slice().forEach((function(e){e[0]({value:void 0,done:!0})})),!t||t()}t=function(){t=null,e.removeListener("data",s),e.removeListener("error",a),e.removeListener("end",u),e.removeListener("finish",u),e.removeListener("close",u)},e.on("data",s),e.on("error",a),e.on("end",u),e.on("finish",u),e.on("close",u);var c={next:function(){return new Promise((function(e,t){return r?t(r):i.length?e({value:i.shift(),done:!1}):n?e({value:void 0,done:!0}):void o.push([e,t])}))}};return vn&&(c[Symbol.asyncIterator]=function(){return this}),c}(o);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}Lt((function(){return window.document.createElement})),Lt((function(){return navigator.userAgent.indexOf("jsdom")>=0}));var mn=function(e,t,r){var n=new Error(r);throw n.name="ServerError",n.response=e,n.statusCode=e.status,n.result=t,n},gn=Symbol(),_n=function(e){function t(r){var n,i,o=r.graphQLErrors,s=r.protocolErrors,a=r.clientErrors,u=r.networkError,c=r.errorMessage,l=r.extraInfo,h=e.call(this,c)||this;return h.name="ApolloError",h.graphQLErrors=o||[],h.protocolErrors=s||[],h.clientErrors=a||[],h.networkError=u||null,h.message=c||(i=y(y(y([],(n=h).graphQLErrors,!0),n.clientErrors,!0),n.protocolErrors,!0),n.networkError&&i.push(n.networkError),i.map((function(e){return mr(e)&&e.message||"Error message not found."})).join("\n")),h.extraInfo=l,h.__proto__=t.prototype,h}return c(t,e),t}(Error),On=Array.isArray;function Sn(e){return Array.isArray(e)&&e.length>0}var En=Object.prototype.hasOwnProperty;function wn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Tn(e)}function Tn(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new An,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var In=function(e,t,r){return this.merge(e[r],t[r])},An=function(){function e(e){void 0===e&&(e=In),this.reconciler=e,this.isObject=mr,this.pastCopies=new Set}return e.prototype.merge=function(e,t){for(var r=this,n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return mr(t)&&mr(e)?(Object.keys(t).forEach((function(i){if(En.call(e,i)){var o=e[i];if(t[i]!==o){var s=r.reconciler.apply(r,y([e,t,i],n,!1));s!==o&&((e=r.shallowCopyForMerge(e))[i]=s)}}else(e=r.shallowCopyForMerge(e))[i]=t[i]})),e):t},e.prototype.shallowCopyForMerge=function(e){return mr(e)&&(this.pastCopies.has(e)||(e=Array.isArray(e)?e.slice(0):l({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},e}();function Mn(e){return"incremental"in e}function Fn(e){return mr(e)&&"payload"in e}function kn(e,t){var r=e,n=new An;return Mn(t)&&Sn(t.incremental)&&t.incremental.forEach((function(e){for(var t=e.data,i=e.path,o=i.length-1;o>=0;--o){var s=i[o],a=isNaN(+s)?{}:[];a[s]=t,t=a}r=n.merge(r,t)})),r}var Dn=Object.prototype.hasOwnProperty;function jn(e){var t={};return e.split("\n").forEach((function(e){var r=e.indexOf(":");if(r>-1){var n=e.slice(0,r).trim().toLowerCase(),i=e.slice(r+1).trim();t[n]=i}})),t}function xn(e,t){e.status>=300&&mn(e,function(){try{return JSON.parse(t)}catch(e){return t}}(),"Response not successful: Received status code ".concat(e.status));try{return JSON.parse(t)}catch(n){var r=n;throw r.name="ServerParseError",r.response=e,r.statusCode=e.status,r.bodyText=t,r}}function Pn(e){return 9===e||32===e}function Nn(e){return e>=48&&e<=57}function Cn(e){return e>=97&&e<=122||e>=65&&e<=90}function Rn(e){return Cn(e)||95===e}function qn(e){var t;let r=Number.MAX_SAFE_INTEGER,n=null,i=-1;for(let t=0;t<e.length;++t){var o;const s=e[t],a=Ln(s);a!==s.length&&(n=null!==(o=n)&&void 0!==o?o:t,i=t,0!==t&&a<r&&(r=a))}return e.map(((e,t)=>0===t?e:e.slice(r))).slice(null!==(t=n)&&void 0!==t?t:0,i+1)}function Ln(e){let t=0;for(;t<e.length&&Pn(e.charCodeAt(t));)++t;return t}const Bn=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Qn(e){return Vn[e.charCodeAt(0)]}const Vn=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],Un={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>zn(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Wn("(",zn(e.variableDefinitions,", "),")"),r=zn([e.operation,zn([e.name,t]),zn(e.directives," ")]," ");return("query"===r?"":r+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:r,directives:n})=>e+": "+t+Wn(" = ",r)+Wn(" ",zn(n," "))},SelectionSet:{leave:({selections:e})=>Yn(e)},Field:{leave({alias:e,name:t,arguments:r,directives:n,selectionSet:i}){const o=Wn("",e,": ")+t;let s=o+Wn("(",zn(r,", "),")");return s.length>80&&(s=o+Wn("(\n",$n(zn(r,"\n")),"\n)")),zn([s,zn(n," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Wn(" ",zn(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:r})=>zn(["...",Wn("on ",e),zn(t," "),r]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:r,directives:n,selectionSet:i})=>`fragment ${e}${Wn("(",zn(r,", "),")")} on ${t} ${Wn("",zn(n," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const r=e.replace(/"""/g,'\\"""'),n=r.split(/\r\n|[\n\r]/g),i=1===n.length,o=n.length>1&&n.slice(1).every((e=>0===e.length||Pn(e.charCodeAt(0)))),s=r.endsWith('\\"""'),a=e.endsWith('"')&&!s,u=e.endsWith("\\"),c=a||u,l=!i||e.length>70||c||o||s;let h="";const d=i&&Pn(e.charCodeAt(0));return(l&&!d||o)&&(h+="\n"),h+=r,(l||c)&&(h+="\n"),'"""'+h+'"""'}(e):`"${e.replace(Bn,Qn)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+zn(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+zn(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Wn("(",zn(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:r})=>Wn("",e,"\n")+zn(["schema",zn(t," "),Yn(r)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:r})=>Wn("",e,"\n")+zn(["scalar",t,zn(r," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Wn("",e,"\n")+zn(["type",t,Wn("implements ",zn(r," & ")),zn(n," "),Yn(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:r,type:n,directives:i})=>Wn("",e,"\n")+t+(Gn(r)?Wn("(\n",$n(zn(r,"\n")),"\n)"):Wn("(",zn(r,", "),")"))+": "+n+Wn(" ",zn(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:r,defaultValue:n,directives:i})=>Wn("",e,"\n")+zn([t+": "+r,Wn("= ",n),zn(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Wn("",e,"\n")+zn(["interface",t,Wn("implements ",zn(r," & ")),zn(n," "),Yn(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:r,types:n})=>Wn("",e,"\n")+zn(["union",t,zn(r," "),Wn("= ",zn(n," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:r,values:n})=>Wn("",e,"\n")+zn(["enum",t,zn(r," "),Yn(n)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:r})=>Wn("",e,"\n")+zn([t,zn(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:r,fields:n})=>Wn("",e,"\n")+zn(["input",t,zn(r," "),Yn(n)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:r,repeatable:n,locations:i})=>Wn("",e,"\n")+"directive @"+t+(Gn(r)?Wn("(\n",$n(zn(r,"\n")),"\n)"):Wn("(",zn(r,", "),")"))+(n?" repeatable":"")+" on "+zn(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>zn(["extend schema",zn(e," "),Yn(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>zn(["extend scalar",e,zn(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>zn(["extend type",e,Wn("implements ",zn(t," & ")),zn(r," "),Yn(n)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>zn(["extend interface",e,Wn("implements ",zn(t," & ")),zn(r," "),Yn(n)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:r})=>zn(["extend union",e,zn(t," "),Wn("= ",zn(r," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:r})=>zn(["extend enum",e,zn(t," "),Yn(r)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:r})=>zn(["extend input",e,zn(t," "),Yn(r)]," ")}};function zn(e,t=""){var r;return null!==(r=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==r?r:""}function Yn(e){return Wn("{\n",$n(zn(e,"\n")),"\n}")}function Wn(e,t,r=""){return null!=t&&""!==t?e+t+r:""}function $n(e){return Wn(" ",e.replace(/\n/g,"\n "))}function Gn(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}var Hn=dn?new WeakMap:void 0,Kn=function(e){var t;return(t=null==Hn?void 0:Hn.get(e))||(t=function(e){return sn(e,Un)}(e),null==Hn||Hn.set(e,t)),t},Jn={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},Xn=function(e,t){return t(e)};function Zn(e){return new br((function(t){t.error(e)}))}var ei={kind:rn.FIELD,name:{kind:rn.NAME,value:"__typename"}};function ti(e,t){return!e||e.selectionSet.selections.every((function(e){return e.kind===rn.FRAGMENT_SPREAD&&ti(t[e.name.value],t)}))}function ri(e){return ti(Pr(e)||function(e){Yt("Document"===e.kind,77),Yt(e.definitions.length<=1,78);var t=e.definitions[0];return Yt("FragmentDefinition"===t.kind,79),t}(e),_r(Cr(e)))?null:e}function ni(e){var t=new Map;return function(r){void 0===r&&(r=e);var n=t.get(r);return n||t.set(r,n={variables:new Set,fragmentSpreads:new Set}),n}}function ii(e,t){xr(t);for(var r=ni(""),n=ni(""),i=function(e){for(var t=0,i=void 0;t<e.length&&(i=e[t]);++t)if(!On(i)){if(i.kind===rn.OPERATION_DEFINITION)return r(i.name&&i.name.value);if(i.kind===rn.FRAGMENT_DEFINITION)return n(i.name.value)}return!1!==globalThis.__DEV__&&Yt.error(82),null},o=0,s=t.definitions.length-1;s>=0;--s)t.definitions[s].kind===rn.OPERATION_DEFINITION&&++o;var a,u,c,h=(a=e,u=new Map,c=new Map,a.forEach((function(e){e&&(e.name?u.set(e.name,e):e.test&&c.set(e.test,e))})),function(e){var t=u.get(e.name.value);return!t&&c.size&&c.forEach((function(r,n){n(e)&&(t=r)})),t}),d=function(e){return Sn(e)&&e.map(h).some((function(e){return e&&e.remove}))},f=new Map,p=!1,v={enter:function(e){if(d(e.directives))return p=!0,null}},y=sn(t,{Field:v,InlineFragment:v,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(e,t,r,n,o){var s=i(o);s&&s.variables.add(e.name.value)}},FragmentSpread:{enter:function(e,t,r,n,o){if(d(e.directives))return p=!0,null;var s=i(o);s&&s.fragmentSpreads.add(e.name.value)}},FragmentDefinition:{enter:function(e,t,r,n){f.set(JSON.stringify(n),e)},leave:function(e,t,r,i){return e===f.get(JSON.stringify(i))?e:o>0&&e.selectionSet.selections.every((function(e){return e.kind===rn.FIELD&&"__typename"===e.name.value}))?(n(e.name.value).removed=!0,p=!0,null):void 0}},Directive:{leave:function(e){if(h(e))return p=!0,null}}});if(!p)return t;var b=function(e){return e.transitiveVars||(e.transitiveVars=new Set(e.variables),e.removed||e.fragmentSpreads.forEach((function(t){b(n(t)).transitiveVars.forEach((function(t){e.transitiveVars.add(t)}))}))),e},m=new Set;y.definitions.forEach((function(e){e.kind===rn.OPERATION_DEFINITION?b(r(e.name&&e.name.value)).fragmentSpreads.forEach((function(e){m.add(e)})):e.kind!==rn.FRAGMENT_DEFINITION||0!==o||n(e.name.value).removed||m.add(e.name.value)})),m.forEach((function(e){b(n(e)).fragmentSpreads.forEach((function(e){m.add(e)}))}));var g={enter:function(e){if(t=e.name.value,!m.has(t)||n(t).removed)return null;var t}};return ri(sn(y,{FragmentSpread:g,FragmentDefinition:g,OperationDefinition:{leave:function(e){if(e.variableDefinitions){var t=b(r(e.name&&e.name.value)).transitiveVars;if(t.size<e.variableDefinitions.length)return l(l({},e),{variableDefinitions:e.variableDefinitions.filter((function(e){return t.has(e.variable.name.value)}))})}}}}))}var oi=Object.assign((function(e){return sn(e,{SelectionSet:{enter:function(e,t,r){if(!r||r.kind!==rn.OPERATION_DEFINITION){var n=e.selections;if(n&&!n.some((function(e){return jr(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var i=r;if(!(jr(i)&&i.directives&&i.directives.some((function(e){return"export"===e.name.value}))))return l(l({},e),{selections:y(y([],n,!0),[ei],!1)})}}}}})}),{added:function(e){return e===ei}});function si(e){return"query"===qr(e).operation?e:sn(e,{OperationDefinition:{enter:function(e){return l(l({},e),{operation:"query"})}}})}function ai(e){return xr(e),ii([{test:function(e){return"client"===e.name.value},remove:!0}],e)}var ui=Lt((function(){return fetch})),ci=function(e){void 0===e&&(e={});var t=e.uri,r=void 0===t?"/graphql":t,n=e.fetch,i=e.print,o=void 0===i?Xn:i,s=e.includeExtensions,a=e.preserveHeaderCase,u=e.useGETForQueries,c=e.includeUnusedVariables,p=void 0!==c&&c,v=h(e,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);!1!==globalThis.__DEV__&&function(e){if(!e&&"undefined"==typeof fetch)throw Wt(37)}(n||ui);var y={http:{includeExtensions:s,preserveHeaderCase:a},options:v.fetchOptions,credentials:v.credentials,headers:v.headers};return new Ur((function(e){var t=function(e,t){return e.getContext().uri||("function"==typeof t?t(e):t||"/graphql")}(e,r),i=e.getContext(),s={};if(i.clientAwareness){var a=i.clientAwareness,c=a.name,h=a.version;c&&(s["apollographql-client-name"]=c),h&&(s["apollographql-client-version"]=h)}var v=l(l({},s),i.headers),b={http:i.http,options:i.fetchOptions,credentials:i.credentials,headers:v};if(cn(["client"],e.query)){var m=ai(e.query);if(!m)return Zn(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));e.query=m}var g,_,O,S,E,w=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},o={};r.forEach((function(e){i=l(l(l({},i),e.options),{headers:l(l({},i.headers),e.headers)}),e.credentials&&(i.credentials=e.credentials),o=l(l({},o),e.http)})),i.headers&&(i.headers=function(e,t){if(!t){var r=Object.create(null);return Object.keys(Object(e)).forEach((function(t){r[t.toLowerCase()]=e[t]})),r}var n=Object.create(null);Object.keys(Object(e)).forEach((function(t){n[t.toLowerCase()]={originalName:t,value:e[t]}}));var i=Object.create(null);return Object.keys(n).forEach((function(e){i[n[e].originalName]=n[e].value})),i}(i.headers,o.preserveHeaderCase));var s=e.operationName,a=e.extensions,u=e.variables,c=e.query,h={operationName:s,variables:u};return o.includeExtensions&&(h.extensions=a),o.includeQuery&&(h.query=t(c,Kn)),{options:i,body:h}}(e,o,Jn,y,b),T=w.options,I=w.body;I.variables&&!p&&(I.variables=(g=I.variables,_=e.query,O=l({},g),S=new Set(Object.keys(g)),sn(_,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&S.delete(e.name.value)}}),S.forEach((function(e){delete O[e]})),O)),T.signal||"undefined"==typeof AbortController||(E=new AbortController,T.signal=E.signal);var A,M="OperationDefinition"===(A=qr(e.query)).kind&&"subscription"===A.operation,F=cn(["defer"],e.query);if(u&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(T.method="GET"),F||M){T.headers=T.headers||{};var k="multipart/mixed;";M&&F&&!1!==globalThis.__DEV__&&Yt.warn(38),M?k+="boundary=graphql;subscriptionSpec=1.0,application/json":F&&(k+="deferSpec=20220824,application/json"),T.headers.accept=k}if("GET"===T.method){var D=function(e,t){var r=[],n=function(e,t){r.push("".concat(e,"=").concat(encodeURIComponent(t)))};if("query"in t&&n("query",t.query),t.operationName&&n("operationName",t.operationName),t.variables){var i=void 0;try{i=hn(t.variables,"Variables map")}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=hn(t.extensions,"Extensions map")}catch(e){return{parseError:e}}n("extensions",o)}var s="",a=e,u=e.indexOf("#");-1!==u&&(s=e.substr(u),a=e.substr(0,u));var c=-1===a.indexOf("?")?"?":"&";return{newURI:a+c+r.join("&")+s}}(t,I),j=D.newURI,x=D.parseError;if(x)return Zn(x);t=j}else try{T.body=hn(I,"Payload")}catch(x){return Zn(x)}return new br((function(r){var i=n||Lt((function(){return fetch}))||ui,o=r.next.bind(r);return i(t,T).then((function(t){var r;e.setContext({response:t});var n,i=null===(r=t.headers)||void 0===r?void 0:r.get("content-type");return null!==i&&/^multipart\/mixed/i.test(i)?function(e,t){var r;return d(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,h,d,p,v,y,b,m,g,_,O,S,E,w,T,I,A;return f(this,(function(f){switch(f.label){case 0:if(void 0===TextDecoder)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");n=new TextDecoder("utf-8"),i=null===(r=e.headers)||void 0===r?void 0:r.get("content-type"),o="boundary=",s=(null==i?void 0:i.includes(o))?null==i?void 0:i.substring((null==i?void 0:i.indexOf(o))+9).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",a="\r\n--".concat(s),u="",c=bn(e),h=!0,f.label=1;case 1:return h?[4,c.next()]:[3,3];case 2:for(d=f.sent(),p=d.value,v=d.done,y="string"==typeof p?p:n.decode(p),b=u.length-a.length+1,h=!v,m=(u+=y).indexOf(a,b);m>-1;){if(g=void 0,I=[u.slice(0,m),u.slice(m+a.length)],u=I[1],_=(g=I[0]).indexOf("\r\n\r\n"),O=jn(g.slice(0,_)),(S=O["content-type"])&&-1===S.toLowerCase().indexOf("application/json"))throw new Error("Unsupported patch content type: application/json is required.");if(E=g.slice(_))if(w=xn(e,E),Object.keys(w).length>1||"data"in w||"incremental"in w||"errors"in w||"payload"in w)Fn(w)?(T={},"payload"in w&&(T=l({},w.payload)),"errors"in w&&(T=l(l({},T),{extensions:l(l({},"extensions"in T?T.extensions:null),(A={},A[gn]=w.errors,A))})),t(T)):t(w);else if(1===Object.keys(w).length&&"hasNext"in w&&!w.hasNext)return[2];m=u.indexOf(a)}return[3,1];case 3:return[2]}}))}))}(t,o):(n=e,function(e){return e.text().then((function(t){return xn(e,t)})).then((function(t){return Array.isArray(t)||Dn.call(t,"data")||Dn.call(t,"errors")||mn(e,t,"Server response was missing for query '".concat(Array.isArray(n)?n.map((function(e){return e.operationName})):n.operationName,"'.")),t}))})(t).then(o)})).then((function(){E=void 0,r.complete()})).catch((function(e){E=void 0,function(e,t){e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e)}(e,r)})),function(){E&&E.abort()}}))}))},li=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,ci(t).request)||this;return r.options=t,r}return c(t,e),t}(Ur);const{toString:hi,hasOwnProperty:di}=Object.prototype,fi=Function.prototype.toString,pi=new Map;function vi(e,t){try{return bi(e,t)}finally{pi.clear()}}const yi=vi;function bi(e,t){if(e===t)return!0;const r=hi.call(e);if(r!==hi.call(t))return!1;switch(r){case"[object Array]":if(e.length!==t.length)return!1;case"[object Object]":{if(Oi(e,t))return!0;const r=mi(e),n=mi(t),i=r.length;if(i!==n.length)return!1;for(let e=0;e<i;++e)if(!di.call(t,r[e]))return!1;for(let n=0;n<i;++n){const i=r[n];if(!bi(e[i],t[i]))return!1}return!0}case"[object Error]":return e.name===t.name&&e.message===t.message;case"[object Number]":if(e!=e)return t!=t;case"[object Boolean]":case"[object Date]":return+e==+t;case"[object RegExp]":case"[object String]":return e==`${t}`;case"[object Map]":case"[object Set]":{if(e.size!==t.size)return!1;if(Oi(e,t))return!0;const n=e.entries(),i="[object Map]"===r;for(;;){const e=n.next();if(e.done)break;const[r,o]=e.value;if(!t.has(r))return!1;if(i&&!bi(o,t.get(r)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":e=new Uint8Array(e),t=new Uint8Array(t);case"[object DataView]":{let r=e.byteLength;if(r===t.byteLength)for(;r--&&e[r]===t[r];);return-1===r}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const r=fi.call(e);return r===fi.call(t)&&!function(e,t){const r=e.length-t.length;return r>=0&&e.indexOf(t,r)===r}(r,_i)}}return!1}function mi(e){return Object.keys(e).filter(gi,e)}function gi(e){return void 0!==this[e]}const _i="{ [native code] }";function Oi(e,t){let r=pi.get(e);if(r){if(r.has(t))return!0}else pi.set(e,r=new Set);return r.add(t),!1}const Si=()=>Object.create(null),{forEach:Ei,slice:wi}=Array.prototype,{hasOwnProperty:Ti}=Object.prototype;class Ii{constructor(e=!0,t=Si){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return Ei.call(e,(e=>t=t.getChildTrie(e))),Ti.call(t,"data")?t.data:t.data=this.makeData(wi.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let r=0,n=e.length;t&&r<n;++r){const n=t.mapFor(e[r],!1);t=n&&n.get(e[r])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const r=e[0],n=this.mapFor(r,!1),i=n&&n.get(r);i&&(t=i.removeArray(wi.call(e,1)),i.data||i.weak||i.strong&&i.strong.size||n.delete(r))}else t=this.data,delete this.data;return t}getChildTrie(e){const t=this.mapFor(e,!0);let r=t.get(e);return r||t.set(e,r=new Ii(this.weakness,this.makeData)),r}mapFor(e,t){return this.weakness&&function(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}}var Ai,Mi,Fi=function(){function e(){this.known=new(fn?WeakSet:Set),this.pool=new Ii(dn),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return mr(e)&&this.known.has(e)},e.prototype.pass=function(e){if(mr(e)){var t=function(e){return mr(e)?On(e)?e.slice(0):l({__proto__:Object.getPrototypeOf(e)},e):e}(e);return this.passes.set(t,e),t}return e},e.prototype.admit=function(e){var t=this;if(mr(e)){var r=this.passes.get(e);if(r)return r;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var n=e.map(this.admit,this);return(a=this.pool.lookupArray(n)).array||(this.known.add(a.array=n),!1!==globalThis.__DEV__&&Object.freeze(n)),a.array;case null:case Object.prototype:if(this.known.has(e))return e;var i=Object.getPrototypeOf(e),o=[i],s=this.sortedKeys(e);o.push(s.json);var a,u=o.length;if(s.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(a=this.pool.lookupArray(o)).object){var c=a.object=Object.create(i);this.known.add(c),s.sorted.forEach((function(e,t){c[e]=o[u+t]})),!1!==globalThis.__DEV__&&Object.freeze(c)}return a.object}}return e},e.prototype.sortedKeys=function(e){var t=Object.keys(e),r=this.pool.lookupArray(t);if(!r.keys){t.sort();var n=JSON.stringify(t);(r.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,r.keys={sorted:t,json:n})}return r.keys},e}(),ki=Object.assign((function(e){if(mr(e)){void 0===Ai&&Di();var t=Ai.admit(e),r=Mi.get(t);return void 0===r&&Mi.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:Di});function Di(){Ai=new Fi,Mi=new(dn?WeakMap:Map)}function ji(e){return e}var xi=function(){function e(e,t){void 0===t&&(t=Object.create(null)),this.resultCache=fn?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),!1!==t.cache&&(this.stableCacheKeys=new Ii(dn,(function(e){return{key:e}})))}return e.prototype.getCacheKey=function(e){return[e]},e.identity=function(){return new e(ji,{cache:!1})},e.split=function(t,r,n){return void 0===n&&(n=e.identity()),new e((function(e){return(t(e)?r:n).transformDocument(e)}),{cache:!1})},e.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var t=this.getStableCacheEntry(e);if(t&&t.value)return t.value;xr(e);var r=this.transform(e);return this.resultCache.add(r),t&&(t.value=r),r},e.prototype.concat=function(t){var r=this;return new e((function(e){return t.transformDocument(r.transformDocument(e))}),{cache:!1})},e.prototype.getStableCacheEntry=function(e){if(this.stableCacheKeys){var t=this.getCacheKey(e);return t?(Yt(Array.isArray(t),65),this.stableCacheKeys.lookupArray(t)):void 0}},e}();function Pi(e,t,r){return new br((function(n){var i={then:function(e){return new Promise((function(t){return t(e())}))}};function o(e,t){return function(r){if(e){var o=function(){return n.closed?0:e(r)};i=i.then(o,o).then((function(e){return n.next(e)}),(function(e){return n.error(e)}))}else n[t](r)}}var s={next:o(t,"next"),error:o(r,"error"),complete:function(){i.then((function(){return n.complete()}))}},a=e.subscribe(s);return function(){return a.unsubscribe()}}))}function Ni(e){return Sn(Ci(e))}function Ci(e){var t=Sn(e.errors)?e.errors.slice(0):[];return Mn(e)&&Sn(e.incremental)&&e.incremental.forEach((function(e){e.errors&&t.push.apply(t,e.errors)})),t}function Ri(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function qi(e){function t(t){Object.defineProperty(e,t,{value:br})}return pn&&Symbol.species&&t(Symbol.species),t("@@species"),e}function Li(e){return e&&"function"==typeof e.then}var Bi,Qi=function(e){function t(t){var r=e.call(this,(function(e){return r.addObserver(e),function(){return r.removeObserver(e)}}))||this;return r.observers=new Set,r.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),r.handlers={next:function(e){null!==r.sub&&(r.latest=["next",e],r.notify("next",e),Ri(r.observers,"next",e))},error:function(e){var t=r.sub;null!==t&&(t&&setTimeout((function(){return t.unsubscribe()})),r.sub=null,r.latest=["error",e],r.reject(e),r.notify("error",e),Ri(r.observers,"error",e))},complete:function(){var e=r,t=e.sub,n=e.sources;if(null!==t){var i=(void 0===n?[]:n).shift();i?Li(i)?i.then((function(e){return r.sub=e.subscribe(r.handlers)})):r.sub=i.subscribe(r.handlers):(t&&setTimeout((function(){return t.unsubscribe()})),r.sub=null,r.latest&&"next"===r.latest[0]?r.resolve(r.latest[1]):r.resolve(),r.notify("complete"),Ri(r.observers,"complete"))}}},r.nextResultListeners=new Set,r.cancel=function(e){r.reject(e),r.sources=[],r.handlers.complete()},r.promise.catch((function(e){})),"function"==typeof t&&(t=[new br(t)]),Li(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return c(t,e),t.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},t.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],r=e[t];r&&r.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},t.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e))},t.prototype.removeObserver=function(e){this.observers.delete(e)&&this.observers.size<1&&this.handlers.complete()},t.prototype.notify=function(e,t){var r=this.nextResultListeners;r.size&&(this.nextResultListeners=new Set,r.forEach((function(r){return r(e,t)})))},t.prototype.beforeNext=function(e){var t=!1;this.nextResultListeners.add((function(r,n){t||(t=!0,e(r,n))}))},t}(br);function Vi(e){return!!e&&e<7}function Ui(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Object.create(null);return e.forEach((function(e){e&&Object.keys(e).forEach((function(t){var n=e[t];void 0!==n&&(r[t]=n)}))})),r}qi(Qi),function(e){e[e.loading=1]="loading",e[e.setVariables=2]="setVariables",e[e.fetchMore=3]="fetchMore",e[e.refetch=4]="refetch",e[e.poll=6]="poll",e[e.ready=7]="ready",e[e.error=8]="error"}(Bi||(Bi={}));var zi=Object.prototype.toString;function Yi(e){return Wi(e)}function Wi(e,t){switch(zi.call(e)){case"[object Array]":if((t=t||new Map).has(e))return t.get(e);var r=e.slice(0);return t.set(e,r),r.forEach((function(e,n){r[n]=Wi(e,t)})),r;case"[object Object]":if((t=t||new Map).has(e))return t.get(e);var n=Object.create(Object.getPrototypeOf(e));return t.set(e,n),Object.keys(e).forEach((function(r){n[r]=Wi(e[r],t)})),n;default:return e}}function $i(e,t,r,n){var i=t.data,o=h(t,["data"]),s=r.data,a=h(r,["data"]);return yi(o,a)&&Gi(qr(e).selectionSet,i,s,{fragmentMap:_r(Cr(e)),variables:n})}function Gi(e,t,r,n){if(t===r)return!0;var i=new Set;return e.selections.every((function(e){if(i.has(e))return!0;if(i.add(e),!un(e,n.variables))return!0;if(Hi(e))return!0;if(jr(e)){var o=kr(e),s=t&&t[o],a=r&&r[o],u=e.selectionSet;if(!u)return yi(s,a);var c=Array.isArray(s),l=Array.isArray(a);if(c!==l)return!1;if(c&&l){var h=s.length;if(a.length!==h)return!1;for(var d=0;d<h;++d)if(!Gi(u,s[d],a[d],n))return!1;return!0}return Gi(u,s,a,n)}var f=Or(e,n.fragmentMap);return f?!!Hi(f)||Gi(f.selectionSet,t,r,n):void 0}))}function Hi(e){return!!e.directives&&e.directives.some(Ki)}function Ki(e){return"nonreactive"===e.name.value}var Ji=Object.assign,Xi=Object.hasOwnProperty,Zi=function(e){function t(t){var r=t.queryManager,n=t.queryInfo,i=t.options,o=e.call(this,(function(e){try{var t=e._subscription._observer;t&&!t.error&&(t.error=to)}catch(e){}var r=!o.observers.size;o.observers.add(e);var n=o.last;return n&&n.error?e.error&&e.error(n.error):n&&n.result&&e.next&&e.next(n.result),r&&o.reobserve().catch((function(){})),function(){o.observers.delete(e)&&!o.observers.size&&o.tearDownQuery()}}))||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=n,o.queryManager=r,o.waitForOwnResult=no(i.fetchPolicy),o.isTornDown=!1;var s=r.defaultOptions.watchQuery,a=(void 0===s?{}:s).fetchPolicy,u=void 0===a?"cache-first":a,c=i.fetchPolicy,h=void 0===c?u:c,d=i.initialFetchPolicy,f=void 0===d?"standby"===h?u:h:d;o.options=l(l({},i),{initialFetchPolicy:f,fetchPolicy:h}),o.queryId=n.queryId||r.generateQueryId();var p=Pr(o.query);return o.queryName=p&&p.name&&p.name.value,o}return c(t,e),Object.defineProperty(t.prototype,"query",{get:function(){return this.lastQuery||this.options.query},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),t.prototype.result=function(){var e=this;return new Promise((function(t,r){var n={next:function(r){t(r),e.observers.delete(n),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){i.unsubscribe()}),0)},error:r},i=e.subscribe(n)}))},t.prototype.getCurrentResult=function(e){void 0===e&&(e=!0);var t=this.getLastResult(!0),r=this.queryInfo.networkStatus||t&&t.networkStatus||Bi.ready,n=l(l({},t),{loading:Vi(r),networkStatus:r}),i=this.options.fetchPolicy,o=void 0===i?"cache-first":i;if(no(o)||this.queryManager.getDocumentInfo(this.query).hasForcedResolvers);else if(this.waitForOwnResult)this.queryInfo.updateWatch();else{var s=this.queryInfo.getDiff();(s.complete||this.options.returnPartialData)&&(n.data=s.result),vi(n.data,{})&&(n.data=void 0),s.complete?(delete n.partial,!s.complete||n.networkStatus!==Bi.loading||"cache-first"!==o&&"cache-only"!==o||(n.networkStatus=Bi.ready,n.loading=!1)):n.partial=!0,!1===globalThis.__DEV__||s.complete||this.options.partialRefetch||n.loading||n.data||n.error||ro(s.missing)}return e&&this.updateLastResult(n),n},t.prototype.isDifferentFromLastResult=function(e,t){return!this.last||(this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective?!$i(this.query,this.last.result,e,this.variables):!vi(this.last.result,e))||t&&!vi(this.last.variables,t)},t.prototype.getLast=function(e,t){var r=this.last;if(r&&r[e]&&(!t||vi(r.variables,this.variables)))return r[e]},t.prototype.getLastResult=function(e){return this.getLast("result",e)},t.prototype.getLastError=function(e){return this.getLast("error",e)},t.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},t.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},t.prototype.refetch=function(e){var t,r={pollInterval:0},n=this.options.fetchPolicy;if(r.fetchPolicy="cache-and-network"===n?n:"no-cache"===n?"no-cache":"network-only",!1!==globalThis.__DEV__&&e&&Xi.call(e,"variables")){var i=Rr(this.query),o=i.variableDefinitions;o&&o.some((function(e){return"variables"===e.variable.name.value}))||!1!==globalThis.__DEV__&&Yt.warn(20,e,(null===(t=i.name)||void 0===t?void 0:t.value)||i)}return e&&!vi(this.options.variables,e)&&(r.variables=this.options.variables=l(l({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(r,Bi.refetch)},t.prototype.fetchMore=function(e){var t=this,r=l(l({},e.query?e:l(l(l(l({},this.options),{query:this.options.query}),e),{variables:l(l({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"});r.query=this.transformDocument(r.query);var n=this.queryManager.generateQueryId();this.lastQuery=e.query?this.transformDocument(this.options.query):r.query;var i=this.queryInfo,o=i.networkStatus;i.networkStatus=Bi.fetchMore,r.notifyOnNetworkStatusChange&&this.observe();var s=new Set;return this.queryManager.fetchQuery(n,r,Bi.fetchMore).then((function(a){return t.queryManager.removeQuery(n),i.networkStatus===Bi.fetchMore&&(i.networkStatus=o),t.queryManager.cache.batch({update:function(n){var i=e.updateQuery;i?n.updateQuery({query:t.query,variables:t.variables,returnPartialData:!0,optimistic:!1},(function(e){return i(e,{fetchMoreResult:a.data,variables:r.variables})})):n.writeQuery({query:r.query,variables:r.variables,data:a.data})},onWatchUpdated:function(e){s.add(e.query)}}),a})).finally((function(){s.has(t.query)||eo(t)}))},t.prototype.subscribeToMore=function(e){var t=this,r=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(r){var n=e.updateQuery;n&&t.updateQuery((function(e,t){var i=t.variables;return n(e,{subscriptionData:r,variables:i})}))},error:function(t){e.onError?e.onError(t):!1!==globalThis.__DEV__&&Yt.error(21,t)}});return this.subscriptions.add(r),function(){t.subscriptions.delete(r)&&r.unsubscribe()}},t.prototype.setOptions=function(e){return this.reobserve(e)},t.prototype.silentSetOptions=function(e){var t=Ui(this.options,e||{});Ji(this.options,t)},t.prototype.setVariables=function(e){return vi(this.variables,e)?this.observers.size?this.result():Promise.resolve():(this.options.variables=e,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:e},Bi.setVariables):Promise.resolve())},t.prototype.updateQuery=function(e){var t=this.queryManager,r=e(t.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});r&&(t.cache.writeQuery({query:this.options.query,data:r,variables:this.variables}),t.broadcastQueries())},t.prototype.startPolling=function(e){this.options.pollInterval=e,this.updatePolling()},t.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},t.prototype.applyNextFetchPolicy=function(e,t){if(t.nextFetchPolicy){var r=t.fetchPolicy,n=void 0===r?"cache-first":r,i=t.initialFetchPolicy,o=void 0===i?n:i;"standby"===n||("function"==typeof t.nextFetchPolicy?t.fetchPolicy=t.nextFetchPolicy(n,{reason:e,options:t,observable:this,initialFetchPolicy:o}):t.fetchPolicy="variables-changed"===e?o:t.nextFetchPolicy)}return t.fetchPolicy},t.prototype.fetch=function(e,t,r){return this.queryManager.setObservableQuery(this),this.queryManager.fetchConcastWithInfo(this.queryId,e,t,r)},t.prototype.updatePolling=function(){var e=this;if(!this.queryManager.ssrMode){var t=this.pollingInfo,r=this.options.pollInterval;if(r){if(!t||t.interval!==r){Yt(r,22),(t||(this.pollingInfo={})).interval=r;var n=function(){e.pollingInfo&&(Vi(e.queryInfo.networkStatus)?i():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"network-only"},Bi.poll).then(i,i))},i=function(){var t=e.pollingInfo;t&&(clearTimeout(t.timeout),t.timeout=setTimeout(n,t.interval))};i()}}else t&&(clearTimeout(t.timeout),delete this.pollingInfo)}},t.prototype.updateLastResult=function(e,t){void 0===t&&(t=this.variables);var r=this.getLastError();return r&&this.last&&!vi(t,this.last.variables)&&(r=void 0),this.last=l({result:this.queryManager.assumeImmutableResults?e:Yi(e),variables:t},r?{error:r}:null)},t.prototype.reobserveAsConcast=function(e,t){var r=this;this.isTornDown=!1;var n=t===Bi.refetch||t===Bi.fetchMore||t===Bi.poll,i=this.options.variables,o=this.options.fetchPolicy,s=Ui(this.options,e||{}),a=n?s:Ji(this.options,s),u=this.transformDocument(a.query);this.lastQuery=u,n||(this.updatePolling(),e&&e.variables&&!vi(e.variables,i)&&"standby"!==a.fetchPolicy&&a.fetchPolicy===o&&(this.applyNextFetchPolicy("variables-changed",a),void 0===t&&(t=Bi.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=no(a.fetchPolicy));var c=function(){r.concast===f&&(r.waitForOwnResult=!1)},h=a.variables&&l({},a.variables),d=this.fetch(a,t,u),f=d.concast,p=d.fromLink,v={next:function(e){c(),r.reportResult(e,h)},error:function(e){c(),r.reportError(e,h)}};return n||!p&&this.concast||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=f,this.observer=v),f.addObserver(v),f},t.prototype.reobserve=function(e,t){return this.reobserveAsConcast(e,t).promise},t.prototype.resubscribeAfterError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.last;this.resetLastResults();var n=this.subscribe.apply(this,e);return this.last=r,n},t.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},t.prototype.reportResult=function(e,t){var r=this.getLastError(),n=this.isDifferentFromLastResult(e,t);(r||!e.partial||this.options.returnPartialData)&&this.updateLastResult(e,t),(r||n)&&Ri(this.observers,"next",e)},t.prototype.reportError=function(e,t){var r=l(l({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:Bi.error,loading:!1});this.updateLastResult(r,t),Ri(this.observers,"error",this.last.error=e)},t.prototype.hasObservers=function(){return this.observers.size>0},t.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},t.prototype.transformDocument=function(e){return this.queryManager.transform(e)},t}(br);function eo(e){var t=e.options,r=t.fetchPolicy,n=t.nextFetchPolicy;return"cache-and-network"===r||"network-only"===r?e.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(e,t){return this.nextFetchPolicy=n,"function"==typeof this.nextFetchPolicy?this.nextFetchPolicy(e,t):r}}):e.reobserve()}function to(e){!1!==globalThis.__DEV__&&Yt.error(23,e.message,e.stack)}function ro(e){!1!==globalThis.__DEV__&&e&&!1!==globalThis.__DEV__&&Yt.debug(24,e)}function no(e){return"network-only"===e||"no-cache"===e||"standby"===e}function io(e){return e.kind===rn.FIELD||e.kind===rn.FRAGMENT_SPREAD||e.kind===rn.INLINE_FRAGMENT}qi(Zi);const oo=()=>Object.create(null),{forEach:so,slice:ao}=Array.prototype,{hasOwnProperty:uo}=Object.prototype;class co{constructor(e=!0,t=oo){this.weakness=e,this.makeData=t}lookup(...e){return this.lookupArray(e)}lookupArray(e){let t=this;return so.call(e,(e=>t=t.getChildTrie(e))),uo.call(t,"data")?t.data:t.data=this.makeData(ao.call(e))}peek(...e){return this.peekArray(e)}peekArray(e){let t=this;for(let r=0,n=e.length;t&&r<n;++r){const n=this.weakness&&lo(e[r])?t.weak:t.strong;t=n&&n.get(e[r])}return t&&t.data}getChildTrie(e){const t=this.weakness&&lo(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map);let r=t.get(e);return r||t.set(e,r=new co(this.weakness,this.makeData)),r}}function lo(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}function ho(){}class fo{constructor(e=1/0,t=ho){this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:e,newer:r}=t;r&&(r.older=e),e&&(e.newer=r),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=r)}return t}set(e,t){let r=this.getNode(e);return r?r.value=t:(r={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=r),this.newest=r,this.oldest=this.oldest||r,this.map.set(e,r),r.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const t=this.map.get(e);return!!t&&(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0)}}var po=null,vo={},yo=1;function bo(e){try{return e()}catch(e){}}var mo="@wry/context:Slot",go=bo((function(){return globalThis}))||bo((function(){return r.g}))||Object.create(null),_o=go[mo]||Array[mo]||function(e){try{Object.defineProperty(go,mo,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}}(function(){function e(){this.id=["slot",yo++,Date.now(),Math.random().toString(36).slice(2)].join(":")}return e.prototype.hasValue=function(){for(var e=po;e;e=e.parent)if(this.id in e.slots){var t=e.slots[this.id];if(t===vo)break;return e!==po&&(po.slots[this.id]=t),!0}return po&&(po.slots[this.id]=vo),!1},e.prototype.getValue=function(){if(this.hasValue())return po.slots[this.id]},e.prototype.withValue=function(e,t,r,n){var i,o=((i={__proto__:null})[this.id]=e,i),s=po;po={parent:s,slots:o};try{return t.apply(n,r)}finally{po=s}},e.bind=function(e){var t=po;return function(){var r=po;try{return po=t,e.apply(this,arguments)}finally{po=r}}},e.noContext=function(e,t,r){if(!po)return e.apply(r,t);var n=po;try{return po=null,e.apply(r,t)}finally{po=n}},e}());_o.bind,_o.noContext;const Oo=new _o,{hasOwnProperty:So}=Object.prototype,Eo=Array.from||function(e){const t=[];return e.forEach((e=>t.push(e))),t};function wo(e){const{unsubscribe:t}=e;"function"==typeof t&&(e.unsubscribe=void 0,t())}const To=[],Io=100;function Ao(e,t){if(!e)throw new Error(t||"assertion failure")}function Mo(e,t){const r=e.length;return r>0&&r===t.length&&e[r-1]===t[r-1]}function Fo(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}function ko(e){return e.slice(0)}class Do{constructor(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++Do.count}peek(){if(1===this.value.length&&!Po(this))return jo(this),this.value[0]}recompute(e){return Ao(!this.recomputing,"already recomputing"),jo(this),Po(this)?function(e,t){return Qo(e),Oo.withValue(e,xo,[e,t]),function(e,t){if("function"==typeof e.subscribe)try{wo(e),e.unsubscribe=e.subscribe.apply(null,t)}catch(t){return e.setDirty(),!1}return!0}(e,t)&&function(e){e.dirty=!1,Po(e)||Co(e)}(e),Fo(e.value)}(this,e):Fo(this.value)}setDirty(){this.dirty||(this.dirty=!0,No(this),wo(this))}dispose(){this.setDirty(),Qo(this),Ro(this,((e,t)=>{e.setDirty(),Vo(e,this)}))}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=To.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(Eo(this.deps).forEach((e=>e.delete(this))),this.deps.clear(),To.push(this.deps),this.deps=null)}}function jo(e){const t=Oo.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),Po(e)?qo(t,e):Lo(t,e),t}function xo(e,t){e.recomputing=!0;const{normalizeResult:r}=e;let n;r&&1===e.value.length&&(n=ko(e.value)),e.value.length=0;try{if(e.value[0]=e.fn.apply(null,t),r&&n&&!Mo(n,e.value))try{e.value[0]=r(e.value[0],n[0])}catch(e){}}catch(t){e.value[1]=t}e.recomputing=!1}function Po(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function No(e){Ro(e,qo)}function Co(e){Ro(e,Lo)}function Ro(e,t){const r=e.parents.size;if(r){const n=Eo(e.parents);for(let i=0;i<r;++i)t(n[i],e)}}function qo(e,t){Ao(e.childValues.has(t)),Ao(Po(t));const r=!Po(e);if(e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=To.pop()||new Set;e.dirtyChildren.add(t),r&&No(e)}function Lo(e,t){Ao(e.childValues.has(t)),Ao(!Po(t));const r=e.childValues.get(t);0===r.length?e.childValues.set(t,ko(t.value)):Mo(r,t.value)||e.setDirty(),Bo(e,t),Po(e)||Co(e)}function Bo(e,t){const r=e.dirtyChildren;r&&(r.delete(t),0===r.size&&(To.length<Io&&To.push(r),e.dirtyChildren=null))}function Qo(e){e.childValues.size>0&&e.childValues.forEach(((t,r)=>{Vo(e,r)})),e.forgetDeps(),Ao(null===e.dirtyChildren)}function Vo(e,t){t.parents.delete(e),e.childValues.delete(t),Bo(e,t)}Do.count=0;const Uo={setDirty:!0,dispose:!0,forget:!0};function zo(e){const t=new Map,r=e&&e.subscribe;function n(e){const n=Oo.getValue();if(n){let i=t.get(e);i||t.set(e,i=new Set),n.dependOn(i),"function"==typeof r&&(wo(i),i.unsubscribe=r(e))}}return n.dirty=function(e,r){const n=t.get(e);if(n){const i=r&&So.call(Uo,r)?r:"setDirty";Eo(n).forEach((e=>e[i]())),t.delete(e),wo(n)}},n}let Yo;function Wo(...e){return(Yo||(Yo=new co("function"==typeof WeakMap))).lookupArray(e)}const $o=new Set;function Go(e,{max:t=Math.pow(2,16),keyArgs:r,makeCacheKey:n=Wo,normalizeResult:i,subscribe:o,cache:s=fo}=Object.create(null)){const a="function"==typeof s?new s(t,(e=>e.dispose())):s,u=function(){const t=n.apply(null,r?r.apply(null,arguments):arguments);if(void 0===t)return e.apply(null,arguments);let s=a.get(t);s||(a.set(t,s=new Do(e)),s.normalizeResult=i,s.subscribe=o,s.forget=()=>a.delete(t));const u=s.recompute(Array.prototype.slice.call(arguments));return a.set(t,s),$o.add(a),Oo.hasValue()||($o.forEach((e=>e.clean())),$o.clear()),u};function c(e){const t=e&&a.get(e);t&&t.setDirty()}function l(e){const t=e&&a.get(e);if(t)return t.peek()}function h(e){return!!e&&a.delete(e)}return Object.defineProperty(u,"size",{get:()=>a.size,configurable:!1,enumerable:!1}),Object.freeze(u.options={max:t,keyArgs:r,makeCacheKey:n,normalizeResult:i,subscribe:o,cache:a}),u.dirtyKey=c,u.dirty=function(){c(n.apply(null,arguments))},u.peekKey=l,u.peek=function(){return l(n.apply(null,arguments))},u.forgetKey=h,u.forget=function(){return h(n.apply(null,arguments))},u.makeCacheKey=n,u.getKey=r?function(){return n.apply(null,r.apply(null,arguments))}:n,Object.freeze(u)}var Ho=new _o,Ko=new WeakMap;function Jo(e){var t=Ko.get(e);return t||Ko.set(e,t={vars:new Set,dep:zo()}),t}function Xo(e){Jo(e).vars.forEach((function(t){return t.forgetCache(e)}))}function Zo(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){Jo(e).dep.dirty(n),function(e){e.broadcastWatches&&e.broadcastWatches()}(e)}));var s=Array.from(r);r.clear(),s.forEach((function(t){return t(e)}))}}else{var a=Ho.getValue();a&&(i(a),Jo(a).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),Jo(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}var es=function(){function e(e){var t=e.cache,r=e.client,n=e.resolvers,i=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,r&&(this.client=r),n&&this.addResolvers(n),i&&this.setFragmentMatcher(i)}return e.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=wn(t.resolvers,e)})):this.resolvers=wn(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers||{}},e.prototype.runResolvers=function(e){var t=e.document,r=e.remoteResult,n=e.context,i=e.variables,o=e.onlyRunForcedResolvers,s=void 0!==o&&o;return d(this,void 0,void 0,(function(){return f(this,(function(e){return t?[2,this.resolveDocument(t,r.data,n,i,this.fragmentMatcher,s).then((function(e){return l(l({},r),{data:e.result})}))]:[2,r]}))}))},e.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},e.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},e.prototype.clientQuery=function(e){return cn(["client"],e)&&this.resolvers?e:null},e.prototype.serverQuery=function(e){return ai(e)},e.prototype.prepareContext=function(e){var t=this.cache;return l(l({},e),{cache:t,getCacheKey:function(e){return t.identify(e)}})},e.prototype.addExportedVariables=function(e,t,r){return void 0===t&&(t={}),void 0===r&&(r={}),d(this,void 0,void 0,(function(){return f(this,(function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(r),t).then((function(e){return l(l({},t),e.exportedVariables)}))]:[2,l({},t)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return sn(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return on}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:si(e),variables:t,returnPartialData:!0,optimistic:!1}).result},e.prototype.resolveDocument=function(e,t,r,n,i,o){return void 0===r&&(r={}),void 0===n&&(n={}),void 0===i&&(i=function(){return!0}),void 0===o&&(o=!1),d(this,void 0,void 0,(function(){var s,a,u,c,h,d,p,v,y,b;return f(this,(function(f){return s=qr(e),a=Cr(e),u=_r(a),c=this.collectSelectionsToResolve(s,u),h=s.operation,d=h?h.charAt(0).toUpperCase()+h.slice(1):"Query",v=(p=this).cache,y=p.client,b={fragmentMap:u,context:l(l({},r),{cache:v,client:y}),variables:n,fragmentMatcher:i,defaultOperationType:d,exportedVariables:{},selectionsToResolve:c,onlyRunForcedResolvers:o},[2,this.resolveSelectionSet(s.selectionSet,!1,t,b).then((function(e){return{result:e,exportedVariables:b.exportedVariables}}))]}))}))},e.prototype.resolveSelectionSet=function(e,t,r,n){return d(this,void 0,void 0,(function(){var i,o,s,a,u,c=this;return f(this,(function(l){return i=n.fragmentMap,o=n.context,s=n.variables,a=[r],u=function(e){return d(c,void 0,void 0,(function(){var u,c;return f(this,(function(l){return(t||n.selectionsToResolve.has(e))&&un(e,s)?jr(e)?[2,this.resolveField(e,t,r,n).then((function(t){var r;void 0!==t&&a.push(((r={})[kr(e)]=t,r))}))]:(function(e){return"InlineFragment"===e.kind}(e)?u=e:(u=i[e.name.value],Yt(u,18,e.name.value)),u&&u.typeCondition&&(c=u.typeCondition.name.value,n.fragmentMatcher(r,c,o))?[2,this.resolveSelectionSet(u.selectionSet,t,r,n).then((function(e){a.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(e.selections.map(u)).then((function(){return Tn(a)}))]}))}))},e.prototype.resolveField=function(e,t,r,n){return d(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d,p=this;return f(this,(function(f){return r?(i=n.variables,o=e.name.value,s=kr(e),a=o!==s,u=r[s]||r[o],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=r.__typename||n.defaultOperationType,(h=this.resolvers&&this.resolvers[l])&&(d=h[a?o:s])&&(c=Promise.resolve(Ho.withValue(this.cache,d,[r,Fr(e,i),n.context,{field:e,fragmentMap:n.fragmentMap}])))),[2,c.then((function(r){var i,o;if(void 0===r&&(r=u),e.directives&&e.directives.forEach((function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach((function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(n.exportedVariables[e.value.value]=r)}))})),!e.selectionSet)return r;if(null==r)return r;var s=null!==(o=null===(i=e.directives)||void 0===i?void 0:i.some((function(e){return"client"===e.name.value})))&&void 0!==o&&o;return Array.isArray(r)?p.resolveSubSelectedArray(e,t||s,r,n):e.selectionSet?p.resolveSelectionSet(e.selectionSet,t||s,r,n):void 0}))]):[2,null]}))}))},e.prototype.resolveSubSelectedArray=function(e,t,r,n){var i=this;return Promise.all(r.map((function(r){return null===r?null:Array.isArray(r)?i.resolveSubSelectedArray(e,t,r,n):e.selectionSet?i.resolveSelectionSet(e.selectionSet,t,r,n):void 0})))},e.prototype.collectSelectionsToResolve=function(e,t){var r=function(e){return!Array.isArray(e)},n=this.selectionsToResolveCache;return function e(i){if(!n.has(i)){var o=new Set;n.set(i,o),sn(i,{Directive:function(e,t,n,i,s){"client"===e.name.value&&s.forEach((function(e){r(e)&&io(e)&&o.add(e)}))},FragmentSpread:function(n,i,s,a,u){var c=t[n.name.value];Yt(c,19,n.name.value);var l=e(c);l.size>0&&(u.forEach((function(e){r(e)&&io(e)&&o.add(e)})),o.add(n),l.forEach((function(e){o.add(e)})))}})}return n.get(i)}(e)},e}(),ts=new(dn?WeakMap:Map);function rs(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return ts.set(e,(ts.get(e)+1)%1e15),r.apply(this,arguments)})}function ns(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var is=function(){function e(e,t){void 0===t&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var r=this.cache=e.cache;ts.has(r)||(ts.set(r,0),rs(r,"evict"),rs(r,"modify"),rs(r,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||Bi.loading;return this.variables&&this.networkStatus!==Bi.loading&&!vi(this.variables,e.variables)&&(t=Bi.setVariables),vi(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},e.prototype.reset=function(){ns(this),this.dirty=!1},e.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&vi(e,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables);var t=this.observableQuery;if(t&&"no-cache"===t.options.fetchPolicy)return{complete:!1};var r=this.cache.diff(e);return this.updateLastDiff(r,e),r},e.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},e.prototype.getDiffOptions=function(e){var t;return void 0===e&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:null===(t=this.observableQuery)||void 0===t?void 0:t.options.canonizeResults}},e.prototype.setDiff=function(e){var t=this,r=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),this.dirty||vi(r&&r.result,e&&e.result)||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout((function(){return t.notify()}),0)))},e.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){t.getDiff().fromOptimisticTransaction?e.observe():eo(e)})):delete this.oqListener)},e.prototype.notify=function(){var e=this;ns(this),this.shouldNotify()&&this.listeners.forEach((function(t){return t(e)})),this.dirty=!1},e.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Vi(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if("cache-only"!==e&&"cache-and-network"!==e)return!1}return!0},e.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=e.prototype.cancel;var t=this.observableQuery;t&&t.stopPolling()}},e.prototype.cancel=function(){},e.prototype.updateWatch=function(e){var t=this;void 0===e&&(e=this.variables);var r=this.observableQuery;if(!r||"no-cache"!==r.options.fetchPolicy){var n=l(l({},this.getDiffOptions(e)),{watcher:this,callback:function(e){return t.setDiff(e)}});this.lastWatch&&vi(n,this.lastWatch)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},e.prototype.resetLastWrite=function(){this.lastWrite=void 0},e.prototype.shouldWrite=function(e,t){var r=this.lastWrite;return!(r&&r.dmCount===ts.get(this.cache)&&vi(t,r.variables)&&vi(e.data,r.result.data))},e.prototype.markResult=function(e,t,r,n){var i=this,o=new An,s=Sn(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Sn(e.incremental)){var a=kn(this.getDiff().result,e);e.data=a}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=s,"no-cache"===r.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(r.variables)):0!==n&&(os(e,r.errorPolicy)?this.cache.performTransaction((function(o){if(i.shouldWrite(e,r.variables))o.writeQuery({query:t,data:e.data,variables:r.variables,overwrite:1===n}),i.lastWrite={result:e,variables:r.variables,dmCount:ts.get(i.cache)};else if(i.lastDiff&&i.lastDiff.diff.complete)return void(e.data=i.lastDiff.diff.result);var s=i.getDiffOptions(r.variables),a=o.diff(s);!i.stopped&&vi(i.variables,r.variables)&&i.updateWatch(r.variables),i.updateLastDiff(a,s),a.complete&&(e.data=a.result)})):this.lastWrite=void 0)},e.prototype.markReady=function(){return this.networkError=null,this.networkStatus=Bi.ready},e.prototype.markError=function(e){return this.networkStatus=Bi.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function os(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!Ni(e);return!n&&r&&e.data&&(n=!0),n}var ss=Object.prototype.hasOwnProperty,as=function(){function e(e){var t=e.cache,r=e.link,n=e.defaultOptions,i=e.documentTransform,o=e.queryDeduplication,s=void 0!==o&&o,a=e.onBroadcast,u=e.ssrMode,c=void 0!==u&&u,l=e.clientAwareness,h=void 0===l?{}:l,d=e.localState,f=e.assumeImmutableResults,p=void 0===f?!!t.assumeImmutableResults:f,v=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(dn?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map;var y=new xi((function(e){return v.cache.transformDocument(e)}),{cache:!1});this.cache=t,this.link=r,this.defaultOptions=n||Object.create(null),this.queryDeduplication=s,this.clientAwareness=h,this.localState=d||new es({cache:t}),this.ssrMode=c,this.assumeImmutableResults=p,this.documentTransform=i?y.concat(i).concat(y):y,(this.onBroadcast=a)&&(this.mutationStore=Object.create(null))}return e.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(Wt(25))},e.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},e.prototype.mutate=function(e){var t,r,n=e.mutation,i=e.variables,o=e.optimisticResponse,s=e.updateQueries,a=e.refetchQueries,u=void 0===a?[]:a,c=e.awaitRefetchQueries,h=void 0!==c&&c,p=e.update,v=e.onQueryUpdated,y=e.fetchPolicy,b=void 0===y?(null===(t=this.defaultOptions.mutate)||void 0===t?void 0:t.fetchPolicy)||"network-only":y,m=e.errorPolicy,g=void 0===m?(null===(r=this.defaultOptions.mutate)||void 0===r?void 0:r.errorPolicy)||"none":m,_=e.keepRootFields,O=e.context;return d(this,void 0,void 0,(function(){var e,t,r,a;return f(this,(function(c){switch(c.label){case 0:return Yt(n,26),Yt("network-only"===b||"no-cache"===b,27),e=this.generateMutationId(),n=this.cache.transformForLink(this.transform(n)),t=this.getDocumentInfo(n).hasClientExports,i=this.getVariables(n,i),t?[4,this.localState.addExportedVariables(n,i,O)]:[3,2];case 1:i=c.sent(),c.label=2;case 2:return r=this.mutationStore&&(this.mutationStore[e]={mutation:n,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:e,document:n,variables:i,fetchPolicy:b,errorPolicy:g,context:O,updateQueries:s,update:p,keepRootFields:_}),this.broadcastQueries(),a=this,[2,new Promise((function(t,c){return Pi(a.getObservableFromLink(n,l(l({},O),{optimisticResponse:o}),i,!1),(function(t){if(Ni(t)&&"none"===g)throw new _n({graphQLErrors:Ci(t)});r&&(r.loading=!1,r.error=null);var c=l({},t);return"function"==typeof u&&(u=u(c)),"ignore"===g&&Ni(c)&&delete c.errors,a.markMutationResult({mutationId:e,result:c,document:n,variables:i,fetchPolicy:b,errorPolicy:g,context:O,update:p,updateQueries:s,awaitRefetchQueries:h,refetchQueries:u,removeOptimistic:o?e:void 0,onQueryUpdated:v,keepRootFields:_})})).subscribe({next:function(e){a.broadcastQueries(),"hasNext"in e&&!1!==e.hasNext||t(e)},error:function(t){r&&(r.loading=!1,r.error=t),o&&a.cache.removeOptimistic(e),a.broadcastQueries(),c(t instanceof _n?t:new _n({networkError:t}))}})}))]}}))}))},e.prototype.markMutationResult=function(e,t){var r=this;void 0===t&&(t=this.cache);var n=e.result,i=[],o="no-cache"===e.fetchPolicy;if(!o&&os(n,e.errorPolicy)){if(Mn(n)||i.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Mn(n)&&Sn(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),a=void 0;s.result&&(a=kn(s.result,n)),void 0!==a&&(n.data=a,i.push({result:a,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach((function(e,o){var s=e.observableQuery,a=s&&s.queryName;if(a&&ss.call(u,a)){var c=u[a],l=r.queries.get(o),h=l.document,d=l.variables,f=t.diff({query:h,variables:d,returnPartialData:!0,optimistic:!1}),p=f.result;if(f.complete&&p){var v=c(p,{mutationResult:n,queryName:h&&Nr(h)||void 0,queryVariables:d});v&&i.push({result:v,dataId:"ROOT_QUERY",query:h,variables:d})}}}))}if(i.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var c=[];if(this.refetchQueries({updateCache:function(t){o||i.forEach((function(e){return t.write(e)}));var s,a=e.update,u=!(Mn(s=n)||function(e){return"hasNext"in e&&"data"in e}(s))||Mn(n)&&!n.hasNext;if(a){if(!o){var c=t.diff({id:"ROOT_MUTATION",query:r.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});c.complete&&("incremental"in(n=l(l({},n),{data:c.result}))&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}u&&a(t,n,{context:e.context,variables:e.variables})}o||e.keepRootFields||!u||t.modify({id:"ROOT_MUTATION",fields:function(e,t){var r=t.fieldName,n=t.DELETE;return"__typename"===r?e:n}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach((function(e){return c.push(e)})),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(c).then((function(){return n}))}return Promise.resolve(n)},e.prototype.markMutationOptimistic=function(e,t){var r=this,n="function"==typeof e?e(t.variables):e;return this.cache.recordOptimisticTransaction((function(e){try{r.markMutationResult(l(l({},t),{result:{data:n}}),e)}catch(e){!1!==globalThis.__DEV__&&Yt.error(e)}}),t.mutationId)},e.prototype.fetchQuery=function(e,t,r){return this.fetchConcastWithInfo(e,t,r).concast.promise},e.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,r){e[r]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},e.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},e.prototype.transform=function(e){return this.documentTransform.transformDocument(e)},e.prototype.getDocumentInfo=function(e){var t=this.transformCache;if(!t.has(e)){var r={hasClientExports:ln(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:cn(["nonreactive"],e),clientQuery:this.localState.clientQuery(e),serverQuery:ii([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"}],e),defaultVars:Lr(Pr(e)),asQuery:l(l({},e),{definitions:e.definitions.map((function(e){return"OperationDefinition"===e.kind&&"query"!==e.operation?l(l({},e),{operation:"query"}):e}))})};t.set(e,r)}return t.get(e)},e.prototype.getVariables=function(e,t){return l(l({},this.getDocumentInfo(e).defaultVars),t)},e.prototype.watchQuery=function(e){var t=this.transform(e.query);void 0===(e=l(l({},e),{variables:this.getVariables(t,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var r=new is(this),n=new Zi({queryManager:this,queryInfo:r,options:e});return n.lastQuery=t,this.queries.set(n.queryId,r),r.init({document:t,observableQuery:n,variables:n.variables}),n},e.prototype.query=function(e,t){var r=this;return void 0===t&&(t=this.generateQueryId()),Yt(e.query,28),Yt("Document"===e.query.kind,29),Yt(!e.returnPartialData,30),Yt(!e.pollInterval,31),this.fetchQuery(t,l(l({},e),{query:this.transform(e.query)})).finally((function(){return r.stopQuery(t)}))},e.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},e.prototype.generateRequestId=function(){return this.requestIdCounter++},e.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},e.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},e.prototype.clearStore=function(e){return void 0===e&&(e={discardWatches:!0}),this.cancelPendingFetches(Wt(32)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=Bi.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},e.prototype.getObservableQueries=function(e){var t=this;void 0===e&&(e="active");var r=new Map,n=new Map,i=new Set;return Array.isArray(e)&&e.forEach((function(e){var r;"string"==typeof e?n.set(e,!1):mr(r=e)&&"Document"===r.kind&&Array.isArray(r.definitions)?n.set(t.transform(e),!1):mr(e)&&e.query&&i.add(e)})),this.queries.forEach((function(t,i){var o=t.observableQuery,s=t.document;if(o){if("all"===e)return void r.set(i,o);var a=o.queryName;if("standby"===o.options.fetchPolicy||"active"===e&&!o.hasObservers())return;("active"===e||a&&n.has(a)||s&&n.has(s))&&(r.set(i,o),a&&n.set(a,!0),s&&n.set(s,!0))}})),i.size&&i.forEach((function(e){var n=Vt("legacyOneTimeQuery"),i=t.getQuery(n).init({document:e.query,variables:e.variables}),o=new Zi({queryManager:t,queryInfo:i,options:l(l({},e),{fetchPolicy:"network-only"})});Yt(o.queryId===n),i.setObservableQuery(o),r.set(n,o)})),!1!==globalThis.__DEV__&&n.size&&n.forEach((function(e,t){e||!1!==globalThis.__DEV__&&Yt.warn("string"==typeof t?33:34,t)})),r},e.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.getObservableQueries(e?"all":"active").forEach((function(n,i){var o=n.options.fetchPolicy;n.resetLastResults(),(e||"standby"!==o&&"cache-only"!==o)&&r.push(n.refetch()),t.getQuery(i).setDiff(null)})),this.broadcastQueries(),Promise.all(r)},e.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},e.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,n=e.fetchPolicy,i=e.errorPolicy,o=void 0===i?"none":i,s=e.variables,a=e.context,u=void 0===a?{}:a;r=this.transform(r),s=this.getVariables(r,s);var c=function(e){return t.getObservableFromLink(r,u,e).map((function(i){"no-cache"!==n&&(os(i,o)&&t.cache.write({query:r,result:i.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries());var s=Ni(i),a=function(e){return!!e.extensions&&Array.isArray(e.extensions[gn])}(i);if(s||a){var u={};if(s&&(u.graphQLErrors=i.errors),a&&(u.protocolErrors=i.extensions[gn]),"none"===o||a)throw new _n(u)}return"ignore"===o&&delete i.errors,i}))};if(this.getDocumentInfo(r).hasClientExports){var l=this.localState.addExportedVariables(r,s,u).then(c);return new br((function(e){var t=null;return l.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(s)},e.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},e.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},e.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},e.prototype.getLocalState=function(){return this.localState},e.prototype.getObservableFromLink=function(e,t,r,n){var i,o,s=this;void 0===n&&(n=null!==(i=null==t?void 0:t.queryDeduplication)&&void 0!==i?i:this.queryDeduplication);var a=this.getDocumentInfo(e),u=a.serverQuery,c=a.clientQuery;if(u){var h=this.inFlightLinkObservables,d=this.link,f={query:u,variables:r,operationName:Nr(u)||void 0,context:this.prepareContext(l(l({},t),{forceFetch:!n}))};if(t=f.context,n){var p=Kn(u),v=h.get(p)||new Map;h.set(p,v);var y=ki(r);if(!(o=v.get(y))){var b=new Qi([zr(d,f)]);v.set(y,o=b),b.beforeNext((function(){v.delete(y)&&v.size<1&&h.delete(p)}))}}else o=new Qi([zr(d,f)])}else o=new Qi([br.of({data:{}})]),t=this.prepareContext(t);return c&&(o=Pi(o,(function(e){return s.localState.runResolvers({document:c,remoteResult:e,context:t,variables:r})}))),o},e.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId(),i=this.cache.transformForLink(r.query);return Pi(this.getObservableFromLink(i,r.context,r.variables),(function(o){var s=Ci(o),a=s.length>0;if(n>=e.lastRequestId){if(a&&"none"===r.errorPolicy)throw e.markError(new _n({graphQLErrors:s}));e.markResult(o,i,r,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:Bi.ready};return a&&"ignore"!==r.errorPolicy&&(u.errors=s,u.networkStatus=Bi.error),u}),(function(t){var r=t.hasOwnProperty("graphQLErrors")?t:new _n({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},e.prototype.fetchConcastWithInfo=function(e,t,r,n){var i=this;void 0===r&&(r=Bi.loading),void 0===n&&(n=t.query);var o,s,a=this.getVariables(n,t.variables),u=this.getQuery(e),c=this.defaultOptions.watchQuery,l=t.fetchPolicy,h=void 0===l?c&&c.fetchPolicy||"cache-first":l,d=t.errorPolicy,f=void 0===d?c&&c.errorPolicy||"none":d,p=t.returnPartialData,v=void 0!==p&&p,y=t.notifyOnNetworkStatusChange,b=void 0!==y&&y,m=t.context,g=void 0===m?{}:m,_=Object.assign({},t,{query:n,variables:a,fetchPolicy:h,errorPolicy:f,returnPartialData:v,notifyOnNetworkStatusChange:b,context:g}),O=function(e){_.variables=e;var n=i.fetchQueryByPolicy(u,_,r);return"standby"!==_.fetchPolicy&&n.sources.length>0&&u.observableQuery&&u.observableQuery.applyNextFetchPolicy("after-fetch",t),n},S=function(){return i.fetchCancelFns.delete(e)};if(this.fetchCancelFns.set(e,(function(e){S(),setTimeout((function(){return o.cancel(e)}))})),this.getDocumentInfo(_.query).hasClientExports)o=new Qi(this.localState.addExportedVariables(_.query,_.variables,_.context).then(O).then((function(e){return e.sources}))),s=!0;else{var E=O(_.variables);s=E.fromLink,o=new Qi(E.sources)}return o.promise.then(S,S),{concast:o,fromLink:s}},e.prototype.refetchQueries=function(e){var t=this,r=e.updateCache,n=e.include,i=e.optimistic,o=void 0!==i&&i,s=e.removeOptimistic,a=void 0===s?o?Vt("refetchQueries"):void 0:s,u=e.onQueryUpdated,c=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){c.set(r,{oq:e,lastDiff:t.getQuery(r).getDiff()})}));var l=new Map;return r&&this.cache.batch({update:r,optimistic:o&&a||!1,removeOptimistic:a,onWatchUpdated:function(e,t,r){var n=e.watcher instanceof is&&e.watcher.observableQuery;if(n){if(u){c.delete(n.queryId);var i=u(n,t,r);return!0===i&&(i=n.refetch()),!1!==i&&l.set(n,i),i}null!==u&&c.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),c.size&&c.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,s=e.diff;if(u){if(!s){var a=i.queryInfo;a.reset(),s=a.getDiff()}n=u(i,s,o)}u&&!0!==n||(n=i.refetch()),!1!==n&&l.set(i,n),r.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(r)})),a&&this.cache.removeOptimistic(a),l},e.prototype.fetchQueryByPolicy=function(e,t,r){var n=this,i=t.query,o=t.variables,s=t.fetchPolicy,a=t.refetchWritePolicy,u=t.errorPolicy,c=t.returnPartialData,h=t.context,d=t.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:i,variables:o,networkStatus:r});var p=function(){return e.getDiff()},v=function(t,r){void 0===r&&(r=e.networkStatus||Bi.loading);var s=t.result;!1===globalThis.__DEV__||c||vi(s,{})||ro(t.missing);var a=function(e){return br.of(l({data:e,loading:Vi(r),networkStatus:r},t.complete?null:{partial:!0}))};return s&&n.getDocumentInfo(i).hasForcedResolvers?n.localState.runResolvers({document:i,remoteResult:{data:s},context:h,variables:o,onlyRunForcedResolvers:!0}).then((function(e){return a(e.data||void 0)})):"none"===u&&r===Bi.refetch&&Array.isArray(t.missing)?a(void 0):a(s)},y="no-cache"===s?0:r===Bi.refetch&&"merge"!==a?1:2,b=function(){return n.getResultsFromLink(e,y,{query:i,variables:o,context:h,fetchPolicy:s,errorPolicy:u})},m=d&&"number"==typeof f&&f!==r&&Vi(r);switch(s){default:case"cache-first":return(g=p()).complete?{fromLink:!1,sources:[v(g,e.markReady())]}:c||m?{fromLink:!0,sources:[v(g),b()]}:{fromLink:!0,sources:[b()]};case"cache-and-network":var g;return(g=p()).complete||c||m?{fromLink:!0,sources:[v(g),b()]}:{fromLink:!0,sources:[b()]};case"cache-only":return{fromLink:!1,sources:[v(p(),e.markReady())]};case"network-only":return m?{fromLink:!0,sources:[v(p()),b()]}:{fromLink:!0,sources:[b()]};case"no-cache":return m?{fromLink:!0,sources:[v(e.getDiff()),b()]}:{fromLink:!0,sources:[b()]};case"standby":return{fromLink:!1,sources:[]}}},e.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new is(this,e)),this.queries.get(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return l(l({},t),{clientAwareness:this.clientAwareness})},e}();function us(e,t){return Ui(e,t,t.variables&&{variables:Ui(l(l({},e&&e.variables),t.variables))})}var cs=!1,ls=function(){function e(e){var t=this;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw Wt(15);var r=e.uri,n=e.credentials,i=e.headers,o=e.cache,s=e.documentTransform,a=e.ssrMode,u=void 0!==a&&a,c=e.ssrForceFetchDelay,l=void 0===c?0:c,h=e.connectToDevTools,d=void 0===h?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1!==globalThis.__DEV__:h,f=e.queryDeduplication,p=void 0===f||f,v=e.defaultOptions,y=e.assumeImmutableResults,b=void 0===y?o.assumeImmutableResults:y,m=e.resolvers,g=e.typeDefs,_=e.fragmentMatcher,O=e.name,S=e.version,E=e.link;E||(E=r?new li({uri:r,credentials:n,headers:i}):Ur.empty()),this.link=E,this.cache=o,this.disableNetworkFetches=u||l>0,this.queryDeduplication=p,this.defaultOptions=v||Object.create(null),this.typeDefs=g,l&&setTimeout((function(){return t.disableNetworkFetches=!1}),l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),this.version=qt,this.localState=new es({cache:o,client:this,resolvers:m,fragmentMatcher:_}),this.queryManager=new as({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,documentTransform:s,queryDeduplication:p,ssrMode:u,clientAwareness:{name:O,version:S},localState:this.localState,assumeImmutableResults:b,onBroadcast:d?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0}),d&&this.connectToDevTools()}return e.prototype.connectToDevTools=function(){if("object"==typeof window){var e=window,t=Symbol.for("apollo.devtools");(e[t]=e[t]||[]).push(this),e.__APOLLO_CLIENT__=this}cs||!1===globalThis.__DEV__||(cs=!0,setTimeout((function(){if("undefined"!=typeof window&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__){var e=window.navigator,t=e&&e.userAgent,r=void 0;"string"==typeof t&&(t.indexOf("Chrome/")>-1?r="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":t.indexOf("Firefox/")>-1&&(r="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),r&&!1!==globalThis.__DEV__&&Yt.log("Download the Apollo DevTools for a better development experience: %s",r)}}),1e4))},Object.defineProperty(e.prototype,"documentTransform",{get:function(){return this.queryManager.documentTransform},enumerable:!1,configurable:!0}),e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=us(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=l(l({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=us(this.defaultOptions.query,e)),Yt("cache-and-network"!==e.fetchPolicy,16),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=l(l({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=us(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},e.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},e.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return!1!==e.broadcast&&this.queryManager.broadcastQueries(),t},e.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return!1!==e.broadcast&&this.queryManager.broadcastQueries(),t},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return zr(this.link,e)},e.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore({discardWatches:!1})})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},e.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore({discardWatches:!0})})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},e.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},e.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),r=[],n=[];t.forEach((function(e,t){r.push(t),n.push(e)}));var i=Promise.all(n);return i.queries=r,i.results=n,i.catch((function(e){!1!==globalThis.__DEV__&&Yt.debug(17,e)})),i},e.prototype.getObservableQueries=function(e){return void 0===e&&(e="active"),this.queryManager.getObservableQueries(e)},e.prototype.extract=function(e){return this.cache.extract(e)},e.prototype.restore=function(e){return this.cache.restore(e)},e.prototype.addResolvers=function(e){this.localState.addResolvers(e)},e.prototype.setResolvers=function(e){this.localState.setResolvers(e)},e.prototype.getResolvers=function(){return this.localState.getResolvers()},e.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},e.prototype.setLink=function(e){this.link=this.queryManager.link=e},e}(),hs=function(){function e(){this.assumeImmutableResults=!1,this.getFragmentDoc=Go(gr)}return e.prototype.batch=function(e){var t,r=this,n="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;return this.performTransaction((function(){return t=e.update(r)}),n),t},e.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},e.prototype.transformDocument=function(e){return e},e.prototype.transformForLink=function(e){return e},e.prototype.identify=function(e){},e.prototype.gc=function(){return[]},e.prototype.modify=function(e){return!1},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(l(l({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(l(l({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},e.prototype.writeQuery=function(e){var t=e.id,r=e.data,n=h(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:r}))},e.prototype.writeFragment=function(e){var t=e.id,r=e.data,n=e.fragment,i=e.fragmentName,o=h(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,i),dataId:t,result:r}))},e.prototype.updateQuery=function(e,t){return this.batch({update:function(r){var n=r.readQuery(e),i=t(n);return null==i?n:(r.writeQuery(l(l({},e),{data:i})),i)}})},e.prototype.updateFragment=function(e,t){return this.batch({update:function(r){var n=r.readFragment(e),i=t(n);return null==i?n:(r.writeFragment(l(l({},e),{data:i})),i)}})},e}(),ds=function(e){function t(r,n,i,o){var s,a=e.call(this,r)||this;if(a.message=r,a.path=n,a.query=i,a.variables=o,Array.isArray(a.path)){a.missing=a.message;for(var u=a.path.length-1;u>=0;--u)a.missing=((s={})[a.path[u]]=a.missing,s)}else a.missing=a.path;return a.__proto__=t.prototype,a}return c(t,e),t}(Error);function fs(e){return!1!==globalThis.__DEV__&&(t=e,(r=new Set([t])).forEach((function(e){mr(e)&&function(e){if(!1!==globalThis.__DEV__&&!Object.isFrozen(e))try{Object.freeze(e)}catch(e){if(e instanceof TypeError)return null;throw e}return e}(e)===e&&Object.getOwnPropertyNames(e).forEach((function(t){mr(e[t])&&r.add(e[t])}))}))),e;var t,r}var ps=Object.prototype.hasOwnProperty;function vs(e){return null==e}function ys(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=vs(n)?vs(i)?void 0:{_id:i}:{id:n}),vs(n)&&!vs(i)&&(n=i),!vs(n)))return"".concat(r,":").concat("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))}var bs={dataIdFromObject:ys,addTypename:!0,resultCaching:!0,canonizeResults:!1};function ms(e){var t=e.canonizeResults;return void 0===t?bs.canonizeResults:t}var gs=/^[_a-z][_0-9a-z]*/i;function _s(e){var t=e.match(gs);return t?t[0]:e}function Os(e,t,r){return!!mr(t)&&(On(t)?t.every((function(t){return Os(e,t,r)})):e.selections.every((function(e){if(jr(e)&&un(e,r)){var n=kr(e);return ps.call(t,n)&&(!e.selectionSet||Os(e.selectionSet,t[n],r))}return!0})))}function Ss(e){return mr(e)&&!Er(e)&&!On(e)}function Es(e,t){var r=_r(Cr(e));return{fragmentMap:r,lookupFragment:function(e){var n=r[e];return!n&&t&&(n=t.lookup(e)),n||null}}}var ws=Object.create(null),Ts=function(){return ws},Is=Object.create(null),As=function(){function e(e,t){var r=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(e,t){return fs(Er(e)?r.get(e.__ref,t):e&&e[t])},this.canRead=function(e){return Er(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return Sr(e);if(Er(e))return e;var n=r.policies.identify(e)[0];if(n){var i=Sr(n);return t&&r.merge(n,e),i}}}return e.prototype.toObject=function(){return l({},this.data)},e.prototype.has=function(e){return void 0!==this.lookup(e,!0)},e.prototype.get=function(e,t){if(this.group.depend(e,t),ps.call(this.data,e)){var r=this.data[e];if(r&&ps.call(r,t))return r[t]}return"__typename"===t&&ps.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Ds?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),ps.call(this.data,e)?this.data[e]:this instanceof Ds?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},e.prototype.merge=function(e,t){var r,n=this;Er(e)&&(e=e.__ref),Er(t)&&(t=t.__ref);var i="string"==typeof e?this.lookup(r=e):e,o="string"==typeof t?this.lookup(r=t):t;if(o){Yt("string"==typeof r,1);var s=new An(xs).merge(i,o);if(this.data[r]=s,s!==i&&(delete this.refs[r],this.group.caching)){var a=Object.create(null);i||(a.__exists=1),Object.keys(o).forEach((function(e){if(!i||i[e]!==s[e]){a[e]=1;var t=_s(e);t===e||n.policies.hasKeyArgs(s.__typename,t)||(a[t]=1),void 0!==s[e]||n instanceof Ds||delete s[e]}})),!a.__typename||i&&i.__typename||this.policies.rootTypenamesById[r]!==s.__typename||delete a.__typename,Object.keys(a).forEach((function(e){return n.group.dirty(r,e)}))}}},e.prototype.modify=function(e,t){var r=this,n=this.lookup(e);if(n){var i=Object.create(null),o=!1,s=!0,a={DELETE:ws,INVALIDATE:Is,isReference:Er,toReference:this.toReference,canRead:this.canRead,readField:function(t,n){return r.policies.readField("string"==typeof t?{fieldName:t,from:n||Sr(e)}:t,{store:r})}};if(Object.keys(n).forEach((function(u){var c=_s(u),h=n[u];if(void 0!==h){var d="function"==typeof t?t:t[u]||t[c];if(d){var f=d===Ts?ws:d(fs(h),l(l({},a),{fieldName:c,storeFieldName:u,storage:r.getStorage(e,u)}));if(f===Is)r.group.dirty(e,u);else if(f===ws&&(f=void 0),f!==h&&(i[u]=f,o=!0,h=f,!1!==globalThis.__DEV__)){var p=function(e){if(void 0===r.lookup(e.__ref))return!1!==globalThis.__DEV__&&Yt.warn(2,e),!0};if(Er(f))p(f);else if(Array.isArray(f))for(var v=!1,y=void 0,b=0,m=f;b<m.length;b++){var g=m[b];if(Er(g)){if(v=!0,p(g))break}else"object"==typeof g&&g&&r.policies.identify(g)[0]&&(y=g);if(v&&void 0!==y){!1!==globalThis.__DEV__&&Yt.warn(3,y);break}}}}void 0!==h&&(s=!1)}})),o)return this.merge(e,i),s&&(this instanceof Ds?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},e.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),s=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,s?((n={})[s]=Ts,n):Ts)}return!1},e.prototype.evict=function(e,t){var r=!1;return e.id&&(ps.call(this.data,e.id)&&(r=this.delete(e.id,e.fieldName,e.args)),this instanceof Ds&&this!==t&&(r=this.parent.evict(e,t)||r),(e.fieldName||r)&&this.group.dirty(e.id,e.fieldName||"__exists")),r},e.prototype.clear=function(){this.replace(null)},e.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){ps.call(e.policies.rootTypenamesById,t)||r.push(t)})),r.length&&(t.__META={extraRootIds:r.sort()}),t},e.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach((function(r){e&&ps.call(e,r)||t.delete(r)})),e){var r=e.__META,n=h(e,["__META"]);Object.keys(n).forEach((function(e){t.merge(e,n[e])})),r&&r.extraRootIds.forEach(this.retain,this)}},e.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},e.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},e.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Ds?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},e.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){ps.call(r,n)&&(Object.keys(e.findChildRefIds(n)).forEach(t.add,t),delete r[n])}));var n=Object.keys(r);if(n.length){for(var i=this;i instanceof Ds;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},e.prototype.findChildRefIds=function(e){if(!ps.call(this.refs,e)){var t=this.refs[e]=Object.create(null),r=this.data[e];if(!r)return t;var n=new Set([r]);n.forEach((function(e){Er(e)&&(t[e.__ref]=!0),mr(e)&&Object.keys(e).forEach((function(t){var r=e[t];mr(r)&&n.add(r)}))}))}return this.refs[e]},e.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},e}(),Ms=function(){function e(e,t){void 0===t&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return e.prototype.resetCaching=function(){this.d=this.caching?zo():null,this.keyMaker=new Ii(dn)},e.prototype.depend=function(e,t){if(this.d){this.d(Fs(e,t));var r=_s(t);r!==t&&this.d(Fs(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(Fs(e,t),"__exists"===t?"forget":"setDirty")},e}();function Fs(e,t){return t+"#"+e}function ks(e,t){Ps(e)&&e.group.depend(t,"__exists")}!function(e){var t=function(e){function t(t){var r=t.policies,n=t.resultCaching,i=void 0===n||n,o=t.seed,s=e.call(this,r,new Ms(i))||this;return s.stump=new js(s),s.storageTrie=new Ii(dn),o&&s.replace(o),s}return c(t,e),t.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},t.prototype.removeLayer=function(){return this},t.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},t}(e);e.Root=t}(As||(As={}));var Ds=function(e){function t(t,r,n,i){var o=e.call(this,r.policies,i)||this;return o.id=t,o.parent=r,o.replay=n,o.group=i,n(o),o}return c(t,e),t.prototype.addLayer=function(e,r){return new t(e,this,r,this.group)},t.prototype.removeLayer=function(e){var t=this,r=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach((function(e){var n=t.data[e],i=r.lookup(e);i?n?n!==i&&Object.keys(n).forEach((function(r){vi(n[r],i[r])||t.group.dirty(e,r)})):(t.group.dirty(e,"__exists"),Object.keys(i).forEach((function(r){t.group.dirty(e,r)}))):t.delete(e)})),r):r===this.parent?this:r.addLayer(this.id,this.replay)},t.prototype.toObject=function(){return l(l({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var r=this.parent.findChildRefIds(t);return ps.call(this.data,t)?l(l({},r),e.prototype.findChildRefIds.call(this,t)):r},t.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},t}(As),js=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,(function(){}),new Ms(t.group.caching,t.group))||this}return c(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(e,t){return this.parent.merge(e,t)},t}(Ds);function xs(e,t,r){var n=e[r],i=t[r];return vi(n,i)?n:i}function Ps(e){return!!(e instanceof As&&e.group.caching)}function Ns(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var Cs=function(){function e(e){var t=this;this.knownResults=new(dn?WeakMap:Map),this.config=Ui(e,{addTypename:!1!==e.addTypename,canonizeResults:ms(e)}),this.canon=e.canon||new Fi,this.executeSelectionSet=Go((function(e){var r,n=e.context.canonizeResults,i=Ns(e);i[3]=!n;var o=(r=t.executeSelectionSet).peek.apply(r,i);return o?n?l(l({},o),{result:t.canon.admit(o.result)}):o:(ks(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))}),{max:this.config.resultCacheMaxSize,keyArgs:Ns,makeCacheKey:function(e,t,r,n){if(Ps(r.store))return r.store.makeCacheKey(e,Er(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=Go((function(e){return ks(e.context.store,e.enclosingRef.__ref),t.execSubSelectedArrayImpl(e)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var t=e.field,r=e.array,n=e.context;if(Ps(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return e.prototype.resetCanon=function(){this.canon=new Fi},e.prototype.diffQueryAgainstStore=function(e){var t=e.store,r=e.query,n=e.rootId,i=void 0===n?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,a=void 0===s||s,u=e.canonizeResults,c=void 0===u?this.config.canonizeResults:u,h=this.config.cache.policies;o=l(l({},Lr(Rr(r))),o);var d,f=Sr(i),p=this.executeSelectionSet({selectionSet:qr(r).selectionSet,objectOrReference:f,enclosingRef:f,context:l({store:t,query:r,policies:h,variables:o,varString:ki(o),canonizeResults:c},Es(r,this.config.fragments))});if(p.missing&&(d=[new ds(Rs(p.missing),p.missing,r,o)],!a))throw d[0];return{result:p.result,complete:!d,missing:d}},e.prototype.isFresh=function(e,t,r,n){if(Ps(n.store)&&this.knownResults.get(e)===r){var i=this.executeSelectionSet.peek(r,t,n,this.canon.isKnown(e));if(i&&e===i.result)return!0}return!1},e.prototype.execSelectionSetImpl=function(e){var t=this,r=e.selectionSet,n=e.objectOrReference,i=e.enclosingRef,o=e.context;if(Er(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s,a=o.variables,u=o.policies,c=o.store.getFieldValue(n,"__typename"),l=[],h=new An;function d(e,t){var r;return e.missing&&(s=h.merge(s,((r={})[t]=e.missing,r))),e.result}this.config.addTypename&&"string"==typeof c&&!u.rootIdsByTypename[c]&&l.push({__typename:c});var f=new Set(r.selections);f.forEach((function(e){var r,p;if(un(e,a))if(jr(e)){var v=u.readField({fieldName:e.name.value,field:e,variables:o.variables,from:n},o),y=kr(e);void 0===v?oi.added(e)||(s=h.merge(s,((r={})[y]="Can't find field '".concat(e.name.value,"' on ").concat(Er(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),r))):On(v)?v=d(t.executeSubSelectedArray({field:e,array:v,enclosingRef:i,context:o}),y):e.selectionSet?null!=v&&(v=d(t.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:v,enclosingRef:Er(v)?v:i,context:o}),y)):o.canonizeResults&&(v=t.canon.pass(v)),void 0!==v&&l.push(((p={})[y]=v,p))}else{var b=Or(e,o.lookupFragment);if(!b&&e.kind===rn.FRAGMENT_SPREAD)throw Wt(9,e.name.value);b&&u.fragmentMatches(b,c)&&b.selectionSet.selections.forEach(f.add,f)}}));var p={result:Tn(l),missing:s},v=o.canonizeResults?this.canon.admit(p):fs(p);return v.result&&this.knownResults.set(v.result,r),v},e.prototype.execSubSelectedArrayImpl=function(e){var t,r=this,n=e.field,i=e.array,o=e.enclosingRef,s=e.context,a=new An;function u(e,r){var n;return e.missing&&(t=a.merge(t,((n={})[r]=e.missing,n))),e.result}return n.selectionSet&&(i=i.filter(s.store.canRead)),i=i.map((function(e,t){return null===e?null:On(e)?u(r.executeSubSelectedArray({field:n,array:e,enclosingRef:o,context:s}),t):n.selectionSet?u(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:e,enclosingRef:Er(e)?e:o,context:s}),t):(!1!==globalThis.__DEV__&&function(e,t,r){if(!t.selectionSet){var n=new Set([r]);n.forEach((function(r){mr(r)&&(Yt(!Er(r),10,function(e,t){return Er(t)?e.get(t.__ref,"__typename"):t&&t.__typename}(e,r),t.name.value),Object.values(r).forEach(n.add,n))}))}}(s.store,n,e),e)})),{result:s.canonizeResults?this.canon.admit(i):i,missing:t}},e}();function Rs(e){try{JSON.stringify(e,(function(e,t){if("string"==typeof t)throw t;return t}))}catch(e){return e}}var qs=Object.create(null);function Ls(e){var t=JSON.stringify(e);return qs[t]||(qs[t]=Object.create(null))}function Bs(e){var t=Ls(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,r){var n=function(e,t){return r.readField(t,e)},i=r.keyObject=Vs(e,(function(e){var i=Ys(r.storeObject,e,n);return void 0===i&&t!==r.storeObject&&ps.call(t,e[0])&&(i=Ys(t,e,zs)),Yt(void 0!==i,4,e.join("."),t),i}));return"".concat(r.typename,":").concat(JSON.stringify(i))})}function Qs(e){var t=Ls(e);return t.keyArgsFn||(t.keyArgsFn=function(t,r){var n=r.field,i=r.variables,o=r.fieldName,s=Vs(e,(function(e){var r=e[0],o=r.charAt(0);if("@"!==o)if("$"!==o){if(t)return Ys(t,e)}else{var s=r.slice(1);if(i&&ps.call(i,s)){var a=e.slice(0);return a[0]=s,Ys(i,a)}}else if(n&&Sn(n.directives)){var u=r.slice(1),c=n.directives.find((function(e){return e.name.value===u})),l=c&&Fr(c,i);return l&&Ys(l,e.slice(1))}})),a=JSON.stringify(s);return(t||"{}"!==a)&&(o+=":"+a),o})}function Vs(e,t){var r=new An;return Us(e).reduce((function(e,n){var i,o=t(n);if(void 0!==o){for(var s=n.length-1;s>=0;--s)(i={})[n[s]]=o,o=i;e=r.merge(e,o)}return e}),Object.create(null))}function Us(e){var t=Ls(e);if(!t.paths){var r=t.paths=[],n=[];e.forEach((function(t,i){On(t)?(Us(t).forEach((function(e){return r.push(n.concat(e))})),n.length=0):(n.push(t),On(e[i+1])||(r.push(n.slice(0)),n.length=0))}))}return t.paths}function zs(e,t){return e[t]}function Ys(e,t,r){return r=r||zs,Ws(t.reduce((function e(t,n){return On(t)?t.map((function(t){return e(t,n)})):t&&r(t,n)}),e))}function Ws(e){return mr(e)?On(e)?e.map(Ws):Vs(Object.keys(e).sort(),(function(t){return Ys(e,t)})):e}function $s(e){return void 0!==e.args?e.args:e.field?Fr(e.field,e.variables):null}Ir.setStringify(ki);var Gs=function(){},Hs=function(e,t){return t.fieldName},Ks=function(e,t,r){return(0,r.mergeObjects)(e,t)},Js=function(e,t){return t},Xs=function(){function e(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=l({dataIdFromObject:ys},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return e.prototype.identify=function(e,t){var r,n=this,i=t&&(t.typename||(null===(r=t.storeObject)||void 0===r?void 0:r.__typename))||e.__typename;if(i===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o,s=t&&t.storeObject||e,a=l(l({},t),{typename:i,storeObject:s,readField:t&&t.readField||function(){var e=ea(arguments,s);return n.readField(e,{store:n.cache.data,variables:e.variables})}}),u=i&&this.getTypePolicy(i),c=u&&u.keyFn||this.config.dataIdFromObject;c;){var h=c(l(l({},e),s),a);if(!On(h)){o=h;break}c=Bs(h)}return o=o?String(o):void 0,a.keyObject?[o,a.keyObject]:[o]},e.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach((function(r){var n=e[r],i=n.queryType,o=n.mutationType,s=n.subscriptionType,a=h(n,["queryType","mutationType","subscriptionType"]);i&&t.setRootTypename("Query",r),o&&t.setRootTypename("Mutation",r),s&&t.setRootTypename("Subscription",r),ps.call(t.toBeAdded,r)?t.toBeAdded[r].push(a):t.toBeAdded[r]=[a]}))},e.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function s(e,t){e.merge="function"==typeof t?t:!0===t?Ks:!1===t?Js:e.merge}s(n,t.merge),n.keyFn=!1===i?Gs:On(i)?Bs(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var a=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===a?Hs:On(a)?Qs(a):"function"==typeof a?a:n.keyFn,"function"==typeof u&&(n.read=u),s(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||Hs)}))},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var r="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[r];t!==n&&(Yt(!n||n===e,5,e),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=r,this.rootTypenamesById[r]=t)},e.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach((function(r){t.getSupertypeSet(r,!0),e[r].forEach((function(e){t.getSupertypeSet(e,!0).add(r);var n=e.match(gs);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},e.prototype.getTypePolicy=function(e){var t=this;if(!ps.call(this.typePolicies,e)){var r=this.typePolicies[e]=Object.create(null);r.fields=Object.create(null);var n=this.supertypeMap.get(e);!n&&this.fuzzySubtypes.size&&(n=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach((function(r,i){if(r.test(e)){var o=t.supertypeMap.get(i);o&&o.forEach((function(e){return n.add(e)}))}}))),n&&n.size&&n.forEach((function(e){var n=t.getTypePolicy(e),i=n.fields,o=h(n,["fields"]);Object.assign(r,o),Object.assign(r.fields,i)}))}var i=this.toBeAdded[e];return i&&i.length&&i.splice(0).forEach((function(r){t.updateTypePolicy(e,r)})),this.typePolicies[e]},e.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},e.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},e.prototype.fragmentMatches=function(e,t,r,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),a=[s],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&a.indexOf(t)<0&&a.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=!1,h=0;h<a.length;++h){var d=a[h];if(d.has(o))return s.has(o)||(l&&!1!==globalThis.__DEV__&&Yt.warn(6,t,o),s.add(o)),!0;d.forEach(u),c&&h===a.length-1&&Os(e.selectionSet,r,n)&&(c=!1,l=!0,this.fuzzySubtypes.forEach((function(e,r){var n=t.match(e);n&&n[0]===t&&u(r)})))}return!1},e.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},e.prototype.getStoreFieldName=function(e){var t,r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},a=$s(e);o;){var u=o(a,s);if(!On(u)){t=u||n;break}o=Qs(u)}return void 0===t&&(t=e.field?function(e,t){var r=null;e.directives&&(r={},e.directives.forEach((function(e){r[e.name.value]={},e.arguments&&e.arguments.forEach((function(n){var i=n.name,o=n.value;return wr(r[e.name.value],i,o,t)}))})));var n=null;return e.arguments&&e.arguments.length&&(n={},e.arguments.forEach((function(e){var r=e.name,i=e.value;return wr(n,r,i,t)}))),Ir(e.name.value,n,r)}(e.field,e.variables):Ir(n,$s(e))),!1===t?n:n===_s(t)?t:n+":"+t},e.prototype.readField=function(e,t){var r=e.from;if(r&&(e.field||e.fieldName)){if(void 0===e.typename){var n=t.store.getFieldValue(r,"__typename");n&&(e.typename=n)}var i=this.getStoreFieldName(e),o=_s(i),s=t.store.getFieldValue(r,i),a=this.getFieldPolicy(e.typename,o,!1),u=a&&a.read;if(u){var c=Zs(this,r,e,t,t.store.getStorage(Er(r)?r.__ref:r,i));return Ho.withValue(this.cache,u,[s,c])}return s}},e.prototype.getReadFunction=function(e,t){var r=this.getFieldPolicy(e,t,!1);return r&&r.read},e.prototype.getMergeFunction=function(e,t,r){var n=this.getFieldPolicy(e,t,!1),i=n&&n.merge;return!i&&r&&(i=(n=this.getTypePolicy(r))&&n.merge),i},e.prototype.runMergeFunction=function(e,t,r,n,i){var o=r.field,s=r.typename,a=r.merge;return a===Ks?ta(n.store)(e,t):a===Js?t:(n.overwrite&&(e=void 0),a(e,t,Zs(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},e}();function Zs(e,t,r,n,i){var o=e.getStoreFieldName(r),s=_s(o),a=r.variables||n.variables,u=n.store,c=u.toReference,l=u.canRead;return{args:$s(r),field:r.field||null,fieldName:s,storeFieldName:o,variables:a,isReference:Er,toReference:c,storage:i,cache:e.cache,canRead:l,readField:function(){return e.readField(ea(arguments,t,a),n)},mergeObjects:ta(n.store)}}function ea(e,t,r){var n,i=e[0],o=e[1],s=e.length;return"string"==typeof i?n={fieldName:i,from:s>1?o:t}:(n=l({},i),ps.call(n,"from")||(n.from=t)),!1!==globalThis.__DEV__&&void 0===n.from&&!1!==globalThis.__DEV__&&Yt.warn(7,Ut(Array.from(e))),void 0===n.variables&&(n.variables=r),n}function ta(e){return function(t,r){if(On(t)||On(r))throw Wt(8);if(mr(t)&&mr(r)){var n=e.getFieldValue(t,"__typename"),i=e.getFieldValue(r,"__typename");if(n&&i&&n!==i)return r;if(Er(t)&&Ss(r))return e.merge(t.__ref,r),t;if(Ss(t)&&Er(r))return e.merge(t,r.__ref),r;if(Ss(t)&&Ss(r))return l(l({},t),r)}return r}}function ra(e,t,r){var n="".concat(t).concat(r),i=e.flavors.get(n);return i||e.flavors.set(n,i=e.clientOnly===t&&e.deferred===r?e:l(l({},e),{clientOnly:t,deferred:r})),i}var na=function(){function e(e,t,r){this.cache=e,this.reader=t,this.fragments=r}return e.prototype.writeToStore=function(e,t){var r=this,n=t.query,i=t.result,o=t.dataId,s=t.variables,a=t.overwrite,u=Pr(n),c=new An;s=l(l({},Lr(u)),s);var h=l(l({store:e,written:Object.create(null),merge:function(e,t){return c.merge(e,t)},variables:s,varString:ki(s)},Es(n,this.fragments)),{overwrite:!!a,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),d=this.processSelectionSet({result:i||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:h});if(!Er(d))throw Wt(11,i);return h.incomingById.forEach((function(t,n){var i=t.storeObject,o=t.mergeTree,s=t.fieldNodeSet,a=Sr(n);if(o&&o.map.size){var u=r.applyMerges(o,a,i,h);if(Er(u))return;i=u}if(!1!==globalThis.__DEV__&&!h.overwrite){var c=Object.create(null);s.forEach((function(e){e.selectionSet&&(c[e.name.value]=!0)})),Object.keys(i).forEach((function(e){(function(e){return!0===c[_s(e)]})(e)&&!function(e){var t=o&&o.map.get(e);return Boolean(t&&t.info&&t.info.merge)}(e)&&function(e,t,r,n){var i=function(e){var t=n.getFieldValue(e,r);return"object"==typeof t&&t},o=i(e);if(o){var s=i(t);if(s&&!Er(o)&&!vi(o,s)&&!Object.keys(o).every((function(e){return void 0!==n.getFieldValue(s,e)}))){var a=n.getFieldValue(e,"__typename")||n.getFieldValue(t,"__typename"),u=_s(r),c="".concat(a,".").concat(u);if(!ca.has(c)){ca.add(c);var l=[];On(o)||On(s)||[o,s].forEach((function(e){var t=n.getFieldValue(e,"__typename");"string"!=typeof t||l.includes(t)||l.push(t)})),!1!==globalThis.__DEV__&&Yt.warn(14,u,a,l.length?"either ensure all objects of type "+l.join(" and ")+" have an ID or a custom merge function, or ":"",c,o,s)}}}}(a,i,e,h.store)}))}e.merge(n,i)})),e.retain(d.__ref),d},e.prototype.processSelectionSet=function(e){var t=this,r=e.dataId,n=e.result,i=e.selectionSet,o=e.context,s=e.mergeTree,a=this.cache.policies,u=Object.create(null),c=r&&a.rootTypenamesById[r]||Dr(n,i,o.fragmentMap)||r&&o.store.get(r,"__typename");"string"==typeof c&&(u.__typename=c);var h=function(){var e=ea(arguments,u,o.variables);if(Er(e.from)){var t=o.incomingById.get(e.from.__ref);if(t){var r=a.readField(l(l({},e),{from:t.storeObject}),o);if(void 0!==r)return r}}return a.readField(e,o)},d=new Set;this.flattenFields(i,n,o,c).forEach((function(e,r){var i,o=kr(r),l=n[o];if(d.add(r),void 0!==l){var f=a.getStoreFieldName({typename:c,fieldName:r.name.value,field:r,variables:e.variables}),p=oa(s,f),v=t.processFieldValue(l,r,r.selectionSet?ra(e,!1,!1):e,p),y=void 0;r.selectionSet&&(Er(v)||Ss(v))&&(y=h("__typename",v));var b=a.getMergeFunction(c,r.name.value,y);b?p.info={field:r,typename:c,merge:b}:ua(s,f),u=e.merge(u,((i={})[f]=v,i))}else!1===globalThis.__DEV__||e.clientOnly||e.deferred||oi.added(r)||a.getReadFunction(c,r.name.value)||!1!==globalThis.__DEV__&&Yt.error(12,kr(r),n)}));try{var f=a.identify(n,{typename:c,selectionSet:i,fragmentMap:o.fragmentMap,storeObject:u,readField:h}),p=f[0],v=f[1];r=r||p,v&&(u=o.merge(u,v))}catch(e){if(!r)throw e}if("string"==typeof r){var y=Sr(r),b=o.written[r]||(o.written[r]=[]);if(b.indexOf(i)>=0)return y;if(b.push(i),this.reader&&this.reader.isFresh(n,y,i,o))return y;var m=o.incomingById.get(r);return m?(m.storeObject=o.merge(m.storeObject,u),m.mergeTree=sa(m.mergeTree,s),d.forEach((function(e){return m.fieldNodeSet.add(e)}))):o.incomingById.set(r,{storeObject:u,mergeTree:aa(s)?void 0:s,fieldNodeSet:d}),y}return u},e.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?On(e)?e.map((function(e,o){var s=i.processFieldValue(e,t,r,oa(n,o));return ua(n,o),s})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):!1!==globalThis.__DEV__?Yi(e):e},e.prototype.flattenFields=function(e,t,r,n){void 0===n&&(n=Dr(t,e,r.fragmentMap));var i=new Map,o=this.cache.policies,s=new Ii(!1);return function e(a,u){var c=s.lookup(a,u.clientOnly,u.deferred);c.visited||(c.visited=!0,a.selections.forEach((function(s){if(un(s,r.variables)){var a=u.clientOnly,c=u.deferred;if(a&&c||!Sn(s.directives)||s.directives.forEach((function(e){var t=e.name.value;if("client"===t&&(a=!0),"defer"===t){var n=Fr(e,r.variables);n&&!1===n.if||(c=!0)}})),jr(s)){var l=i.get(s);l&&(a=a&&l.clientOnly,c=c&&l.deferred),i.set(s,ra(r,a,c))}else{var h=Or(s,r.lookupFragment);if(!h&&s.kind===rn.FRAGMENT_SPREAD)throw Wt(13,s.name.value);h&&o.fragmentMatches(h,n,t,r.variables)&&e(h.selectionSet,ra(r,a,c))}}})))}(e,r),i},e.prototype.applyMerges=function(e,t,r,n,i){var o,s=this;if(e.map.size&&!Er(r)){var a,u=On(r)||!Er(t)&&!Ss(t)?void 0:t,c=r;u&&!i&&(i=[Er(u)?u.__ref:u]);var h=function(e,t){return On(e)?"number"==typeof t?e[t]:void 0:n.store.getFieldValue(e,String(t))};e.map.forEach((function(e,t){var r=h(u,t),o=h(c,t);if(void 0!==o){i&&i.push(t);var l=s.applyMerges(e,r,o,n,i);l!==o&&(a=a||new Map).set(t,l),i&&Yt(i.pop()===t)}})),a&&(r=On(c)?c.slice(0):l({},c),a.forEach((function(e,t){r[t]=e})))}return e.info?this.cache.policies.runMergeFunction(t,r,e.info,n,i&&(o=n.store).getStorage.apply(o,i)):r},e}(),ia=[];function oa(e,t){var r=e.map;return r.has(t)||r.set(t,ia.pop()||{map:new Map}),r.get(t)}function sa(e,t){if(e===t||!t||aa(t))return e;if(!e||aa(e))return t;var r=e.info&&t.info?l(l({},e.info),t.info):e.info||t.info,n=e.map.size&&t.map.size,i={info:r,map:n?new Map:e.map.size?e.map:t.map};if(n){var o=new Set(t.map.keys());e.map.forEach((function(e,r){i.map.set(r,sa(e,t.map.get(r))),o.delete(r)})),o.forEach((function(r){i.map.set(r,sa(t.map.get(r),e.map.get(r)))}))}return i}function aa(e){return!e||!(e.info||e.map.size)}function ua(e,t){var r=e.map,n=r.get(t);n&&aa(n)&&(ia.push(n),r.delete(t))}var ca=new Set,la=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.watches=new Set,r.addTypenameTransform=new xi(oi),r.assumeImmutableResults=!0,r.makeVar=Zo,r.txCount=0,r.config=function(e){return Ui(bs,e)}(t),r.addTypename=!!r.config.addTypename,r.policies=new Xs({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return c(t,e),t.prototype.init=function(){var e=this.data=new As.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()},t.prototype.resetResultCache=function(e){var t=this,r=this.storeReader,n=this.config.fragments;this.storeWriter=new na(this,this.storeReader=new Cs({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:ms(this.config),canon:e?void 0:r&&r.canon,fragments:n}),n),this.maybeBroadcastWatch=Go((function(e,r){return t.broadcastWatch(e,r)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var r=e.optimistic?t.optimisticData:t.data;if(Ps(r)){var n=e.optimistic,i=e.id,o=e.variables;return r.makeCacheKey(e.query,e.callback,ki({optimistic:n,id:i,variables:o}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach((function(e){return e.resetCaching()}))},t.prototype.restore=function(e){return this.init(),e&&this.data.replace(e),this},t.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},t.prototype.read=function(e){var t=e.returnPartialData,r=void 0!==t&&t;try{return this.storeReader.diffQueryAgainstStore(l(l({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:r})).result||null}catch(e){if(e instanceof ds)return null;throw e}},t.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.modify=function(e){if(ps.call(e,"id")&&!e.id)return!1;var t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.diff=function(e){return this.storeReader.diffQueryAgainstStore(l(l({},e),{store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",config:this.config}))},t.prototype.watch=function(e){var t,r=this;return this.watches.size||Jo(t=this).vars.forEach((function(e){return e.attachCache(t)})),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){r.watches.delete(e)&&!r.watches.size&&Xo(r),r.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){ki.reset();var t=this.optimisticData.gc();return e&&!this.txCount&&(e.resetResultCache?this.resetResultCache(e.resetResultIdentities):e.resetResultIdentities&&this.storeReader.resetCanon()),t},t.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},t.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},t.prototype.identify=function(e){if(Er(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(e){!1!==globalThis.__DEV__&&Yt.warn(e)}},t.prototype.evict=function(e){if(!e.id){if(ps.call(e,"id"))return!1;e=l(l({},e),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(e,this.data)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.reset=function(e){var t=this;return this.init(),ki.reset(),e&&e.discardWatches?(this.watches.forEach((function(e){return t.maybeBroadcastWatch.forget(e)})),this.watches.clear(),Xo(this)):this.broadcastWatches(),Promise.resolve()},t.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},t.prototype.batch=function(e){var t,r=this,n=e.update,i=e.optimistic,o=void 0===i||i,s=e.removeOptimistic,a=e.onWatchUpdated,u=function(e){var i=r,o=i.data,s=i.optimisticData;++r.txCount,e&&(r.data=r.optimisticData=e);try{return t=n(r)}finally{--r.txCount,r.data=o,r.optimisticData=s}},c=new Set;return a&&!this.txCount&&this.broadcastWatches(l(l({},e),{onWatchUpdated:function(e){return c.add(e),!1}})),"string"==typeof o?this.optimisticData=this.optimisticData.addLayer(o,u):!1===o?u(this.data):u(),"string"==typeof s&&(this.optimisticData=this.optimisticData.removeLayer(s)),a&&c.size?(this.broadcastWatches(l(l({},e),{onWatchUpdated:function(e,t){var r=a.call(this,e,t);return!1!==r&&c.delete(e),r}})),c.size&&c.forEach((function(e){return r.maybeBroadcastWatch.dirty(e)}))):this.broadcastWatches(e),t},t.prototype.performTransaction=function(e,t){return this.batch({update:e,optimistic:t||null!==t})},t.prototype.transformDocument=function(e){return this.addTypenameToDocument(this.addFragmentsToDocument(e))},t.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,e)}))},t.prototype.addFragmentsToDocument=function(e){var t=this.config.fragments;return t?t.transform(e):e},t.prototype.addTypenameToDocument=function(e){return this.addTypename?this.addTypenameTransform.transformDocument(e):e},t.prototype.broadcastWatch=function(e,t){var r=e.lastDiff,n=this.diff(e);t&&(e.optimistic&&"string"==typeof t.optimistic&&(n.fromOptimisticTransaction=!0),t.onWatchUpdated&&!1===t.onWatchUpdated.call(this,e,n,r))||r&&vi(r.result,n.result)||e.callback(e.lastDiff=n,r)},t}(hs);function ha(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const da=/\r\n|[\n\r]/g;function fa(e,t){let r=0,n=1;for(const i of e.body.matchAll(da)){if("number"==typeof i.index||ha(!1),i.index>=t)break;r=i.index+i[0].length,n+=1}return{line:n,column:t+1-r}}function pa(e,t){const r=e.locationOffset.column-1,n="".padStart(r)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=1===t.line?r:0,u=t.column+a,c=`${e.name}:${s}:${u}\n`,l=n.split(/\r\n|[\n\r]/g),h=l[i];if(h.length>120){const e=Math.floor(u/80),t=u%80,r=[];for(let e=0;e<h.length;e+=80)r.push(h.slice(e,e+80));return c+va([[`${s} |`,r[0]],...r.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",r[e+1]]])}return c+va([[s-1+" |",l[i-1]],[`${s} |`,h],["|","^".padStart(u)],[`${s+1} |`,l[i+1]]])}function va(e){const t=e.filter((([e,t])=>void 0!==t)),r=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(r)+(t?" "+t:""))).join("\n")}class ya extends Error{constructor(e,...t){var r,n,i;const{nodes:o,source:s,positions:a,path:u,originalError:c,extensions:l}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=u?u:void 0,this.originalError=null!=c?c:void 0,this.nodes=ba(Array.isArray(o)?o:o?[o]:void 0);const h=ba(null===(r=this.nodes)||void 0===r?void 0:r.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=s?s:null==h||null===(n=h[0])||void 0===n?void 0:n.source,this.positions=null!=a?a:null==h?void 0:h.map((e=>e.start)),this.locations=a&&s?a.map((e=>fa(s,e))):null==h?void 0:h.map((e=>fa(e.source,e.start)));const d="object"==typeof(f=null==c?void 0:c.extensions)&&null!==f?null==c?void 0:c.extensions:void 0;var f;this.extensions=null!==(i=null!=l?l:d)&&void 0!==i?i:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=c&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,ya):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const r of this.nodes)r.loc&&(e+="\n\n"+pa((t=r.loc).source,fa(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+pa(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function ba(e){return void 0===e||0===e.length?void 0:e}function ma(e,t,r){return new ya(`Syntax Error: ${r}`,{source:e,positions:[t]})}var ga,_a,Oa;!function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(ga||(ga={})),(Oa=_a||(_a={})).SOF="<SOF>",Oa.EOF="<EOF>",Oa.BANG="!",Oa.DOLLAR="$",Oa.AMP="&",Oa.PAREN_L="(",Oa.PAREN_R=")",Oa.SPREAD="...",Oa.COLON=":",Oa.EQUALS="=",Oa.AT="@",Oa.BRACKET_L="[",Oa.BRACKET_R="]",Oa.BRACE_L="{",Oa.PIPE="|",Oa.BRACE_R="}",Oa.NAME="Name",Oa.INT="Int",Oa.FLOAT="Float",Oa.STRING="String",Oa.BLOCK_STRING="BlockString",Oa.COMMENT="Comment";class Sa{constructor(e){const t=new Jr(_a.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==_a.EOF)do{if(e.next)e=e.next;else{const t=Fa(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===_a.COMMENT);return e}}function Ea(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function wa(e,t){return Ta(e.charCodeAt(t))&&Ia(e.charCodeAt(t+1))}function Ta(e){return e>=55296&&e<=56319}function Ia(e){return e>=56320&&e<=57343}function Aa(e,t){const r=e.source.body.codePointAt(t);if(void 0===r)return _a.EOF;if(r>=32&&r<=126){const e=String.fromCodePoint(r);return'"'===e?"'\"'":`"${e}"`}return"U+"+r.toString(16).toUpperCase().padStart(4,"0")}function Ma(e,t,r,n,i){const o=e.line,s=1+r-e.lineStart;return new Jr(t,r,n,o,s,i)}function Fa(e,t){const r=e.source.body,n=r.length;let i=t;for(;i<n;){const t=r.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===r.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return ka(e,i);case 33:return Ma(e,_a.BANG,i,i+1);case 36:return Ma(e,_a.DOLLAR,i,i+1);case 38:return Ma(e,_a.AMP,i,i+1);case 40:return Ma(e,_a.PAREN_L,i,i+1);case 41:return Ma(e,_a.PAREN_R,i,i+1);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return Ma(e,_a.SPREAD,i,i+3);break;case 58:return Ma(e,_a.COLON,i,i+1);case 61:return Ma(e,_a.EQUALS,i,i+1);case 64:return Ma(e,_a.AT,i,i+1);case 91:return Ma(e,_a.BRACKET_L,i,i+1);case 93:return Ma(e,_a.BRACKET_R,i,i+1);case 123:return Ma(e,_a.BRACE_L,i,i+1);case 124:return Ma(e,_a.PIPE,i,i+1);case 125:return Ma(e,_a.BRACE_R,i,i+1);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?La(e,i):xa(e,i)}if(Nn(t)||45===t)return Da(e,i,t);if(Rn(t))return Ba(e,i);throw ma(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":Ea(t)||wa(r,i)?`Unexpected character: ${Aa(e,i)}.`:`Invalid character: ${Aa(e,i)}.`)}return Ma(e,_a.EOF,n,n)}function ka(e,t){const r=e.source.body,n=r.length;let i=t+1;for(;i<n;){const e=r.charCodeAt(i);if(10===e||13===e)break;if(Ea(e))++i;else{if(!wa(r,i))break;i+=2}}return Ma(e,_a.COMMENT,t,i,r.slice(t+1,i))}function Da(e,t,r){const n=e.source.body;let i=t,o=r,s=!1;if(45===o&&(o=n.charCodeAt(++i)),48===o){if(o=n.charCodeAt(++i),Nn(o))throw ma(e.source,i,`Invalid number, unexpected digit after 0: ${Aa(e,i)}.`)}else i=ja(e,i,o),o=n.charCodeAt(i);if(46===o&&(s=!0,o=n.charCodeAt(++i),i=ja(e,i,o),o=n.charCodeAt(i)),69!==o&&101!==o||(s=!0,o=n.charCodeAt(++i),43!==o&&45!==o||(o=n.charCodeAt(++i)),i=ja(e,i,o),o=n.charCodeAt(i)),46===o||Rn(o))throw ma(e.source,i,`Invalid number, expected digit but got: ${Aa(e,i)}.`);return Ma(e,s?_a.FLOAT:_a.INT,t,i,n.slice(t,i))}function ja(e,t,r){if(!Nn(r))throw ma(e.source,t,`Invalid number, expected digit but got: ${Aa(e,t)}.`);const n=e.source.body;let i=t+1;for(;Nn(n.charCodeAt(i));)++i;return i}function xa(e,t){const r=e.source.body,n=r.length;let i=t+1,o=i,s="";for(;i<n;){const n=r.charCodeAt(i);if(34===n)return s+=r.slice(o,i),Ma(e,_a.STRING,t,i+1,s);if(92!==n){if(10===n||13===n)break;if(Ea(n))++i;else{if(!wa(r,i))throw ma(e.source,i,`Invalid character within String: ${Aa(e,i)}.`);i+=2}}else{s+=r.slice(o,i);const t=117===r.charCodeAt(i+1)?123===r.charCodeAt(i+2)?Pa(e,i):Na(e,i):qa(e,i);s+=t.value,i+=t.size,o=i}}throw ma(e.source,i,"Unterminated string.")}function Pa(e,t){const r=e.source.body;let n=0,i=3;for(;i<12;){const e=r.charCodeAt(t+i++);if(125===e){if(i<5||!Ea(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|Ra(e),n<0)break}throw ma(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+i)}".`)}function Na(e,t){const r=e.source.body,n=Ca(r,t+2);if(Ea(n))return{value:String.fromCodePoint(n),size:6};if(Ta(n)&&92===r.charCodeAt(t+6)&&117===r.charCodeAt(t+7)){const e=Ca(r,t+8);if(Ia(e))return{value:String.fromCodePoint(n,e),size:12}}throw ma(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+6)}".`)}function Ca(e,t){return Ra(e.charCodeAt(t))<<12|Ra(e.charCodeAt(t+1))<<8|Ra(e.charCodeAt(t+2))<<4|Ra(e.charCodeAt(t+3))}function Ra(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function qa(e,t){const r=e.source.body;switch(r.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw ma(e.source,t,`Invalid character escape sequence: "${r.slice(t,t+2)}".`)}function La(e,t){const r=e.source.body,n=r.length;let i=e.lineStart,o=t+3,s=o,a="";const u=[];for(;o<n;){const n=r.charCodeAt(o);if(34===n&&34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)){a+=r.slice(s,o),u.push(a);const n=Ma(e,_a.BLOCK_STRING,t,o+3,qn(u).join("\n"));return e.line+=u.length-1,e.lineStart=i,n}if(92!==n||34!==r.charCodeAt(o+1)||34!==r.charCodeAt(o+2)||34!==r.charCodeAt(o+3))if(10!==n&&13!==n)if(Ea(n))++o;else{if(!wa(r,o))throw ma(e.source,o,`Invalid character within String: ${Aa(e,o)}.`);o+=2}else a+=r.slice(s,o),u.push(a),13===n&&10===r.charCodeAt(o+1)?o+=2:++o,a="",s=o,i=o;else a+=r.slice(s,o),s=o+1,o+=4}throw ma(e.source,o,"Unterminated string.")}function Ba(e,t){const r=e.source.body,n=r.length;let i=t+1;for(;i<n&&(Cn(o=r.charCodeAt(i))||Nn(o)||95===o);)++i;var o;return Ma(e,_a.NAME,t,i,r.slice(t,i))}class Qa{constructor(e,t="GraphQL request",r={line:1,column:1}){"string"==typeof e||Yr(!1,`Body must be a string. Received: ${Gr(e)}.`),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||Yr(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Yr(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class Va{constructor(e,t={}){const r=function(e){return e instanceof Qa}(e)?e:new Qa(e);this._lexer=new Sa(r),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(_a.NAME);return this.node(e,{kind:rn.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:rn.DOCUMENT,definitions:this.many(_a.SOF,this.parseDefinition,_a.EOF)})}parseDefinition(){if(this.peek(_a.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===_a.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw ma(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(_a.BRACE_L))return this.node(e,{kind:rn.OPERATION_DEFINITION,operation:tn.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let r;return this.peek(_a.NAME)&&(r=this.parseName()),this.node(e,{kind:rn.OPERATION_DEFINITION,operation:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(_a.NAME);switch(e.value){case"query":return tn.QUERY;case"mutation":return tn.MUTATION;case"subscription":return tn.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(_a.PAREN_L,this.parseVariableDefinition,_a.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:rn.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(_a.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(_a.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(_a.DOLLAR),this.node(e,{kind:rn.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:rn.SELECTION_SET,selections:this.many(_a.BRACE_L,this.parseSelection,_a.BRACE_R)})}parseSelection(){return this.peek(_a.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let r,n;return this.expectOptionalToken(_a.COLON)?(r=t,n=this.parseName()):n=t,this.node(e,{kind:rn.FIELD,alias:r,name:n,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(_a.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(_a.PAREN_L,t,_a.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,r=this.parseName();return this.expectToken(_a.COLON),this.node(t,{kind:rn.ARGUMENT,name:r,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(_a.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(_a.NAME)?this.node(e,{kind:rn.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:rn.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:rn.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:rn.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case _a.BRACKET_L:return this.parseList(e);case _a.BRACE_L:return this.parseObject(e);case _a.INT:return this.advanceLexer(),this.node(t,{kind:rn.INT,value:t.value});case _a.FLOAT:return this.advanceLexer(),this.node(t,{kind:rn.FLOAT,value:t.value});case _a.STRING:case _a.BLOCK_STRING:return this.parseStringLiteral();case _a.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:rn.BOOLEAN,value:!0});case"false":return this.node(t,{kind:rn.BOOLEAN,value:!1});case"null":return this.node(t,{kind:rn.NULL});default:return this.node(t,{kind:rn.ENUM,value:t.value})}case _a.DOLLAR:if(e){if(this.expectToken(_a.DOLLAR),this._lexer.token.kind===_a.NAME){const e=this._lexer.token.value;throw ma(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:rn.STRING,value:e.value,block:e.kind===_a.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:rn.LIST,values:this.any(_a.BRACKET_L,(()=>this.parseValueLiteral(e)),_a.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:rn.OBJECT,fields:this.any(_a.BRACE_L,(()=>this.parseObjectField(e)),_a.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,r=this.parseName();return this.expectToken(_a.COLON),this.node(t,{kind:rn.OBJECT_FIELD,name:r,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(_a.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(_a.AT),this.node(t,{kind:rn.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(_a.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(_a.BRACKET_R),t=this.node(e,{kind:rn.LIST_TYPE,type:r})}else t=this.parseNamedType();return this.expectOptionalToken(_a.BANG)?this.node(e,{kind:rn.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:rn.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(_a.STRING)||this.peek(_a.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),n=this.many(_a.BRACE_L,this.parseOperationTypeDefinition,_a.BRACE_R);return this.node(e,{kind:rn.SCHEMA_DEFINITION,description:t,directives:r,operationTypes:n})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(_a.COLON);const r=this.parseNamedType();return this.node(e,{kind:rn.OPERATION_TYPE_DEFINITION,operation:t,type:r})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),n=this.parseConstDirectives();return this.node(e,{kind:rn.SCALAR_TYPE_DEFINITION,description:t,name:r,directives:n})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:rn.OBJECT_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:i,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(_a.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(_a.BRACE_L,this.parseFieldDefinition,_a.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName(),n=this.parseArgumentDefs();this.expectToken(_a.COLON);const i=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:rn.FIELD_DEFINITION,description:t,name:r,arguments:n,type:i,directives:o})}parseArgumentDefs(){return this.optionalMany(_a.PAREN_L,this.parseInputValueDef,_a.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName();this.expectToken(_a.COLON);const n=this.parseTypeReference();let i;this.expectOptionalToken(_a.EQUALS)&&(i=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:rn.INPUT_VALUE_DEFINITION,description:t,name:r,type:n,defaultValue:i,directives:o})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:rn.INTERFACE_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:i,fields:o})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:rn.UNION_TYPE_DEFINITION,description:t,name:r,directives:n,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(_a.EQUALS)?this.delimitedMany(_a.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:rn.ENUM_TYPE_DEFINITION,description:t,name:r,directives:n,values:i})}parseEnumValuesDefinition(){return this.optionalMany(_a.BRACE_L,this.parseEnumValueDefinition,_a.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseEnumValueName(),n=this.parseConstDirectives();return this.node(e,{kind:rn.ENUM_VALUE_DEFINITION,description:t,name:r,directives:n})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw ma(this._lexer.source,this._lexer.token.start,`${Ua(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:rn.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:r,directives:n,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(_a.BRACE_L,this.parseInputValueDef,_a.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===_a.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),r=this.optionalMany(_a.BRACE_L,this.parseOperationTypeDefinition,_a.BRACE_R);if(0===t.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:rn.SCHEMA_EXTENSION,directives:t,operationTypes:r})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),r=this.parseConstDirectives();if(0===r.length)throw this.unexpected();return this.node(e,{kind:rn.SCALAR_TYPE_EXTENSION,name:t,directives:r})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),r=this.parseImplementsInterfaces(),n=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===r.length&&0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:rn.OBJECT_TYPE_EXTENSION,name:t,interfaces:r,directives:n,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),r=this.parseImplementsInterfaces(),n=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===r.length&&0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:rn.INTERFACE_TYPE_EXTENSION,name:t,interfaces:r,directives:n,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),r=this.parseConstDirectives(),n=this.parseUnionMemberTypes();if(0===r.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:rn.UNION_TYPE_EXTENSION,name:t,directives:r,types:n})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),r=this.parseConstDirectives(),n=this.parseEnumValuesDefinition();if(0===r.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:rn.ENUM_TYPE_EXTENSION,name:t,directives:r,values:n})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),r=this.parseConstDirectives(),n=this.parseInputFieldsDefinition();if(0===r.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:rn.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:r,fields:n})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(_a.AT);const r=this.parseName(),n=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:rn.DIRECTIVE_DEFINITION,description:t,name:r,arguments:n,repeatable:i,locations:o})}parseDirectiveLocations(){return this.delimitedMany(_a.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(ga,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new Kr(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw ma(this._lexer.source,t.start,`Expected ${za(e)}, found ${Ua(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==_a.NAME||t.value!==e)throw ma(this._lexer.source,t.start,`Expected "${e}", found ${Ua(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===_a.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return ma(this._lexer.source,t.start,`Unexpected ${Ua(t)}.`)}any(e,t,r){this.expectToken(e);const n=[];for(;!this.expectOptionalToken(r);)n.push(t.call(this));return n}optionalMany(e,t,r){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(r));return e}return[]}many(e,t,r){this.expectToken(e);const n=[];do{n.push(t.call(this))}while(!this.expectOptionalToken(r));return n}delimitedMany(e,t){this.expectOptionalToken(e);const r=[];do{r.push(t.call(this))}while(this.expectOptionalToken(e));return r}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(void 0!==e&&t.kind!==_a.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw ma(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function Ua(e){const t=e.value;return za(e.kind)+(null!=t?` "${t}"`:"")}function za(e){return function(e){return e===_a.BANG||e===_a.DOLLAR||e===_a.AMP||e===_a.PAREN_L||e===_a.PAREN_R||e===_a.SPREAD||e===_a.COLON||e===_a.EQUALS||e===_a.AT||e===_a.BRACKET_L||e===_a.BRACKET_R||e===_a.BRACE_L||e===_a.PIPE||e===_a.BRACE_R}(e)?`"${e}"`:e}var Ya=new Map,Wa=new Map,$a=!0,Ga=!1;function Ha(e){return e.replace(/[\s,]+/g," ").trim()}function Ka(e){var t,r,n,i=Ha(e);if(!Ya.has(i)){var o=function(e,t){return new Va(e,t).parseDocument()}(e,{experimentalFragmentVariables:Ga,allowLegacyFragmentVariables:Ga});if(!o||"Document"!==o.kind)throw new Error("Not a valid GraphQL document.");Ya.set(i,function(e){var t=new Set(e.definitions);t.forEach((function(e){e.loc&&delete e.loc,Object.keys(e).forEach((function(r){var n=e[r];n&&"object"==typeof n&&t.add(n)}))}));var r=e.loc;return r&&(delete r.startToken,delete r.endToken),e}((t=o,r=new Set,n=[],t.definitions.forEach((function(e){if("FragmentDefinition"===e.kind){var t=e.name.value,i=Ha((s=e.loc).source.body.substring(s.start,s.end)),o=Wa.get(t);o&&!o.has(i)?$a&&console.warn("Warning: fragment with name "+t+" already exists.\ngraphql-tag enforces all fragment names across your application to be unique; read more about\nthis in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"):o||Wa.set(t,o=new Set),o.add(i),r.has(i)||(r.add(i),n.push(e))}else n.push(e);var s})),l(l({},t),{definitions:n}))))}return Ya.get(i)}function Ja(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];"string"==typeof e&&(e=[e]);var n=e[0];return t.forEach((function(t,r){t&&"Document"===t.kind?n+=t.loc.source.body:n+=t,n+=e[r+1]})),Ka(n)}var Xa,Za=Ja;(Xa=Ja||(Ja={})).gql=Za,Xa.resetCaches=function(){Ya.clear(),Wa.clear()},Xa.disableFragmentWarnings=function(){$a=!1},Xa.enableExperimentalFragmentVariables=function(){Ga=!0},Xa.disableExperimentalFragmentVariables=function(){Ga=!1},Ja.default=Ja;const eu=["aiData","api","application","application-kotlin","backend-function","extraction","internal-storage","internalCodeExecutor","mutation","named-query","native-query","observability","openapi","query","queue","quota","secret","storage","webhooks","ws"];function tu(e,t,r){const n=new URL("https://squid.cloud");n.host=`${t}.${e}.${n.host}`;const i=r.replace(/^\//g,"").split("/")[0]||"";ru(e)&&(n.protocol="http",n.port=eu.includes(i)?"8001":"8000",function(e){return/android$/.test(e)}(e)?n.host="10.0.2.2":function(e){return/ios$/.test(e)}(e)&&(n.host="localhost"));const o=n.toString();r=r.startsWith("/")?r.slice(1):r;const s=o.replace(/\/$/g,"");return r.length?`${s}/${r}`:s}function ru(e){return/^local/.test(e)}class nu{constructor(e,t,r,n){this.rpcManager=e,this.region=r,this.appId=n;const i=tu(this.region,this.appId,`${t}/graphql`);this.client=new ls({link:new li({uri:i,headers:this.rpcManager.getStaticHeaders()}),cache:new la})}async query(e){return(await this.client.query({query:Ja`
|
|
2
2
|
${e.query}
|
|
3
3
|
`,variables:e.variables})).data}async mutate(e){return(await this.client.mutate({mutation:Ja`
|
|
4
4
|
${e.query}
|
|
5
|
-
`})).data}}class iu{constructor(e,t,r){this.rpcManager=e,this.region=t,this.appId=r,this.clientsMap=new Map}get(e){let t=this.clientsMap.get(e);return t||(t=new nu(this.rpcManager,e,this.region,this.appId),this.clientsMap.set(e,t),t)}}class ou{constructor(e,t,r){this.rpcManager=e,this.lockManager=t,this.querySender=r}async sendMutations(e,t){const r=gt(e),n=r.map((e=>`sendMutation_${Ke(e.squidDocIdObj)}`));await this.lockManager.lock(...n),await this.querySender.waitForAllQueriesToFinish();try{const e={mutations:r,integrationId:t};return await this.rpcManager.post("mutation/mutate",e)}catch(e){throw we.debug("Error while sending mutations",{error:e,mutations:JSON.stringify(r,null,2)}),e}finally{this.lockManager.release(...n)}}}class su{constructor(e){this.rpcManager=e}async executeNativeQuery(e){return this.rpcManager.post("native-query/execute",e)}}function au(e,t){switch(t.type){case"simple":return function(e,t){const{query:r,dereference:n}=t,{collectionName:i,integrationId:o}=r;let s=e.collection(i,o).query();return s=uu(s,r),n?s.dereference():s}(e,t);case"join":return function(e,t){const{root:r,joins:n,joinConditions:i,dereference:o,grouped:s}=t,{collectionName:a,integrationId:u}=r.query;let c=e.collection(a,u).joinQuery(r.alias);return c=uu(c,r.query),Object.entries(n).map((([t,r])=>{const{collectionName:n,integrationId:o}=r,{left:s,right:a,leftAlias:u}=i[t];let l=e.collection(n,o).query();l=uu(l,r),c=c.join(l,t,{left:s,right:a},{leftAlias:u})})),o&&s?c.grouped().dereference():o?c.dereference():s?c.grouped():c}(e,t);case"merged":return function(e,t){const{queries:r}=t,{collectionName:n,integrationId:i}=cu(r[0]),o=r.map((t=>au(e,t)));return e.collection(n,i).or(...o)}(e,t)}}function uu(e,t){const{conditions:r,limit:n,sortOrder:i}=t;for(const t of r){if(!("operator"in t))throw new Error("Composite conditions are not support in query serialization.");const{fieldName:r,operator:n,value:i}=t;e.where(r,n,i)}e.limit(n);for(const{fieldName:t,asc:r}of i)e.sortBy(t,r);return e}function cu(e){switch(e.type){case"simple":{const{collectionName:t,integrationId:r}=e.query;return{collectionName:t,integrationId:r}}case"join":{const{collectionName:t,integrationId:r}=e.root.query;return{collectionName:t,integrationId:r}}case"merged":return cu(e.queries[0])}}const lu={"in:in":(e,t)=>e.every((e=>t.includes(e))),"in:not in":(e,t)=>e.every((e=>!t.includes(e))),"not in:not in":(e,t)=>t.every((t=>e.includes(t))),">:not in":(e,t)=>t.every((t=>e>=t)),">=:not in":(e,t)=>t.every((t=>e>t)),"<:not in":(e,t)=>t.every((t=>e<=t)),"<=:not in":(e,t)=>t.every((t=>e<t)),">:>":(e,t)=>e>=t,">=:>":(e,t)=>e>t,"in:>":(e,t)=>e.every((e=>e>t)),">:>=":(e,t)=>e>=t,">=:>=":(e,t)=>e>=t,"in:>=":(e,t)=>e.every((e=>e>=t)),"<:<":(e,t)=>e<=t,"<=:<":(e,t)=>e<t,"in:<":(e,t)=>e.every((e=>e<t)),"<:<=":(e,t)=>e<=t,"<=:<=":(e,t)=>e<=t,"in:<=":(e,t)=>e.every((e=>e<=t)),"like:like":(e,t)=>hu(e.toLowerCase(),t.toLowerCase()),"like_cs:like":(e,t)=>hu(e.toLowerCase(),t.toLowerCase()),"like:like_cs":(e,t)=>hu(e,t)&&fu(t),"like_cs:like_cs":(e,t)=>hu(e,t),"like:not like":(e,t)=>!du(e.toLowerCase(),t.toLowerCase()),"like_cs:not like":(e,t)=>!du(e.toLowerCase(),t.toLowerCase()),"like:not like_cs":(e,t)=>!du(e.toLowerCase(),t.toLowerCase()),"like_cs:not like_cs":(e,t)=>!du(e,t),"not like:like":(e,t)=>vu(e,t),"not like_cs:like":(e,t)=>vu(e,t),"not like:like_cs":(e,t)=>vu(e,t),"not like_cs:like_cs":(e,t)=>vu(e,t),"not like:not like":(e,t)=>hu(t.toLowerCase(),e.toLowerCase()),"not like_cs:not like":(e,t)=>hu(t,e)&&fu(e),"not like:not like_cs":(e,t)=>hu(t.toLowerCase(),e.toLowerCase()),"not like_cs:not like_cs":(e,t)=>hu(t,e),"in:like":(e,t)=>e.every((e=>ut(t,e,"like"))),"in:like_cs":(e,t)=>e.every((e=>ut(t,e,"like_cs"))),"in:not like":(e,t)=>e.every((e=>ut(t,e,"not like"))),"in:not like_cs":(e,t)=>e.every((e=>ut(t,e,"not like_cs"))),"like:in":(e,t)=>!e.includes("%")&&!e.includes("_")&&!!t.find((t=>t.toLowerCase()===e.toLowerCase())),"like_cs:in":(e,t)=>!e.includes("%")&&!e.includes("_")&&t.includes(e),"not like:in":(e,t)=>e.length>0&&pu(e)||yu(e)&&t.includes(""),"not like_cs:in":(e,t)=>e.length>0&&pu(e)||yu(e)&&t.includes(""),"not in:like":(e,t)=>t.length>0&&pu(t)||yu(t)&&e.includes(""),"not in:like_cs":(e,t)=>t.length>0&&pu(t)||yu(t)&&e.includes(""),"not in:not like":(e,t)=>!t.includes("%")&&!t.includes("_")&&!!e.find((e=>e.toLowerCase()===t.toLowerCase())),"not in:not like_cs":(e,t)=>!t.includes("%")&&!t.includes("_")&&e.includes(t),"like:not in":(e,t)=>t.every((t=>ut(e,t,"not like"))),"like_cs:not in":(e,t)=>t.every((t=>ut(e,t,"not like_cs"))),"not like:not in":(e,t)=>t.every((t=>ut(e,t,"like"))),"not like_cs:not in":(e,t)=>t.every((t=>ut(e,t,"like_cs"))),"array_includes_some:array_includes_some":(e,t)=>e.every((e=>t.includes(e))),"array_includes_all:array_includes_all":(e,t)=>e.every((e=>t.includes(e))),"array_not_includes:array_not_includes":(e,t)=>t.every((t=>e.includes(t))),"array_includes_some:array_not_includes":(e,t)=>e.every((e=>!t.includes(e))),"array_not_includes:array_includes_some":(e,t)=>t.every((t=>!e.includes(t))),"array_includes_all:array_includes_some":(e,t)=>e.every((e=>t.includes(e))),"array_includes_some:array_includes_all":(e,t)=>e.every((e=>t.includes(e))),"array_not_includes:array_includes_all":(e,t)=>t.every((t=>!e.includes(t))),"array_includes_all:array_not_includes":(e,t)=>e.every((e=>!t.includes(e)))};function hu(e,t,r=0,n=0){if(n>=t.length)return r>=e.length;if(r>=e.length)return pu(t.substring(n));const i=e[r],o=t[n];return"%"===i&&"%"===o?hu(e,t,r+1,n+1)||hu(e,t,r+1,n):"%"!==i&&("%"===o?hu(e,t,r,n+1)||hu(e,t,r+1,n):(i===o||"_"===o)&&hu(e,t,r+1,n+1))}function du(e,t,r=0,n=0){if(r>=e.length&&n>=t.length)return!0;if(r>=e.length)return pu(t.substring(n));if(n>=t.length)return pu(e.substring(r));const i=r<e.length?e[r]:"",o=n<t.length?t[n]:"";return"%"===i&&"%"===o?du(e,t,r+1,n+1)||du(e,t,r,n+1)||du(e,t,r+1,n):"%"===i||"%"===o?du(e,t,r,n+1)||du(e,t,r+1,n):(i===o||"_"===i||"_"===o)&&du(e,t,r+1,n+1)}function fu(e){return!/[a-zA-Z]/.test(e)}function pu(e){return e.split("").every((e=>"%"===e))}function vu(e,t){return e.length>0&&pu(e)||t.length>0&&pu(t)||yu(e)&&0===t.length}function yu(e){let t=!1,r=!1;for(const n of e)switch(n){case"%":t=!0;break;case"_":if(r)return!1;r=!0;break;default:return!1}return t&&r}class bu{constructor(e){this.query=e,this.query=e,this.parsedConditions=this.parseConditions(this.query.conditions.filter(Ue))}get integrationId(){return this.query.integrationId}get collectionName(){return this.query.collectionName}get limit(){return this.query.limit}sortedBy(e){const t=e.find(((e,t)=>{var r;return!he(this.query.sortOrder[t],Object.assign(Object.assign({},e),{asc:null===(r=e.asc)||void 0===r||r}))}));return!t}sortedByExact(e){return e.length===this.query.sortOrder.length&&this.sortedBy(e)}isSubqueryOf(e,t,r){return this.isSubqueryOfCondition({fieldName:e,operator:t,value:r})}isSubqueryOfCondition(e){return!!this.parsedConditions.filter((t=>t.fieldName===e.fieldName)).find((t=>this.evaluateSubset(t,e)))}isSubqueryOfConditions(e){return this.parseConditions(e).every((e=>this.isSubqueryOfCondition(e)))}isSubqueryOfQuery(e){if(e.collectionName!==this.collectionName||e.integrationId!==this.integrationId)return!1;const t=e.conditions.filter(Ue),r=this.isSubqueryOfConditions(t),n=this.sortedBy(e.sortOrder),i=-1===e.limit||this.limit>-1&&this.limit<e.limit;return r&&n&&i}getConditionsFor(...e){return this.parsedConditions.filter((t=>e.includes(t.fieldName)))}getConditionsForField(e){return this.parsedConditions.filter((t=>t.fieldName===e))}documentMatchesQuery(e){for(const t of this.parsedConditions){const r=t.fieldName,n=t.operator,i=oe(e,r);if("in"===n){if(t.value.includes(i))continue;return!1}if("not in"!==n){if(!ut(t.value,i,n))return!1}else if(t.value.includes(i))return!1}return!0}evaluateSubset(e,t){const{operator:r,value:n}=e,{operator:i,value:o}=this.parseConditions([t])[0],s=lu[`${r}:${i}`];return!!s&&s(n,o)}evaluateIncludes(e,t){const{operator:r,value:n}=e,{operator:i,value:o}=this.parseConditions([t])[0],s=Array.isArray(n)?n.sort():n,a=Array.isArray(o)?o.sort():o;return i===r&&he(a,s)}parseConditions(e){const t=[],r=new Map,n=new Map;return e.forEach((e=>{switch(e.operator){case"==":case"in":r.set(e.fieldName,(r.get(e.fieldName)||[]).concat(e.value));break;case"!=":case"not in":n.set(e.fieldName,(n.get(e.fieldName)||[]).concat(e.value));break;default:t.push(e)}})),r.forEach(((e,r)=>{t.push({fieldName:r,operator:"in",value:e})})),n.forEach(((e,r)=>{t.push({fieldName:r,operator:"not in",value:e})})),t}}class mu{constructor(e,t,r){this.documentStore=e,this.documentReferenceFactory=t,this.querySubscriptionManager=r}peek(e){if(!this.querySubscriptionManager.findValidParentOfQuery(e))return[];const{integrationId:t,collectionName:r}=e,n=new bu(e),i=this.documentReferenceFactory.getDocumentsForCollection(t,r).filter((e=>n.documentMatchesQuery(e.data))),o={};return i.forEach((e=>{o[e.squidDocId]=e})),this.documentStore.sortAndLimitDocs(new Set(Object.keys(o)),e).map((e=>o[Ke(e.__docId__,r,t)]))}}function gu(e,t){return a((function(r,n){var i=0;r.subscribe(L(n,(function(r){return e.call(t,r,i++)&&n.next(r)})))}))}class _u{constructor(e,t){this.rpcManager=e,this.destructManager=t,this.pendingQueryRequests=[],this.safeToSendQueriesToServer=new o.BehaviorSubject(!0),this.inflightQueriesCount=new o.BehaviorSubject(0),this.destructManager.onPreDestruct((()=>{this.preDestruct()}))}async sendQuery(e){const t=new o.Subject,r=(0,o.firstValueFrom)(t);return this.pendingQueryRequests.push({queryRequest:e,responseSubject:t}),this.pendingQueryBatchTimeout&&(clearTimeout(this.pendingQueryBatchTimeout),this.pendingQueryBatchTimeout=void 0),this.pendingQueryRequests.length>=10?(this.processQueryBatch(),r):(this.pendingQueryBatchTimeout=setTimeout((()=>{this.safeToSendQueriesToServer.pipe(gu(Boolean),(0,o.take)(1)).subscribe((()=>{this.processQueryBatch()}))}),0),r)}async processQueryBatch(){const e=this.pendingQueryRequests.splice(0);if(!e.length)return;const t=e.map((({queryRequest:e})=>e)),r=e.map((({responseSubject:e})=>e));this.inflightQueriesCount.next(this.inflightQueriesCount.value+t.length);try{const r=await this.rpcManager.post("query/batchQueries",t);for(const{queryRequest:t,responseSubject:n}of e){const e=t.clientRequestId,i=r.errors[e],o=r.results[e];i?n.error(i):n.next(o)}}catch(e){r.forEach((t=>t.error(e)))}finally{this.inflightQueriesCount.next(this.inflightQueriesCount.value-t.length)}}async waitForAllQueriesToFinish(){return(0,o.firstValueFrom)(this.inflightQueriesCount.pipe(gu((e=>0===e)))).then((()=>{}))}preDestruct(){this.safeToSendQueriesToServer.next(!1),this.safeToSendQueriesToServer.complete()}}var Ou,Su=r(4123);function Eu(e,t,r=((e,t)=>e>t?1:e<t?-1:0),n=0,i=e.length-1){if(i<n)return-1;const o=Math.trunc((n+i)/2);return 0===r(t,e[o])?o:r(t,e[o])>0?Eu(e,t,r,o+1,i):Eu(e,t,r,n,o-1)}function wu(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){if(-1!==Eu(e,t,r))return;let n;for(n=e.length-1;n>=0&&r(e[n],t)>0;n--)e[n+1]=e[n];e[n+1]=t}function Tu(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){const n=Eu(e,t,r);n>-1&&e.splice(n,1)}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.DISABLED=1]="DISABLED",e[e.ENABLED=2]="ENABLED"}(Ou||(Ou={}));const Iu=100,Au=20;class Mu{constructor(e,t,r,n,i,s){this.rpcManager=e,this.clientIdService=t,this.documentStore=r,this.destructManager=n,this.documentIdentityService=i,this.querySender=s,this.onOrphanDocuments=new o.Subject,this.ongoingQueries=new Map,this.clientRequestIdToLocalDocuments=new Map,this.localDocumentToClientRequestIds=new Map,this.queryMappingManager=new ku,this.queryResultsSubject=new o.Subject,this.documentIdentityService.observeChanges().subscribe(this.migrateDocIds.bind(this)),this.clientIdService.observeClientReadyToBeRegenerated().subscribe((()=>{this.refreshOngoingQueries()})),this.destructManager.onPreDestruct((()=>{this.preDestruct()}))}observeQueryResults(){return this.queryResultsSubject.asObservable()}hasOngoingQuery(e){return this.ongoingQueries.has(e)}getQuery(e){return(0,V.truthy)(this.ongoingQueries.get(e),"UNKNOWN_QUERY").query}setGotInitialResult(e){const t=this.ongoingQueries.get(e);(null==t?void 0:t.gotInitialResponse)&&this.removeClientRequestIdMapping(e),t&&(t.gotInitialResponse=!0,t.isInFlight=!1)}findQueriesForDocument(e,t){const{collectionName:r,integrationId:n}=He(t),i=this.queryMappingManager.getMapping(r,n);return i?function(e,t){var r;const n=[...e.unconditional||[]],i=new Map;for(const[n,o]of Object.entries(e.conditional||{})){const e=_e(n);let s;if(Ue(e)){const n=null!==(r=oe(t,e.fieldName))&&void 0!==r?r:null;s=ut(e.value,n,e.operator)}else s=Fu(e,t);if(s)for(const e of o)i.set(e,(i.get(e)||0)+1)}for(const[t,r]of i.entries())r>=e.queriesMetadata[t].condCount&&n.push(t);return n}(i,e):[]}setClientRequestIdsForLocalDoc(e,t){const r=this.localDocumentToClientRequestIds.get(e)||new Set,n=new Set(t?this.findQueriesForDocument(t,e).map((e=>function(e){const t=e.split("_");return{clientId:t[0],clientRequestId:t[1]}}(e).clientRequestId)):[]),i=new Set([...r,...n]);for(const t of[...r]){if(n.has(t))continue;r.delete(t);const i=this.clientRequestIdToLocalDocuments.get(t);i&&(i.delete(e),i.size||this.clientRequestIdToLocalDocuments.delete(t)),r.size||this.localDocumentToClientRequestIds.delete(e)}for(const t of n){let r=this.localDocumentToClientRequestIds.get(e);r||(r=new Set,this.localDocumentToClientRequestIds.set(e,r)),r.add(t);let n=this.clientRequestIdToLocalDocuments.get(t);n||(n=new Set,this.clientRequestIdToLocalDocuments.set(t,n)),n.add(e)}return[...i]}errorOutAllQueries(e,t){const r=this.localDocumentToClientRequestIds.get(e)||new Set;for(const e of r){const r=this.ongoingQueries.get(e);r&&(this.destructManager.isDestructing?r.dataSubject.complete():r.dataSubject.error(t),r.done=!0)}}notifyAllSubscriptions(e){const t=new Set;for(const r of e){const e=this.ongoingQueries.get(r);if(!e)continue;if(!e.gotInitialResponse||!e.activated||e.isInFlight)continue;const n=this.clientRequestIdToLocalDocuments.get(r)||new Set,i=this.documentStore.sortAndLimitDocs(n,e.query),o=e.supportedQueries.map((e=>this.updateOngoingQueryWithNewDataFromSupportingQuery(i,e))).some(Boolean);let s=e;for(;!s.allObservables;)s=(0,V.truthy)(null==s?void 0:s.supportingOngoingQuery);if(o&&t.add(s),e.query.limit>0)switch(e.limitUnderflowState){case Ou.UNKNOWN:e.limitUnderflowState=n.size===e.query.limit+Iu?Ou.ENABLED:Ou.DISABLED;break;case Ou.DISABLED:break;case Ou.ENABLED:if(n.size<e.query.limit+Au){e.limitUnderflowState=Ou.UNKNOWN,this.sendQueryToServerOrUseParentQuery(e);continue}}e.dataSubject.next(i)}for(const e of t){const t=this.collectAllObservables(e);(0,V.truthy)(e.allObservables).next(t)}}isValidParent(e){if(!e.activated||e.isInFlight||e.isEmptyForJoin||e.done||!e.subscribe||!e.gotInitialResponse||!e.dataSubject.value)return!1;const t=-1===e.query.limit?1e3:e.query.limit;return e.dataSubject.value.length<t}findValidParentOfOngoingQuery(e){if(e.forceFetchFromServer)return;const t=new bu(e.query);for(const r of this.ongoingQueries.values()){if(e===r)return;if(this.isValidParent(r)&&t.isSubqueryOfQuery(r.query))return r}}findValidParentOfQuery(e){const t=new bu(e);for(const e of this.ongoingQueries.values())if(this.isValidParent(e)&&t.isSubqueryOfQuery(e.query))return e}processQuery(e,t,r,n,i,s){return(0,o.defer)((()=>{const a=this.createOngoingQueryGraph(e,t,r,n,i,!0);s&&(a.forceFetchFromServer=!0),this.sendQueryToServerOrUseParentQuery(a),a.allObservables=new o.ReplaySubject(1);const u=a.allObservables.pipe((0,o.switchMap)((e=>(0,o.combineLatest)(e).pipe(Q((e=>this.joinResults(e,n,a)))))),gu((()=>this.allOngoingQueriesGotInitialResult(a))),(0,o.startWith)(void 0),(0,o.pairwise)(),gu((([e,t])=>!he(e,t))),Q((([,e])=>e)),i?(0,o.tap)():(0,o.take)(1),(0,o.finalize)((()=>{var e;a.dataSubject.complete(),a.done=!0,this.completeAllSupportedQueries(a).then(),null===(e=a.allObservables)||void 0===e||e.complete()}))),c=this.collectAllObservables(a);return a.allObservables.next(c),u})).pipe((0,o.share)())}hasOngoingQueryForDocId(e){const t=this.localDocumentToClientRequestIds.get(e);return!!t&&!!t.size}removeClientRequestIdMapping(e){const t=this.clientRequestIdToLocalDocuments.get(e);if(!t)return;this.clientRequestIdToLocalDocuments.delete(e);const r=[];for(const n of t){const t=(0,V.truthy)(this.localDocumentToClientRequestIds.get(n));t.delete(e),t.size||(this.localDocumentToClientRequestIds.delete(n),r.push(n))}r.length&&this.onOrphanDocuments.next(r)}registerQueryFinalizer(e){const t=e.clientRequestId,r=lt(this.clientIdService.getClientId(),t);e.dataSubject.pipe((0,o.finalize)((async()=>{if(e.unsubscribeBlockerCount.value>0&&await(0,o.firstValueFrom)((0,o.race)(this.destructManager.observeIsDestructing(),e.unsubscribeBlockerCount.pipe(gu((e=>0===e))))),this.queryMappingManager.removeQuery(r).then(),this.ongoingQueries.delete(t),e.subscribe&&!e.isEmptyForJoin&&e.activated){const r={clientRequestId:t};this.rpcManager.post("query/unsubscribe",r).catch((t=>{this.destructManager.isDestructing||console.error("Got error while unsubscribing from query",e.query,t)}))}this.removeClientRequestIdMapping(t),this.ongoingQueries.delete(t)})),gu(Boolean)).subscribe({error:()=>{}})}createOngoingQueryGraph(e,t,r,n,i,s,a={}){if(a[t])return a[t];const u=U(),c=[],l={clientRequestId:u,activated:s,alias:t,query:e,subscribe:i,dataSubject:new o.BehaviorSubject(null),supportedQueries:c,supportingOngoingQuery:void 0,joinCondition:void 0,gotInitialResponse:!1,isEmptyForJoin:!1,canExpandForJoin:!0,unsubscribeBlockerCount:new o.BehaviorSubject(0),queryRegistered:new o.BehaviorSubject(!1),done:!1,isInFlight:!1,forceFetchFromServer:!1,limitUnderflowState:i?Ou.UNKNOWN:Ou.DISABLED};this.registerQueryFinalizer(l),this.ongoingQueries.set(u,l),a[t]=l;for(const[e,o]of Object.entries(n)){const s=o.leftAlias;if(s!==t&&e!==t)continue;const u=s===t?e:s;if(s===t){const e=this.createOngoingQueryGraph(r[u],u,r,n,i,!1,a);e.joinCondition=o,c.push(e)}else l.supportingOngoingQuery=this.createOngoingQueryGraph(r[u],u,r,n,i,!1,a)}return l}collectAllObservables(e,t=[]){if(e.isEmptyForJoin)return t;const r=e.alias;t.push(e.dataSubject.pipe(gu(Boolean),Q((e=>({docs:e,alias:r})))));for(const r of e.supportedQueries)this.collectAllObservables(r,t);return t}joinResults(e,t,r){const n=e.reduce(((e,t)=>(e[t.alias]?e[t.alias].push(...t.docs):e[t.alias]=[...t.docs],e)),{});let i=n[r.alias].map((e=>({[r.alias]:e})));const o=this.getOngoingQueriesBfs(r),s=new Set;for(let e=1;e<o.length;e++){const r=o[e].alias;s.has(r)||(s.add(r),i=this.join(i,r,n[r],t[r]))}return i}join(e,t,r,n){if(!e.length)return e;const i=Object.keys(e[0]);if(!n||!i.includes(n.leftAlias))throw new Error("No join condition found for alias "+t);const o=new Map;return(r||[]).forEach((e=>{const t=e[n.right];o.has(t)||o.set(t,[]),(0,V.truthy)(o.get(t)).push(e)})),e.flatMap((e=>{var r;const i=o.get(null===(r=e[n.leftAlias])||void 0===r?void 0:r[n.left])||[];return i.length?i.map((r=>Object.assign(Object.assign({},e),{[t]:r}))):n.isInner?[]:[Object.assign(Object.assign({},e),{[t]:void 0})]}))}getOngoingQueriesBfs(e){const t=[],r=[e];for(;r.length;){const e=(0,V.truthy)(r.shift());e.isEmptyForJoin||(t.push(e),r.push(...e.supportedQueries))}return t}updateOngoingQueryWithNewDataFromSupportingQuery(e,t){var r;const n=(0,V.truthy)(t.joinCondition),i=t.query;if(t.activated){if(!t.canExpandForJoin)return!1;const s=(0,V.truthy)(null===(r=t.supportingOngoingQuery)||void 0===r?void 0:r.supportedQueries).filter((e=>e.alias===t.alias)),a=new Set(e.map((e=>{var t;return null!==(t=e[n.left])&&void 0!==t?t:null})));for(const e of s)e.query.conditions.filter(Ue).filter((e=>e.fieldName===n.right)).forEach((e=>{a.delete(e.value)}));if(0===a.size)return!1;const u=fe(i);u.conditions=u.conditions.filter((e=>!Ue(e)||e.fieldName!==n.right)),[...a].forEach((e=>{u.conditions.push({fieldName:n.right,operator:"==",value:e})}));const c=Object.assign(Object.assign({},t),{query:u,activated:!0,gotInitialResponse:!1,dataSubject:new o.BehaviorSubject(null),clientRequestId:U(),isEmptyForJoin:!1});return this.registerQueryFinalizer(c),this.ongoingQueries.set(c.clientRequestId,c),(0,V.truthy)(t.supportingOngoingQuery).supportedQueries.push(c),this.sendQueryToServerOrUseParentQuery(c),!0}{if(t.activated=!0,i.conditions.filter(Ue).filter((e=>e.fieldName===n.right&&"=="===e.operator)).map((e=>e.value)).length)return this.sendQueryToServerOrUseParentQuery(t),t.canExpandForJoin=!1,!0;const r=e.map((e=>{var t;return null!==(t=e[n.left])&&void 0!==t?t:null})).map((e=>({fieldName:n.right,operator:"==",value:e})));return r.length?(i.conditions.push(...r),this.sendQueryToServerOrUseParentQuery(t)):t.isEmptyForJoin=!0,!0}}allOngoingQueriesGotInitialResult(e){return!!e.isEmptyForJoin||!!e.gotInitialResponse&&(!e.supportedQueries.length||e.supportedQueries.every((e=>this.allOngoingQueriesGotInitialResult(e))))}async completeAllSupportedQueries(e){const t=[...e.supportedQueries||[]];for(;t.length;){const e=(0,V.truthy)(t.shift());t.push(...e.supportedQueries||[]),await(0,o.firstValueFrom)(e.unsubscribeBlockerCount.pipe(gu((e=>0===e)))),e.dataSubject.complete()}}preDestruct(){this.unsubscribe()}unsubscribe(){var e;const t=[...this.ongoingQueries.values()];for(const r of t)r.dataSubject.complete(),null===(e=r.allObservables)||void 0===e||e.complete()}hasSubscription(e){var t;return!!(null===(t=this.ongoingQueries.get(e))||void 0===t?void 0:t.subscribe)}sendQueryToServerOrUseParentQuery(e,t=!1){if(this.destructManager.isDestructing)return;const r=e.query,n=e.clientRequestId,i=lt(this.clientIdService.getClientId(),n);this.queryMappingManager.addQuery(r,i),this.ongoingQueries.set(n,e);const o=t?void 0:this.findValidParentOfOngoingQuery(e);o?this.useParentOngoingQuery(e,o).then():this.sendQueryToServer(e)}async useParentOngoingQuery(e,t){const r={clientRequestId:e.clientRequestId,query:e.query,parentClientRequestId:t.clientRequestId},n=new bu(e.query);t.unsubscribeBlockerCount.next(t.unsubscribeBlockerCount.value+1);try{await(0,o.firstValueFrom)(t.queryRegistered.pipe(gu(Boolean)))}catch(t){return this.destructManager.isDestructing?(e.dataSubject.complete(),e.queryRegistered.complete()):(e.dataSubject.error(t),e.queryRegistered.error(t)),void(e.done=!0)}if(this.destructManager.isDestructing)return;if(e.done)return;this.rpcManager.post("query/register",r).then((()=>{e.isInFlight=!1,e.queryRegistered.next(!0)})).catch((r=>{e.isInFlight=!1,this.destructManager.isDestructing?e.dataSubject.complete():(console.error("Query error",e.query,t.query,r),e.dataSubject.error(r)),e.done=!0})).finally((()=>{t.unsubscribeBlockerCount.next(t.unsubscribeBlockerCount.value-1)}));const i=(0,o.race)(e.queryRegistered.pipe(gu(Boolean),(0,o.delay)(2e3),(0,o.take)(1)),this.destructManager.observeIsDestructing().pipe((0,o.take)(1)));t.dataSubject.pipe((0,o.takeWhile)((()=>!e.done)),(0,o.takeUntil)(i),gu(Boolean),(0,o.tap)((()=>{e.gotInitialResponse||this.setGotInitialResult(e.clientRequestId)})),Q((e=>e.filter((e=>n.documentMatchesQuery(e)))))).subscribe({next:t=>{for(const r of t)this.setClientRequestIdsForLocalDoc(Ke(r.__docId__,e.query.collectionName,e.query.integrationId),r);this.notifyAllSubscriptions([e.clientRequestId])},error:t=>{this.destructManager.isDestructing?e.dataSubject.complete():e.dataSubject.error(t)}})}sendQueryToServer(e){const t=e.query.limit,r=t>0&&e.subscribe?t+Iu:t,n={query:Object.assign(Object.assign({},e.query),{limit:r}),clientRequestId:e.clientRequestId,subscribe:e.subscribe};e.isInFlight=!0,this.querySender.sendQuery(n).then((t=>{e.isInFlight=!1,e.queryRegistered.next(!0),this.queryResultsSubject.next(t)})).catch((t=>{e.isInFlight=!1,this.destructManager.isDestructing?(e.dataSubject.complete(),e.queryRegistered.complete()):(we.debug("Query error",e.query,t),e.dataSubject.error(t),e.queryRegistered.error("query failed")),e.done=!0}))}refreshOngoingQueries(){for(const e of this.ongoingQueries.values())this.sendQueryToServerOrUseParentQuery(e,!0)}migrateDocIds(e){const t=Object.keys(e);for(const r of this.clientRequestIdToLocalDocuments.values())t.forEach((t=>{r.has(t)&&(r.delete(t),r.add(e[t]))}));t.forEach((t=>{ce(this.localDocumentToClientRequestIds,t,e[t])}))}}function Fu(e,t){var r;for(const n of e.fields){const e=null!==(r=oe(t,n.fieldName))&&void 0!==r?r:null;if(ut(n.value,e,n.operator))return!0;if(ut(n.value,e,"!="))return!1}return!1}class ku{constructor(){this.stateService=new Su.TrieStore({}),this.querySubscriptionIdToQuery={}}addQuery(e,t){this.stateService.runInBatch((()=>{let r=0;const n=new Set;for(const i of e.conditions){if(Ue(i)&&["=="].includes(i.operator)){const e=Oe(i.fieldName);n.has(e)||(r++,n.add(e))}else r++;const o=this.getConditionStatePath(e,i),s=[...this.stateService.get(o)||[]];wu(s,t),this.stateService.set(o,s)}if(!e.conditions.length){const r=["queryMapping",e.collectionName,e.integrationId,"mapping","unconditional"],n=[...this.stateService.get(r)||[]];wu(n,t),this.stateService.set(r,n)}this.stateService.set([...this.getQueryMetadataStatePath(e,t),"condCount"],r)})),this.querySubscriptionIdToQuery[t]=e}async removeQuery(e){const t=this.querySubscriptionIdToQuery[e];if(t)return this.stateService.runInBatch((()=>{for(const r of t.conditions){const n=this.getConditionStatePath(t,r),i=[...this.stateService.get(n)||[]];Tu(i,e),i.length?this.stateService.set(n,i):this.stateService.delete(n)}if(!t.conditions.length){const r=["queryMapping",t.collectionName,t.integrationId,"mapping","unconditional"],n=[...this.stateService.get(r)||[]];Tu(n,e),this.stateService.set(r,n)}this.stateService.delete(this.getQueryMetadataStatePath(t,e))})),t}getMapping(e,t){return this.stateService.get(["queryMapping",e,t,"mapping"])}getQueryMetadataStatePath(e,t){return["queryMapping",e.collectionName,e.integrationId,"mapping","queriesMetadata",`${t}`]}getConditionStatePath(e,t){return["queryMapping",e.collectionName,e.integrationId,"mapping","conditional",(r=t,me(r))];var r}}class Du{constructor(){this.locks={}}async lock(...e){if(this.canGetLock(...e))return void this.lockSync(...e);const t=Object.entries(this.locks).filter((([t])=>e.includes(t))).map((([,e])=>e));await(0,o.lastValueFrom)((0,o.combineLatest)(t).pipe((0,o.filter)((e=>!e.includes(!0))),(0,o.take)(1))),await this.lock(...e)}release(...e){for(const t of e){const e=(0,V.truthy)(this.locks[t]);e.next(!1),e.complete(),delete this.locks[t]}}canGetLock(...e){return!e.some((e=>{var t;return null===(t=this.locks[e])||void 0===t?void 0:t.value}))}lockSync(...e){(0,V.assertTruthy)(this.canGetLock(...e),"Cannot acquire lock sync");for(const t of e)this.locks[t]=new o.BehaviorSubject(!0)}}class ju{constructor(e,t,r){this.rpcManager=e,this.socketManager=t,this.queueManagers=new Map,this.socketManager.observeNotifications().subscribe((e=>{const t=this.getOrUndefined(e.integrationId,e.topicName);t&&t.onMessages(e.payload)})),r.onPreDestruct((()=>{for(const e of this.queueManagers.values())for(const t of e.values())t.destruct()}))}get(e,t){let r=this.queueManagers.get(e);r||(r=new Map,this.queueManagers.set(e,r));let n=r.get(t);return n||(n=new Pu(e,t,this.rpcManager),r.set(t,n)),n}getOrUndefined(e,t){var r;return null===(r=this.queueManagers.get(e))||void 0===r?void 0:r.get(t)}}const xu="subscriptionMutex";class Pu{constructor(e,t,r){this.integrationId=e,this.topicName=t,this.rpcManager=r,this.messagesSubject=new o.Subject,this.subscriberCount=0,this.lockManager=new Du}async produce(e){await this.lockManager.lock(xu);try{await this.rpcManager.post("queue/produceMessages",{integrationId:this.integrationId,topicName:this.topicName,messages:e})}finally{this.lockManager.release(xu)}}consume(){return(0,o.defer)((()=>(this.subscriberCount++,1===this.subscriberCount&&this.performSubscribe(),this.messagesSubject.asObservable().pipe((0,o.finalize)((()=>{this.subscriberCount--,0===this.subscriberCount&&this.performUnsubscribe()}))))))}async performSubscribe(){await this.lockManager.lock(xu);try{await this.rpcManager.post("queue/subscribe",{integrationId:this.integrationId,topicName:this.topicName})}catch(e){this.messagesSubject.error(e),this.messagesSubject.complete(),this.subscriberCount=0,this.messagesSubject=new o.Subject}finally{this.lockManager.release(xu)}}async performUnsubscribe(){await this.lockManager.lock(xu);try{await this.rpcManager.post("queue/unsubscribe",{integrationId:this.integrationId,topicName:this.topicName})}finally{this.lockManager.release(xu)}}onMessages(e){for(const t of e)this.messagesSubject.next(t)}destruct(){this.messagesSubject.complete()}}class Nu{constructor(e,t){this.capacity=e,this.seconds=t,this.tokens=e,this.refillRatePerMs=e/(1e3*t),this.lastRefillTimestamp=Date.now()}async consume(){this.attemptConsume()||await(0,o.firstValueFrom)((0,o.interval)(10).pipe((0,o.filter)((()=>this.attemptConsume())),(0,o.first)()))}attemptConsume(){return this.refill(),this.tokens>=1&&(this.tokens-=1,!0)}refill(){const e=Date.now(),t=(e-this.lastRefillTimestamp)*this.refillRatePerMs;this.tokens=Math.min(this.tokens+t,this.capacity),this.lastRefillTimestamp=e}}class Cu extends Error{constructor(e,t,r,n,i,o){super(o||`RPC error ${e} ${t} calling ${r}`),this.statusCode=e,this.statusText=t,this.url=r,this.headers=n,this.body=i}}async function Ru(e){const t=await async function({headers:e,files:t,filesFieldName:r,message:n,url:i,extractErrorMessage:o}){const s=new Headers(e),a={method:"POST",headers:s,body:void 0};if(t.length){const e=new FormData;for(const n of t){const t=n instanceof Blob?n:n.blob,i=(Blob,n.name);e.append(r,t,i)}e.append("body",ge(n)),a.body=e}else s.append("Content-Type","application/json"),a.body=ge(n);try{const e=await fetch(i,a),t={};if(e.headers.forEach(((e,r)=>{t[r]=e})),!e.ok){const r=await e.text(),n=qu(r);if(!o)throw new Cu(e.status,e.statusText,i,t,n,r);let s;try{s="string"==typeof n?n:(null==n?void 0:n.message)||r}catch(e){}throw s||(s=e.statusText),new Cu(e.status,e.statusText,i,t,n,s)}const r=await e.text();return we.debug(`received response from url ${i}: ${JSON.stringify(r)}`),{body:r,headers:t,status:e.status,statusText:e.statusText}}catch(e){throw we.debug(`Unable to perform fetch request to url: ${i}`,e),e}}(e);return t.body=qu(t.body),t}function qu(e){if(e){try{return _e(e)}catch(e){}return e}}class Lu{constructor(e,t,r,n,i,s){this.region=e,this.appId=t,this.authManager=i,this.clientIdService=s,this.staticHeaders={},this.onGoingRpcCounter=new o.BehaviorSubject(0);for(const[e,t]of Object.entries(n))this.setStaticHeader(e,t);this.clientIdService.observeClientId().subscribe((e=>{e?this.setStaticHeader("x-squid-clientid",e):this.deleteStaticHeader("x-squid-clientid")})),r.onDestruct((async()=>{await this.awaitAllSettled()}));const a=this.authManager.getApiKey()?5:1;this.rateLimiters={default:new Nu(60*a,5),ai:new Nu(20*a,5),secret:new Nu(20*a,5)}}async getAuthHeaders(){const e=this.authManager.getApiKey();if(e)return{Authorization:`ApiKey ${e}`};const{token:t,integrationId:r}=await this.authManager.getAuthData();if(!t)return{};let n=`Bearer ${t}`;return r&&(n+=`; IntegrationId ${r}`),{Authorization:n}}async awaitAllSettled(){await(0,o.firstValueFrom)(this.onGoingRpcCounter.pipe((0,o.filter)((e=>0===e))))}setStaticHeader(e,t){this.staticHeaders[e]=t}deleteStaticHeader(e){delete this.staticHeaders[e]}getStaticHeaders(){return this.staticHeaders}async post(e,t,r=[],n="files"){return(await this.rawPost(e,t,r,n)).body}async rawPost(e,t,r=[],n="files",i=!0){this.onGoingRpcCounter.next(this.onGoingRpcCounter.value+1);try{await this.getRateLimiterBucket(e).consume();const o=await this.getAuthHeaders(),s=Object.assign(Object.assign({},this.staticHeaders),o);we.debug(`sending request: path: ${e} message: ${JSON.stringify(t)}`);const a=tu(this.region,this.appId,e);return await Ru({url:a,headers:s,message:t,files:r,filesFieldName:n,extractErrorMessage:i})}finally{this.onGoingRpcCounter.next(this.onGoingRpcCounter.value-1)}}getRateLimiterBucket(e){return e.startsWith("ai/chatbot")?(0,V.truthy)(this.rateLimiters.ai,"MISSING_RATE_LIMITER_AI"):e.startsWith("secret/")?(0,V.truthy)(this.rateLimiters.secret,"MISSING_RATE_LIMITER_SECRETS"):(0,V.truthy)(this.rateLimiters.default,"MISSING_RATE_LIMITER_DEFAULT")}}class Bu{constructor(e){this.rpcManager=e}reportMetric(e){const t={metrics:[e]};this.rpcManager.post("/observability/metrics",t)}}class Qu{constructor(e){this.rpcManager=e}async get(e){const t={key:e};return await this.rpcManager.post("secret/get",t)||void 0}getAll(){return this.rpcManager.post("secret/getAll",{})}upsert(e,t){return this.upsertMany([{key:e,value:t}]).then((e=>e[0]))}upsertMany(e){const t={entries:e};return this.rpcManager.post("secret/upsert",t)}delete(e){const t={keys:[e]};return this.rpcManager.post("secret/delete",t)}deleteMany(e){const t={keys:e};return this.rpcManager.post("secret/delete",t)}get apiKeys(){return new Vu(this.rpcManager)}}class Vu{constructor(e){this.rpcManager=e}get(e){const t={key:e};return this.rpcManager.post("secret/api-key/get",t)}getAll(){return this.rpcManager.post("secret/api-key/getAll",{})}upsert(e){const t={key:e};return this.rpcManager.post("secret/api-key/upsert",t)}delete(e){const t={key:e};return this.rpcManager.post("secret/api-key/delete",t)}}const Uu=e=>e();var zu;function Yu(){}const Wu="undefined"!=typeof process&&(null===(zu=process.versions)||void 0===zu?void 0:zu.node)?r(5086):Ee().WebSocket;class $u{constructor(e,t,r,n=Uu,i,s){this.clientIdService=e,this.region=t,this.appId=r,this.messageNotificationWrapper=n,this.destructManager=i,this.authManager=s,this.webSocketObserver=new o.Subject,this.allMessagesObserver=new o.Subject,this.connectionReady=new o.BehaviorSubject(!1),this.seenMessageIds=new Set,this.destructSubject=new o.Subject,this.connectedAtLeastOnce=!1,this.clientTooOldThreshold=3e4,this.destructManager.onDestruct((async()=>{await this.destruct()})),this.setupMessageAcknowledgments(),this.connect(),this.lastTick=new Date,this.tickInterval=setInterval((()=>this.tick()),5e3),this.observeConnectionReady().pipe((0,o.skip)(1),(0,o.filter)((e=>!e)),(0,o.switchMap)((()=>(0,o.race)((0,o.timer)(this.clientTooOldThreshold),this.connectionReady.pipe((0,o.filter)(Boolean)),this.destructManager.observeIsDestructing())))).subscribe((()=>{this.connectionReady.value?we.debug(this.clientIdService.getClientId(),"Client reconnected before becoming too old. Ignoring..."):this.destructManager.isDestructing||(we.debug(this.clientIdService.getClientId(),"Client disconnected for a long period - refreshing"),this.refreshClient())})),this.observeConnectionReady().pipe((0,o.filter)(Boolean)).subscribe((()=>{this.clientIdService.isClientTooOld()&&this.clientIdService.notifyClientNotTooOld()}))}refreshClient(){this.destructManager.isDestructing?we.debug(this.clientIdService.getClientId(),"Client too old but is destructed. Ignoring..."):this.clientIdService.isClientTooOld()?we.debug(this.clientIdService.getClientId(),"Client is already marked as too old. Ignoring..."):(we.debug(this.clientIdService.getClientId(),"Notifying client too old"),this.clientIdService.notifyClientTooOld(),we.debug(this.clientIdService.getClientId(),"Client too old. Reconnecting..."),this.connect())}tick(){Math.abs(Date.now()-this.lastTick.getTime())>this.clientTooOldThreshold&&(we.debug(this.clientIdService.getClientId(),"Tick: Client not responding for a long time. Refreshing..."),this.refreshClient()),this.lastTick=new Date}observeNotifications(){return this.webSocketObserver.asObservable()}observeConnectionReady(){return this.connectionReady.asObservable().pipe((0,o.distinctUntilChanged)())}sendMessage(e){this.sendMessageAsync(e).then()}async sendMessageAsync(e){var t;await(0,o.firstValueFrom)(this.connectionReady.pipe((0,o.filter)(Boolean)));const r=await this.authManager.getToken();if(this.connectionReady.value)try{(0,V.assertTruthy)(this.socket,"Socket is undefined in sendMessageAsync");const t=ge({message:e,authToken:r});we.debug(this.clientIdService.getClientId(),"Sending message to socket: ",t),this.socket.send(t)}catch(r){(null===(t=this.socket)||void 0===t?void 0:t.connected)?console.error("Websocket message is ignored due to a non-recoverable error",r):(this.connectionReady.next(!1),await this.sendMessageAsync(e))}else await this.sendMessageAsync(e)}sendKillMessage(){var e;(null===(e=this.socket)||void 0===e?void 0:e.connected)&&this.socket.send(ge({message:{type:"kill"}}))}closeCurrentSocketSilently(){if(this.socket)try{this.socket.close()}catch(e){}}connect(){this.closeCurrentSocketSilently(),this.connectionReady.value&&this.connectionReady.next(!1);const e=tu(this.region,this.appId,"ws/general").replace("https","wss").replace("http","ws"),t=this.clientIdService.getClientId();we.debug(this.clientIdService.getClientId(),"Connecting to socket at:",e);const r=`${e}?clientId=${t}`;this.socket=function(e,t={}){let r,n=0,i=1;const o={connected:!1,closeCalled:!1,open(){var i;const s=null!==(i=null==Wu?void 0:Wu.WebSocket)&&void 0!==i?i:Wu;r=new s(e,t.protocols||[]),r.onmessage=t.onmessage?e=>{e.data&&t.onmessage?t.onmessage(e):console.log("No data received from websockets, please contact support@squid.cloud with this message.")}:Yu,r.onopen=function(e){o.connected=!0,(t.onopen||Yu)(e),n=0},r.onclose=function(e){if(o.connected=!1,4999!==e.code&&4001!==e.code)return we.debug("WebSocket closed. Reconnecting. Close code: ",e.code),(t.onclose||Yu)(e),void o.reconnect(e);(t.onclose||Yu)(e)},r.onerror=function(e){o.connected=!1,e&&"ECONNREFUSED"===e.code?o.reconnect(e):o.closeCalled||(t.onerror||Yu)(e)}},reconnect(e){const r=void 0!==t.maxAttempts?t.maxAttempts:1/0;i&&n++<r?i=setTimeout((function(){(t.onreconnect||Yu)(e),we.debug("WebSocket trying to reconnect..."),o.open()}),t.timeoutMillis||1e3):(t.onmaximum||Yu)(e)},json(e){r.send(JSON.stringify(e))},send(e){r.send(e)},close(e=4999,t){o.closeCalled=!0;try{o.connected=!1,clearTimeout(i),i=void 0,r.close(e,t)}catch(e){}}};return o.open(),o}(r,{timeoutMillis:1e4,onmessage:e=>this.onMessage(e.data),onopen:()=>{we.debug(this.clientIdService.getClientId(),`Connection to socket established. Endpoint: ${e}`)},onreconnect:()=>{we.debug(t,"WebSocket reconnect event triggered"),this.clientIdService.getClientId()===t?this.connectionReady.value&&this.connectionReady.next(!1):we.debug(t,`WebSocket reconnect event triggered - ignored because the client id changed. Old: ${this.clientIdService.getClientId()}`)},onclose:()=>{we.debug(t,"WebSocket onclose event triggered"),this.clientIdService.getClientId()===t?this.connectionReady.value&&this.connectionReady.next(!1):we.debug(t,`WebSocket onclose event triggered - ignored because the client id changed. new: ${this.clientIdService.getClientId()}`)},onerror:e=>console.error("WebSocket error:",e)})}disconnectForTest(){var e;this.connectionReady.next(!1),null===(e=this.socket)||void 0===e||e.close(4998)}onConnectionReady(){this.connectionReady.next(!0),this.connectedAtLeastOnce?this.sendMessage({type:"catchup"}):this.connectedAtLeastOnce=!0}onMessage(e){if("connectionReady"===e)return we.debug(this.clientIdService.getClientId(),"Got socket message: connectionReady"),void this.onConnectionReady();const t=_e(e);for(const e of t)this.allMessagesObserver.next(e),this.seenMessageIds.has(e.messageId)||(this.seenMessageIds.add(e.messageId),we.debug(this.clientIdService.getClientId(),new Date,"Got socket message",JSON.stringify(e,null,2)),this.messageNotificationWrapper((()=>{this.webSocketObserver.next(e)})))}setupMessageAcknowledgments(){const e=new o.Subject;this.allMessagesObserver.subscribe((t=>{(null==t?void 0:t.messageId)&&e.next(t.messageId)}));const t=[];e.pipe((0,o.tap)((e=>t.push(e))),(0,o.debounceTime)(100)).subscribe((async()=>{const e=[...t.splice(0)];this.sendMessage({type:"acknowledge",payload:e})}))}async destruct(){this.sendKillMessage(),await(0,o.firstValueFrom)((0,o.timer)(0)),this.connectionReady.next(!1),await(0,o.firstValueFrom)((0,o.timer)(0)),clearInterval(this.tickInterval),this.closeCurrentSocketSilently(),this.webSocketObserver.complete(),this.allMessagesObserver.complete(),this.destructSubject.next()}}function Gu(e,t){return`${function(e){(0,V.assertString)(e,"Invalid application ID");const[t,r,n,i]=e.split("-");return(0,V.assertTruthy)(!i,`Invalid application ID: ${e}`),{appId:t,environmentId:null!=r?r:"prod",squidDeveloperId:n}}(e).appId}${t&&"prod"!==t?`-${t}`:""}`}class Hu{constructor(e="built_in_storage",t){this.integrationId=e,this.rpcManager=t}async uploadFile(e,t,r){const n={integrationId:this.integrationId,dirPathInBucket:e,expirationInSeconds:r};await this.rpcManager.post("storage/uploadFile",n,[t])}async getFileMetadata(e){const t={integrationId:this.integrationId,filePathInBucket:e};return await this.rpcManager.post("storage/getFileMetadata",t)}async getDownloadUrl(e,t){const r={integrationId:this.integrationId,filePathInBucket:e,urlExpirationInSeconds:t};return await this.rpcManager.post("storage/getDownloadUrl",r)}async listDirectoryContents(e){const t={integrationId:this.integrationId,dirPathInBucket:e};return await this.rpcManager.post("storage/listDirectoryContents",t)}async deleteFile(e){await this.deleteFiles([e])}async deleteFiles(e){const t={integrationId:this.integrationId,filePathsInBucket:e};await this.rpcManager.post("storage/deleteFiles",t)}}class Ku{constructor(e){this.options=e,this.destructManager=new Et,(0,V.assertTruthy)(e.appId,"APP_ID_MUST_BE_PROVIDED");for(const e of Object.getOwnPropertyNames(Object.getPrototypeOf(this))){const t=this[e];"function"!=typeof t||"constructor"===e||e.startsWith("_")||(this[e]=t.bind(this))}const t="prod"!==e.environmentId&&e.squidDeveloperId,r=function(e,t,r){return`${Gu(e,t)}${r?`-${r}`:""}`}(e.appId,e.environmentId,t?e.squidDeveloperId:void 0),n=function(e,t){const r={};return ru(e)&&(r["x-squid-appid"]=t),r}(e.region,r);this.clientIdService=new Te(this.destructManager),this.authManager=new ne(e.apiKey,e.authProvider),this.socketManager=new $u(this.clientIdService,e.region,r,e.messageNotificationWrapper,this.destructManager,this.authManager),this.rpcManager=new Lu(e.region,r,this.destructManager,n,this.authManager,this.clientIdService),this.aiClientFactory=new X(this.rpcManager,this.socketManager),this.aiClient=new ee(this.aiClientFactory,this.rpcManager),this.apiClient=new re(this.rpcManager),this.documentStore=new Mt,this.lockManager=new Du,this.distributedLockManager=new wt(this.socketManager,this.destructManager),this.documentIdentityService=new It(this.documentStore,this.destructManager),this.documentReferenceFactory=new At(this.documentIdentityService),this.querySender=new _u(this.rpcManager,this.destructManager),this.observabilityClient=new Bu(this.rpcManager),this.querySubscriptionManager=new Mu(this.rpcManager,this.clientIdService,this.documentStore,this.destructManager,this.documentIdentityService,this.querySender),this.localQueryManager=new mu(this.documentStore,this.documentReferenceFactory,this.querySubscriptionManager);const i=new ou(this.rpcManager,this.lockManager,this.querySender);this.queryBuilderFactory=new Ze(this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.documentIdentityService),this.dataManager=new Ot(this.documentStore,i,this.socketManager,this.querySubscriptionManager,this.queryBuilderFactory,this.lockManager,this.destructManager,this.documentIdentityService,this.querySender),this.collectionReferenceFactory=new ft(this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager,this.dataManager),this.documentReferenceFactory.setDataManager(this.dataManager),this.backendFunctionManager=new Se(this.clientIdService,this.rpcManager),this.nativeQueryManager=new su(this.rpcManager),this.graphqlClientFactory=new iu(this.rpcManager,e.region,r),this.secretClient=new Qu(this.rpcManager),this._connectionDetails=new pt(this.clientIdService,this.socketManager),this.queueManagerFactory=new ju(this.rpcManager,this.socketManager,this.destructManager)}static getInstance(e){const t=me(e);let r=Ku.squidInstancesMap[t];return r||(r=new Ku(e),Ku.squidInstancesMap[t]=r,r)}static getInstances(){return Object.values(Ku.squidInstancesMap)}setAuthProvider(e){this.authManager.setAuthProvider(e)}collection(e,t=Be.built_in_db){return this._validateNotDestructed(),this.collectionReferenceFactory.get(e,t)}runInTransaction(e){return this._validateNotDestructed(),this.dataManager.runInTransaction(e)}executeFunction(e,...t){return this._validateNotDestructed(),(0,o.firstValueFrom)(this.backendFunctionManager.executeFunctionAndSubscribe(e,...t))}executeNativeRelationalQuery(e,t,r={}){const n={type:"relational",query:t,params:r,integrationId:e};return this.nativeQueryManager.executeNativeQuery(n)}executeNativeMongoQuery(e,t,r){const n={type:"mongo",collectionName:t,aggregationPipeline:r,integrationId:e};return this.nativeQueryManager.executeNativeQuery(n)}graphql(e){return this._validateNotDestructed(),this.graphqlClientFactory.get(e)}ai(){return this._validateNotDestructed(),this.aiClient}api(){return this._validateNotDestructed(),this.apiClient}storage(e="built_in_storage"){return this._validateNotDestructed(),new Hu(e,this.rpcManager)}get secrets(){return this.secretClient}get observability(){return this.observabilityClient}acquireLock(e){return this._validateNotDestructed(),this.distributedLockManager.lock(e)}async withLock(e,t){const r=await this.acquireLock(e);try{return await t(r)}finally{r.release()}}queue(e,t=Be.built_in_queue){return this._validateNotDestructed(),this.queueManagerFactory.get(t,e)}async destruct(){return this.destructManager.destruct().finally((()=>{const e=Object.entries(Ku.squidInstancesMap).find((([,e])=>e===this));e&&delete Ku.squidInstancesMap[e[0]]}))}connectionDetails(){return this._validateNotDestructed(),this._connectionDetails}async _unsubscribe(){this.querySubscriptionManager.unsubscribe(),await this.rpcManager.awaitAllSettled()}_validateNotDestructed(){(0,V.assertTruthy)(!this.destructManager.isDestructing,"The client was already destructed.")}internal(){const{rpcManager:e}=this;return{getApplicationUrl:(e,t,r)=>tu(e,t,r),getStaticHeaders:()=>e.getStaticHeaders()}}}Ku.squidInstancesMap={};var Ju=exports;for(var Xu in n)Ju[Xu]=n[Xu];n.__esModule&&Object.defineProperty(Ju,"__esModule",{value:!0})})();
|
|
5
|
+
`})).data}}class iu{constructor(e,t,r){this.rpcManager=e,this.region=t,this.appId=r,this.clientsMap=new Map}get(e){let t=this.clientsMap.get(e);return t||(t=new nu(this.rpcManager,e,this.region,this.appId),this.clientsMap.set(e,t),t)}}class ou{constructor(e,t,r){this.rpcManager=e,this.lockManager=t,this.querySender=r}async sendMutations(e,t){const r=gt(e),n=r.map((e=>`sendMutation_${Ke(e.squidDocIdObj)}`));await this.lockManager.lock(...n),await this.querySender.waitForAllQueriesToFinish();try{const e={mutations:r,integrationId:t};return await this.rpcManager.post("mutation/mutate",e)}catch(e){throw we.debug("Error while sending mutations",{error:e,mutations:JSON.stringify(r,null,2)}),e}finally{this.lockManager.release(...n)}}}class su{constructor(e){this.rpcManager=e}async executeNativeQuery(e){return this.rpcManager.post("native-query/execute",e)}}function au(e,t){switch(t.type){case"simple":return function(e,t){const{query:r,dereference:n}=t,{collectionName:i,integrationId:o}=r;let s=e.collection(i,o).query();return s=uu(s,r),n?s.dereference():s}(e,t);case"join":return function(e,t){const{root:r,joins:n,joinConditions:i,dereference:o,grouped:s}=t,{collectionName:a,integrationId:u}=r.query;let c=e.collection(a,u).joinQuery(r.alias);return c=uu(c,r.query),Object.entries(n).map((([t,r])=>{const{collectionName:n,integrationId:o}=r,{left:s,right:a,leftAlias:u}=i[t];let l=e.collection(n,o).query();l=uu(l,r),c=c.join(l,t,{left:s,right:a},{leftAlias:u})})),o&&s?c.grouped().dereference():o?c.dereference():s?c.grouped():c}(e,t);case"merged":return function(e,t){const{queries:r}=t,{collectionName:n,integrationId:i}=cu(r[0]),o=r.map((t=>au(e,t)));return e.collection(n,i).or(...o)}(e,t)}}function uu(e,t){const{conditions:r,limit:n,sortOrder:i}=t;for(const t of r){if(!("operator"in t))throw new Error("Composite conditions are not support in query serialization.");const{fieldName:r,operator:n,value:i}=t;e.where(r,n,i)}e.limit(n);for(const{fieldName:t,asc:r}of i)e.sortBy(t,r);return e}function cu(e){switch(e.type){case"simple":{const{collectionName:t,integrationId:r}=e.query;return{collectionName:t,integrationId:r}}case"join":{const{collectionName:t,integrationId:r}=e.root.query;return{collectionName:t,integrationId:r}}case"merged":return cu(e.queries[0])}}const lu={"in:in":(e,t)=>e.every((e=>t.includes(e))),"in:not in":(e,t)=>e.every((e=>!t.includes(e))),"not in:not in":(e,t)=>t.every((t=>e.includes(t))),">:not in":(e,t)=>t.every((t=>e>=t)),">=:not in":(e,t)=>t.every((t=>e>t)),"<:not in":(e,t)=>t.every((t=>e<=t)),"<=:not in":(e,t)=>t.every((t=>e<t)),">:>":(e,t)=>e>=t,">=:>":(e,t)=>e>t,"in:>":(e,t)=>e.every((e=>e>t)),">:>=":(e,t)=>e>=t,">=:>=":(e,t)=>e>=t,"in:>=":(e,t)=>e.every((e=>e>=t)),"<:<":(e,t)=>e<=t,"<=:<":(e,t)=>e<t,"in:<":(e,t)=>e.every((e=>e<t)),"<:<=":(e,t)=>e<=t,"<=:<=":(e,t)=>e<=t,"in:<=":(e,t)=>e.every((e=>e<=t)),"like:like":(e,t)=>hu(e.toLowerCase(),t.toLowerCase()),"like_cs:like":(e,t)=>hu(e.toLowerCase(),t.toLowerCase()),"like:like_cs":(e,t)=>hu(e,t)&&fu(t),"like_cs:like_cs":(e,t)=>hu(e,t),"like:not like":(e,t)=>!du(e.toLowerCase(),t.toLowerCase()),"like_cs:not like":(e,t)=>!du(e.toLowerCase(),t.toLowerCase()),"like:not like_cs":(e,t)=>!du(e.toLowerCase(),t.toLowerCase()),"like_cs:not like_cs":(e,t)=>!du(e,t),"not like:like":(e,t)=>vu(e,t),"not like_cs:like":(e,t)=>vu(e,t),"not like:like_cs":(e,t)=>vu(e,t),"not like_cs:like_cs":(e,t)=>vu(e,t),"not like:not like":(e,t)=>hu(t.toLowerCase(),e.toLowerCase()),"not like_cs:not like":(e,t)=>hu(t,e)&&fu(e),"not like:not like_cs":(e,t)=>hu(t.toLowerCase(),e.toLowerCase()),"not like_cs:not like_cs":(e,t)=>hu(t,e),"in:like":(e,t)=>e.every((e=>ut(t,e,"like"))),"in:like_cs":(e,t)=>e.every((e=>ut(t,e,"like_cs"))),"in:not like":(e,t)=>e.every((e=>ut(t,e,"not like"))),"in:not like_cs":(e,t)=>e.every((e=>ut(t,e,"not like_cs"))),"like:in":(e,t)=>!e.includes("%")&&!e.includes("_")&&!!t.find((t=>t.toLowerCase()===e.toLowerCase())),"like_cs:in":(e,t)=>!e.includes("%")&&!e.includes("_")&&t.includes(e),"not like:in":(e,t)=>e.length>0&&pu(e)||yu(e)&&t.includes(""),"not like_cs:in":(e,t)=>e.length>0&&pu(e)||yu(e)&&t.includes(""),"not in:like":(e,t)=>t.length>0&&pu(t)||yu(t)&&e.includes(""),"not in:like_cs":(e,t)=>t.length>0&&pu(t)||yu(t)&&e.includes(""),"not in:not like":(e,t)=>!t.includes("%")&&!t.includes("_")&&!!e.find((e=>e.toLowerCase()===t.toLowerCase())),"not in:not like_cs":(e,t)=>!t.includes("%")&&!t.includes("_")&&e.includes(t),"like:not in":(e,t)=>t.every((t=>ut(e,t,"not like"))),"like_cs:not in":(e,t)=>t.every((t=>ut(e,t,"not like_cs"))),"not like:not in":(e,t)=>t.every((t=>ut(e,t,"like"))),"not like_cs:not in":(e,t)=>t.every((t=>ut(e,t,"like_cs"))),"array_includes_some:array_includes_some":(e,t)=>e.every((e=>t.includes(e))),"array_includes_all:array_includes_all":(e,t)=>e.every((e=>t.includes(e))),"array_not_includes:array_not_includes":(e,t)=>t.every((t=>e.includes(t))),"array_includes_some:array_not_includes":(e,t)=>e.every((e=>!t.includes(e))),"array_not_includes:array_includes_some":(e,t)=>t.every((t=>!e.includes(t))),"array_includes_all:array_includes_some":(e,t)=>e.every((e=>t.includes(e))),"array_includes_some:array_includes_all":(e,t)=>e.every((e=>t.includes(e))),"array_not_includes:array_includes_all":(e,t)=>t.every((t=>!e.includes(t))),"array_includes_all:array_not_includes":(e,t)=>e.every((e=>!t.includes(e)))};function hu(e,t,r=0,n=0){if(n>=t.length)return r>=e.length;if(r>=e.length)return pu(t.substring(n));const i=e[r],o=t[n];return"%"===i&&"%"===o?hu(e,t,r+1,n+1)||hu(e,t,r+1,n):"%"!==i&&("%"===o?hu(e,t,r,n+1)||hu(e,t,r+1,n):(i===o||"_"===o)&&hu(e,t,r+1,n+1))}function du(e,t,r=0,n=0){if(r>=e.length&&n>=t.length)return!0;if(r>=e.length)return pu(t.substring(n));if(n>=t.length)return pu(e.substring(r));const i=r<e.length?e[r]:"",o=n<t.length?t[n]:"";return"%"===i&&"%"===o?du(e,t,r+1,n+1)||du(e,t,r,n+1)||du(e,t,r+1,n):"%"===i||"%"===o?du(e,t,r,n+1)||du(e,t,r+1,n):(i===o||"_"===i||"_"===o)&&du(e,t,r+1,n+1)}function fu(e){return!/[a-zA-Z]/.test(e)}function pu(e){return e.split("").every((e=>"%"===e))}function vu(e,t){return e.length>0&&pu(e)||t.length>0&&pu(t)||yu(e)&&0===t.length}function yu(e){let t=!1,r=!1;for(const n of e)switch(n){case"%":t=!0;break;case"_":if(r)return!1;r=!0;break;default:return!1}return t&&r}class bu{constructor(e){this.query=e,this.query=e,this.parsedConditions=this.parseConditions(this.query.conditions.filter(Ue))}get integrationId(){return this.query.integrationId}get collectionName(){return this.query.collectionName}get limit(){return this.query.limit}sortedBy(e){const t=e.find(((e,t)=>{var r;return!he(this.query.sortOrder[t],Object.assign(Object.assign({},e),{asc:null===(r=e.asc)||void 0===r||r}))}));return!t}sortedByExact(e){return e.length===this.query.sortOrder.length&&this.sortedBy(e)}isSubqueryOf(e,t,r){return this.isSubqueryOfCondition({fieldName:e,operator:t,value:r})}isSubqueryOfCondition(e){return!!this.parsedConditions.filter((t=>t.fieldName===e.fieldName)).find((t=>this.evaluateSubset(t,e)))}isSubqueryOfConditions(e){return this.parseConditions(e).every((e=>this.isSubqueryOfCondition(e)))}isSubqueryOfQuery(e){if(e.collectionName!==this.collectionName||e.integrationId!==this.integrationId)return!1;const t=e.conditions.filter(Ue),r=this.isSubqueryOfConditions(t),n=this.sortedBy(e.sortOrder),i=-1===e.limit||this.limit>-1&&this.limit<e.limit;return r&&n&&i}getConditionsFor(...e){return this.parsedConditions.filter((t=>e.includes(t.fieldName)))}getConditionsForField(e){return this.parsedConditions.filter((t=>t.fieldName===e))}documentMatchesQuery(e){for(const t of this.parsedConditions){const r=t.fieldName,n=t.operator,i=oe(e,r);if("in"===n){if(t.value.includes(i))continue;return!1}if("not in"!==n){if(!ut(t.value,i,n))return!1}else if(t.value.includes(i))return!1}return!0}evaluateSubset(e,t){const{operator:r,value:n}=e,{operator:i,value:o}=this.parseConditions([t])[0],s=lu[`${r}:${i}`];return!!s&&s(n,o)}evaluateIncludes(e,t){const{operator:r,value:n}=e,{operator:i,value:o}=this.parseConditions([t])[0],s=Array.isArray(n)?n.sort():n,a=Array.isArray(o)?o.sort():o;return i===r&&he(a,s)}parseConditions(e){const t=[],r=new Map,n=new Map;return e.forEach((e=>{switch(e.operator){case"==":case"in":r.set(e.fieldName,(r.get(e.fieldName)||[]).concat(e.value));break;case"!=":case"not in":n.set(e.fieldName,(n.get(e.fieldName)||[]).concat(e.value));break;default:t.push(e)}})),r.forEach(((e,r)=>{t.push({fieldName:r,operator:"in",value:e})})),n.forEach(((e,r)=>{t.push({fieldName:r,operator:"not in",value:e})})),t}}class mu{constructor(e,t,r){this.documentStore=e,this.documentReferenceFactory=t,this.querySubscriptionManager=r}peek(e){if(!this.querySubscriptionManager.findValidParentOfQuery(e))return[];const{integrationId:t,collectionName:r}=e,n=new bu(e),i=this.documentReferenceFactory.getDocumentsForCollection(t,r).filter((e=>n.documentMatchesQuery(e.data))),o={};return i.forEach((e=>{o[e.squidDocId]=e})),this.documentStore.sortAndLimitDocs(new Set(Object.keys(o)),e).map((e=>o[Ke(e.__docId__,r,t)]))}}function gu(e,t){return a((function(r,n){var i=0;r.subscribe(L(n,(function(r){return e.call(t,r,i++)&&n.next(r)})))}))}class _u{constructor(e,t){this.rpcManager=e,this.destructManager=t,this.pendingQueryRequests=[],this.safeToSendQueriesToServer=new o.BehaviorSubject(!0),this.inflightQueriesCount=new o.BehaviorSubject(0),this.destructManager.onPreDestruct((()=>{this.preDestruct()}))}async sendQuery(e){const t=new o.Subject,r=(0,o.firstValueFrom)(t);return this.pendingQueryRequests.push({queryRequest:e,responseSubject:t}),this.pendingQueryBatchTimeout&&(clearTimeout(this.pendingQueryBatchTimeout),this.pendingQueryBatchTimeout=void 0),this.pendingQueryRequests.length>=10?(this.processQueryBatch(),r):(this.pendingQueryBatchTimeout=setTimeout((()=>{this.safeToSendQueriesToServer.pipe(gu(Boolean),(0,o.take)(1)).subscribe((()=>{this.processQueryBatch()}))}),0),r)}async processQueryBatch(){const e=this.pendingQueryRequests.splice(0);if(!e.length)return;const t=e.map((({queryRequest:e})=>e)),r=e.map((({responseSubject:e})=>e));this.inflightQueriesCount.next(this.inflightQueriesCount.value+t.length);try{const r=await this.rpcManager.post("query/batchQueries",t);for(const{queryRequest:t,responseSubject:n}of e){const e=t.clientRequestId,i=r.errors[e],o=r.results[e];i?n.error(i):n.next(o)}}catch(e){r.forEach((t=>t.error(e)))}finally{this.inflightQueriesCount.next(this.inflightQueriesCount.value-t.length)}}async waitForAllQueriesToFinish(){return(0,o.firstValueFrom)(this.inflightQueriesCount.pipe(gu((e=>0===e)))).then((()=>{}))}preDestruct(){this.safeToSendQueriesToServer.next(!1),this.safeToSendQueriesToServer.complete()}}var Ou,Su=r(4123);function Eu(e,t,r=((e,t)=>e>t?1:e<t?-1:0),n=0,i=e.length-1){if(i<n)return-1;const o=Math.trunc((n+i)/2);return 0===r(t,e[o])?o:r(t,e[o])>0?Eu(e,t,r,o+1,i):Eu(e,t,r,n,o-1)}function wu(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){if(-1!==Eu(e,t,r))return;let n;for(n=e.length-1;n>=0&&r(e[n],t)>0;n--)e[n+1]=e[n];e[n+1]=t}function Tu(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){const n=Eu(e,t,r);n>-1&&e.splice(n,1)}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.DISABLED=1]="DISABLED",e[e.ENABLED=2]="ENABLED"}(Ou||(Ou={}));const Iu=100,Au=20;class Mu{constructor(e,t,r,n,i,s){this.rpcManager=e,this.clientIdService=t,this.documentStore=r,this.destructManager=n,this.documentIdentityService=i,this.querySender=s,this.onOrphanDocuments=new o.Subject,this.ongoingQueries=new Map,this.clientRequestIdToLocalDocuments=new Map,this.localDocumentToClientRequestIds=new Map,this.queryMappingManager=new ku,this.queryResultsSubject=new o.Subject,this.documentIdentityService.observeChanges().subscribe(this.migrateDocIds.bind(this)),this.clientIdService.observeClientReadyToBeRegenerated().subscribe((()=>{this.refreshOngoingQueries()})),this.destructManager.onPreDestruct((()=>{this.preDestruct()}))}observeQueryResults(){return this.queryResultsSubject.asObservable()}hasOngoingQuery(e){return this.ongoingQueries.has(e)}getQuery(e){return(0,V.truthy)(this.ongoingQueries.get(e),"UNKNOWN_QUERY").query}setGotInitialResult(e){const t=this.ongoingQueries.get(e);(null==t?void 0:t.gotInitialResponse)&&this.removeClientRequestIdMapping(e),t&&(t.gotInitialResponse=!0,t.isInFlight=!1)}findQueriesForDocument(e,t){const{collectionName:r,integrationId:n}=He(t),i=this.queryMappingManager.getMapping(r,n);return i?function(e,t){var r;const n=[...e.unconditional||[]],i=new Map;for(const[n,o]of Object.entries(e.conditional||{})){const e=_e(n);let s;if(Ue(e)){const n=null!==(r=oe(t,e.fieldName))&&void 0!==r?r:null;s=ut(e.value,n,e.operator)}else s=Fu(e,t);if(s)for(const e of o)i.set(e,(i.get(e)||0)+1)}for(const[t,r]of i.entries())r>=e.queriesMetadata[t].condCount&&n.push(t);return n}(i,e):[]}setClientRequestIdsForLocalDoc(e,t){const r=this.localDocumentToClientRequestIds.get(e)||new Set,n=new Set(t?this.findQueriesForDocument(t,e).map((e=>function(e){const t=e.split("_");return{clientId:t[0],clientRequestId:t[1]}}(e).clientRequestId)):[]),i=new Set([...r,...n]);for(const t of[...r]){if(n.has(t))continue;r.delete(t);const i=this.clientRequestIdToLocalDocuments.get(t);i&&(i.delete(e),i.size||this.clientRequestIdToLocalDocuments.delete(t)),r.size||this.localDocumentToClientRequestIds.delete(e)}for(const t of n){let r=this.localDocumentToClientRequestIds.get(e);r||(r=new Set,this.localDocumentToClientRequestIds.set(e,r)),r.add(t);let n=this.clientRequestIdToLocalDocuments.get(t);n||(n=new Set,this.clientRequestIdToLocalDocuments.set(t,n)),n.add(e)}return[...i]}errorOutAllQueries(e,t){const r=this.localDocumentToClientRequestIds.get(e)||new Set;for(const e of r){const r=this.ongoingQueries.get(e);r&&(this.destructManager.isDestructing?r.dataSubject.complete():r.dataSubject.error(t),r.done=!0)}}notifyAllSubscriptions(e){const t=new Set;for(const r of e){const e=this.ongoingQueries.get(r);if(!e)continue;if(!e.gotInitialResponse||!e.activated||e.isInFlight)continue;const n=this.clientRequestIdToLocalDocuments.get(r)||new Set,i=this.documentStore.sortAndLimitDocs(n,e.query),o=e.supportedQueries.map((e=>this.updateOngoingQueryWithNewDataFromSupportingQuery(i,e))).some(Boolean);let s=e;for(;!s.allObservables;)s=(0,V.truthy)(null==s?void 0:s.supportingOngoingQuery);if(o&&t.add(s),e.query.limit>0)switch(e.limitUnderflowState){case Ou.UNKNOWN:e.limitUnderflowState=n.size===e.query.limit+Iu?Ou.ENABLED:Ou.DISABLED;break;case Ou.DISABLED:break;case Ou.ENABLED:if(n.size<e.query.limit+Au){e.limitUnderflowState=Ou.UNKNOWN,this.sendQueryToServerOrUseParentQuery(e);continue}}e.dataSubject.next(i)}for(const e of t){const t=this.collectAllObservables(e);(0,V.truthy)(e.allObservables).next(t)}}isValidParent(e){if(!e.activated||e.isInFlight||e.isEmptyForJoin||e.done||!e.subscribe||!e.gotInitialResponse||!e.dataSubject.value)return!1;const t=-1===e.query.limit?1e3:e.query.limit;return e.dataSubject.value.length<t}findValidParentOfOngoingQuery(e){if(e.forceFetchFromServer)return;const t=new bu(e.query);for(const r of this.ongoingQueries.values()){if(e===r)return;if(this.isValidParent(r)&&t.isSubqueryOfQuery(r.query))return r}}findValidParentOfQuery(e){const t=new bu(e);for(const e of this.ongoingQueries.values())if(this.isValidParent(e)&&t.isSubqueryOfQuery(e.query))return e}processQuery(e,t,r,n,i,s){return(0,o.defer)((()=>{const a=this.createOngoingQueryGraph(e,t,r,n,i,!0);s&&(a.forceFetchFromServer=!0),this.sendQueryToServerOrUseParentQuery(a),a.allObservables=new o.ReplaySubject(1);const u=a.allObservables.pipe((0,o.switchMap)((e=>(0,o.combineLatest)(e).pipe(Q((e=>this.joinResults(e,n,a)))))),gu((()=>this.allOngoingQueriesGotInitialResult(a))),(0,o.startWith)(void 0),(0,o.pairwise)(),gu((([e,t])=>!he(e,t))),Q((([,e])=>e)),i?(0,o.tap)():(0,o.take)(1),(0,o.finalize)((()=>{var e;a.dataSubject.complete(),a.done=!0,this.completeAllSupportedQueries(a).then(),null===(e=a.allObservables)||void 0===e||e.complete()}))),c=this.collectAllObservables(a);return a.allObservables.next(c),u})).pipe((0,o.share)())}hasOngoingQueryForDocId(e){const t=this.localDocumentToClientRequestIds.get(e);return!!t&&!!t.size}removeClientRequestIdMapping(e){const t=this.clientRequestIdToLocalDocuments.get(e);if(!t)return;this.clientRequestIdToLocalDocuments.delete(e);const r=[];for(const n of t){const t=(0,V.truthy)(this.localDocumentToClientRequestIds.get(n));t.delete(e),t.size||(this.localDocumentToClientRequestIds.delete(n),r.push(n))}r.length&&this.onOrphanDocuments.next(r)}registerQueryFinalizer(e){const t=e.clientRequestId,r=lt(this.clientIdService.getClientId(),t);e.dataSubject.pipe((0,o.finalize)((async()=>{if(e.unsubscribeBlockerCount.value>0&&await(0,o.firstValueFrom)((0,o.race)(this.destructManager.observeIsDestructing(),e.unsubscribeBlockerCount.pipe(gu((e=>0===e))))),this.queryMappingManager.removeQuery(r).then(),this.ongoingQueries.delete(t),e.subscribe&&!e.isEmptyForJoin&&e.activated){const r={clientRequestId:t};this.rpcManager.post("query/unsubscribe",r).catch((t=>{this.destructManager.isDestructing||console.error("Got error while unsubscribing from query",e.query,t)}))}this.removeClientRequestIdMapping(t),this.ongoingQueries.delete(t)})),gu(Boolean)).subscribe({error:()=>{}})}createOngoingQueryGraph(e,t,r,n,i,s,a={}){if(a[t])return a[t];const u=U(),c=[],l={clientRequestId:u,activated:s,alias:t,query:e,subscribe:i,dataSubject:new o.BehaviorSubject(null),supportedQueries:c,supportingOngoingQuery:void 0,joinCondition:void 0,gotInitialResponse:!1,isEmptyForJoin:!1,canExpandForJoin:!0,unsubscribeBlockerCount:new o.BehaviorSubject(0),queryRegistered:new o.BehaviorSubject(!1),done:!1,isInFlight:!1,forceFetchFromServer:!1,limitUnderflowState:i?Ou.UNKNOWN:Ou.DISABLED};this.registerQueryFinalizer(l),this.ongoingQueries.set(u,l),a[t]=l;for(const[e,o]of Object.entries(n)){const s=o.leftAlias;if(s!==t&&e!==t)continue;const u=s===t?e:s;if(s===t){const e=this.createOngoingQueryGraph(r[u],u,r,n,i,!1,a);e.joinCondition=o,c.push(e)}else l.supportingOngoingQuery=this.createOngoingQueryGraph(r[u],u,r,n,i,!1,a)}return l}collectAllObservables(e,t=[]){if(e.isEmptyForJoin)return t;const r=e.alias;t.push(e.dataSubject.pipe(gu(Boolean),Q((e=>({docs:e,alias:r})))));for(const r of e.supportedQueries)this.collectAllObservables(r,t);return t}joinResults(e,t,r){const n=e.reduce(((e,t)=>(e[t.alias]?e[t.alias].push(...t.docs):e[t.alias]=[...t.docs],e)),{});let i=n[r.alias].map((e=>({[r.alias]:e})));const o=this.getOngoingQueriesBfs(r),s=new Set;for(let e=1;e<o.length;e++){const r=o[e].alias;s.has(r)||(s.add(r),i=this.join(i,r,n[r],t[r]))}return i}join(e,t,r,n){if(!e.length)return e;const i=Object.keys(e[0]);if(!n||!i.includes(n.leftAlias))throw new Error("No join condition found for alias "+t);const o=new Map;return(r||[]).forEach((e=>{const t=e[n.right];o.has(t)||o.set(t,[]),(0,V.truthy)(o.get(t)).push(e)})),e.flatMap((e=>{var r;const i=o.get(null===(r=e[n.leftAlias])||void 0===r?void 0:r[n.left])||[];return i.length?i.map((r=>Object.assign(Object.assign({},e),{[t]:r}))):n.isInner?[]:[Object.assign(Object.assign({},e),{[t]:void 0})]}))}getOngoingQueriesBfs(e){const t=[],r=[e];for(;r.length;){const e=(0,V.truthy)(r.shift());e.isEmptyForJoin||(t.push(e),r.push(...e.supportedQueries))}return t}updateOngoingQueryWithNewDataFromSupportingQuery(e,t){var r;const n=(0,V.truthy)(t.joinCondition),i=t.query;if(t.activated){if(!t.canExpandForJoin)return!1;const s=(0,V.truthy)(null===(r=t.supportingOngoingQuery)||void 0===r?void 0:r.supportedQueries).filter((e=>e.alias===t.alias)),a=new Set(e.map((e=>{var t;return null!==(t=e[n.left])&&void 0!==t?t:null})));for(const e of s)e.query.conditions.filter(Ue).filter((e=>e.fieldName===n.right)).forEach((e=>{a.delete(e.value)}));if(0===a.size)return!1;const u=fe(i);u.conditions=u.conditions.filter((e=>!Ue(e)||e.fieldName!==n.right)),[...a].forEach((e=>{u.conditions.push({fieldName:n.right,operator:"==",value:e})}));const c=Object.assign(Object.assign({},t),{query:u,activated:!0,gotInitialResponse:!1,dataSubject:new o.BehaviorSubject(null),clientRequestId:U(),isEmptyForJoin:!1});return this.registerQueryFinalizer(c),this.ongoingQueries.set(c.clientRequestId,c),(0,V.truthy)(t.supportingOngoingQuery).supportedQueries.push(c),this.sendQueryToServerOrUseParentQuery(c),!0}{if(t.activated=!0,i.conditions.filter(Ue).filter((e=>e.fieldName===n.right&&"=="===e.operator)).map((e=>e.value)).length)return this.sendQueryToServerOrUseParentQuery(t),t.canExpandForJoin=!1,!0;const r=e.map((e=>{var t;return null!==(t=e[n.left])&&void 0!==t?t:null})).map((e=>({fieldName:n.right,operator:"==",value:e})));return r.length?(i.conditions.push(...r),this.sendQueryToServerOrUseParentQuery(t)):t.isEmptyForJoin=!0,!0}}allOngoingQueriesGotInitialResult(e){return!!e.isEmptyForJoin||!!e.gotInitialResponse&&(!e.supportedQueries.length||e.supportedQueries.every((e=>this.allOngoingQueriesGotInitialResult(e))))}async completeAllSupportedQueries(e){const t=[...e.supportedQueries||[]];for(;t.length;){const e=(0,V.truthy)(t.shift());t.push(...e.supportedQueries||[]),await(0,o.firstValueFrom)(e.unsubscribeBlockerCount.pipe(gu((e=>0===e)))),e.dataSubject.complete()}}preDestruct(){this.unsubscribe()}unsubscribe(){var e;const t=[...this.ongoingQueries.values()];for(const r of t)r.dataSubject.complete(),null===(e=r.allObservables)||void 0===e||e.complete()}hasSubscription(e){var t;return!!(null===(t=this.ongoingQueries.get(e))||void 0===t?void 0:t.subscribe)}sendQueryToServerOrUseParentQuery(e,t=!1){if(this.destructManager.isDestructing)return;const r=e.query,n=e.clientRequestId,i=lt(this.clientIdService.getClientId(),n);this.queryMappingManager.addQuery(r,i),this.ongoingQueries.set(n,e);const o=t?void 0:this.findValidParentOfOngoingQuery(e);o?this.useParentOngoingQuery(e,o).then():this.sendQueryToServer(e)}async useParentOngoingQuery(e,t){const r={clientRequestId:e.clientRequestId,query:e.query,parentClientRequestId:t.clientRequestId},n=new bu(e.query);t.unsubscribeBlockerCount.next(t.unsubscribeBlockerCount.value+1);try{await(0,o.firstValueFrom)(t.queryRegistered.pipe(gu(Boolean)))}catch(t){return this.destructManager.isDestructing?(e.dataSubject.complete(),e.queryRegistered.complete()):(e.dataSubject.error(t),e.queryRegistered.error(t)),void(e.done=!0)}if(this.destructManager.isDestructing)return;if(e.done)return;this.rpcManager.post("query/register",r).then((()=>{e.isInFlight=!1,e.queryRegistered.next(!0)})).catch((r=>{e.isInFlight=!1,this.destructManager.isDestructing?e.dataSubject.complete():(console.error("Query error",e.query,t.query,r),e.dataSubject.error(r)),e.done=!0})).finally((()=>{t.unsubscribeBlockerCount.next(t.unsubscribeBlockerCount.value-1)}));const i=(0,o.race)(e.queryRegistered.pipe(gu(Boolean),(0,o.delay)(2e3),(0,o.take)(1)),this.destructManager.observeIsDestructing().pipe((0,o.take)(1)));t.dataSubject.pipe((0,o.takeWhile)((()=>!e.done)),(0,o.takeUntil)(i),gu(Boolean),(0,o.tap)((()=>{e.gotInitialResponse||this.setGotInitialResult(e.clientRequestId)})),Q((e=>e.filter((e=>n.documentMatchesQuery(e)))))).subscribe({next:t=>{for(const r of t)this.setClientRequestIdsForLocalDoc(Ke(r.__docId__,e.query.collectionName,e.query.integrationId),r);this.notifyAllSubscriptions([e.clientRequestId])},error:t=>{this.destructManager.isDestructing?e.dataSubject.complete():e.dataSubject.error(t)}})}sendQueryToServer(e){const t=e.query.limit,r=t>0&&e.subscribe?t+Iu:t,n={query:Object.assign(Object.assign({},e.query),{limit:r}),clientRequestId:e.clientRequestId,subscribe:e.subscribe};e.isInFlight=!0,this.querySender.sendQuery(n).then((t=>{e.isInFlight=!1,e.queryRegistered.next(!0),this.queryResultsSubject.next(t)})).catch((t=>{e.isInFlight=!1,this.destructManager.isDestructing?(e.dataSubject.complete(),e.queryRegistered.complete()):(we.debug("Query error",e.query,t),e.dataSubject.error(t),e.queryRegistered.error("query failed")),e.done=!0}))}refreshOngoingQueries(){for(const e of this.ongoingQueries.values())this.sendQueryToServerOrUseParentQuery(e,!0)}migrateDocIds(e){const t=Object.keys(e);for(const r of this.clientRequestIdToLocalDocuments.values())t.forEach((t=>{r.has(t)&&(r.delete(t),r.add(e[t]))}));t.forEach((t=>{ce(this.localDocumentToClientRequestIds,t,e[t])}))}}function Fu(e,t){var r;for(const n of e.fields){const e=null!==(r=oe(t,n.fieldName))&&void 0!==r?r:null;if(ut(n.value,e,n.operator))return!0;if(ut(n.value,e,"!="))return!1}return!1}class ku{constructor(){this.stateService=new Su.TrieStore({}),this.querySubscriptionIdToQuery={}}addQuery(e,t){this.stateService.runInBatch((()=>{let r=0;const n=new Set;for(const i of e.conditions){if(Ue(i)&&["=="].includes(i.operator)){const e=Oe(i.fieldName);n.has(e)||(r++,n.add(e))}else r++;const o=this.getConditionStatePath(e,i),s=[...this.stateService.get(o)||[]];wu(s,t),this.stateService.set(o,s)}if(!e.conditions.length){const r=["queryMapping",e.collectionName,e.integrationId,"mapping","unconditional"],n=[...this.stateService.get(r)||[]];wu(n,t),this.stateService.set(r,n)}this.stateService.set([...this.getQueryMetadataStatePath(e,t),"condCount"],r)})),this.querySubscriptionIdToQuery[t]=e}async removeQuery(e){const t=this.querySubscriptionIdToQuery[e];if(t)return this.stateService.runInBatch((()=>{for(const r of t.conditions){const n=this.getConditionStatePath(t,r),i=[...this.stateService.get(n)||[]];Tu(i,e),i.length?this.stateService.set(n,i):this.stateService.delete(n)}if(!t.conditions.length){const r=["queryMapping",t.collectionName,t.integrationId,"mapping","unconditional"],n=[...this.stateService.get(r)||[]];Tu(n,e),this.stateService.set(r,n)}this.stateService.delete(this.getQueryMetadataStatePath(t,e))})),t}getMapping(e,t){return this.stateService.get(["queryMapping",e,t,"mapping"])}getQueryMetadataStatePath(e,t){return["queryMapping",e.collectionName,e.integrationId,"mapping","queriesMetadata",`${t}`]}getConditionStatePath(e,t){return["queryMapping",e.collectionName,e.integrationId,"mapping","conditional",(r=t,me(r))];var r}}class Du{constructor(){this.locks={}}async lock(...e){if(this.canGetLock(...e))return void this.lockSync(...e);const t=Object.entries(this.locks).filter((([t])=>e.includes(t))).map((([,e])=>e));await(0,o.lastValueFrom)((0,o.combineLatest)(t).pipe((0,o.filter)((e=>!e.includes(!0))),(0,o.take)(1))),await this.lock(...e)}release(...e){for(const t of e){const e=(0,V.truthy)(this.locks[t]);e.next(!1),e.complete(),delete this.locks[t]}}canGetLock(...e){return!e.some((e=>{var t;return null===(t=this.locks[e])||void 0===t?void 0:t.value}))}lockSync(...e){(0,V.assertTruthy)(this.canGetLock(...e),"Cannot acquire lock sync");for(const t of e)this.locks[t]=new o.BehaviorSubject(!0)}}class ju{constructor(e,t,r){this.rpcManager=e,this.socketManager=t,this.queueManagers=new Map,this.socketManager.observeNotifications().subscribe((e=>{const t=this.getOrUndefined(e.integrationId,e.topicName);t&&t.onMessages(e.payload)})),r.onPreDestruct((()=>{for(const e of this.queueManagers.values())for(const t of e.values())t.destruct()}))}get(e,t){let r=this.queueManagers.get(e);r||(r=new Map,this.queueManagers.set(e,r));let n=r.get(t);return n||(n=new Pu(e,t,this.rpcManager),r.set(t,n)),n}getOrUndefined(e,t){var r;return null===(r=this.queueManagers.get(e))||void 0===r?void 0:r.get(t)}}const xu="subscriptionMutex";class Pu{constructor(e,t,r){this.integrationId=e,this.topicName=t,this.rpcManager=r,this.messagesSubject=new o.Subject,this.subscriberCount=0,this.lockManager=new Du}async produce(e){await this.lockManager.lock(xu);try{await this.rpcManager.post("queue/produceMessages",{integrationId:this.integrationId,topicName:this.topicName,messages:e})}finally{this.lockManager.release(xu)}}consume(){return(0,o.defer)((()=>(this.subscriberCount++,1===this.subscriberCount&&this.performSubscribe(),this.messagesSubject.asObservable().pipe((0,o.finalize)((()=>{this.subscriberCount--,0===this.subscriberCount&&this.performUnsubscribe()}))))))}async performSubscribe(){await this.lockManager.lock(xu);try{await this.rpcManager.post("queue/subscribe",{integrationId:this.integrationId,topicName:this.topicName})}catch(e){this.messagesSubject.error(e),this.messagesSubject.complete(),this.subscriberCount=0,this.messagesSubject=new o.Subject}finally{this.lockManager.release(xu)}}async performUnsubscribe(){await this.lockManager.lock(xu);try{await this.rpcManager.post("queue/unsubscribe",{integrationId:this.integrationId,topicName:this.topicName})}finally{this.lockManager.release(xu)}}onMessages(e){for(const t of e)this.messagesSubject.next(t)}destruct(){this.messagesSubject.complete()}}class Nu{constructor(e,t){this.capacity=e,this.seconds=t,this.tokens=e,this.refillRatePerMs=e/(1e3*t),this.lastRefillTimestamp=Date.now()}async consume(){this.attemptConsume()||await(0,o.firstValueFrom)((0,o.interval)(10).pipe((0,o.filter)((()=>this.attemptConsume())),(0,o.first)()))}attemptConsume(){return this.refill(),this.tokens>=1&&(this.tokens-=1,!0)}refill(){const e=Date.now(),t=(e-this.lastRefillTimestamp)*this.refillRatePerMs;this.tokens=Math.min(this.tokens+t,this.capacity),this.lastRefillTimestamp=e}}class Cu extends Error{constructor(e,t,r,n,i,o){super(o||`RPC error ${e} ${t} calling ${r}`),this.statusCode=e,this.statusText=t,this.url=r,this.headers=n,this.body=i}}async function Ru(e){const t=await async function({headers:e,files:t,filesFieldName:r,message:n,url:i,extractErrorMessage:o}){const s=new Headers(e),a={method:"POST",headers:s,body:void 0};if(t.length){const e=new FormData;for(const n of t){const t=n instanceof Blob?n:n.blob,i=(Blob,n.name);e.append(r,t,i)}e.append("body",ge(n)),a.body=e}else s.append("Content-Type","application/json"),a.body=ge(n);try{const e=await fetch(i,a),t={};if(e.headers.forEach(((e,r)=>{t[r]=e})),!e.ok){const r=await e.text(),n=qu(r);if(!o)throw new Cu(e.status,e.statusText,i,t,n,r);let s;try{s="string"==typeof n?n:(null==n?void 0:n.message)||r}catch(e){}throw s||(s=e.statusText),new Cu(e.status,e.statusText,i,t,n,s)}const r=await e.text();return we.debug(`received response from url ${i}: ${JSON.stringify(r)}`),{body:r,headers:t,status:e.status,statusText:e.statusText}}catch(e){throw we.debug(`Unable to perform fetch request to url: ${i}`,e),e}}(e);return t.body=qu(t.body),t}function qu(e){if(e){try{return _e(e)}catch(e){}return e}}class Lu{constructor(e,t,r,n,i,s){this.region=e,this.appId=t,this.authManager=i,this.clientIdService=s,this.staticHeaders={},this.onGoingRpcCounter=new o.BehaviorSubject(0);for(const[e,t]of Object.entries(n))this.setStaticHeader(e,t);this.clientIdService.observeClientId().subscribe((e=>{e?this.setStaticHeader("x-squid-clientid",e):this.deleteStaticHeader("x-squid-clientid")})),r.onDestruct((async()=>{await this.awaitAllSettled()}));const a=this.authManager.getApiKey()?5:1;this.rateLimiters={default:new Nu(60*a,5),ai:new Nu(20*a,5),secret:new Nu(20*a,5)}}async getAuthHeaders(){const e=this.authManager.getApiKey();if(e)return{Authorization:`ApiKey ${e}`};const{token:t,integrationId:r}=await this.authManager.getAuthData();if(!t)return{};let n=`Bearer ${t}`;return r&&(n+=`; IntegrationId ${r}`),{Authorization:n}}async awaitAllSettled(){await(0,o.firstValueFrom)(this.onGoingRpcCounter.pipe((0,o.filter)((e=>0===e))))}setStaticHeader(e,t){this.staticHeaders[e]=t}deleteStaticHeader(e){delete this.staticHeaders[e]}getStaticHeaders(){return this.staticHeaders}async post(e,t,r=[],n="files"){return(await this.rawPost(e,t,r,n)).body}async rawPost(e,t,r=[],n="files",i=!0){this.onGoingRpcCounter.next(this.onGoingRpcCounter.value+1);try{await this.getRateLimiterBucket(e).consume();const o=await this.getAuthHeaders(),s=Object.assign(Object.assign({},this.staticHeaders),o);we.debug(`sending request: path: ${e} message: ${JSON.stringify(t)}`);const a=tu(this.region,this.appId,e);return await Ru({url:a,headers:s,message:t,files:r,filesFieldName:n,extractErrorMessage:i})}finally{this.onGoingRpcCounter.next(this.onGoingRpcCounter.value-1)}}getRateLimiterBucket(e){return e.startsWith("ai/chatbot")?(0,V.truthy)(this.rateLimiters.ai,"MISSING_RATE_LIMITER_AI"):e.startsWith("secret/")?(0,V.truthy)(this.rateLimiters.secret,"MISSING_RATE_LIMITER_SECRETS"):(0,V.truthy)(this.rateLimiters.default,"MISSING_RATE_LIMITER_DEFAULT")}}class Bu{constructor(e){this.rpcManager=e}reportMetric(e){const t={metrics:[e]};this.rpcManager.post("/observability/metrics",t)}}class Qu{constructor(e){this.rpcManager=e}async get(e){const t={key:e};return await this.rpcManager.post("secret/get",t)||void 0}getAll(){return this.rpcManager.post("secret/getAll",{})}upsert(e,t){return this.upsertMany([{key:e,value:t}]).then((e=>e[0]))}upsertMany(e){const t={entries:e};return this.rpcManager.post("secret/upsert",t)}delete(e){const t={keys:[e]};return this.rpcManager.post("secret/delete",t)}deleteMany(e){const t={keys:e};return this.rpcManager.post("secret/delete",t)}get apiKeys(){return new Vu(this.rpcManager)}}class Vu{constructor(e){this.rpcManager=e}get(e){const t={key:e};return this.rpcManager.post("secret/api-key/get",t)}getAll(){return this.rpcManager.post("secret/api-key/getAll",{})}upsert(e){const t={key:e};return this.rpcManager.post("secret/api-key/upsert",t)}delete(e){const t={key:e};return this.rpcManager.post("secret/api-key/delete",t)}}const Uu=e=>e();var zu;function Yu(){}const Wu="undefined"!=typeof process&&(null===(zu=process.versions)||void 0===zu?void 0:zu.node)?r(5086):Ee().WebSocket;class $u{constructor(e,t,r,n=Uu,i,s){this.clientIdService=e,this.region=t,this.appId=r,this.messageNotificationWrapper=n,this.destructManager=i,this.authManager=s,this.webSocketObserver=new o.Subject,this.allMessagesObserver=new o.Subject,this.connectionReady=new o.BehaviorSubject(!1),this.seenMessageIds=new Set,this.destructSubject=new o.Subject,this.connectedAtLeastOnce=!1,this.clientTooOldThreshold=3e4,this.destructManager.onDestruct((async()=>{await this.destruct()})),this.setupMessageAcknowledgments(),this.connect(),this.lastTick=new Date,this.tickInterval=setInterval((()=>this.tick()),5e3),this.observeConnectionReady().pipe((0,o.skip)(1),(0,o.filter)((e=>!e)),(0,o.switchMap)((()=>(0,o.race)((0,o.timer)(this.clientTooOldThreshold),this.connectionReady.pipe((0,o.filter)(Boolean)),this.destructManager.observeIsDestructing())))).subscribe((()=>{this.connectionReady.value?we.debug(this.clientIdService.getClientId(),"Client reconnected before becoming too old. Ignoring..."):this.destructManager.isDestructing||(we.debug(this.clientIdService.getClientId(),"Client disconnected for a long period - refreshing"),this.refreshClient())})),this.observeConnectionReady().pipe((0,o.filter)(Boolean)).subscribe((()=>{this.clientIdService.isClientTooOld()&&this.clientIdService.notifyClientNotTooOld()}))}refreshClient(){this.destructManager.isDestructing?we.debug(this.clientIdService.getClientId(),"Client too old but is destructed. Ignoring..."):this.clientIdService.isClientTooOld()?we.debug(this.clientIdService.getClientId(),"Client is already marked as too old. Ignoring..."):(we.debug(this.clientIdService.getClientId(),"Notifying client too old"),this.clientIdService.notifyClientTooOld(),we.debug(this.clientIdService.getClientId(),"Client too old. Reconnecting..."),this.connect())}tick(){Math.abs(Date.now()-this.lastTick.getTime())>this.clientTooOldThreshold&&(we.debug(this.clientIdService.getClientId(),"Tick: Client not responding for a long time. Refreshing..."),this.refreshClient()),this.lastTick=new Date}observeNotifications(){return this.webSocketObserver.asObservable()}observeConnectionReady(){return this.connectionReady.asObservable().pipe((0,o.distinctUntilChanged)())}sendMessage(e){this.sendMessageAsync(e).then()}async sendMessageAsync(e){var t;await(0,o.firstValueFrom)(this.connectionReady.pipe((0,o.filter)(Boolean)));const r=await this.authManager.getToken();if(this.connectionReady.value)try{(0,V.assertTruthy)(this.socket,"Socket is undefined in sendMessageAsync");const t=ge({message:e,authToken:r});we.debug(this.clientIdService.getClientId(),"Sending message to socket: ",t),this.socket.send(t)}catch(r){(null===(t=this.socket)||void 0===t?void 0:t.connected)?console.error("Websocket message is ignored due to a non-recoverable error",r):(this.connectionReady.next(!1),await this.sendMessageAsync(e))}else await this.sendMessageAsync(e)}sendKillMessage(){var e;(null===(e=this.socket)||void 0===e?void 0:e.connected)&&this.socket.send(ge({message:{type:"kill"}}))}closeCurrentSocketSilently(){if(this.socket)try{this.socket.close()}catch(e){}}connect(){this.closeCurrentSocketSilently(),this.connectionReady.value&&this.connectionReady.next(!1);const e=tu(this.region,this.appId,"ws/general").replace("https","wss").replace("http","ws"),t=this.clientIdService.getClientId();we.debug(this.clientIdService.getClientId(),"Connecting to socket at:",e);const r=`${e}?clientId=${t}`;this.socket=function(e,t={}){let r,n=0,i=1;const o={connected:!1,closeCalled:!1,open(){var i;const s=null!==(i=null==Wu?void 0:Wu.WebSocket)&&void 0!==i?i:Wu;r=new s(e,t.protocols||[]),r.onmessage=t.onmessage?e=>{e.data&&t.onmessage?t.onmessage(e):console.log("No data received from websockets, please contact support@squid.cloud with this message.")}:Yu,r.onopen=function(e){o.connected=!0,(t.onopen||Yu)(e),n=0},r.onclose=function(e){if(o.connected=!1,4999!==e.code&&4001!==e.code)return we.debug("WebSocket closed. Reconnecting. Close code: ",e.code),(t.onclose||Yu)(e),void o.reconnect(e);(t.onclose||Yu)(e)},r.onerror=function(e){o.connected=!1,e&&"ECONNREFUSED"===e.code?o.reconnect(e):o.closeCalled||(t.onerror||Yu)(e)}},reconnect(e){const r=void 0!==t.maxAttempts?t.maxAttempts:1/0;i&&n++<r?i=setTimeout((function(){(t.onreconnect||Yu)(e),we.debug("WebSocket trying to reconnect..."),o.open()}),t.timeoutMillis||1e3):(t.onmaximum||Yu)(e)},json(e){r.send(JSON.stringify(e))},send(e){r.send(e)},close(e=4999,t){o.closeCalled=!0;try{o.connected=!1,clearTimeout(i),i=void 0,r.close(e,t)}catch(e){}}};return o.open(),o}(r,{timeoutMillis:1e4,onmessage:e=>this.onMessage(e.data),onopen:()=>{we.debug(this.clientIdService.getClientId(),`Connection to socket established. Endpoint: ${e}`)},onreconnect:()=>{we.debug(t,"WebSocket reconnect event triggered"),this.clientIdService.getClientId()===t?this.connectionReady.value&&this.connectionReady.next(!1):we.debug(t,`WebSocket reconnect event triggered - ignored because the client id changed. Old: ${this.clientIdService.getClientId()}`)},onclose:()=>{we.debug(t,"WebSocket onclose event triggered"),this.clientIdService.getClientId()===t?this.connectionReady.value&&this.connectionReady.next(!1):we.debug(t,`WebSocket onclose event triggered - ignored because the client id changed. new: ${this.clientIdService.getClientId()}`)},onerror:e=>console.error("WebSocket error:",e)})}disconnectForTest(){var e;this.connectionReady.next(!1),null===(e=this.socket)||void 0===e||e.close(4998)}onConnectionReady(){this.connectionReady.next(!0),this.connectedAtLeastOnce?this.sendMessage({type:"catchup"}):this.connectedAtLeastOnce=!0}onMessage(e){if("connectionReady"===e)return we.debug(this.clientIdService.getClientId(),"Got socket message: connectionReady"),void this.onConnectionReady();const t=_e(e);for(const e of t)this.allMessagesObserver.next(e),this.seenMessageIds.has(e.messageId)||(this.seenMessageIds.add(e.messageId),we.debug(this.clientIdService.getClientId(),new Date,"Got socket message",JSON.stringify(e,null,2)),this.messageNotificationWrapper((()=>{this.webSocketObserver.next(e)})))}setupMessageAcknowledgments(){const e=new o.Subject;this.allMessagesObserver.subscribe((t=>{(null==t?void 0:t.messageId)&&e.next(t.messageId)}));const t=[];e.pipe((0,o.tap)((e=>t.push(e))),(0,o.debounceTime)(100)).subscribe((async()=>{const e=[...t.splice(0)];this.sendMessage({type:"acknowledge",payload:e})}))}async destruct(){this.sendKillMessage(),await(0,o.firstValueFrom)((0,o.timer)(0)),this.connectionReady.next(!1),await(0,o.firstValueFrom)((0,o.timer)(0)),clearInterval(this.tickInterval),this.closeCurrentSocketSilently(),this.webSocketObserver.complete(),this.allMessagesObserver.complete(),this.destructSubject.next()}}function Gu(e,t){return`${function(e){(0,V.assertString)(e,"Invalid application ID");const[t,r,n,i]=e.split("-");return(0,V.assertTruthy)(!i,`Invalid application ID: ${e}`),{appId:t,environmentId:null!=r?r:"prod",squidDeveloperId:n}}(e).appId}${t&&"prod"!==t?`-${t}`:""}`}class Hu{constructor(e="built_in_storage",t){this.integrationId=e,this.rpcManager=t}async uploadFile(e,t,r){const n={integrationId:this.integrationId,dirPathInBucket:e,expirationInSeconds:r};await this.rpcManager.post("storage/uploadFile",n,[t])}async getFileMetadata(e){const t={integrationId:this.integrationId,filePathInBucket:e};return await this.rpcManager.post("storage/getFileMetadata",t)}async getDownloadUrl(e,t){const r={integrationId:this.integrationId,filePathInBucket:e,urlExpirationInSeconds:t};return await this.rpcManager.post("storage/getDownloadUrl",r)}async listDirectoryContents(e){const t={integrationId:this.integrationId,dirPathInBucket:e};return await this.rpcManager.post("storage/listDirectoryContents",t)}async deleteFile(e){await this.deleteFiles([e])}async deleteFiles(e){const t={integrationId:this.integrationId,filePathsInBucket:e};await this.rpcManager.post("storage/deleteFiles",t)}}class Ku{constructor(e){this.rpcManager=e}async extractDataFromDocumentFile(e,t){return await this.rpcManager.post("documentExtraction/extractDataFromDocumentFile",t,[e])}}class Ju{constructor(e){this.options=e,this.destructManager=new Et,(0,V.assertTruthy)(e.appId,"APP_ID_MUST_BE_PROVIDED");for(const e of Object.getOwnPropertyNames(Object.getPrototypeOf(this))){const t=this[e];"function"!=typeof t||"constructor"===e||e.startsWith("_")||(this[e]=t.bind(this))}const t="prod"!==e.environmentId&&e.squidDeveloperId,r=function(e,t,r){return`${Gu(e,t)}${r?`-${r}`:""}`}(e.appId,e.environmentId,t?e.squidDeveloperId:void 0),n=function(e,t){const r={};return ru(e)&&(r["x-squid-appid"]=t),r}(e.region,r);this.clientIdService=new Te(this.destructManager),this.authManager=new ne(e.apiKey,e.authProvider),this.socketManager=new $u(this.clientIdService,e.region,r,e.messageNotificationWrapper,this.destructManager,this.authManager),this.rpcManager=new Lu(e.region,r,this.destructManager,n,this.authManager,this.clientIdService),this.aiClientFactory=new X(this.rpcManager,this.socketManager),this.aiClient=new ee(this.aiClientFactory,this.rpcManager),this.apiClient=new re(this.rpcManager),this.documentStore=new Mt,this.lockManager=new Du,this.distributedLockManager=new wt(this.socketManager,this.destructManager),this.documentIdentityService=new It(this.documentStore,this.destructManager),this.documentReferenceFactory=new At(this.documentIdentityService),this.querySender=new _u(this.rpcManager,this.destructManager),this.observabilityClient=new Bu(this.rpcManager),this.querySubscriptionManager=new Mu(this.rpcManager,this.clientIdService,this.documentStore,this.destructManager,this.documentIdentityService,this.querySender),this.localQueryManager=new mu(this.documentStore,this.documentReferenceFactory,this.querySubscriptionManager);const i=new ou(this.rpcManager,this.lockManager,this.querySender);this.queryBuilderFactory=new Ze(this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.documentIdentityService),this.dataManager=new Ot(this.documentStore,i,this.socketManager,this.querySubscriptionManager,this.queryBuilderFactory,this.lockManager,this.destructManager,this.documentIdentityService,this.querySender),this.collectionReferenceFactory=new ft(this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager,this.dataManager),this.documentReferenceFactory.setDataManager(this.dataManager),this.backendFunctionManager=new Se(this.clientIdService,this.rpcManager),this.nativeQueryManager=new su(this.rpcManager),this.graphqlClientFactory=new iu(this.rpcManager,e.region,r),this.secretClient=new Qu(this.rpcManager),this._connectionDetails=new pt(this.clientIdService,this.socketManager),this.queueManagerFactory=new ju(this.rpcManager,this.socketManager,this.destructManager)}static getInstance(e){const t=me(e);let r=Ju.squidInstancesMap[t];return r||(r=new Ju(e),Ju.squidInstancesMap[t]=r,r)}static getInstances(){return Object.values(Ju.squidInstancesMap)}setAuthProvider(e){this.authManager.setAuthProvider(e)}collection(e,t=Be.built_in_db){return this._validateNotDestructed(),this.collectionReferenceFactory.get(e,t)}runInTransaction(e){return this._validateNotDestructed(),this.dataManager.runInTransaction(e)}executeFunction(e,...t){return this._validateNotDestructed(),(0,o.firstValueFrom)(this.backendFunctionManager.executeFunctionAndSubscribe(e,...t))}executeNativeRelationalQuery(e,t,r={}){const n={type:"relational",query:t,params:r,integrationId:e};return this.nativeQueryManager.executeNativeQuery(n)}executeNativeMongoQuery(e,t,r){const n={type:"mongo",collectionName:t,aggregationPipeline:r,integrationId:e};return this.nativeQueryManager.executeNativeQuery(n)}graphql(e){return this._validateNotDestructed(),this.graphqlClientFactory.get(e)}ai(){return this._validateNotDestructed(),this.aiClient}api(){return this._validateNotDestructed(),this.apiClient}storage(e="built_in_storage"){return this._validateNotDestructed(),new Hu(e,this.rpcManager)}extraction(){return this._validateNotDestructed(),new Ku(this.rpcManager)}get secrets(){return this.secretClient}get observability(){return this.observabilityClient}acquireLock(e){return this._validateNotDestructed(),this.distributedLockManager.lock(e)}async withLock(e,t){const r=await this.acquireLock(e);try{return await t(r)}finally{r.release()}}queue(e,t=Be.built_in_queue){return this._validateNotDestructed(),this.queueManagerFactory.get(t,e)}async destruct(){return this.destructManager.destruct().finally((()=>{const e=Object.entries(Ju.squidInstancesMap).find((([,e])=>e===this));e&&delete Ju.squidInstancesMap[e[0]]}))}connectionDetails(){return this._validateNotDestructed(),this._connectionDetails}async _unsubscribe(){this.querySubscriptionManager.unsubscribe(),await this.rpcManager.awaitAllSettled()}_validateNotDestructed(){(0,V.assertTruthy)(!this.destructManager.isDestructing,"The client was already destructed.")}internal(){const{rpcManager:e}=this;return{getApplicationUrl:(e,t,r)=>tu(e,t,r),getStaticHeaders:()=>e.getStaticHeaders()}}}Ju.squidInstancesMap={};var Xu=exports;for(var Zu in n)Xu[Zu]=n[Zu];n.__esModule&&Object.defineProperty(Xu,"__esModule",{value:!0})})();
|