@squidcloud/client 1.0.211 → 1.0.213
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 +3 -3
- package/dist/internal-common/src/public-types/ai-chatbot.public-types.d.ts +19 -0
- package/dist/internal-common/src/public-types/regions.public-types.d.ts +2 -2
- package/dist/internal-common/src/public-types-backend/ai-chatbot.public-context.d.ts +0 -19
- package/dist/internal-common/src/public-types-backend/bundle-api.public-types.d.ts +2 -1
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +4 -4
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -14
- package/dist/typescript-client/src/ai-chatbot-client.d.ts +1 -2
- package/dist/typescript-client/src/public-types-deprecated.d.ts +1 -15
- package/package.json +1 -1
- package/dist/internal-common/src/types/application.types.d.ts +0 -1
- package/dist/internal-common/src/types/backend-run.types.d.ts +0 -1
- package/dist/internal-common/src/types/bundle-data.types.d.ts +0 -1
- package/dist/internal-common/src/types/integrations/ai_chatbot.types.d.ts +0 -1
- package/dist/internal-common/src/types/integrations/api.types.d.ts +0 -1
- package/dist/internal-common/src/types/integrations/auth.types.d.ts +0 -1
- package/dist/internal-common/src/types/integrations/database.types.d.ts +0 -1
- package/dist/internal-common/src/types/integrations/observability.types.d.ts +0 -1
- package/dist/internal-common/src/types/integrations/queue-types.d.ts +0 -1
- package/dist/internal-common/src/types/integrations/schemas.d.ts +0 -1
- package/dist/internal-common/src/types/integrations/storage-types.d.ts +0 -1
- package/dist/internal-common/src/types/openapi.types.d.ts +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(()=>{"use strict";var e={8278:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3910: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(8599);t.default=o.PromisePool,i(r(8278),t),i(r(8599),t),i(r(5607),t),i(r(6784),t),i(r(9446),t),i(r(4204),t)},5607:(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},4027:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePoolExecutor=void 0;const n=r(8599),i=r(5607),o=r(9446),s=r(4204);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())}}},8599:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePool=void 0;const n=r(4027);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")},6784:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9446:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StopThePromisePoolError=void 0;class r extends Error{}t.StopThePromisePoolError=r},4204:(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},8975: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(3355),t)},6676:(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(9862),i=r(4356);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},4810:(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(6676),i=r(4356);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}`)}},4356:(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(6676),i=r(9862);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)))}},9862:(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}},7122:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateRecord=t.validateArray=t.validateObject=t.tryCatch=void 0;const n=r(6676);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)))}},3355: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(6676),t),i(r(4810),t),i(r(4356),t),i(r(9862),t),i(r(7122),t)},511: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(7965),t)},7965:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TrieStore=void 0;const n=r(74),i=r(1964),o=r(9978),s=r(4843);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}}},74:(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(8975);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},4843: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(1419),t)},1419:(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")},7257:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncSubject=void 0;var o=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 i(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(9520).Subject);t.AsyncSubject=o},8042:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.BehaviorSubject=void 0;var o=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return i(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(9520).Subject);t.BehaviorSubject=o},3868:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeNotification=t.Notification=t.NotificationKind=void 0;var n,i=r(1727),o=r(7443),s=r(859),a=r(4432);(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},3380:(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},5271:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var n=r(1403),i=r(7215),o=r(2138),s=r(5966),a=r(3782),u=r(4432),c=r(4770),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},216:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ReplaySubject=void 0;var o=r(9520),s=r(1713),a=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=s.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 i(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}(o.Subject);t.ReplaySubject=a},3980:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Scheduler=void 0;var n=r(1713),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},9520:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=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 s=r(5271),a=r(7215),u=r(7392),c=r(2447),l=r(4770),h=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 i(t,e),t.prototype.lift=function(e){var t=new d(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new u.ObjectUnsubscribedError},t.prototype.next=function(e){var t=this;l.errorContext((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=o(t.currentObservers),s=i.next();!s.done;s=i.next())s.value.next(e)}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;l.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;l.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?a.EMPTY_SUBSCRIPTION:(this.currentObservers=null,o.push(e),new a.Subscription((function(){t.currentObservers=null,c.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 s.Observable;return e.source=this,e},t.create=function(e,t){return new d(e,t)},t}(s.Observable);t.Subject=h;var d=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return i(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:a.EMPTY_SUBSCRIPTION},t}(h);t.AnonymousSubject=d},1403:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_OBSERVER=t.SafeSubscriber=t.Subscriber=void 0;var o=r(4432),s=r(7215),a=r(3782),u=r(7234),c=r(5729),l=r(3380),h=r(8972),d=r(4770),f=function(e){function r(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,s.isSubscription(r)&&r.add(n)):n.destination=t.EMPTY_OBSERVER,n}return i(r,e),r.create=function(e,t,r){return new b(e,t,r)},r.prototype.next=function(e){this.isStopped?g(l.nextNotification(e),this):this._next(e)},r.prototype.error=function(e){this.isStopped?g(l.errorNotification(e),this):(this.isStopped=!0,this._error(e))},r.prototype.complete=function(){this.isStopped?g(l.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}(s.Subscription);t.Subscriber=f;var p=Function.prototype.bind;function v(e,t){return p.call(e,t)}var y=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){m(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){m(e)}else m(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){m(e)}},e}(),b=function(e){function t(t,r,n){var i,s,u=e.call(this)||this;return o.isFunction(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:u&&a.config.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},i={next:t.next&&v(t.next,s),error:t.error&&v(t.error,s),complete:t.complete&&v(t.complete,s)}):i=t,u.destination=new y(i),u}return i(t,e),t}(f);function m(e){a.config.useDeprecatedSynchronousErrorHandling?d.captureError(e):u.reportUnhandledError(e)}function g(e,t){var r=a.config.onStoppedNotification;r&&h.timeoutProvider.setTimeout((function(){return r(e,t)}))}t.SafeSubscriber=b,t.EMPTY_OBSERVER={closed:!0,next:c.noop,error:function(e){throw e},complete:c.noop}},7215: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(4432),a=r(5463),u=r(2447),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)}},3782:(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}},3739:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectableObservable=void 0;var o=r(5271),s=r(7215),a=r(2711),u=r(5079),c=r(4024),l=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,c.hasLift(t)&&(n.lift=t.lift),n}return i(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 s.Subscription;var r=this.getSubject();t.add(this.source.subscribe(u.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=s.Subscription.EMPTY)}return t},t.prototype.refCount=function(){return a.refCount()(this)},t}(o.Observable);t.ConnectableObservable=l},1047:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestInit=t.combineLatest=void 0;var n=r(5271),i=r(4744),o=r(6216),s=r(9144),a=r(4666),u=r(2619),c=r(1589),l=r(5079),h=r(5421);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},79:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concat=void 0;var n=r(4554),i=r(2619),o=r(6216);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)))}},1727:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.empty=t.EMPTY=void 0;var n=r(5271);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}},6216:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.from=void 0;var n=r(3200),i=r(9451);t.from=function(e,t){return t?n.scheduled(e,t):i.innerFrom(e)}},2160:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromSubscribable=void 0;var n=r(5271);t.fromSubscribable=function(e){return new n.Observable((function(t){return e.subscribe(t)}))}},9451: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(8219),u=r(2644),c=r(5271),l=r(3292),h=r(7707),d=r(4883),f=r(6380),p=r(9266),v=r(4432),y=r(7234),b=r(2138);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 w(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 w(e)}throw d.createInvalidObservableTypeError(e)},t.fromInteropObservable=m,t.fromArrayLike=g,t.fromPromise=_,t.fromIterable=O,t.fromAsyncIterable=S,t.fromReadableStreamLike=w},4449:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.interval=void 0;var n=r(4617),i=r(5710);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)}},7443:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.of=void 0;var n=r(2619),i=r(6216);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)}},1282:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.onErrorResumeNext=void 0;var n=r(5271),i=r(4475),o=r(5079),s=r(5729),a=r(9451);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()}))}},7779:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.raceInit=t.race=void 0;var n=r(5271),i=r(9451),o=r(4475),s=r(5079);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},859:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throwError=void 0;var n=r(5271),i=r(4432);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)}},5710:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timer=void 0;var n=r(5271),i=r(4617),o=r(6551),s=r(7761);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)}))}},2042: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(5271),s=r(9451),a=r(4475),u=r(1727),c=r(5079),l=r(2619);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}},5079:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.OperatorSubscriber=t.createOperatorSubscriber=void 0;var o=r(1403);t.createOperatorSubscriber=function(e,t,r,n,i){return new s(e,t,r,n,i)};var s=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 i(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}(o.Subscriber);t.OperatorSubscriber=s},3533:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.audit=void 0;var n=r(4024),i=r(9451),o=r(5079);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()})))}))}},5188:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.auditTime=void 0;var n=r(4617),i=r(3533),o=r(5710);t.auditTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.audit((function(){return o.timer(e,t)}))}},4514:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.buffer=void 0;var n=r(4024),i=r(5729),o=r(5079),s=r(9451);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}}))}},2537: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(4024),o=r(5079),s=r(2447);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})))}))}},8720: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(7215),o=r(4024),s=r(5079),a=r(2447),u=r(4617),c=r(2619),l=r(5421);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)}))}},7932: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(7215),o=r(4024),s=r(9451),a=r(5079),u=r(5729),c=r(2447);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()})))}))}},1445:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bufferWhen=void 0;var n=r(4024),i=r(5729),o=r(5079),s=r(9451);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})))}))}},4418:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.catchError=void 0;var n=r(9451),i=r(5079),o=r(4024);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))}))}},4163:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineAll=void 0;var n=r(9893);t.combineAll=n.combineLatestAll},8169: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(1047),s=r(4024),a=r(4475),u=r(4666),c=r(5966),l=r(2619);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)}))}},9893:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestAll=void 0;var n=r(1047),i=r(7534);t.combineLatestAll=function(e){return i.joinAllInternals(n.combineLatest,e)}},7230: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(8169);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)))}},4098: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(4024),s=r(4554),a=r(2619),u=r(6216);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)}))}},4554:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatAll=void 0;var n=r(4594);t.concatAll=function(){return n.mergeAll(1)}},1048:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatMap=void 0;var n=r(9010),i=r(4432);t.concatMap=function(e,t){return i.isFunction(t)?n.mergeMap(e,t,1):n.mergeMap(e,1)}},381:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatMapTo=void 0;var n=r(1048),i=r(4432);t.concatMapTo=function(e,t){return i.isFunction(t)?n.concatMap((function(){return e}),t):n.concatMap((function(){return e}))}},4724: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(4098);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)))}},4347:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.connect=void 0;var n=r(9520),i=r(9451),o=r(4024),s=r(2160),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))}))}},6944:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.count=void 0;var n=r(1386);t.count=function(e){return n.reduce((function(t,r,n){return!e||e(r,n)?t+1:t}),0)}},440:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0;var n=r(4024),i=r(5729),o=r(5079),s=r(9451);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})))}))}},8157:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounceTime=void 0;var n=r(4617),i=r(4024),o=r(5079);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})))}))}},1714:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultIfEmpty=void 0;var n=r(4024),i=r(5079);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()})))}))}},1030:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0;var n=r(4617),i=r(6405),o=r(5710);t.delay=function(e,t){void 0===t&&(t=n.asyncScheduler);var r=o.timer(e,t);return i.delayWhen((function(){return r}))}},6405:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.delayWhen=void 0;var n=r(79),i=r(7138),o=r(3470),s=r(4791),a=r(9010),u=r(9451);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))}))}},9142:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dematerialize=void 0;var n=r(3868),i=r(4024),o=r(5079);t.dematerialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){return n.observeNotification(e,t)})))}))}},2307:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinct=void 0;var n=r(4024),i=r(5079),o=r(5729),s=r(9451);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))}))}},9131:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilChanged=void 0;var n=r(9144),i=r(4024),o=r(5079);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))})))}))}},6659:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilKeyChanged=void 0;var n=r(9131);t.distinctUntilKeyChanged=function(e,t){return n.distinctUntilChanged((function(r,n){return t?t(r[e],n[e]):r[e]===n[e]}))}},4217:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.elementAt=void 0;var n=r(6809),i=r(2763),o=r(8062),s=r(1714),a=r(7138);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})))}}},4707: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(79),s=r(7443);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))))}}},9276:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.every=void 0;var n=r(4024),i=r(5079);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()})))}))}},337:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaust=void 0;var n=r(3977);t.exhaust=n.exhaustAll},3977:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustAll=void 0;var n=r(368),i=r(9144);t.exhaustAll=function(){return n.exhaustMap(i.identity)}},368:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustMap=void 0;var n=r(4338),i=r(9451),o=r(4024),s=r(5079);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()})))}))}},7829:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.expand=void 0;var n=r(4024),i=r(7163);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)}))}},2763:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.filter=void 0;var n=r(4024),i=r(5079);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)})))}))}},4106:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.finalize=void 0;var n=r(4024);t.finalize=function(e){return n.operate((function(t,r){try{t.subscribe(r)}finally{r.add(e)}}))}},8759:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createFind=t.find=void 0;var n=r(4024),i=r(5079);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},3999:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findIndex=void 0;var n=r(4024),i=r(8759);t.findIndex=function(e,t){return n.operate(i.createFind(e,t,"index"))}},5194:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.first=void 0;var n=r(8032),i=r(2763),o=r(7138),s=r(1714),a=r(8062),u=r(9144);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})))}}},2735:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.flatMap=void 0;var n=r(9010);t.flatMap=n.mergeMap},1664:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.groupBy=void 0;var n=r(5271),i=r(9451),o=r(9520),s=r(4024),a=r(5079);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)}))}},3470:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ignoreElements=void 0;var n=r(4024),i=r(5079),o=r(5729);t.ignoreElements=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,o.noop))}))}},9549:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var n=r(4024),i=r(5079);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()})))}))}},7534:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.joinAllInternals=void 0;var n=r(9144),i=r(4666),o=r(5966),s=r(9010),a=r(2378);t.joinAllInternals=function(e,t){return o.pipe(a.toArray(),s.mergeMap((function(t){return e(t)})),t?i.mapOneOrManyArgs(t):n.identity)}},9582:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.last=void 0;var n=r(8032),i=r(2763),o=r(4288),s=r(8062),a=r(1714),u=r(9144);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})))}}},4338:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.map=void 0;var n=r(4024),i=r(5079);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++))})))}))}},4791:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mapTo=void 0;var n=r(4338);t.mapTo=function(e){return n.map((function(){return e}))}},9318:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.materialize=void 0;var n=r(3868),i=r(4024),o=r(5079);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()})))}))}},7446:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.max=void 0;var n=r(1386),i=r(4432);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})}},6094: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(4024),s=r(4475),a=r(4594),u=r(2619),c=r(6216);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)}))}},4594:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=void 0;var n=r(9010),i=r(9144);t.mergeAll=function(e){return void 0===e&&(e=1/0),n.mergeMap(i.identity,e)}},7163:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeInternals=void 0;var n=r(9451),i=r(5421),o=r(5079);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()}}},9010:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMap=void 0;var n=r(4338),i=r(9451),o=r(4024),s=r(7163),a=r(4432);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)})))}},8983:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMapTo=void 0;var n=r(9010),i=r(4432);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))}},2170:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeScan=void 0;var n=r(4024),i=r(7163);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}))}))}},3674: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(6094);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)))}},1446:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.min=void 0;var n=r(1386),i=r(4432);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})}},2318:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.multicast=void 0;var n=r(3739),i=r(4432),o=r(4347);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)}}},3165:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeOn=void 0;var n=r(5421),i=r(4024),o=r(5079);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)})))}))}},2216: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(4475),s=r(1282);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},402:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pairwise=void 0;var n=r(4024),i=r(5079);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})))}))}},5960:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.partition=void 0;var n=r(1574),i=r(2763);t.partition=function(e,t){return function(r){return[i.filter(e,t)(r),i.filter(n.not(e,t))(r)]}}},5658:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pluck=void 0;var n=r(4338);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}))}},3881:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publish=void 0;var n=r(9520),i=r(2318),o=r(4347);t.publish=function(e){return e?function(t){return o.connect(e)(t)}:function(e){return i.multicast(new n.Subject)(e)}}},1755:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishBehavior=void 0;var n=r(8042),i=r(3739);t.publishBehavior=function(e){return function(t){var r=new n.BehaviorSubject(e);return new i.ConnectableObservable(t,(function(){return r}))}}},9801:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishLast=void 0;var n=r(7257),i=r(3739);t.publishLast=function(){return function(e){var t=new n.AsyncSubject;return new i.ConnectableObservable(e,(function(){return t}))}}},5021:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishReplay=void 0;var n=r(216),i=r(2318),o=r(4432);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)}}},2749: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(4475),s=r(9925);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))))}},9925: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(7779),s=r(4024),a=r(9144);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}},1386:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reduce=void 0;var n=r(2181),i=r(4024);t.reduce=function(e,t){return i.operate(n.scanInternals(e,t,arguments.length>=2,!1,!0))}},2711:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.refCount=void 0;var n=r(4024),i=r(5079);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())}))}},1194:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeat=void 0;var n=r(1727),i=r(4024),o=r(5079),s=r(9451),a=r(5710);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()}))}},7085:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeatWhen=void 0;var n=r(9451),i=r(9520),o=r(4024),s=r(5079);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()}))}},7524:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retry=void 0;var n=r(4024),i=r(5079),o=r(9144),s=r(5710),a=r(9451);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()}))}},548:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retryWhen=void 0;var n=r(9451),i=r(9520),o=r(4024),s=r(5079);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()}))}},6577:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sample=void 0;var n=r(9451),i=r(4024),o=r(5729),s=r(5079);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))}))}},3815:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sampleTime=void 0;var n=r(4617),i=r(6577),o=r(4449);t.sampleTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.sample(o.interval(e,t))}},7250:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scan=void 0;var n=r(4024),i=r(2181);t.scan=function(e,t){return n.operate(i.scanInternals(e,t,arguments.length>=2,!0))}},2181:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scanInternals=void 0;var n=r(5079);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()}))}}},842:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sequenceEqual=void 0;var n=r(4024),i=r(5079),o=r(9451);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))}))}},9728: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(9451),s=r(9520),a=r(1403),u=r(4024);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)}}},7768:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.shareReplay=void 0;var n=r(216),i=r(9728);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})}},2445:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.single=void 0;var n=r(8032),i=r(6228),o=r(1137),s=r(4024),a=r(5079);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)})))}))}},6262:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skip=void 0;var n=r(2763);t.skip=function(e){return n.filter((function(t,r){return e<=r}))}},7397:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipLast=void 0;var n=r(9144),i=r(4024),o=r(5079);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}}))}},9900:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipUntil=void 0;var n=r(4024),i=r(5079),o=r(9451),s=r(5729);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)})))}))}},1620:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipWhile=void 0;var n=r(4024),i=r(5079);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)})))}))}},3424:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.startWith=void 0;var n=r(79),i=r(2619),o=r(4024);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)}))}},831:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.subscribeOn=void 0;var n=r(4024);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))}))}},411:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchAll=void 0;var n=r(7222),i=r(9144);t.switchAll=function(){return n.switchMap(i.identity)}},7222:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchMap=void 0;var n=r(9451),i=r(4024),o=r(5079);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()})))}))}},6464:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchMapTo=void 0;var n=r(7222),i=r(4432);t.switchMapTo=function(e,t){return i.isFunction(t)?n.switchMap((function(){return e}),t):n.switchMap((function(){return e}))}},4434:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchScan=void 0;var n=r(7222),i=r(4024);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}}))}},7138:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.take=void 0;var n=r(1727),i=r(4024),o=r(5079);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())})))}))}},4288: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(1727),o=r(4024),s=r(5079);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})))}))}},7341:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.takeUntil=void 0;var n=r(4024),i=r(5079),o=r(9451),s=r(5729);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)}))}},653:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.takeWhile=void 0;var n=r(4024),i=r(5079);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()})))}))}},8668:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tap=void 0;var n=r(4432),i=r(4024),o=r(5079),s=r(9144);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}},9466:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=void 0;var n=r(4024),i=r(5079),o=r(9451);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()})))}))}},9705:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throttleTime=void 0;var n=r(4617),i=r(9466),o=r(5710);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)}},8062:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfEmpty=void 0;var n=r(8032),i=r(4024),o=r(5079);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())})))}))}},6610:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeInterval=t.timeInterval=void 0;var n=r(4617),i=r(4024),o=r(5079);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},6279:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeout=t.TimeoutError=void 0;var n=r(4617),i=r(7761),o=r(4024),s=r(9451),a=r(9876),u=r(5079),c=r(5421);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)}))}},8132:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutWith=void 0;var n=r(4617),i=r(7761),o=r(6279);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})}},4553:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timestamp=void 0;var n=r(1713),i=r(4338);t.timestamp=function(e){return void 0===e&&(e=n.dateTimestampProvider),i.map((function(t){return{value:t,timestamp:e.now()}}))}},2378:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toArray=void 0;var n=r(1386),i=r(4024),o=function(e,t){return e.push(t),e};t.toArray=function(){return i.operate((function(e,t){n.reduce(o,[])(e).subscribe(t)}))}},4768:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.window=void 0;var n=r(9520),i=r(4024),o=r(5079),s=r(5729),a=r(9451);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}}))}},131: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(9520),o=r(4024),s=r(5079);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})))}))}},9579:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.windowTime=void 0;var n=r(9520),i=r(4617),o=r(7215),s=r(4024),a=r(5079),u=r(2447),c=r(2619),l=r(5421);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}}))}},752: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(9520),o=r(7215),s=r(4024),a=r(9451),u=r(5079),c=r(5729),l=r(2447);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()})))}))}},582:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.windowWhen=void 0;var n=r(9520),i=r(4024),o=r(5079),s=r(9451);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})))}))}},4255: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(4024),s=r(5079),a=r(9451),u=r(9144),c=r(5729),l=r(2619);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)}})))}))}},3253: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(2042),s=r(4024);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)}))}},7220:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.zipAll=void 0;var n=r(2042),i=r(7534);t.zipAll=function(e){return i.joinAllInternals(n.zip,e)}},9287: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(3253);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)))}},3584:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleArray=void 0;var n=r(5271);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())}))}))}},1659:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleAsyncIterable=void 0;var n=r(5271),i=r(5421);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)}))}))}},8840:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleIterable=void 0;var n=r(5271),i=r(5686),o=r(4432),s=r(5421);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()}}))}},5704:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleObservable=void 0;var n=r(9451),i=r(3165),o=r(831);t.scheduleObservable=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},4644:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.schedulePromise=void 0;var n=r(9451),i=r(3165),o=r(831);t.schedulePromise=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},3035:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleReadableStreamLike=void 0;var n=r(1659),i=r(9266);t.scheduleReadableStreamLike=function(e,t){return n.scheduleAsyncIterable(i.readableStreamLikeToAsyncGenerator(e),t)}},3200:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduled=void 0;var n=r(5704),i=r(4644),o=r(3584),s=r(8840),a=r(1659),u=r(3292),c=r(2644),l=r(8219),h=r(6380),d=r(7707),f=r(4883),p=r(9266),v=r(3035);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)}},4756:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Action=void 0;var o=function(e){function t(t,r){return e.call(this)||this}return i(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(r(7215).Subscription);t.Action=o},1172:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncAction=void 0;var o=r(4756),s=r(9678),a=r(2447),u=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 i(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),s.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&&s.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,a.arrRemove(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(o.Action);t.AsyncAction=u},6759:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncScheduler=void 0;var o=r(3980),s=function(e){function t(t,r){void 0===r&&(r=o.Scheduler.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return i(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}(o.Scheduler);t.AsyncScheduler=s},4617:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.async=t.asyncScheduler=void 0;var n=r(1172),i=r(6759);t.asyncScheduler=new i.AsyncScheduler(n.AsyncAction),t.async=t.asyncScheduler},1713:(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}},9678: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}},8972: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}},5686:(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()},2138:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observable=void 0,t.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},6809:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentOutOfRangeError=void 0;var n=r(9876);t.ArgumentOutOfRangeError=n.createErrorClass((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}}))},8032:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyError=void 0;var n=r(9876);t.EmptyError=n.createErrorClass((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}))},1137:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NotFoundError=void 0;var n=r(9876);t.NotFoundError=n.createErrorClass((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}}))},7392:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectUnsubscribedError=void 0;var n=r(9876);t.ObjectUnsubscribedError=n.createErrorClass((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}))},6228:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SequenceError=void 0;var n=r(9876);t.SequenceError=n.createErrorClass((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}))},5463:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnsubscriptionError=void 0;var n=r(9876);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}}))},2619:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.popNumber=t.popScheduler=t.popResultSelector=void 0;var n=r(4432),i=r(6551);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}},4744:(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}}},4475:(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}},2447:(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)}}},9876:(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}},1589:(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}),{})}},4770:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.captureError=t.errorContext=void 0;var n=r(3782),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)}},5421:(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}},9144:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.identity=void 0,t.identity=function(e){return e}},8219:(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}},7707:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isAsyncIterable=void 0;var n=r(4432);t.isAsyncIterable=function(e){return Symbol.asyncIterator&&n.isFunction(null==e?void 0:e[Symbol.asyncIterator])}},7761:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isValidDate=void 0,t.isValidDate=function(e){return e instanceof Date&&!isNaN(e)}},4432:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e}},3292:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isInteropObservable=void 0;var n=r(2138),i=r(4432);t.isInteropObservable=function(e){return i.isFunction(e[n.observable])}},6380:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isIterable=void 0;var n=r(5686),i=r(4432);t.isIterable=function(e){return i.isFunction(null==e?void 0:e[n.iterator])}},2644:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isPromise=void 0;var n=r(4432);t.isPromise=function(e){return n.isFunction(null==e?void 0:e.then)}},9266: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(4432);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)}},6551:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isScheduler=void 0;var n=r(4432);t.isScheduler=function(e){return e&&n.isFunction(e.schedule)}},4024:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.operate=t.hasLift=void 0;var n=r(4432);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")}}},4666: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(4338),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)}))}},5729:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.noop=void 0,t.noop=function(){}},1574:(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)}}},5966:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pipeFromArray=t.pipe=void 0;var n=r(9144);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},7234:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reportUnhandledError=void 0;var n=r(3782),i=r(8972);t.reportUnhandledError=function(e){i.timeoutProvider.setTimeout((function(){var t=n.config.onUnhandledError;if(!t)throw e;t(e)}))}},4883:(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.")}},9978:(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(3533);Object.defineProperty(t,"audit",{enumerable:!0,get:function(){return n.audit}});var i=r(5188);Object.defineProperty(t,"auditTime",{enumerable:!0,get:function(){return i.auditTime}});var o=r(4514);Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return o.buffer}});var s=r(2537);Object.defineProperty(t,"bufferCount",{enumerable:!0,get:function(){return s.bufferCount}});var a=r(8720);Object.defineProperty(t,"bufferTime",{enumerable:!0,get:function(){return a.bufferTime}});var u=r(7932);Object.defineProperty(t,"bufferToggle",{enumerable:!0,get:function(){return u.bufferToggle}});var c=r(1445);Object.defineProperty(t,"bufferWhen",{enumerable:!0,get:function(){return c.bufferWhen}});var l=r(4418);Object.defineProperty(t,"catchError",{enumerable:!0,get:function(){return l.catchError}});var h=r(4163);Object.defineProperty(t,"combineAll",{enumerable:!0,get:function(){return h.combineAll}});var d=r(9893);Object.defineProperty(t,"combineLatestAll",{enumerable:!0,get:function(){return d.combineLatestAll}});var f=r(8169);Object.defineProperty(t,"combineLatest",{enumerable:!0,get:function(){return f.combineLatest}});var p=r(7230);Object.defineProperty(t,"combineLatestWith",{enumerable:!0,get:function(){return p.combineLatestWith}});var v=r(4098);Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return v.concat}});var y=r(4554);Object.defineProperty(t,"concatAll",{enumerable:!0,get:function(){return y.concatAll}});var b=r(1048);Object.defineProperty(t,"concatMap",{enumerable:!0,get:function(){return b.concatMap}});var m=r(381);Object.defineProperty(t,"concatMapTo",{enumerable:!0,get:function(){return m.concatMapTo}});var g=r(4724);Object.defineProperty(t,"concatWith",{enumerable:!0,get:function(){return g.concatWith}});var _=r(4347);Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return _.connect}});var O=r(6944);Object.defineProperty(t,"count",{enumerable:!0,get:function(){return O.count}});var S=r(440);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return S.debounce}});var w=r(8157);Object.defineProperty(t,"debounceTime",{enumerable:!0,get:function(){return w.debounceTime}});var E=r(1714);Object.defineProperty(t,"defaultIfEmpty",{enumerable:!0,get:function(){return E.defaultIfEmpty}});var T=r(1030);Object.defineProperty(t,"delay",{enumerable:!0,get:function(){return T.delay}});var I=r(6405);Object.defineProperty(t,"delayWhen",{enumerable:!0,get:function(){return I.delayWhen}});var A=r(9142);Object.defineProperty(t,"dematerialize",{enumerable:!0,get:function(){return A.dematerialize}});var F=r(2307);Object.defineProperty(t,"distinct",{enumerable:!0,get:function(){return F.distinct}});var M=r(9131);Object.defineProperty(t,"distinctUntilChanged",{enumerable:!0,get:function(){return M.distinctUntilChanged}});var k=r(6659);Object.defineProperty(t,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return k.distinctUntilKeyChanged}});var D=r(4217);Object.defineProperty(t,"elementAt",{enumerable:!0,get:function(){return D.elementAt}});var j=r(4707);Object.defineProperty(t,"endWith",{enumerable:!0,get:function(){return j.endWith}});var x=r(9276);Object.defineProperty(t,"every",{enumerable:!0,get:function(){return x.every}});var P=r(337);Object.defineProperty(t,"exhaust",{enumerable:!0,get:function(){return P.exhaust}});var N=r(3977);Object.defineProperty(t,"exhaustAll",{enumerable:!0,get:function(){return N.exhaustAll}});var R=r(368);Object.defineProperty(t,"exhaustMap",{enumerable:!0,get:function(){return R.exhaustMap}});var C=r(7829);Object.defineProperty(t,"expand",{enumerable:!0,get:function(){return C.expand}});var q=r(2763);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return q.filter}});var L=r(4106);Object.defineProperty(t,"finalize",{enumerable:!0,get:function(){return L.finalize}});var B=r(8759);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return B.find}});var Q=r(3999);Object.defineProperty(t,"findIndex",{enumerable:!0,get:function(){return Q.findIndex}});var V=r(5194);Object.defineProperty(t,"first",{enumerable:!0,get:function(){return V.first}});var U=r(1664);Object.defineProperty(t,"groupBy",{enumerable:!0,get:function(){return U.groupBy}});var z=r(3470);Object.defineProperty(t,"ignoreElements",{enumerable:!0,get:function(){return z.ignoreElements}});var Y=r(9549);Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return Y.isEmpty}});var W=r(9582);Object.defineProperty(t,"last",{enumerable:!0,get:function(){return W.last}});var $=r(4338);Object.defineProperty(t,"map",{enumerable:!0,get:function(){return $.map}});var G=r(4791);Object.defineProperty(t,"mapTo",{enumerable:!0,get:function(){return G.mapTo}});var H=r(9318);Object.defineProperty(t,"materialize",{enumerable:!0,get:function(){return H.materialize}});var K=r(7446);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return K.max}});var J=r(6094);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return J.merge}});var X=r(4594);Object.defineProperty(t,"mergeAll",{enumerable:!0,get:function(){return X.mergeAll}});var Z=r(2735);Object.defineProperty(t,"flatMap",{enumerable:!0,get:function(){return Z.flatMap}});var ee=r(9010);Object.defineProperty(t,"mergeMap",{enumerable:!0,get:function(){return ee.mergeMap}});var te=r(8983);Object.defineProperty(t,"mergeMapTo",{enumerable:!0,get:function(){return te.mergeMapTo}});var re=r(2170);Object.defineProperty(t,"mergeScan",{enumerable:!0,get:function(){return re.mergeScan}});var ne=r(3674);Object.defineProperty(t,"mergeWith",{enumerable:!0,get:function(){return ne.mergeWith}});var ie=r(1446);Object.defineProperty(t,"min",{enumerable:!0,get:function(){return ie.min}});var oe=r(2318);Object.defineProperty(t,"multicast",{enumerable:!0,get:function(){return oe.multicast}});var se=r(3165);Object.defineProperty(t,"observeOn",{enumerable:!0,get:function(){return se.observeOn}});var ae=r(2216);Object.defineProperty(t,"onErrorResumeNext",{enumerable:!0,get:function(){return ae.onErrorResumeNext}});var ue=r(402);Object.defineProperty(t,"pairwise",{enumerable:!0,get:function(){return ue.pairwise}});var ce=r(5960);Object.defineProperty(t,"partition",{enumerable:!0,get:function(){return ce.partition}});var le=r(5658);Object.defineProperty(t,"pluck",{enumerable:!0,get:function(){return le.pluck}});var he=r(3881);Object.defineProperty(t,"publish",{enumerable:!0,get:function(){return he.publish}});var de=r(1755);Object.defineProperty(t,"publishBehavior",{enumerable:!0,get:function(){return de.publishBehavior}});var fe=r(9801);Object.defineProperty(t,"publishLast",{enumerable:!0,get:function(){return fe.publishLast}});var pe=r(5021);Object.defineProperty(t,"publishReplay",{enumerable:!0,get:function(){return pe.publishReplay}});var ve=r(2749);Object.defineProperty(t,"race",{enumerable:!0,get:function(){return ve.race}});var ye=r(9925);Object.defineProperty(t,"raceWith",{enumerable:!0,get:function(){return ye.raceWith}});var be=r(1386);Object.defineProperty(t,"reduce",{enumerable:!0,get:function(){return be.reduce}});var me=r(1194);Object.defineProperty(t,"repeat",{enumerable:!0,get:function(){return me.repeat}});var ge=r(7085);Object.defineProperty(t,"repeatWhen",{enumerable:!0,get:function(){return ge.repeatWhen}});var _e=r(7524);Object.defineProperty(t,"retry",{enumerable:!0,get:function(){return _e.retry}});var Oe=r(548);Object.defineProperty(t,"retryWhen",{enumerable:!0,get:function(){return Oe.retryWhen}});var Se=r(2711);Object.defineProperty(t,"refCount",{enumerable:!0,get:function(){return Se.refCount}});var we=r(6577);Object.defineProperty(t,"sample",{enumerable:!0,get:function(){return we.sample}});var Ee=r(3815);Object.defineProperty(t,"sampleTime",{enumerable:!0,get:function(){return Ee.sampleTime}});var Te=r(7250);Object.defineProperty(t,"scan",{enumerable:!0,get:function(){return Te.scan}});var Ie=r(842);Object.defineProperty(t,"sequenceEqual",{enumerable:!0,get:function(){return Ie.sequenceEqual}});var Ae=r(9728);Object.defineProperty(t,"share",{enumerable:!0,get:function(){return Ae.share}});var Fe=r(7768);Object.defineProperty(t,"shareReplay",{enumerable:!0,get:function(){return Fe.shareReplay}});var Me=r(2445);Object.defineProperty(t,"single",{enumerable:!0,get:function(){return Me.single}});var ke=r(6262);Object.defineProperty(t,"skip",{enumerable:!0,get:function(){return ke.skip}});var De=r(7397);Object.defineProperty(t,"skipLast",{enumerable:!0,get:function(){return De.skipLast}});var je=r(9900);Object.defineProperty(t,"skipUntil",{enumerable:!0,get:function(){return je.skipUntil}});var xe=r(1620);Object.defineProperty(t,"skipWhile",{enumerable:!0,get:function(){return xe.skipWhile}});var Pe=r(3424);Object.defineProperty(t,"startWith",{enumerable:!0,get:function(){return Pe.startWith}});var Ne=r(831);Object.defineProperty(t,"subscribeOn",{enumerable:!0,get:function(){return Ne.subscribeOn}});var Re=r(411);Object.defineProperty(t,"switchAll",{enumerable:!0,get:function(){return Re.switchAll}});var Ce=r(7222);Object.defineProperty(t,"switchMap",{enumerable:!0,get:function(){return Ce.switchMap}});var qe=r(6464);Object.defineProperty(t,"switchMapTo",{enumerable:!0,get:function(){return qe.switchMapTo}});var Le=r(4434);Object.defineProperty(t,"switchScan",{enumerable:!0,get:function(){return Le.switchScan}});var Be=r(7138);Object.defineProperty(t,"take",{enumerable:!0,get:function(){return Be.take}});var Qe=r(4288);Object.defineProperty(t,"takeLast",{enumerable:!0,get:function(){return Qe.takeLast}});var Ve=r(7341);Object.defineProperty(t,"takeUntil",{enumerable:!0,get:function(){return Ve.takeUntil}});var Ue=r(653);Object.defineProperty(t,"takeWhile",{enumerable:!0,get:function(){return Ue.takeWhile}});var ze=r(8668);Object.defineProperty(t,"tap",{enumerable:!0,get:function(){return ze.tap}});var Ye=r(9466);Object.defineProperty(t,"throttle",{enumerable:!0,get:function(){return Ye.throttle}});var We=r(9705);Object.defineProperty(t,"throttleTime",{enumerable:!0,get:function(){return We.throttleTime}});var $e=r(8062);Object.defineProperty(t,"throwIfEmpty",{enumerable:!0,get:function(){return $e.throwIfEmpty}});var Ge=r(6610);Object.defineProperty(t,"timeInterval",{enumerable:!0,get:function(){return Ge.timeInterval}});var He=r(6279);Object.defineProperty(t,"timeout",{enumerable:!0,get:function(){return He.timeout}});var Ke=r(8132);Object.defineProperty(t,"timeoutWith",{enumerable:!0,get:function(){return Ke.timeoutWith}});var Je=r(4553);Object.defineProperty(t,"timestamp",{enumerable:!0,get:function(){return Je.timestamp}});var Xe=r(2378);Object.defineProperty(t,"toArray",{enumerable:!0,get:function(){return Xe.toArray}});var Ze=r(4768);Object.defineProperty(t,"window",{enumerable:!0,get:function(){return Ze.window}});var et=r(131);Object.defineProperty(t,"windowCount",{enumerable:!0,get:function(){return et.windowCount}});var tt=r(9579);Object.defineProperty(t,"windowTime",{enumerable:!0,get:function(){return tt.windowTime}});var rt=r(752);Object.defineProperty(t,"windowToggle",{enumerable:!0,get:function(){return rt.windowToggle}});var nt=r(582);Object.defineProperty(t,"windowWhen",{enumerable:!0,get:function(){return nt.windowWhen}});var it=r(4255);Object.defineProperty(t,"withLatestFrom",{enumerable:!0,get:function(){return it.withLatestFrom}});var ot=r(3253);Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return ot.zip}});var st=r(7220);Object.defineProperty(t,"zipAll",{enumerable:!0,get:function(){return st.zipAll}});var at=r(9287);Object.defineProperty(t,"zipWith",{enumerable:!0,get:function(){return at.zipWith}})},1964:e=>{e.exports=require("rxjs")},5352: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_IMAGE_GENERATION_MODEL_NAMES:()=>Te,AI_MODEL_NAMES:()=>Ee,ALL_OPERATORS:()=>Pe,AiAssistantClient:()=>e,AiChatbotClient:()=>Y,AiChatbotClientFactory:()=>H,AiChatbotContextReference:()=>$,AiChatbotInstructionReference:()=>G,AiChatbotProfileReference:()=>W,AiClient:()=>J,AiImageClient:()=>K,ApiClient:()=>Z,ApiKeysSecretClient:()=>Du,ApiManager:()=>me,AuthManager:()=>ge,BackendFunctionManager:()=>_e,BaseQueryBuilder:()=>Ye,Changes:()=>Ge,ClientConnectionState:()=>Ce,ClientIdService:()=>we,CollectionReference:()=>rt,CollectionReferenceFactory:()=>it,ConnectionDetails:()=>ot,CronExpression:()=>Ie,DEFAULT_SHORT_ID_LENGTH:()=>V,DataManager:()=>ht,DestructManager:()=>ft,DistributedLockImpl:()=>vt,DistributedLockManager:()=>pt,DocumentReference:()=>Qe,DocumentReferenceFactory:()=>bt,DocumentStore:()=>mt,ENVIRONMENT_IDS:()=>Ae,FETCH_BEYOND_LIMIT:()=>yu,GraphQLClient:()=>$a,GraphQLClientFactory:()=>Ga,HttpStatus:()=>Me,IntegrationSchemaType:()=>De,IntegrationType:()=>ke,JoinQueryBuilder:()=>He,LIMIT_UNDERFLOW_TRIGGER:()=>bu,LimitUnderflowState:()=>hu,LocalQueryManager:()=>uu,MutationSender:()=>Ha,NOOP_FN:()=>ju,NativeQueryManager:()=>Ka,Pagination:()=>Ue,QueryBuilder:()=>$e,QueryBuilderFactory:()=>ze,QuerySender:()=>lu,QuerySubscriptionManager:()=>mu,QueueManagerFactory:()=>Su,QueueManagerImpl:()=>Eu,RateLimiter:()=>Tu,RpcError:()=>Iu,RpcManager:()=>Mu,SQUID_REGIONS:()=>Ne,SUPPORTED_SQUID_REGIONS:()=>Re,SecretClient:()=>ku,SocketManager:()=>Ru,Squid:()=>Lu,StorageClient:()=>qu,allEnvironmentIds:()=>Fe,deserializeQuery:()=>Ja,generateId:()=>Q,generateShortId:()=>z,isSimpleCondition:()=>xe,rawSquidHttpPost:()=>Au,tryDeserializing:()=>Fu});class e{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){const i={assistantId:e,threadId:t,prompt:r,fileIds:n};return(await this.rpcManager.post("ai/assistant/queryAssistant",i)).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 t=r(1964);function i(e){return"function"==typeof e}function o(e){return function(t){if(function(e){return i(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 s=function(e,t){return s=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])},s(e,t)};function a(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}s(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=function(){return u=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},u.apply(this,arguments)};function c(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 l(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 h(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 d(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 f(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 p(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 v,y,b=(v=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}},(y=v((function(e){Error.call(e),e.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),y.prototype.constructor=y,y);function m(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var g=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,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=d(s),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 s.remove(this);var c=this.initialTeardown;if(i(c))try{c()}catch(e){o=e instanceof b?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var h=d(l),v=h.next();!v.done;v=h.next()){var y=v.value;try{_(y)}catch(e){o=null!=o?o:[],e instanceof b?o=p(p([],f(o)),f(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(o)throw new b(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)_(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)&&m(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&m(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function _(e){i(e)?e():e.unsubscribe()}g.EMPTY;var O=null,S=null,w=!1,E=!1,T={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=T.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,p([e,t],f(r))):setTimeout.apply(void 0,p([e,t],f(r)))},clearTimeout:function(e){var t=T.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function I(){}var A=F("C",void 0,void 0);function F(e,t,r){return{kind:e,value:t,error:r}}var M=function(e){function t(t){var r,n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,((r=t)instanceof g||r&&"closed"in r&&i(r.remove)&&i(r.add)&&i(r.unsubscribe))&&t.add(n)):n.destination=R,n}return a(t,e),t.create=function(e,t,r){return new x(e,t,r)},t.prototype.next=function(e){this.isStopped?N(function(e){return F("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?N(F("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?N(A,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}(g),k=Function.prototype.bind;function D(e,t){return k.call(e,t)}var j=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){P(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){P(e)}else P(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){P(e)}},e}(),x=function(e){function t(t,r,n){var o,s,a=e.call(this)||this;return i(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:a&&E?((s=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},o={next:t.next&&D(t.next,s),error:t.error&&D(t.error,s),complete:t.complete&&D(t.complete,s)}):o=t,a.destination=new j(o),a}return a(t,e),t}(M);function P(e){w||function(e){T.setTimeout((function(){if(!O)throw e;O(e)}))}(e)}function N(e,t){var r=S;r&&T.setTimeout((function(){return r(e,t)}))}var R={closed:!0,next:I,error:function(e){throw e},complete:I};function C(e,t,r,n,i){return new q(e,t,r,n,i)}var q=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 a(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}(M);function L(e,t){return o((function(r,n){var i=0;r.subscribe(C(n,(function(r){n.next(e.call(t,r,i++))})))}))}var B=r(8975);function Q(){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 V=18,U="abcdefghijklmnopqrstuvwxyz0123456789";function z(e=V,t=""){(0,B.assertTruthy)(t.length<e,"ID prefix is too long");let r="";for(let t=0;t<e;t++)r+=U.charAt(Math.floor(Math.random()*U.length));return t.length>0&&(r=t+r.substring(t.length)),r}class Y{constructor(e,r,n){this.rpcManager=e,this.socketManager=r,this.integrationId=n,this.ongoingChatSequences={},this.socketManager.observeNotifications().pipe((0,t.filter)((e=>"aiChatbot"===e.type)),L((e=>e))).subscribe((e=>{this.handleChatResponse(e).then()}))}profile(e){return new W(this,this.integrationId,e)}async mutate(e,t){await this.rpcManager.post("ai/chatbot/mutate",e,t?[t]:[])}chat(e,r,n){const i=Q(),o=void 0===(null==n?void 0:n.smoothTyping)||n.smoothTyping;let s="";const a=new t.Subject,u=new t.Subject;this.ongoingChatSequences[i]=u;let c=-1;u.pipe((0,t.tap)((({tokenIndex:e})=>{void 0!==e&&e<c&&console.warn("Received token index out of order",e,c),void 0!==e&&(c=e)})),(0,t.concatMap)((({value:e,complete:r})=>r?(0,t.of)({value:e,complete:r}):(0,t.of)(e).pipe(o?(0,t.delay)(5):(0,t.tap)(),L((e=>({value:e,complete:!1})))))),(0,t.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:r,options:n,integrationId:this.integrationId,clientRequestId:i};return this.rpcManager.post("ai/chatbot/chat",l).catch((e=>{a.error(e),a.complete()})),a.pipe((0,t.finalize)((()=>{delete this.ongoingChatSequences[i]})),(0,t.share)())}ask(e,r,n){return(0,t.lastValueFrom)(this.chat(e,r,Object.assign(Object.assign({},n||{}),{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 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 W{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 $(this.client,this.integrationId,this.profileId,e)}instruction(e){return new G(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 ${constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||Q()}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 G{constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||Q()}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 H{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 Y(this.rpcManager,this.socketManager,e),this.chatbotsMap.set(e,t),t)}}class K{constructor(e){this.rpcManager=e}async generate(e,t){const r={prompt:e,options:t};return this.rpcManager.post("ai/image/generate",r)}}class J{constructor(t,r){this.aiChatbotClientFactory=t,this.rpcManager=r,this.aiAssistantClient=new e(this.rpcManager)}chatbot(e){return this.aiChatbotClientFactory.getChatbot(e)}assistant(){return this.aiAssistantClient}image(){return new K(this.rpcManager)}executeAiQuery(e,t){const r={integrationId:e,prompt:t};return this.rpcManager.post("aiData/executeAiQuery",r)}}const X={headers:{},queryParams:{},pathParams:{}};class Z{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({},X),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)}}const ee=/[.\[\]]/;function te(e,t){if(!e)return;const r=t.split(ee);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 re(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ne(e,t,r,n="."){var i;const o=t.split(n);let s=e;for(;o.length;){const e=(0,B.truthy)(o.shift());if(o.length){const t=s[e],r=re(t)&&null!==(i=le(t))&&void 0!==i?i:{};s[e]=r,s=r}else s[e]=r}}function ie(e,t,r="."){var n;const i=t.split(r);let o=e;for(;i.length;){const e=(0,B.truthy)(i.shift());if(i.length){const t=re(o[e])&&null!==(n=le(o[e]))&&void 0!==n?n:{};o[e]=t,o=t}else delete o[e]}}function oe(e,t,r){if(e.has(t)){const n=e.get(t);e.delete(t),e.set(r,n)}}function se(e){return null==e}function ae(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)||!ae(e[r],t[r]))return!1;return!0}function ue(e,t){const r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=ce(e[n],t);return r}function ce(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 ue(e,t);if(e instanceof Map)return new Map(ue(Array.from(e),t));if(e instanceof Set)return new Set(ue(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]=ce(e[r],t));return i}function le(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 he(e,t){if(e===t||se(e)&&se(t))return 0;if(se(e))return-1;if(se(t))return 1;const r=typeof e,n=typeof t;return r!==n?r<n?-1:1:"number"==typeof e?((0,B.assertTruthy)("number"==typeof t),isNaN(e)&&isNaN(t)?0:isNaN(e)?-1:isNaN(t)?1:e<t?-1:1):"boolean"==typeof e?((0,B.assertTruthy)("boolean"==typeof t),e<t?-1:1):"bigint"==typeof e?((0,B.assertTruthy)("bigint"==typeof t),e<t?-1:1):"string"==typeof e?((0,B.assertTruthy)("string"==typeof t),e.localeCompare(t)):e instanceof Date&&t instanceof Date?Math.sign(e.getTime()-t.getTime()):0}function de(e,t){return e.reduce(((e,r)=>{const n=t(r);return e[n]?e[n].push(r):e[n]=[r],e}),{})}function fe(e){if(Array.isArray(e))return e.map((e=>fe(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]=fe(e[t])})),r}function pe(e){return ve(fe(e))}function ve(e){if(void 0===e)return null;const t=ce(e,(e=>function(e){return"[object Date]"===Object.prototype.toString.call(e)}(e)?{$date:e.toISOString()}:void 0));return JSON.stringify(t)}function ye(e){return ce(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 be(e){if(void 0===e)throw new Error("INVALID_ENCODE_VALUE");const t=ve(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 me{constructor(e,t){this.clientIdService=e,this.rpcManager=t}callApiAndSubscribe(e,r,n,i,o){const s={integrationId:e,endpointId:r,request:n,options:i};return(0,t.race)((0,t.from)(this.rpcManager.post("api/call",s,o?[o]:void 0,o?"file":void 0)).pipe(L((e=>{const t=e.payload?ye(e.payload):void 0;if(e.success)return t;throw new Error(`Got error while calling API (HTTP Status ${e.httpStatus}). Message: ${e.payload}`)}))),this.clientIdService.observeClientTooOld().pipe(L((()=>{throw new Error("CLIENT_NOT_CONNECTED")}))))}}class ge{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}}class _e{constructor(e,t){this.clientIdService=e,this.rpcManager=t}executeFunctionAndSubscribe(e,...r){const n=[],i=[];r.forEach((e=>{"undefined"!=typeof File&&e instanceof File?n.push(e):i.push(e)}));const o={functionName:e,paramsArrayStr:ve(i)},s=`backend-function/execute?${encodeURIComponent(e)}`;return(0,t.race)((0,t.from)(this.rpcManager.post(s,o,n.length>0?n:[])).pipe(L((e=>{if(!e.success)throw new Error(e.payload);return ye(e.payload)}))),this.clientIdService.observeClientTooOld().pipe(L((()=>{throw new Error("CLIENT_NOT_CONNECTED")}))))}}function Oe(){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 Se{static log(...e){Se.info(...e)}static info(...e){console.log(`%c[${Se.getTimestampString()}] INFO`,"color:green",...e)}static warn(...e){console.warn(`%c[${Se.getTimestampString()}] WARN`,"color:yellow",...e)}static error(...e){console.error(`%c[${Se.getTimestampString()}] ERROR`,"color:red",...e)}static debug(...e){(function(){const e=Oe();return e&&e.SQUID_DEBUG_ENABLED})()&&console.log(`%c[${Se.getTimestampString()}] DEBUG`,"color:cyan",...e)}static getTimestampString(){const e=new Date;return`${e.toLocaleTimeString()}.${e.getMilliseconds()}`}}class we{constructor(e){this.destructManager=e,this.clientTooOldSubject=new t.BehaviorSubject(!1),this.isTenant=!0===Oe().squidTenant,this.clientIdSubject=new t.BehaviorSubject(this.generateClientId()),this.destructManager.onDestruct((()=>{this.clientTooOldSubject.complete(),this.clientIdSubject.complete()}))}observeClientId(){return this.clientIdSubject}observeClientTooOld(){return this.clientTooOldSubject.pipe((0,t.filter)((e=>e)),(0,t.map)((()=>{})))}notifyClientTooOld(){this.clientTooOldSubject.next(!0),this.clientIdSubject.next(this.generateClientId())}notifyClientNotTooOld(){this.clientTooOldSubject.next(!1)}observeClientReadyToBeRegenerated(){return this.clientTooOldSubject.pipe((0,t.skip)(1),(0,t.filter)((e=>!e)),(0,t.map)((()=>{})))}getClientId(){return this.clientIdSubject.value}isClientTooOld(){return this.clientTooOldSubject.value}generateClientId(){return`${this.isTenant?"tenant-":""}${Q()}`}}const Ee=["gpt-3.5-turbo","gpt-3.5-turbo-1106","gpt-4","claude-3-opus-20240229","claude-3-sonnet-20240229","claude-3-haiku-20240307","gpt-4-turbo-preview"],Te=["dall-e-3","stable-diffusion-core"];var Ie;!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"}(Ie||(Ie={}));const Ae=["dev","prod"],Fe=[...Ae];var Me,ke,De,je;function xe(e){return"fieldName"in e}(je=Me||(Me={}))[je.CONTINUE=100]="CONTINUE",je[je.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",je[je.PROCESSING=102]="PROCESSING",je[je.EARLYHINTS=103]="EARLYHINTS",je[je.OK=200]="OK",je[je.CREATED=201]="CREATED",je[je.ACCEPTED=202]="ACCEPTED",je[je.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",je[je.NO_CONTENT=204]="NO_CONTENT",je[je.RESET_CONTENT=205]="RESET_CONTENT",je[je.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",je[je.AMBIGUOUS=300]="AMBIGUOUS",je[je.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",je[je.FOUND=302]="FOUND",je[je.SEE_OTHER=303]="SEE_OTHER",je[je.NOT_MODIFIED=304]="NOT_MODIFIED",je[je.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",je[je.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",je[je.BAD_REQUEST=400]="BAD_REQUEST",je[je.UNAUTHORIZED=401]="UNAUTHORIZED",je[je.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",je[je.FORBIDDEN=403]="FORBIDDEN",je[je.NOT_FOUND=404]="NOT_FOUND",je[je.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",je[je.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",je[je.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",je[je.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",je[je.CONFLICT=409]="CONFLICT",je[je.GONE=410]="GONE",je[je.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",je[je.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",je[je.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",je[je.URI_TOO_LONG=414]="URI_TOO_LONG",je[je.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",je[je.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",je[je.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",je[je.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",je[je.MISDIRECTED=421]="MISDIRECTED",je[je.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",je[je.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",je[je.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",je[je.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",je[je.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",je[je.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",je[je.BAD_GATEWAY=502]="BAD_GATEWAY",je[je.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",je[je.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",je[je.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",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.built_in_s3="built_in_s3",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"}(ke||(ke={})),function(e){e.data="data",e.api="api",e.graphql="graphql"}(De||(De={}));const Pe=["==","!=",">=","<=",">","<","like","not like","like_cs","not like_cs"],Ne=["us-east-1.aws"],Re=Ne;var Ce;!function(e){e.CONNECTED="CONNECTED",e.DISCONNECTED="DISCONNECTED",e.REMOVED="REMOVED"}(Ce||(Ce={}));const qe="__squidId";function Le(e){return ye(e)}function Be(...e){const[t,r,n]=e,i="object"==typeof t?t:{docId:t,collectionName:r,integrationId:n};return i.integrationId||(i.integrationId=void 0),pe(i)}class Qe{constructor(e,t,r){this._squidDocId=e,this.dataManager=t,this.queryBuilderFactory=r,this.refId=Q()}get squidDocId(){return this._squidDocId}get data(){return ce(this.dataRef)}get dataRef(){return(0,B.truthy)(this.dataManager.getProperties(this.squidDocId),(()=>{const{collectionName:e,integrationId:t,docId:r}=Le(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,B.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,t.map)((e=>((0,B.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:Le(this.squidDocId),properties:r};return this.dataManager.applyOutgoingMutation(n,t)}async setInPath(e,t,r){return this.update({[e]:ce(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:Le(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=Le(this.squidDocId),n=r.integrationId;let i=ye(r.docId);if(i[qe]&&(i={}),n===ke.built_in_db&&i.__id)try{const e=ye(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:Le(this.squidDocId)};return this.dataManager.applyOutgoingMutation(t,e)}migrateDocIds(e){const t=e[this.squidDocId];t&&(this._squidDocId=t)}hasSquidPlaceholderId(){const e=ye(this._squidDocId);if("object"==typeof e&&e.docId){const t=ye(e.docId);if("object"==typeof t&&Object.keys(t).includes(qe))return!0}return!1}}function Ve(e){if(!(e instanceof Object))throw new Error("Field sort has to be an object");const t=e;var r,n,i,o;(0,B.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,B.assertTruthy)((i=t.asc,o="boolean",Array.isArray(i)?i.every((e=>typeof e===o)):typeof i===o),"Asc needs to be boolean"),function(e){if(!e||"string"!=typeof e)throw new Error("Field name has to be a non-empty string");if("__docId__"!==e&&!e.match(/^[a-zA-Z_$][a-zA-Z0-9!@#$%^&*~_ ]{0,49}$/))throw new Error("A Field name can contain only a-z, A-Z, 0-9,!@#$%^&*~_, starting with a letter, at least one character, and up to 50. Field name: "+e)}(t.fieldName)}Error;class Ue{constructor(e,r={}){this.internalStateObserver=new t.BehaviorSubject(null),this.firstElement=null,this.isDestroyed=new t.BehaviorSubject(!1),this.snapshotSubject=new t.Subject,this.onFirstPage=!0,this.navigatingToLastPage=!1,this.lastElement=null,(0,B.assertTruthy)(e.getSortOrders().length>0,"Unable to paginate results. Please specify a sort order."),this.snapshotSubject.pipe((0,t.switchAll)()).subscribe((e=>this.dataReceived(e))),this.templateSnapshotEmitter=e.clone(),this.paginateOptions=Object.assign({pageSize:100,subscribe:!0},r),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||se(e)&&se(t))return 0;if(se(e))return-1;if(se(t))return 1;const r=this.templateSnapshotEmitter.getSortOrders();for(const{fieldName:n,asc:i}of r){const r=he(te(e,n),te(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,r){if(this.onFirstPage=!1,r){const r=this.templateSnapshotEmitter.clone().limit(3*this.paginateOptions.pageSize).flipSortOrder();e&&r.addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((t=>({fieldName:t.fieldName,operator:t.asc?"<=":">=",value:te(e,t.fieldName)||null})))),this.snapshotSubject.next(r.snapshots(this.paginateOptions.subscribe).pipe((0,t.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:te(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,t.firstValueFrom)((0,t.race)(this.isDestroyed.pipe((0,t.filter)(Boolean),(0,t.map)((()=>({data:[],extractedData:[],numBefore:0,numAfter:0})))),this.internalStateObserver.pipe((0,t.filter)((e=>null!==e)),(0,t.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,t.filter)((e=>null!==e)),(0,t.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.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,t.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}=Le(e),i=ye(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 $e(e,t,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this,this.documentIdentityService)}}class Ye{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)}throwIfInvalidLikePattern(e){if(/\\(?![%_\\])/.test(e))throw new Error("Invalid pattern. Cannot have any \\ which are not followed by _, % or \\")}}class We{constructor(e){this.queryBuilder=e}peek(){return this.queryBuilder.peek().map((e=>e.data))}snapshot(){return(0,t.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.queryBuilder.snapshots(e).pipe(L((e=>e.map((e=>e.data)))))}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){return new We(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 Ue(this,e)}}class $e extends Ye{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,B.assertNumber)(e,"Limit needs to be a number"),-1!==e&&((0,B.assertTruthy)(e>0,"query limit has to be greater than 0"),(0,B.assertTruthy)(Math.floor(e)===e,"query limit has to be an integer"),(0,B.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,B.assertTruthy)(ae(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 Ve(r),(0,B.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=de(this.query.conditions.filter(xe)||[],(e=>e.fieldName));for(const r of Object.values(t)){const t=de(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)=>he(e.value,t.value))),">"===r||">="===r?e.push(t[t.length-1]):e.push(t[0])}}return[...this.query.conditions.filter((e=>!xe(e))),...e]}getSortOrder(){return this.query.sortOrder}snapshot(){return(0,t.firstValueFrom)(this.snapshots(!1))}setForceFetchFromServer(){return this.forceFetchFromServer=!0,this}peek(){return this.localQueryManager.peek(this.build())}snapshots(e=!0){if(this.containsEmptyInCondition)return new t.BehaviorSubject([]);const r=this.build();return this.querySubscriptionManager.processQuery(r,this.collectionName,{},{},e,this.forceFetchFromServer).pipe(L((e=>e.map((e=>{(0,B.assertTruthy)(1===Object.keys(e).length);const t=e[this.collectionName],r=Be((0,B.truthy)(t).__docId__,this.collectionName,this.integrationId);return this.documentReferenceFactory.create(r,this.queryBuilderFactory)})))))}changes(){let e,r=new Set;return this.snapshots().pipe((0,t.combineLatestWith)(this.documentIdentityService.observeChanges().pipe((0,t.switchMap)((r=>(Object.entries(r).forEach((([t,r])=>{!function(e,t,r){const n=e[t];void 0!==n&&(e[r]=n,delete e[t])}(e||{},t,r)})),t.NEVER))),(0,t.startWith)({}))),L((([t])=>{let n=[];const i=[],o=[];if(e){for(const o of t){const t=o.squidDocId,s=o.dataRef;if(r.has(s))delete e[t],r.delete(s);else if(e[t]){i.push(o);const n=e[t];delete e[t],r.delete(n)}else n.push(o)}for(const e of r)o.push(e)}else n=t;e={},r=new Set;for(const n of t){const t=n.dataRef;e[n.squidDocId]=t,r.add(t)}return new Ge(n,i,o)})))}get hash(){return be(this.build())}dereference(){return new We(this)}getSortOrders(){return this.query.sortOrder}clone(){const e=new $e(this.collectionName,this.integrationId,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.queryBuilderFactory,this.documentIdentityService);return e.query=ce(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 Ue(this,e)}}class Ge{constructor(e,t,r){this.inserts=e,this.updates=t,this.deletes=r}}class He extends Ye{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 He(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,t.firstValueFrom)(this.snapshots(!1))}snapshots(e=!0){return this.containsEmptyInCondition?new t.BehaviorSubject([]):this.querySubscriptionManager.processQuery(this.build(),this.rootAlias,ce(this.joins),ce(this.joinConditions),e,!1).pipe(L((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?Be(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 Xe(this)}dereference(){return new Ke(this)}build(){return this.queryBuilder.build()}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){const e=new He(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,this.rootAlias,this.latestAlias,ce(this.leftToRight),ce(this.joins),ce(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 Ue(this,e)}}class Ke{constructor(e){this.joinQueryBuilder=e}grouped(){return this.joinQueryBuilder.grouped().dereference()}snapshot(){return(0,t.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(L((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 Ke(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 Ue(this,e)}serialize(){return Object.assign(Object.assign({},this.joinQueryBuilder.serialize()),{dereference:!0})}getLimit(){return this.joinQueryBuilder.getLimit()}}class Je{constructor(e){this.groupedJoin=e}snapshot(){return(0,t.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.groupedJoin.snapshots(e).pipe(L((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 Je(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 Ue(this,e)}}class Xe{constructor(e){this.joinQueryBuilder=e}snapshot(){return(0,t.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(L((e=>this.groupData(e,this.joinQueryBuilder.rootAlias))))}peek(){throw new Error("peek is not currently supported for join queries")}dereference(){return new Je(this)}groupData(e,t){const r=de(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 Xe(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 Ue(this,e)}}function Ze(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 ae(e,t);if("!="===r)return!ae(e,t);switch(r){case"<":return!se(e)&&(!!se(t)||t<e);case"<=":return!!se(t)||!se(e)&&t<=e;case">":return!se(t)&&(!!se(e)||t>e);case">=":return!!se(e)||!se(t)&&t>=e;case"like":return"string"==typeof t&&"string"==typeof e&&et(t,e,!1);case"not like":return!("string"==typeof t&&"string"==typeof e&&et(t,e,!1));case"like_cs":return"string"==typeof t&&"string"==typeof e&&et(t,e,!0);case"not like_cs":return!("string"==typeof t&&"string"==typeof e&&et(t,e,!0));default:throw new Error(`Unsupported operator comparison: ${r}`)}}function et(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 tt(e,t){return`${e}_${t}`}class rt{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=Q()}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!==ke.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={[qe]:Q()};else e=e&&"string"!=typeof e?{__id:pe(e)}:{__id:e||Q()};const t=Be(pe(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 Qe?await r.delete(t):await this.doc(r).delete(t)}),t)}query(){return this.queryBuilderFactory.get(this.collectionName,this.integrationId)}joinQuery(e){return new He(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,e,e,{[e]:[]},{},{},this.query())}or(...e){return new nt(...e)}}class nt{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,t.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,...r){return(0,t.combineLatest)([...r]).pipe((0,t.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=te(this.extractData(t),n),o=te(this.extractData(r),n);if(!Ze(e,o,"=="))return Ze(o,e,"<")?i?-1:1:i?1:-1}return 0})).slice(0,this.getLimit())})))}clone(){return new nt(...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 Ue(this,e)}}class it{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 rt(e,t,this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager,this.dataManager),r.set(e,n)),n}}class ot{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 st=r(3910);function at(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?ce(t.value):t.value;case"removeProperty":return;default:throw new Error("Unknown property mutation type: "+JSON.stringify(t))}}function ut(e){return Object.entries(e.properties).sort((([e],[t])=>e.split(".").length-t.split(".").length))}function ct(e){let r=[];return(0,t.from)(e).pipe((0,t.groupBy)((e=>`${e.squidDocIdObj.integrationId}${e.squidDocIdObj.collectionName}/${e.squidDocIdObj.docId}`)),(0,t.mergeMap)((e=>e.pipe((0,t.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,B.assertTruthy)("update"===t.type,"Invalid mutation type"),"update"===e.type)return function(e,t){const r=ce(e);t=ce(t);for(const[e]of ut(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 ut(t))r.properties[e]=[...r.properties[e]||[],...n];return r}(e,t);const r=ce(e);for(const[e,n]of ut(t)){const t=n;for(const n of t){const t=at(te(r.properties,e),n);void 0===t?ie(r.properties,e):ne(r.properties,e,t)}}return r}(e,t)))))),(0,t.toArray)()).subscribe((e=>{r=e})),r}const lt="dataManager_runInTransaction";class ht{constructor(e,r,n,i,o,s,a,u,c){this.documentStore=e,this.mutationSender=r,this.socketManager=n,this.querySubscriptionManager=i,this.queryBuilderFactory=o,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 t.Subject,this.outgoingMutationsEmpty=new t.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,B.assertTruthy)(t===this.currentTransactionId,"Transaction already ended."),e(t).then((e=>Promise.resolve(e)));this.lockManager.canGetLock(lt)?this.lockManager.lockSync(lt):await this.lockManager.lock(lt);let r=dt;const n=()=>r!==dt;return new Promise((async(t,i)=>{try{let o;this.currentTransactionId=Q();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(lt)}catch(e){r=n()?r:e}}n()&&i(r)}))}async applyOutgoingMutation(e,t){var r;const n=Be(e.squidDocIdObj);this.knownDirtyDocs.add(n),t||this.lockManager.canGetLock(lt)||(await this.lockManager.lock(lt),this.lockManager.release(lt)),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=ct([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=ut(t);for(const[e,t]of n){const n=t;for(const t of n){const n=at(te(r,e),t);void 0===n?ie(r,e):ne(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,B.assertTruthy)(t===this.currentTransactionId,"Transaction already ended."),void e(t);await this.lockManager.lock(lt);try{this.currentTransactionId=Q();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(lt)}}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,t.filter)((e=>"mutations"===e.type)),L((e=>e))).subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,t.filter)(Boolean),(0,t.take)(1)).subscribe((()=>{this.handleIncomingMutations(e.payload)}))})),this.querySubscriptionManager.observeQueryResults().subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,t.filter)(Boolean),(0,t.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=Be(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||pe(Object.assign(Object.assign({},t),{__ts__:void 0}))!==pe(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 r=this.groupOutgoingMutationsByIntegrationId();try{await st.PromisePool.for(r).withConcurrency(r.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,t.firstValueFrom)(this.pendingOutgoingMutationsChanged.pipe((0,t.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=Be(e.mutation.squidDocIdObj),r=(0,B.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}=Le(t);this.setExpiration(t,!0);try{const r=e.includes(qe)?[]:await this.queryBuilderFactory.getForDocument(t).setForceFetchFromServer().snapshot();if((0,B.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();for(const e of t)try{await this.queryBuilderFactory.getForDocument(e).snapshot()}catch(e){}}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=Be(t.mutation.squidDocIdObj),n=e[r];n&&(t.mutation.squidDocIdObj=Le(n))}))})),Object.entries(e).forEach((([e,t])=>{oe(this.pendingOutgoingMutations,e,t),oe(this.docIdToLocalTimestamp,e,t),oe(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 dt=Symbol("undefined");class ft{constructor(){this.preDestructors=[],this.destructors=[],this.isDestructedSubject=new t.BehaviorSubject(!1)}get isDestructing(){return this.isDestructedSubject.value}observeIsDestructing(){return this.isDestructedSubject.asObservable().pipe((0,t.filter)(Boolean),L((()=>{})))}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 pt{constructor(e,r){this.socketManager=e,this.destructManager=r,this.ongoingLocks={},this.acquireLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,t.filter)((e=>"lockAcquired"===e.type))),this.releaseLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,t.filter)((e=>"lockReleased"===e.type))),this.lockWaitForConnectionThreshold=2e3,r.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,r=1e3){if(!await(0,t.firstValueFrom)((0,t.race)((0,t.timer)(this.lockWaitForConnectionThreshold).pipe(L((()=>!1))),this.socketManager.observeConnectionReady().pipe((0,t.filter)(Boolean)),this.destructManager.observeIsDestructing())))return Promise.reject("CLIENT_NOT_CONNECTED");const n=Q(),i={type:"acquireLock",payload:{mutex:e,timeoutMillis:r,clientRequestId:n}};this.socketManager.sendMessage(i);const o=await(0,t.firstValueFrom)((0,t.race)((0,t.timer)(r+4e3).pipe((0,t.take)(1),L((()=>({payload:{error:"TIMEOUT_GETTING_LOCK",lockId:void 0}})))),this.acquireLockMessagesFromServer.pipe((0,t.filter)((e=>e.payload.clientRequestId===n)))));if(this.destructManager.isDestructing)throw new Error("Destructing");if(!o.payload.lockId)throw new Error(`Failed to acquire lock: ${o.payload.error}`);const s=o.payload.lockId,a=new vt(s,n,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 vt{constructor(e,r,n,i){this.lockId=e,this.clientRequestId=r,this.ongoingLocks=n,this.socketManager=i,this.released=!1,this.onReleaseSubject=new t.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 yt{constructor(e,r){this.documentStore=e,this.destructManager=r,this.changeNotifier=new t.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 bt{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 Qe(e,(0,B.truthy)(this.dataManager,"dataManager not found"),t);const{integrationId:n,collectionName:i}=Le(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=Le(e),n=Le(t);oe(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=ce(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,B.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=he(te(e,n),te(t,n));if(0!==r)return i?r:-r}return 0}group(e,t){return Object.values(de(e,(e=>pe(t.map((t=>te(e,t)))))))}sortAndLimitDocs(e,t){if(0===e.size)return[];const r=[...e].map((e=>this.squidDocIdToDoc.get(e))).filter(B.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;oe(this.squidDocIdToDoc,e,t);const n=Le(t),i=ye(n.docId);this.saveDocument(t,Object.assign(Object.assign(Object.assign({},r),i),{__docId__:n.docId}))}}var gt="Invariant Violation",_t=Object.setPrototypeOf,Ot=void 0===_t?function(e,t){return e.__proto__=t,e}:_t,St=function(e){function t(r){void 0===r&&(r=gt);var n=e.call(this,"number"==typeof r?gt+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=gt,Ot(n,t.prototype),n}return a(t,e),t}(Error);function wt(e,t){if(!e)throw new St(t)}var Et,Tt=["debug","log","warn","error","silent"],It=Tt.indexOf("log");function At(e){return function(){if(Tt.indexOf(e)>=It)return(console[e]||console.log).apply(console,arguments)}}(Et=wt||(wt={})).debug=At("debug"),Et.log=At("log"),Et.warn=At("warn"),Et.error=At("error");var Ft="3.8.9";function Mt(e){try{return e()}catch(e){}}const kt=Mt((function(){return globalThis}))||Mt((function(){return window}))||Mt((function(){return self}))||Mt((function(){return global}))||Mt((function(){return Mt.constructor("return this")()}));var Dt=new Map;function jt(e){var t=Dt.get(e)||1;return Dt.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function xt(e,t){void 0===t&&(t=0);var r=jt("stringifyForDisplay");return JSON.stringify(e,(function(e,t){return void 0===t?r:t}),t).split(JSON.stringify(r)).join("<undefined>")}function Pt(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=Lt(i))||(t=Bt(i,r),r=[])}e.apply(void 0,[t].concat(r))}}var Nt=Object.assign((function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];e||wt(e,Lt(t,r)||Bt(t,r))}),{debug:Pt(wt.debug),log:Pt(wt.log),warn:Pt(wt.warn),error:Pt(wt.error)});function Rt(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new St(Lt(e,t)||Bt(e,t))}var Ct=Symbol.for("ApolloErrorMessageHandler_"+Ft);function qt(e){return"string"==typeof e?e:xt(e,2).slice(0,1e3)}function Lt(e,t){if(void 0===t&&(t=[]),e)return kt[Ct]&&kt[Ct](e,t.map(qt))}function Bt(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:Ft,message:e,args:t.map(qt)})))}function Qt(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 Vt(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 Ut(e,t,r){return t&&Vt(e.prototype,t),r&&Vt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}globalThis.__DEV__;var zt=function(){return"function"==typeof Symbol},Yt=function(e){return zt()&&Boolean(Symbol[e])},Wt=function(e){return Yt(e)?Symbol[e]:"@@"+e};zt()&&!Yt("observable")&&(Symbol.observable=Symbol("observable"));var $t=Wt("iterator"),Gt=Wt("observable"),Ht=Wt("species");function Kt(e,t){var r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function Jt(e){var t=e.constructor;return void 0!==t&&null===(t=t[Ht])&&(t=void 0),void 0!==t?t:ar}function Xt(e){return e instanceof ar}function Zt(e){Zt.log?Zt.log(e):setTimeout((function(){throw e}))}function er(e){Promise.resolve().then((function(){try{e()}catch(e){Zt(e)}}))}function tr(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var r=Kt(t,"unsubscribe");r&&r.call(t)}}catch(e){Zt(e)}}function rr(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function nr(e,t,r){e._state="running";var n=e._observer;try{var i=Kt(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(rr(e),!i)throw r;i.call(n,r);break;case"complete":rr(e),i&&i.call(n)}}catch(e){Zt(e)}"closed"===e._state?tr(e):"running"===e._state&&(e._state="ready")}function ir(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 er((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(nr(e,t[r].type,t[r].value),"closed"!==e._state);++r);}}(e)}))):void nr(e,t,r);e._queue.push({type:t,value:r})}}var or=function(){function e(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";var r=new sr(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&&(rr(this),tr(this))},Ut(e,[{key:"closed",get:function(){return"closed"===this._state}}]),e}(),sr=function(){function e(e){this._subscription=e}var t=e.prototype;return t.next=function(e){ir(this._subscription,"next",e)},t.error=function(e){ir(this._subscription,"error",e)},t.complete=function(){ir(this._subscription,"complete")},Ut(e,[{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),ar=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 or(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(Jt(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(Jt(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=Jt(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=Jt(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=Jt(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[Gt]=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=Kt(t,Gt);if(n){var i=n.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Xt(i)&&i.constructor===r?i:new r((function(e){return i.subscribe(e)}))}if(Yt("iterator")&&(n=Kt(t,$t)))return new r((function(e){er((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 Qt(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)?Qt(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){er((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){er((function(){if(!e.closed){for(var t=0;t<r.length;++t)if(e.next(r[t]),e.closed)return;e.complete()}}))}))},Ut(e,null,[{key:Ht,get:function(){return this}}]),e}();function ur(e){return null!==e&&"object"==typeof e}function cr(e,t){var r=t,n=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw Rt(70,e.operation,e.name?" named '".concat(e.name.value,"'"):"");"FragmentDefinition"===e.kind&&n.push(e)})),void 0===r&&(Nt(1===n.length,71,n.length),r=n[0].name.value),u(u({},e),{definitions:p([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],e.definitions,!0)})}function lr(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function hr(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 Nt(n,72,r),n||null;default:return null}}function dr(e){return{__ref:String(e)}}function fr(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function pr(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 pr(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 pr(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 Rt(81,t.value,r.kind);e[t.value]=null}}zt()&&Object.defineProperty(ar,Symbol("extensions"),{value:{symbol:Gt,hostReportError:Zt},configurable:!0});var vr=["connection","include","skip","client","rest","export","nonreactive"],yr=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(br(i),")")}return r.connection.key}var o=e;if(t){var s=br(t);o+="(".concat(s,")")}return r&&Object.keys(r).forEach((function(e){-1===vr.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@".concat(e,"(").concat(br(r[e]),")"):o+="@".concat(e))})),o}),{setStringify:function(e){var t=br;return br=e,t}}),br=function(e){return JSON.stringify(e,mr)};function mr(e,t){return ur(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function gr(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return pr(r,n,i,t)})),r}return null}function _r(e){return e.alias?e.alias.value:e.name.value}function Or(e,t,r){for(var n,i=0,o=t.selections;i<o.length;i++)if(Sr(u=o[i])){if("__typename"===u.name.value)return e[_r(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=Or(e,hr(u=a[s],r).selectionSet,r);if("string"==typeof c)return c}}function Sr(e){return"Field"===e.kind}function wr(e){Nt(e&&"Document"===e.kind,73);var t=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw Rt(74,e.kind);return e}));return Nt(t.length<=1,75,t.length),e}function Er(e){return wr(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function Tr(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&!!e.name})).map((function(e){return e.name.value}))[0]||null}function Ir(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function Ar(e){var t=Er(e);return Nt(t&&"query"===t.operation,76),t}function Fr(e){var t;wr(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 Rt(80)}function Mr(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&pr(t,e.variable.name,e.defaultValue)})),t}function kr(e,t){return t?t(e):ar.of()}function Dr(e){return"function"==typeof e?new xr(e):e}function jr(e){return e.request.length<=1}var xr=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return ar.of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(Dr).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,r,n){var i=Dr(r),o=Dr(n||new e(kr));return jr(i)&&jr(o)?new e((function(e){return t(e)?i.request(e)||ar.of():o.request(e)||ar.of()})):new e((function(e,r){return t(e)?i.request(e,r)||ar.of():o.request(e,r)||ar.of()}))},e.execute=function(e,t){return e.request(function(e,t){var r=u({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){r=u(u({},r),"function"==typeof e?e(r):e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return u({},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?Tr(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 Rt(43,i)}return e}(t))))||ar.of()},e.concat=function(t,r){var n=Dr(t);if(jr(n))return!1!==globalThis.__DEV__&&Nt.warn(35,n),n;var i=Dr(r);return jr(i)?new e((function(e){return n.request(e,(function(e){return i.request(e)||ar.of()}))||ar.of()})):new e((function(e,t){return n.request(e,(function(e){return i.request(e,t)||ar.of()}))||ar.of()}))},e.prototype.split=function(t,r,n){return this.concat(e.split(t,r,n||new e(kr)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw Rt(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}(),Pr=xr.execute;function Nr(e,t){if(!Boolean(e))throw new Error(t)}const Rr=10,Cr=2;function qr(e){return Lr(e,[])}function Lr(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:Lr(t,r)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Cr)return"[Array]";const r=Math.min(Rr,e.length),n=e.length-r,i=[];for(let n=0;n<r;++n)i.push(Lr(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>Cr)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+": "+Lr(r,t)));return"{ "+n.join(", ")+" }"}(e,r)}(e,t);default:return String(e)}}class Br{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 Qr{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 Vr={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"]},Ur=new Set(Object.keys(Vr));function zr(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&Ur.has(t)}var Yr,Wr,$r;!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(Yr||(Yr={})),($r=Wr||(Wr={})).NAME="Name",$r.DOCUMENT="Document",$r.OPERATION_DEFINITION="OperationDefinition",$r.VARIABLE_DEFINITION="VariableDefinition",$r.SELECTION_SET="SelectionSet",$r.FIELD="Field",$r.ARGUMENT="Argument",$r.FRAGMENT_SPREAD="FragmentSpread",$r.INLINE_FRAGMENT="InlineFragment",$r.FRAGMENT_DEFINITION="FragmentDefinition",$r.VARIABLE="Variable",$r.INT="IntValue",$r.FLOAT="FloatValue",$r.STRING="StringValue",$r.BOOLEAN="BooleanValue",$r.NULL="NullValue",$r.ENUM="EnumValue",$r.LIST="ListValue",$r.OBJECT="ObjectValue",$r.OBJECT_FIELD="ObjectField",$r.DIRECTIVE="Directive",$r.NAMED_TYPE="NamedType",$r.LIST_TYPE="ListType",$r.NON_NULL_TYPE="NonNullType",$r.SCHEMA_DEFINITION="SchemaDefinition",$r.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",$r.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",$r.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",$r.FIELD_DEFINITION="FieldDefinition",$r.INPUT_VALUE_DEFINITION="InputValueDefinition",$r.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",$r.UNION_TYPE_DEFINITION="UnionTypeDefinition",$r.ENUM_TYPE_DEFINITION="EnumTypeDefinition",$r.ENUM_VALUE_DEFINITION="EnumValueDefinition",$r.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",$r.DIRECTIVE_DEFINITION="DirectiveDefinition",$r.SCHEMA_EXTENSION="SchemaExtension",$r.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",$r.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",$r.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",$r.UNION_TYPE_EXTENSION="UnionTypeExtension",$r.ENUM_TYPE_EXTENSION="EnumTypeExtension",$r.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension";const Gr=Object.freeze({});function Hr(e,t,r=Vr){const n=new Map;for(const e of Object.values(Wr))n.set(e,Kr(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;zr(h)||Nr(!1,`Invalid AST Node: ${qr(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===Gr)break;if(!1===m){if(!e){d.pop();continue}}else if(void 0!==m&&(l.push([o,m]),!e)){if(!zr(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 Kr(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 Jr(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;Nt(r&&1===r.length,67,n);var i=r[0];Nt(i.name&&"if"===i.name.value,68,n);var o=i.value;Nt(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],Nt(void 0!==i,66,r.name.value)):i=n.value.value,"skip"===r.name.value?!i:i}))}function Xr(e,t,r){var n=new Set(e),i=n.size;return Hr(t,{Directive:function(e){if(n.delete(e.name.value)&&(!r||!n.size))return Gr}}),r?!n.size:n.size<i}function Zr(e){return e&&Xr(["client","export"],e,!0)}var en=function(e,t){var r;try{r=JSON.stringify(e)}catch(e){var n=Rt(39,t,e.message);throw n.parseError=e,n}return r},tn="function"==typeof WeakMap&&"ReactNative"!==Mt((function(){return navigator.product})),rn="function"==typeof WeakSet,nn="function"==typeof Symbol&&"function"==typeof Symbol.for,on=nn&&Symbol.asyncIterator;function sn(e){var t={next:function(){return e.read()}};return on&&(t[Symbol.asyncIterator]=function(){return this}),t}function an(e){var t,r,n,i,o=e;if(e.body&&(o=e.body),i=o,on&&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 sn(o.getReader());if(function(e){return!!e.stream}(o))return sn(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)})))}},on&&(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 on&&(c[Symbol.asyncIterator]=function(){return this}),c}(o);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}Mt((function(){return window.document.createElement})),Mt((function(){return navigator.userAgent.indexOf("jsdom")>=0}));var un=function(e,t,r){var n=new Error(r);throw n.name="ServerError",n.response=e,n.statusCode=e.status,n.result=t,n},cn=Symbol(),ln=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=p(p(p([],(n=h).graphQLErrors,!0),n.clientErrors,!0),n.protocolErrors,!0),n.networkError&&i.push(n.networkError),i.map((function(e){return ur(e)&&e.message||"Error message not found."})).join("\n")),h.extraInfo=l,h.__proto__=t.prototype,h}return a(t,e),t}(Error),hn=Array.isArray;function dn(e){return Array.isArray(e)&&e.length>0}var fn=Object.prototype.hasOwnProperty;function pn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return vn(e)}function vn(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new bn,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var yn=function(e,t,r){return this.merge(e[r],t[r])},bn=function(){function e(e){void 0===e&&(e=yn),this.reconciler=e,this.isObject=ur,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 ur(t)&&ur(e)?(Object.keys(t).forEach((function(i){if(fn.call(e,i)){var o=e[i];if(t[i]!==o){var s=r.reconciler.apply(r,p([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 ur(e)&&(this.pastCopies.has(e)||(e=Array.isArray(e)?e.slice(0):u({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},e}();function mn(e){return"incremental"in e}function gn(e){return ur(e)&&"payload"in e}function _n(e,t){var r=e,n=new bn;return mn(t)&&dn(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 On=Object.prototype.hasOwnProperty;function Sn(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 wn(e,t){e.status>=300&&un(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 En(e){return 9===e||32===e}function Tn(e){return e>=48&&e<=57}function In(e){return e>=97&&e<=122||e>=65&&e<=90}function An(e){return In(e)||95===e}function Fn(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=Mn(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 Mn(e){let t=0;for(;t<e.length&&En(e.charCodeAt(t));)++t;return t}const kn=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Dn(e){return jn[e.charCodeAt(0)]}const jn=["\\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"],xn={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>Pn(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Rn("(",Pn(e.variableDefinitions,", "),")"),r=Pn([e.operation,Pn([e.name,t]),Pn(e.directives," ")]," ");return("query"===r?"":r+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:r,directives:n})=>e+": "+t+Rn(" = ",r)+Rn(" ",Pn(n," "))},SelectionSet:{leave:({selections:e})=>Nn(e)},Field:{leave({alias:e,name:t,arguments:r,directives:n,selectionSet:i}){const o=Rn("",e,": ")+t;let s=o+Rn("(",Pn(r,", "),")");return s.length>80&&(s=o+Rn("(\n",Cn(Pn(r,"\n")),"\n)")),Pn([s,Pn(n," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Rn(" ",Pn(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:r})=>Pn(["...",Rn("on ",e),Pn(t," "),r]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:r,directives:n,selectionSet:i})=>`fragment ${e}${Rn("(",Pn(r,", "),")")} on ${t} ${Rn("",Pn(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||En(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&&En(e.charCodeAt(0));return(l&&!d||o)&&(h+="\n"),h+=r,(l||c)&&(h+="\n"),'"""'+h+'"""'}(e):`"${e.replace(kn,Dn)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+Pn(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+Pn(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Rn("(",Pn(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:r})=>Rn("",e,"\n")+Pn(["schema",Pn(t," "),Nn(r)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:r})=>Rn("",e,"\n")+Pn(["scalar",t,Pn(r," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Rn("",e,"\n")+Pn(["type",t,Rn("implements ",Pn(r," & ")),Pn(n," "),Nn(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:r,type:n,directives:i})=>Rn("",e,"\n")+t+(qn(r)?Rn("(\n",Cn(Pn(r,"\n")),"\n)"):Rn("(",Pn(r,", "),")"))+": "+n+Rn(" ",Pn(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:r,defaultValue:n,directives:i})=>Rn("",e,"\n")+Pn([t+": "+r,Rn("= ",n),Pn(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Rn("",e,"\n")+Pn(["interface",t,Rn("implements ",Pn(r," & ")),Pn(n," "),Nn(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:r,types:n})=>Rn("",e,"\n")+Pn(["union",t,Pn(r," "),Rn("= ",Pn(n," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:r,values:n})=>Rn("",e,"\n")+Pn(["enum",t,Pn(r," "),Nn(n)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:r})=>Rn("",e,"\n")+Pn([t,Pn(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:r,fields:n})=>Rn("",e,"\n")+Pn(["input",t,Pn(r," "),Nn(n)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:r,repeatable:n,locations:i})=>Rn("",e,"\n")+"directive @"+t+(qn(r)?Rn("(\n",Cn(Pn(r,"\n")),"\n)"):Rn("(",Pn(r,", "),")"))+(n?" repeatable":"")+" on "+Pn(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>Pn(["extend schema",Pn(e," "),Nn(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>Pn(["extend scalar",e,Pn(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>Pn(["extend type",e,Rn("implements ",Pn(t," & ")),Pn(r," "),Nn(n)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>Pn(["extend interface",e,Rn("implements ",Pn(t," & ")),Pn(r," "),Nn(n)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:r})=>Pn(["extend union",e,Pn(t," "),Rn("= ",Pn(r," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:r})=>Pn(["extend enum",e,Pn(t," "),Nn(r)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:r})=>Pn(["extend input",e,Pn(t," "),Nn(r)]," ")}};function Pn(e,t=""){var r;return null!==(r=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==r?r:""}function Nn(e){return Rn("{\n",Cn(Pn(e,"\n")),"\n}")}function Rn(e,t,r=""){return null!=t&&""!==t?e+t+r:""}function Cn(e){return Rn(" ",e.replace(/\n/g,"\n "))}function qn(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}var Ln=tn?new WeakMap:void 0,Bn=function(e){var t;return(t=null==Ln?void 0:Ln.get(e))||(t=function(e){return Hr(e,xn)}(e),null==Ln||Ln.set(e,t)),t},Qn={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},Vn=function(e,t){return t(e)};function Un(e){return new ar((function(t){t.error(e)}))}var zn={kind:Wr.FIELD,name:{kind:Wr.NAME,value:"__typename"}};function Yn(e,t){return!e||e.selectionSet.selections.every((function(e){return e.kind===Wr.FRAGMENT_SPREAD&&Yn(t[e.name.value],t)}))}function Wn(e){return Yn(Er(e)||function(e){Nt("Document"===e.kind,77),Nt(e.definitions.length<=1,78);var t=e.definitions[0];return Nt("FragmentDefinition"===t.kind,79),t}(e),lr(Ir(e)))?null:e}function $n(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 Gn(e,t){wr(t);for(var r=$n(""),n=$n(""),i=function(e){for(var t=0,i=void 0;t<e.length&&(i=e[t]);++t)if(!hn(i)){if(i.kind===Wr.OPERATION_DEFINITION)return r(i.name&&i.name.value);if(i.kind===Wr.FRAGMENT_DEFINITION)return n(i.name.value)}return!1!==globalThis.__DEV__&&Nt.error(82),null},o=0,s=t.definitions.length-1;s>=0;--s)t.definitions[s].kind===Wr.OPERATION_DEFINITION&&++o;var a,c,l,h=(a=e,c=new Map,l=new Map,a.forEach((function(e){e&&(e.name?c.set(e.name,e):e.test&&l.set(e.test,e))})),function(e){var t=c.get(e.name.value);return!t&&l.size&&l.forEach((function(r,n){n(e)&&(t=r)})),t}),d=function(e){return dn(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=Hr(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===Wr.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===Wr.OPERATION_DEFINITION?b(r(e.name&&e.name.value)).fragmentSpreads.forEach((function(e){m.add(e)})):e.kind!==Wr.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 Wn(Hr(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 u(u({},e),{variableDefinitions:e.variableDefinitions.filter((function(e){return t.has(e.variable.name.value)}))})}}}}))}var Hn=Object.assign((function(e){return Hr(e,{SelectionSet:{enter:function(e,t,r){if(!r||r.kind!==Wr.OPERATION_DEFINITION){var n=e.selections;if(n&&!n.some((function(e){return Sr(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var i=r;if(!(Sr(i)&&i.directives&&i.directives.some((function(e){return"export"===e.name.value}))))return u(u({},e),{selections:p(p([],n,!0),[zn],!1)})}}}}})}),{added:function(e){return e===zn}});function Kn(e){return"query"===Fr(e).operation?e:Hr(e,{OperationDefinition:{enter:function(e){return u(u({},e),{operation:"query"})}}})}function Jn(e){return wr(e),Gn([{test:function(e){return"client"===e.name.value},remove:!0}],e)}var Xn=Mt((function(){return fetch})),Zn=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?Vn:i,s=e.includeExtensions,a=e.preserveHeaderCase,d=e.useGETForQueries,f=e.includeUnusedVariables,p=void 0!==f&&f,v=c(e,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);!1!==globalThis.__DEV__&&function(e){if(!e&&"undefined"==typeof fetch)throw Rt(37)}(n||Xn);var y={http:{includeExtensions:s,preserveHeaderCase:a},options:v.fetchOptions,credentials:v.credentials,headers:v.headers};return new xr((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,f=a.version;c&&(s["apollographql-client-name"]=c),f&&(s["apollographql-client-version"]=f)}var v=u(u({},s),i.headers),b={http:i.http,options:i.fetchOptions,credentials:i.credentials,headers:v};if(Xr(["client"],e.query)){var m=Jn(e.query);if(!m)return Un(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,w,E=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=u(u(u({},i),e.options),{headers:u(u({},i.headers),e.headers)}),e.credentials&&(i.credentials=e.credentials),o=u(u({},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,c=e.variables,l=e.query,h={operationName:s,variables:c};return o.includeExtensions&&(h.extensions=a),o.includeQuery&&(h.query=t(l,Bn)),{options:i,body:h}}(e,o,Qn,y,b),T=E.options,I=E.body;I.variables&&!p&&(I.variables=(g=I.variables,_=e.query,O=u({},g),S=new Set(Object.keys(g)),Hr(_,{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||(w=new AbortController,T.signal=w.signal);var A,F="OperationDefinition"===(A=Fr(e.query)).kind&&"subscription"===A.operation,M=Xr(["defer"],e.query);if(d&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(T.method="GET"),M||F){T.headers=T.headers||{};var k="multipart/mixed;";F&&M&&!1!==globalThis.__DEV__&&Nt.warn(38),F?k+="boundary=graphql;subscriptionSpec=1.0,application/json":M&&(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=en(t.variables,"Variables map")}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=en(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 Un(x);t=j}else try{T.body=en(I,"Payload")}catch(x){return Un(x)}return new ar((function(r){var i=n||Mt((function(){return fetch}))||Xn,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 l(this,void 0,void 0,(function(){var n,i,o,s,a,c,l,d,f,p,v,y,b,m,g,_,O,S,w,E,T,I,A;return h(this,(function(h){switch(h.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),c="",l=an(e),d=!0,h.label=1;case 1:return d?[4,l.next()]:[3,3];case 2:for(f=h.sent(),p=f.value,v=f.done,y="string"==typeof p?p:n.decode(p),b=c.length-a.length+1,d=!v,m=(c+=y).indexOf(a,b);m>-1;){if(g=void 0,I=[c.slice(0,m),c.slice(m+a.length)],c=I[1],_=(g=I[0]).indexOf("\r\n\r\n"),O=Sn(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(w=g.slice(_))if(E=wn(e,w),Object.keys(E).length>1||"data"in E||"incremental"in E||"errors"in E||"payload"in E)gn(E)?(T={},"payload"in E&&(T=u({},E.payload)),"errors"in E&&(T=u(u({},T),{extensions:u(u({},"extensions"in T?T.extensions:null),(A={},A[cn]=E.errors,A))})),t(T)):t(E);else if(1===Object.keys(E).length&&"hasNext"in E&&!E.hasNext)return[2];m=c.indexOf(a)}return[3,1];case 3:return[2]}}))}))}(t,o):(n=e,function(e){return e.text().then((function(t){return wn(e,t)})).then((function(t){return Array.isArray(t)||On.call(t,"data")||On.call(t,"errors")||un(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(){w=void 0,r.complete()})).catch((function(e){w=void 0,function(e,t){e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e)}(e,r)})),function(){w&&w.abort()}}))}))},ei=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,Zn(t).request)||this;return r.options=t,r}return a(t,e),t}(xr);const{toString:ti,hasOwnProperty:ri}=Object.prototype,ni=Function.prototype.toString,ii=new Map;function oi(e,t){try{return ai(e,t)}finally{ii.clear()}}const si=oi;function ai(e,t){if(e===t)return!0;const r=ti.call(e);if(r!==ti.call(t))return!1;switch(r){case"[object Array]":if(e.length!==t.length)return!1;case"[object Object]":{if(hi(e,t))return!0;const r=ui(e),n=ui(t),i=r.length;if(i!==n.length)return!1;for(let e=0;e<i;++e)if(!ri.call(t,r[e]))return!1;for(let n=0;n<i;++n){const i=r[n];if(!ai(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(hi(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&&!ai(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=ni.call(e);return r===ni.call(t)&&!function(e,t){const r=e.length-t.length;return r>=0&&e.indexOf(t,r)===r}(r,li)}}return!1}function ui(e){return Object.keys(e).filter(ci,e)}function ci(e){return void 0!==this[e]}const li="{ [native code] }";function hi(e,t){let r=ii.get(e);if(r){if(r.has(t))return!0}else ii.set(e,r=new Set);return r.add(t),!1}const di=()=>Object.create(null),{forEach:fi,slice:pi}=Array.prototype,{hasOwnProperty:vi}=Object.prototype;class yi{constructor(e=!0,t=di){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return fi.call(e,(e=>t=t.getChildTrie(e))),vi.call(t,"data")?t.data:t.data=this.makeData(pi.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(pi.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 yi(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 bi,mi,gi=function(){function e(){this.known=new(rn?WeakSet:Set),this.pool=new yi(tn),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return ur(e)&&this.known.has(e)},e.prototype.pass=function(e){if(ur(e)){var t=function(e){return ur(e)?hn(e)?e.slice(0):u({__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(ur(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}(),_i=Object.assign((function(e){if(ur(e)){void 0===bi&&Oi();var t=bi.admit(e),r=mi.get(t);return void 0===r&&mi.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:Oi});function Oi(){bi=new gi,mi=new(tn?WeakMap:Map)}function Si(e){return e}var wi=function(){function e(e,t){void 0===t&&(t=Object.create(null)),this.resultCache=rn?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),!1!==t.cache&&(this.stableCacheKeys=new yi(tn,(function(e){return{key:e}})))}return e.prototype.getCacheKey=function(e){return[e]},e.identity=function(){return new e(Si,{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;wr(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?(Nt(Array.isArray(t),65),this.stableCacheKeys.lookupArray(t)):void 0}},e}();function Ei(e,t,r){return new ar((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 Ti(e){return dn(Ii(e))}function Ii(e){var t=dn(e.errors)?e.errors.slice(0):[];return mn(e)&&dn(e.incremental)&&e.incremental.forEach((function(e){e.errors&&t.push.apply(t,e.errors)})),t}function Ai(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function Fi(e){function t(t){Object.defineProperty(e,t,{value:ar})}return nn&&Symbol.species&&t(Symbol.species),t("@@species"),e}function Mi(e){return e&&"function"==typeof e.then}var ki,Di=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),Ai(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),Ai(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?Mi(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"),Ai(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 ar(t)]),Mi(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return a(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}(ar);function ji(e){return!!e&&e<7}function xi(){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}Fi(Di),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"}(ki||(ki={}));var Pi=Object.prototype.toString;function Ni(e){return Ri(e)}function Ri(e,t){switch(Pi.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]=Ri(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]=Ri(e[r],t)})),n;default:return e}}function Ci(e,t,r,n){var i=t.data,o=c(t,["data"]),s=r.data,a=c(r,["data"]);return si(o,a)&&qi(Fr(e).selectionSet,i,s,{fragmentMap:lr(Ir(e)),variables:n})}function qi(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),!Jr(e,n.variables))return!0;if(Li(e))return!0;if(Sr(e)){var o=_r(e),s=t&&t[o],a=r&&r[o],u=e.selectionSet;if(!u)return si(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(!qi(u,s[d],a[d],n))return!1;return!0}return qi(u,s,a,n)}var f=hr(e,n.fragmentMap);return f?!!Li(f)||qi(f.selectionSet,t,r,n):void 0}))}function Li(e){return!!e.directives&&e.directives.some(Bi)}function Bi(e){return"nonreactive"===e.name.value}var Qi=Object.assign,Vi=Object.hasOwnProperty,Ui=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=Yi)}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=$i(i.fetchPolicy),o.isTornDown=!1;var s=r.defaultOptions.watchQuery,a=(void 0===s?{}:s).fetchPolicy,c=void 0===a?"cache-first":a,l=i.fetchPolicy,h=void 0===l?c:l,d=i.initialFetchPolicy,f=void 0===d?"standby"===h?c:h:d;o.options=u(u({},i),{initialFetchPolicy:f,fetchPolicy:h}),o.queryId=n.queryId||r.generateQueryId();var p=Er(o.query);return o.queryName=p&&p.name&&p.name.value,o}return a(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||ki.ready,n=u(u({},t),{loading:ji(r),networkStatus:r}),i=this.options.fetchPolicy,o=void 0===i?"cache-first":i;if($i(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),oi(n.data,{})&&(n.data=void 0),s.complete?(delete n.partial,!s.complete||n.networkStatus!==ki.loading||"cache-first"!==o&&"cache-only"!==o||(n.networkStatus=ki.ready,n.loading=!1)):n.partial=!0,!1===globalThis.__DEV__||s.complete||this.options.partialRefetch||n.loading||n.data||n.error||Wi(s.missing)}return e&&this.updateLastResult(n),n},t.prototype.isDifferentFromLastResult=function(e,t){return!this.last||(this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective?!Ci(this.query,this.last.result,e,this.variables):!oi(this.last.result,e))||t&&!oi(this.last.variables,t)},t.prototype.getLast=function(e,t){var r=this.last;if(r&&r[e]&&(!t||oi(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&&Vi.call(e,"variables")){var i=Ar(this.query),o=i.variableDefinitions;o&&o.some((function(e){return"variables"===e.variable.name.value}))||!1!==globalThis.__DEV__&&Nt.warn(20,e,(null===(t=i.name)||void 0===t?void 0:t.value)||i)}return e&&!oi(this.options.variables,e)&&(r.variables=this.options.variables=u(u({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(r,ki.refetch)},t.prototype.fetchMore=function(e){var t=this,r=u(u({},e.query?e:u(u(u(u({},this.options),{query:this.options.query}),e),{variables:u(u({},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=ki.fetchMore,r.notifyOnNetworkStatusChange&&this.observe();var s=new Set;return this.queryManager.fetchQuery(n,r,ki.fetchMore).then((function(a){return t.queryManager.removeQuery(n),i.networkStatus===ki.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)||zi(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__&&Nt.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=xi(this.options,e||{});Qi(this.options,t)},t.prototype.setVariables=function(e){return oi(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},ki.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){Nt(r,22),(t||(this.pollingInfo={})).interval=r;var n=function(){e.pollingInfo&&(ji(e.queryInfo.networkStatus)?i():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"network-only"},ki.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&&!oi(t,this.last.variables)&&(r=void 0),this.last=u({result:this.queryManager.assumeImmutableResults?e:Ni(e),variables:t},r?{error:r}:null)},t.prototype.reobserveAsConcast=function(e,t){var r=this;this.isTornDown=!1;var n=t===ki.refetch||t===ki.fetchMore||t===ki.poll,i=this.options.variables,o=this.options.fetchPolicy,s=xi(this.options,e||{}),a=n?s:Qi(this.options,s),c=this.transformDocument(a.query);this.lastQuery=c,n||(this.updatePolling(),e&&e.variables&&!oi(e.variables,i)&&"standby"!==a.fetchPolicy&&a.fetchPolicy===o&&(this.applyNextFetchPolicy("variables-changed",a),void 0===t&&(t=ki.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=$i(a.fetchPolicy));var l=function(){r.concast===f&&(r.waitForOwnResult=!1)},h=a.variables&&u({},a.variables),d=this.fetch(a,t,c),f=d.concast,p=d.fromLink,v={next:function(e){l(),r.reportResult(e,h)},error:function(e){l(),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)&&Ai(this.observers,"next",e)},t.prototype.reportError=function(e,t){var r=u(u({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:ki.error,loading:!1});this.updateLastResult(r,t),Ai(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}(ar);function zi(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 Yi(e){!1!==globalThis.__DEV__&&Nt.error(23,e.message,e.stack)}function Wi(e){!1!==globalThis.__DEV__&&e&&!1!==globalThis.__DEV__&&Nt.debug(24,e)}function $i(e){return"network-only"===e||"no-cache"===e||"standby"===e}function Gi(e){return e.kind===Wr.FIELD||e.kind===Wr.FRAGMENT_SPREAD||e.kind===Wr.INLINE_FRAGMENT}Fi(Ui);const Hi=()=>Object.create(null),{forEach:Ki,slice:Ji}=Array.prototype,{hasOwnProperty:Xi}=Object.prototype;class Zi{constructor(e=!0,t=Hi){this.weakness=e,this.makeData=t}lookup(...e){return this.lookupArray(e)}lookupArray(e){let t=this;return Ki.call(e,(e=>t=t.getChildTrie(e))),Xi.call(t,"data")?t.data:t.data=this.makeData(Ji.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&&eo(e[r])?t.weak:t.strong;t=n&&n.get(e[r])}return t&&t.data}getChildTrie(e){const t=this.weakness&&eo(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 Zi(this.weakness,this.makeData)),r}}function eo(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}function to(){}class ro{constructor(e=1/0,t=to){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 no=null,io={},oo=1;function so(e){try{return e()}catch(e){}}var ao="@wry/context:Slot",uo=so((function(){return globalThis}))||so((function(){return r.g}))||Object.create(null),co=uo[ao]||Array[ao]||function(e){try{Object.defineProperty(uo,ao,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}}(function(){function e(){this.id=["slot",oo++,Date.now(),Math.random().toString(36).slice(2)].join(":")}return e.prototype.hasValue=function(){for(var e=no;e;e=e.parent)if(this.id in e.slots){var t=e.slots[this.id];if(t===io)break;return e!==no&&(no.slots[this.id]=t),!0}return no&&(no.slots[this.id]=io),!1},e.prototype.getValue=function(){if(this.hasValue())return no.slots[this.id]},e.prototype.withValue=function(e,t,r,n){var i,o=((i={__proto__:null})[this.id]=e,i),s=no;no={parent:s,slots:o};try{return t.apply(n,r)}finally{no=s}},e.bind=function(e){var t=no;return function(){var r=no;try{return no=t,e.apply(this,arguments)}finally{no=r}}},e.noContext=function(e,t,r){if(!no)return e.apply(r,t);var n=no;try{return no=null,e.apply(r,t)}finally{no=n}},e}());co.bind,co.noContext;const lo=new co,{hasOwnProperty:ho}=Object.prototype,fo=Array.from||function(e){const t=[];return e.forEach((e=>t.push(e))),t};function po(e){const{unsubscribe:t}=e;"function"==typeof t&&(e.unsubscribe=void 0,t())}const vo=[],yo=100;function bo(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 go(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}function _o(e){return e.slice(0)}class Oo{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,++Oo.count}peek(){if(1===this.value.length&&!Eo(this))return So(this),this.value[0]}recompute(e){return bo(!this.recomputing,"already recomputing"),So(this),Eo(this)?function(e,t){return Do(e),lo.withValue(e,wo,[e,t]),function(e,t){if("function"==typeof e.subscribe)try{po(e),e.unsubscribe=e.subscribe.apply(null,t)}catch(t){return e.setDirty(),!1}return!0}(e,t)&&function(e){e.dirty=!1,Eo(e)||Io(e)}(e),go(e.value)}(this,e):go(this.value)}setDirty(){this.dirty||(this.dirty=!0,To(this),po(this))}dispose(){this.setDirty(),Do(this),Ao(this,((e,t)=>{e.setDirty(),jo(e,this)}))}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=vo.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(fo(this.deps).forEach((e=>e.delete(this))),this.deps.clear(),vo.push(this.deps),this.deps=null)}}function So(e){const t=lo.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),Eo(e)?Fo(t,e):Mo(t,e),t}function wo(e,t){e.recomputing=!0;const{normalizeResult:r}=e;let n;r&&1===e.value.length&&(n=_o(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 Eo(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function To(e){Ao(e,Fo)}function Io(e){Ao(e,Mo)}function Ao(e,t){const r=e.parents.size;if(r){const n=fo(e.parents);for(let i=0;i<r;++i)t(n[i],e)}}function Fo(e,t){bo(e.childValues.has(t)),bo(Eo(t));const r=!Eo(e);if(e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=vo.pop()||new Set;e.dirtyChildren.add(t),r&&To(e)}function Mo(e,t){bo(e.childValues.has(t)),bo(!Eo(t));const r=e.childValues.get(t);0===r.length?e.childValues.set(t,_o(t.value)):mo(r,t.value)||e.setDirty(),ko(e,t),Eo(e)||Io(e)}function ko(e,t){const r=e.dirtyChildren;r&&(r.delete(t),0===r.size&&(vo.length<yo&&vo.push(r),e.dirtyChildren=null))}function Do(e){e.childValues.size>0&&e.childValues.forEach(((t,r)=>{jo(e,r)})),e.forgetDeps(),bo(null===e.dirtyChildren)}function jo(e,t){t.parents.delete(e),e.childValues.delete(t),ko(e,t)}Oo.count=0;const xo={setDirty:!0,dispose:!0,forget:!0};function Po(e){const t=new Map,r=e&&e.subscribe;function n(e){const n=lo.getValue();if(n){let i=t.get(e);i||t.set(e,i=new Set),n.dependOn(i),"function"==typeof r&&(po(i),i.unsubscribe=r(e))}}return n.dirty=function(e,r){const n=t.get(e);if(n){const i=r&&ho.call(xo,r)?r:"setDirty";fo(n).forEach((e=>e[i]())),t.delete(e),po(n)}},n}let No;function Ro(...e){return(No||(No=new Zi("function"==typeof WeakMap))).lookupArray(e)}const Co=new Set;function qo(e,{max:t=Math.pow(2,16),keyArgs:r,makeCacheKey:n=Ro,normalizeResult:i,subscribe:o,cache:s=ro}=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 Oo(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),Co.add(a),lo.hasValue()||(Co.forEach((e=>e.clean())),Co.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 Lo=new co,Bo=new WeakMap;function Qo(e){var t=Bo.get(e);return t||Bo.set(e,t={vars:new Set,dep:Po()}),t}function Vo(e){Qo(e).vars.forEach((function(t){return t.forgetCache(e)}))}function Uo(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){Qo(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=Lo.getValue();a&&(i(a),Qo(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),Qo(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}var zo=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=pn(t.resolvers,e)})):this.resolvers=pn(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 l(this,void 0,void 0,(function(){return h(this,(function(e){return t?[2,this.resolveDocument(t,r.data,n,i,this.fragmentMatcher,s).then((function(e){return u(u({},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 Xr(["client"],e)&&this.resolvers?e:null},e.prototype.serverQuery=function(e){return Jn(e)},e.prototype.prepareContext=function(e){var t=this.cache;return u(u({},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={}),l(this,void 0,void 0,(function(){return h(this,(function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(r),t).then((function(e){return u(u({},t),e.exportedVariables)}))]:[2,u({},t)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return Hr(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 Gr}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:Kn(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),l(this,void 0,void 0,(function(){var s,a,c,l,d,f,p,v,y,b;return h(this,(function(h){return s=Fr(e),a=Ir(e),c=lr(a),l=this.collectSelectionsToResolve(s,c),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",v=(p=this).cache,y=p.client,b={fragmentMap:c,context:u(u({},r),{cache:v,client:y}),variables:n,fragmentMatcher:i,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,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 l(this,void 0,void 0,(function(){var i,o,s,a,u,c=this;return h(this,(function(d){return i=n.fragmentMap,o=n.context,s=n.variables,a=[r],u=function(e){return l(c,void 0,void 0,(function(){var u,c;return h(this,(function(l){return(t||n.selectionsToResolve.has(e))&&Jr(e,s)?Sr(e)?[2,this.resolveField(e,t,r,n).then((function(t){var r;void 0!==t&&a.push(((r={})[_r(e)]=t,r))}))]:(function(e){return"InlineFragment"===e.kind}(e)?u=e:(u=i[e.name.value],Nt(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 vn(a)}))]}))}))},e.prototype.resolveField=function(e,t,r,n){return l(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,d,f,p=this;return h(this,(function(h){return r?(i=n.variables,o=e.name.value,s=_r(e),a=o!==s,u=r[s]||r[o],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=r.__typename||n.defaultOperationType,(d=this.resolvers&&this.resolvers[l])&&(f=d[a?o:s])&&(c=Promise.resolve(Lo.withValue(this.cache,f,[r,gr(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),Hr(i,{Directive:function(e,t,n,i,s){"client"===e.name.value&&s.forEach((function(e){r(e)&&Gi(e)&&o.add(e)}))},FragmentSpread:function(n,i,s,a,u){var c=t[n.name.value];Nt(c,19,n.name.value);var l=e(c);l.size>0&&(u.forEach((function(e){r(e)&&Gi(e)&&o.add(e)})),o.add(n),l.forEach((function(e){o.add(e)})))}})}return n.get(i)}(e)},e}(),Yo=new(tn?WeakMap:Map);function Wo(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return Yo.set(e,(Yo.get(e)+1)%1e15),r.apply(this,arguments)})}function $o(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var Go=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;Yo.has(r)||(Yo.set(r,0),Wo(r,"evict"),Wo(r,"modify"),Wo(r,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||ki.loading;return this.variables&&this.networkStatus!==ki.loading&&!oi(this.variables,e.variables)&&(t=ki.setVariables),oi(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(){$o(this),this.dirty=!1},e.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&oi(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||oi(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():zi(e)})):delete this.oqListener)},e.prototype.notify=function(){var e=this;$o(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(ji(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=u(u({},this.getDiffOptions(e)),{watcher:this,callback:function(e){return t.setDiff(e)}});this.lastWatch&&oi(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===Yo.get(this.cache)&&oi(t,r.variables)&&oi(e.data,r.result.data))},e.prototype.markResult=function(e,t,r,n){var i=this,o=new bn,s=dn(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&dn(e.incremental)){var a=_n(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&&(Ho(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:Yo.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&&oi(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=ki.ready},e.prototype.markError=function(e){return this.networkStatus=ki.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function Ho(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!Ti(e);return!n&&r&&e.data&&(n=!0),n}var Ko=Object.prototype.hasOwnProperty,Jo=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(tn?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map;var y=new wi((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 zo({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(Rt(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,c=void 0===a?[]:a,d=e.awaitRefetchQueries,f=void 0!==d&&d,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 l(this,void 0,void 0,(function(){var e,t,r,a;return h(this,(function(l){switch(l.label){case 0:return Nt(n,26),Nt("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=l.sent(),l.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,l){return Ei(a.getObservableFromLink(n,u(u({},O),{optimisticResponse:o}),i,!1),(function(t){if(Ti(t)&&"none"===g)throw new ln({graphQLErrors:Ii(t)});r&&(r.loading=!1,r.error=null);var l=u({},t);return"function"==typeof c&&(c=c(l)),"ignore"===g&&Ti(l)&&delete l.errors,a.markMutationResult({mutationId:e,result:l,document:n,variables:i,fetchPolicy:b,errorPolicy:g,context:O,update:p,updateQueries:s,awaitRefetchQueries:f,refetchQueries:c,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(),l(t instanceof ln?t:new ln({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&&Ho(n,e.errorPolicy)){if(mn(n)||i.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),mn(n)&&dn(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=_n(s.result,n)),void 0!==a&&(n.data=a,i.push({result:a,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var c=e.updateQueries;c&&this.queries.forEach((function(e,o){var s=e.observableQuery,a=s&&s.queryName;if(a&&Ko.call(c,a)){var u=c[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=u(p,{mutationResult:n,queryName:h&&Tr(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 l=[];if(this.refetchQueries({updateCache:function(t){o||i.forEach((function(e){return t.write(e)}));var s,a=e.update,c=!(mn(s=n)||function(e){return"hasNext"in e&&"data"in e}(s))||mn(n)&&!n.hasNext;if(a){if(!o){var l=t.diff({id:"ROOT_MUTATION",query:r.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});l.complete&&("incremental"in(n=u(u({},n),{data:l.result}))&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}c&&a(t,n,{context:e.context,variables:e.variables})}o||e.keepRootFields||!c||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 l.push(e)})),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).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(u(u({},t),{result:{data:n}}),e)}catch(e){!1!==globalThis.__DEV__&&Nt.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:Zr(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:Xr(["nonreactive"],e),clientQuery:this.localState.clientQuery(e),serverQuery:Gn([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"}],e),defaultVars:Mr(Er(e)),asQuery:u(u({},e),{definitions:e.definitions.map((function(e){return"OperationDefinition"===e.kind&&"query"!==e.operation?u(u({},e),{operation:"query"}):e}))})};t.set(e,r)}return t.get(e)},e.prototype.getVariables=function(e,t){return u(u({},this.getDocumentInfo(e).defaultVars),t)},e.prototype.watchQuery=function(e){var t=this.transform(e.query);void 0===(e=u(u({},e),{variables:this.getVariables(t,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var r=new Go(this),n=new Ui({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()),Nt(e.query,28),Nt("Document"===e.query.kind,29),Nt(!e.returnPartialData,30),Nt(!e.pollInterval,31),this.fetchQuery(t,u(u({},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(Rt(32)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=ki.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):ur(r=e)&&"Document"===r.kind&&Array.isArray(r.definitions)?n.set(t.transform(e),!1):ur(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=jt("legacyOneTimeQuery"),i=t.getQuery(n).init({document:e.query,variables:e.variables}),o=new Ui({queryManager:t,queryInfo:i,options:u(u({},e),{fetchPolicy:"network-only"})});Nt(o.queryId===n),i.setObservableQuery(o),r.set(n,o)})),!1!==globalThis.__DEV__&&n.size&&n.forEach((function(e,t){e||!1!==globalThis.__DEV__&&Nt.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&&(Ho(i,o)&&t.cache.write({query:r,result:i.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries());var s=Ti(i),a=function(e){return!!e.extensions&&Array.isArray(e.extensions[cn])}(i);if(s||a){var u={};if(s&&(u.graphQLErrors=i.errors),a&&(u.protocolErrors=i.extensions[cn]),"none"===o||a)throw new ln(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 ar((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),c=a.serverQuery,l=a.clientQuery;if(c){var h=this.inFlightLinkObservables,d=this.link,f={query:c,variables:r,operationName:Tr(c)||void 0,context:this.prepareContext(u(u({},t),{forceFetch:!n}))};if(t=f.context,n){var p=Bn(c),v=h.get(p)||new Map;h.set(p,v);var y=_i(r);if(!(o=v.get(y))){var b=new Di([Pr(d,f)]);v.set(y,o=b),b.beforeNext((function(){v.delete(y)&&v.size<1&&h.delete(p)}))}}else o=new Di([Pr(d,f)])}else o=new Di([ar.of({data:{}})]),t=this.prepareContext(t);return l&&(o=Ei(o,(function(e){return s.localState.runResolvers({document:l,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 Ei(this.getObservableFromLink(i,r.context,r.variables),(function(o){var s=Ii(o),a=s.length>0;if(n>=e.lastRequestId){if(a&&"none"===r.errorPolicy)throw e.markError(new ln({graphQLErrors:s}));e.markResult(o,i,r,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:ki.ready};return a&&"ignore"!==r.errorPolicy&&(u.errors=s,u.networkStatus=ki.error),u}),(function(t){var r=t.hasOwnProperty("graphQLErrors")?t:new ln({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=ki.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 Di(this.localState.addExportedVariables(_.query,_.variables,_.context).then(O).then((function(e){return e.sources}))),s=!0;else{var w=O(_.variables);s=w.fromLink,o=new Di(w.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?jt("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 Go&&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,c=t.errorPolicy,l=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||ki.loading);var s=t.result;!1===globalThis.__DEV__||l||oi(s,{})||Wi(t.missing);var a=function(e){return ar.of(u({data:e,loading:ji(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"===c&&r===ki.refetch&&Array.isArray(t.missing)?a(void 0):a(s)},y="no-cache"===s?0:r===ki.refetch&&"merge"!==a?1:2,b=function(){return n.getResultsFromLink(e,y,{query:i,variables:o,context:h,fetchPolicy:s,errorPolicy:c})},m=d&&"number"==typeof f&&f!==r&&ji(r);switch(s){default:case"cache-first":return(g=p()).complete?{fromLink:!1,sources:[v(g,e.markReady())]}:l||m?{fromLink:!0,sources:[v(g),b()]}:{fromLink:!0,sources:[b()]};case"cache-and-network":var g;return(g=p()).complete||l||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 Go(this,e)),this.queries.get(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return u(u({},t),{clientAwareness:this.clientAwareness})},e}();function Xo(e,t){return xi(e,t,t.variables&&{variables:xi(u(u({},e&&e.variables),t.variables))})}var Zo=!1,es=function(){function e(e){var t=this;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw Rt(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,w=e.link;w||(w=r?new ei({uri:r,credentials:n,headers:i}):xr.empty()),this.link=w,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=Ft,this.localState=new zo({cache:o,client:this,resolvers:m,fragmentMatcher:_}),this.queryManager=new Jo({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}Zo||!1===globalThis.__DEV__||(Zo=!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__&&Nt.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=Xo(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=u(u({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=Xo(this.defaultOptions.query,e)),Nt("cache-and-network"!==e.fetchPolicy,16),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=u(u({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Xo(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 Pr(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__&&Nt.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}(),ts=function(){function e(){this.assumeImmutableResults=!1,this.getFragmentDoc=qo(cr)}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(u(u({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(u(u({},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=c(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=c(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(u(u({},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(u(u({},e),{data:i})),i)}})},e}(),rs=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 a(t,e),t}(Error);function ns(e){return!1!==globalThis.__DEV__&&(t=e,(r=new Set([t])).forEach((function(e){ur(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){ur(e[t])&&r.add(e[t])}))}))),e;var t,r}var is=Object.prototype.hasOwnProperty;function os(e){return null==e}function ss(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=os(n)?os(i)?void 0:{_id:i}:{id:n}),os(n)&&!os(i)&&(n=i),!os(n)))return"".concat(r,":").concat("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))}var as={dataIdFromObject:ss,addTypename:!0,resultCaching:!0,canonizeResults:!1};function us(e){var t=e.canonizeResults;return void 0===t?as.canonizeResults:t}var cs=/^[_a-z][_0-9a-z]*/i;function ls(e){var t=e.match(cs);return t?t[0]:e}function hs(e,t,r){return!!ur(t)&&(hn(t)?t.every((function(t){return hs(e,t,r)})):e.selections.every((function(e){if(Sr(e)&&Jr(e,r)){var n=_r(e);return is.call(t,n)&&(!e.selectionSet||hs(e.selectionSet,t[n],r))}return!0})))}function ds(e){return ur(e)&&!fr(e)&&!hn(e)}function fs(e,t){var r=lr(Ir(e));return{fragmentMap:r,lookupFragment:function(e){var n=r[e];return!n&&t&&(n=t.lookup(e)),n||null}}}var ps=Object.create(null),vs=function(){return ps},ys=Object.create(null),bs=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 ns(fr(e)?r.get(e.__ref,t):e&&e[t])},this.canRead=function(e){return fr(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return dr(e);if(fr(e))return e;var n=r.policies.identify(e)[0];if(n){var i=dr(n);return t&&r.merge(n,e),i}}}return e.prototype.toObject=function(){return u({},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),is.call(this.data,e)){var r=this.data[e];if(r&&is.call(r,t))return r[t]}return"__typename"===t&&is.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Os?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),is.call(this.data,e)?this.data[e]:this instanceof Os?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},e.prototype.merge=function(e,t){var r,n=this;fr(e)&&(e=e.__ref),fr(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){Nt("string"==typeof r,1);var s=new bn(ws).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=ls(e);t===e||n.policies.hasKeyArgs(s.__typename,t)||(a[t]=1),void 0!==s[e]||n instanceof Os||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:ps,INVALIDATE:ys,isReference:fr,toReference:this.toReference,canRead:this.canRead,readField:function(t,n){return r.policies.readField("string"==typeof t?{fieldName:t,from:n||dr(e)}:t,{store:r})}};if(Object.keys(n).forEach((function(c){var l=ls(c),h=n[c];if(void 0!==h){var d="function"==typeof t?t:t[c]||t[l];if(d){var f=d===vs?ps:d(ns(h),u(u({},a),{fieldName:l,storeFieldName:c,storage:r.getStorage(e,c)}));if(f===ys)r.group.dirty(e,c);else if(f===ps&&(f=void 0),f!==h&&(i[c]=f,o=!0,h=f,!1!==globalThis.__DEV__)){var p=function(e){if(void 0===r.lookup(e.__ref))return!1!==globalThis.__DEV__&&Nt.warn(2,e),!0};if(fr(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(fr(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__&&Nt.warn(3,y);break}}}}void 0!==h&&(s=!1)}})),o)return this.merge(e,i),s&&(this instanceof Os?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]=vs,n):vs)}return!1},e.prototype.evict=function(e,t){var r=!1;return e.id&&(is.call(this.data,e.id)&&(r=this.delete(e.id,e.fieldName,e.args)),this instanceof Os&&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){is.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&&is.call(e,r)||t.delete(r)})),e){var r=e.__META,n=c(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 Os?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){is.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 Os;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},e.prototype.findChildRefIds=function(e){if(!is.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){fr(e)&&(t[e.__ref]=!0),ur(e)&&Object.keys(e).forEach((function(t){var r=e[t];ur(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?Po():null,this.keyMaker=new yi(tn)},e.prototype.depend=function(e,t){if(this.d){this.d(gs(e,t));var r=ls(t);r!==t&&this.d(gs(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(gs(e,t),"__exists"===t?"forget":"setDirty")},e}();function gs(e,t){return t+"#"+e}function _s(e,t){Es(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 Ss(s),s.storageTrie=new yi(tn),o&&s.replace(o),s}return a(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}(bs||(bs={}));var Os=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 a(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){oi(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 u(u({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var r=this.parent.findChildRefIds(t);return is.call(this.data,t)?u(u({},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}(bs),Ss=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,(function(){}),new ms(t.group.caching,t.group))||this}return a(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(e,t){return this.parent.merge(e,t)},t}(Os);function ws(e,t,r){var n=e[r],i=t[r];return oi(n,i)?n:i}function Es(e){return!!(e instanceof bs&&e.group.caching)}function Ts(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var Is=function(){function e(e){var t=this;this.knownResults=new(tn?WeakMap:Map),this.config=xi(e,{addTypename:!1!==e.addTypename,canonizeResults:us(e)}),this.canon=e.canon||new gi,this.executeSelectionSet=qo((function(e){var r,n=e.context.canonizeResults,i=Ts(e);i[3]=!n;var o=(r=t.executeSelectionSet).peek.apply(r,i);return o?n?u(u({},o),{result:t.canon.admit(o.result)}):o:(_s(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))}),{max:this.config.resultCacheMaxSize,keyArgs:Ts,makeCacheKey:function(e,t,r,n){if(Es(r.store))return r.store.makeCacheKey(e,fr(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=qo((function(e){return _s(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(Es(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return e.prototype.resetCanon=function(){this.canon=new gi},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,c=e.canonizeResults,l=void 0===c?this.config.canonizeResults:c,h=this.config.cache.policies;o=u(u({},Mr(Ar(r))),o);var d,f=dr(i),p=this.executeSelectionSet({selectionSet:Fr(r).selectionSet,objectOrReference:f,enclosingRef:f,context:u({store:t,query:r,policies:h,variables:o,varString:_i(o),canonizeResults:l},fs(r,this.config.fragments))});if(p.missing&&(d=[new rs(As(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(Es(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(fr(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 bn;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(Jr(e,a))if(Sr(e)){var v=u.readField({fieldName:e.name.value,field:e,variables:o.variables,from:n},o),y=_r(e);void 0===v?Hn.added(e)||(s=h.merge(s,((r={})[y]="Can't find field '".concat(e.name.value,"' on ").concat(fr(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),r))):hn(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:fr(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=hr(e,o.lookupFragment);if(!b&&e.kind===Wr.FRAGMENT_SPREAD)throw Rt(9,e.name.value);b&&u.fragmentMatches(b,c)&&b.selectionSet.selections.forEach(f.add,f)}}));var p={result:vn(l),missing:s},v=o.canonizeResults?this.canon.admit(p):ns(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 bn;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:hn(e)?u(r.executeSubSelectedArray({field:n,array:e,enclosingRef:o,context:s}),t):n.selectionSet?u(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:e,enclosingRef:fr(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){ur(r)&&(Nt(!fr(r),10,function(e,t){return fr(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 As(e){try{JSON.stringify(e,(function(e,t){if("string"==typeof t)throw t;return t}))}catch(e){return e}}var Fs=Object.create(null);function Ms(e){var t=JSON.stringify(e);return Fs[t]||(Fs[t]=Object.create(null))}function ks(e){var t=Ms(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,r){var n=function(e,t){return r.readField(t,e)},i=r.keyObject=js(e,(function(e){var i=Ns(r.storeObject,e,n);return void 0===i&&t!==r.storeObject&&is.call(t,e[0])&&(i=Ns(t,e,Ps)),Nt(void 0!==i,4,e.join("."),t),i}));return"".concat(r.typename,":").concat(JSON.stringify(i))})}function Ds(e){var t=Ms(e);return t.keyArgsFn||(t.keyArgsFn=function(t,r){var n=r.field,i=r.variables,o=r.fieldName,s=js(e,(function(e){var r=e[0],o=r.charAt(0);if("@"!==o)if("$"!==o){if(t)return Ns(t,e)}else{var s=r.slice(1);if(i&&is.call(i,s)){var a=e.slice(0);return a[0]=s,Ns(i,a)}}else if(n&&dn(n.directives)){var u=r.slice(1),c=n.directives.find((function(e){return e.name.value===u})),l=c&&gr(c,i);return l&&Ns(l,e.slice(1))}})),a=JSON.stringify(s);return(t||"{}"!==a)&&(o+=":"+a),o})}function js(e,t){var r=new bn;return xs(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 xs(e){var t=Ms(e);if(!t.paths){var r=t.paths=[],n=[];e.forEach((function(t,i){hn(t)?(xs(t).forEach((function(e){return r.push(n.concat(e))})),n.length=0):(n.push(t),hn(e[i+1])||(r.push(n.slice(0)),n.length=0))}))}return t.paths}function Ps(e,t){return e[t]}function Ns(e,t,r){return r=r||Ps,Rs(t.reduce((function e(t,n){return hn(t)?t.map((function(t){return e(t,n)})):t&&r(t,n)}),e))}function Rs(e){return ur(e)?hn(e)?e.map(Rs):js(Object.keys(e).sort(),(function(t){return Ns(e,t)})):e}function Cs(e){return void 0!==e.args?e.args:e.field?gr(e.field,e.variables):null}yr.setStringify(_i);var qs=function(){},Ls=function(e,t){return t.fieldName},Bs=function(e,t,r){return(0,r.mergeObjects)(e,t)},Qs=function(e,t){return t},Vs=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=u({dataIdFromObject:ss},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=u(u({},t),{typename:i,storeObject:s,readField:t&&t.readField||function(){var e=zs(arguments,s);return n.readField(e,{store:n.cache.data,variables:e.variables})}}),c=i&&this.getTypePolicy(i),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var h=l(u(u({},e),s),a);if(!hn(h)){o=h;break}l=ks(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=c(n,["queryType","mutationType","subscriptionType"]);i&&t.setRootTypename("Query",r),o&&t.setRootTypename("Mutation",r),s&&t.setRootTypename("Subscription",r),is.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?Bs:!1===t?Qs:e.merge}s(n,t.merge),n.keyFn=!1===i?qs:hn(i)?ks(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?Ls:hn(a)?Ds(a):"function"==typeof a?a:n.keyFn,"function"==typeof u&&(n.read=u),s(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||Ls)}))},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var r="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[r];t!==n&&(Nt(!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(cs);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},e.prototype.getTypePolicy=function(e){var t=this;if(!is.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=c(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__&&Nt.warn(6,t,o),s.add(o)),!0;d.forEach(u),c&&h===a.length-1&&hs(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=Cs(e);o;){var u=o(a,s);if(!hn(u)){t=u||n;break}o=Ds(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 pr(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 pr(n,r,i,t)}))),yr(e.name.value,n,r)}(e.field,e.variables):yr(n,Cs(e))),!1===t?n:n===ls(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=ls(i),s=t.store.getFieldValue(r,i),a=this.getFieldPolicy(e.typename,o,!1),u=a&&a.read;if(u){var c=Us(this,r,e,t,t.store.getStorage(fr(r)?r.__ref:r,i));return Lo.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===Bs?Ys(n.store)(e,t):a===Qs?t:(n.overwrite&&(e=void 0),a(e,t,Us(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},e}();function Us(e,t,r,n,i){var o=e.getStoreFieldName(r),s=ls(o),a=r.variables||n.variables,u=n.store,c=u.toReference,l=u.canRead;return{args:Cs(r),field:r.field||null,fieldName:s,storeFieldName:o,variables:a,isReference:fr,toReference:c,storage:i,cache:e.cache,canRead:l,readField:function(){return e.readField(zs(arguments,t,a),n)},mergeObjects:Ys(n.store)}}function zs(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=u({},i),is.call(n,"from")||(n.from=t)),!1!==globalThis.__DEV__&&void 0===n.from&&!1!==globalThis.__DEV__&&Nt.warn(7,xt(Array.from(e))),void 0===n.variables&&(n.variables=r),n}function Ys(e){return function(t,r){if(hn(t)||hn(r))throw Rt(8);if(ur(t)&&ur(r)){var n=e.getFieldValue(t,"__typename"),i=e.getFieldValue(r,"__typename");if(n&&i&&n!==i)return r;if(fr(t)&&ds(r))return e.merge(t.__ref,r),t;if(ds(t)&&fr(r))return e.merge(t,r.__ref),r;if(ds(t)&&ds(r))return u(u({},t),r)}return r}}function Ws(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:u(u({},e),{clientOnly:t,deferred:r})),i}var $s=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,c=Er(n),l=new bn;s=u(u({},Mr(c)),s);var h=u(u({store:e,written:Object.create(null),merge:function(e,t){return l.merge(e,t)},variables:s,varString:_i(s)},fs(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:c.selectionSet,mergeTree:{map:new Map},context:h});if(!fr(d))throw Rt(11,i);return h.incomingById.forEach((function(t,n){var i=t.storeObject,o=t.mergeTree,s=t.fieldNodeSet,a=dr(n);if(o&&o.map.size){var u=r.applyMerges(o,a,i,h);if(fr(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[ls(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&&!fr(o)&&!oi(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=ls(r),c="".concat(a,".").concat(u);if(!Zs.has(c)){Zs.add(c);var l=[];hn(o)||hn(s)||[o,s].forEach((function(e){var t=n.getFieldValue(e,"__typename");"string"!=typeof t||l.includes(t)||l.push(t)})),!1!==globalThis.__DEV__&&Nt.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,c=Object.create(null),l=r&&a.rootTypenamesById[r]||Or(n,i,o.fragmentMap)||r&&o.store.get(r,"__typename");"string"==typeof l&&(c.__typename=l);var h=function(){var e=zs(arguments,c,o.variables);if(fr(e.from)){var t=o.incomingById.get(e.from.__ref);if(t){var r=a.readField(u(u({},e),{from:t.storeObject}),o);if(void 0!==r)return r}}return a.readField(e,o)},d=new Set;this.flattenFields(i,n,o,l).forEach((function(e,r){var i,o=_r(r),u=n[o];if(d.add(r),void 0!==u){var f=a.getStoreFieldName({typename:l,fieldName:r.name.value,field:r,variables:e.variables}),p=Hs(s,f),v=t.processFieldValue(u,r,r.selectionSet?Ws(e,!1,!1):e,p),y=void 0;r.selectionSet&&(fr(v)||ds(v))&&(y=h("__typename",v));var b=a.getMergeFunction(l,r.name.value,y);b?p.info={field:r,typename:l,merge:b}:Xs(s,f),c=e.merge(c,((i={})[f]=v,i))}else!1===globalThis.__DEV__||e.clientOnly||e.deferred||Hn.added(r)||a.getReadFunction(l,r.name.value)||!1!==globalThis.__DEV__&&Nt.error(12,_r(r),n)}));try{var f=a.identify(n,{typename:l,selectionSet:i,fragmentMap:o.fragmentMap,storeObject:c,readField:h}),p=f[0],v=f[1];r=r||p,v&&(c=o.merge(c,v))}catch(e){if(!r)throw e}if("string"==typeof r){var y=dr(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,c),m.mergeTree=Ks(m.mergeTree,s),d.forEach((function(e){return m.fieldNodeSet.add(e)}))):o.incomingById.set(r,{storeObject:c,mergeTree:Js(s)?void 0:s,fieldNodeSet:d}),y}return c},e.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?hn(e)?e.map((function(e,o){var s=i.processFieldValue(e,t,r,Hs(n,o));return Xs(n,o),s})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):!1!==globalThis.__DEV__?Ni(e):e},e.prototype.flattenFields=function(e,t,r,n){void 0===n&&(n=Or(t,e,r.fragmentMap));var i=new Map,o=this.cache.policies,s=new yi(!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(Jr(s,r.variables)){var a=u.clientOnly,c=u.deferred;if(a&&c||!dn(s.directives)||s.directives.forEach((function(e){var t=e.name.value;if("client"===t&&(a=!0),"defer"===t){var n=gr(e,r.variables);n&&!1===n.if||(c=!0)}})),Sr(s)){var l=i.get(s);l&&(a=a&&l.clientOnly,c=c&&l.deferred),i.set(s,Ws(r,a,c))}else{var h=hr(s,r.lookupFragment);if(!h&&s.kind===Wr.FRAGMENT_SPREAD)throw Rt(13,s.name.value);h&&o.fragmentMatches(h,n,t,r.variables)&&e(h.selectionSet,Ws(r,a,c))}}})))}(e,r),i},e.prototype.applyMerges=function(e,t,r,n,i){var o,s=this;if(e.map.size&&!fr(r)){var a,c=hn(r)||!fr(t)&&!ds(t)?void 0:t,l=r;c&&!i&&(i=[fr(c)?c.__ref:c]);var h=function(e,t){return hn(e)?"number"==typeof t?e[t]:void 0:n.store.getFieldValue(e,String(t))};e.map.forEach((function(e,t){var r=h(c,t),o=h(l,t);if(void 0!==o){i&&i.push(t);var u=s.applyMerges(e,r,o,n,i);u!==o&&(a=a||new Map).set(t,u),i&&Nt(i.pop()===t)}})),a&&(r=hn(l)?l.slice(0):u({},l),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}(),Gs=[];function Hs(e,t){var r=e.map;return r.has(t)||r.set(t,Gs.pop()||{map:new Map}),r.get(t)}function Ks(e,t){if(e===t||!t||Js(t))return e;if(!e||Js(e))return t;var r=e.info&&t.info?u(u({},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,Ks(e,t.map.get(r))),o.delete(r)})),o.forEach((function(r){i.map.set(r,Ks(t.map.get(r),e.map.get(r)))}))}return i}function Js(e){return!e||!(e.info||e.map.size)}function Xs(e,t){var r=e.map,n=r.get(t);n&&Js(n)&&(Gs.push(n),r.delete(t))}var Zs=new Set,ea=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.watches=new Set,r.addTypenameTransform=new wi(Hn),r.assumeImmutableResults=!0,r.makeVar=Uo,r.txCount=0,r.config=function(e){return xi(as,e)}(t),r.addTypename=!!r.config.addTypename,r.policies=new Vs({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return a(t,e),t.prototype.init=function(){var e=this.data=new bs.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 $s(this,this.storeReader=new Is({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:us(this.config),canon:e?void 0:r&&r.canon,fragments:n}),n),this.maybeBroadcastWatch=qo((function(e,r){return t.broadcastWatch(e,r)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var r=e.optimistic?t.optimisticData:t.data;if(Es(r)){var n=e.optimistic,i=e.id,o=e.variables;return r.makeCacheKey(e.query,e.callback,_i({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(u(u({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:r})).result||null}catch(e){if(e instanceof rs)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(is.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(u(u({},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||Qo(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&&Vo(r),r.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){_i.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(fr(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(e){!1!==globalThis.__DEV__&&Nt.warn(e)}},t.prototype.evict=function(e){if(!e.id){if(is.call(e,"id"))return!1;e=u(u({},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(),_i.reset(),e&&e.discardWatches?(this.watches.forEach((function(e){return t.maybeBroadcastWatch.forget(e)})),this.watches.clear(),Vo(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,c=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}},l=new Set;return a&&!this.txCount&&this.broadcastWatches(u(u({},e),{onWatchUpdated:function(e){return l.add(e),!1}})),"string"==typeof o?this.optimisticData=this.optimisticData.addLayer(o,c):!1===o?c(this.data):c(),"string"==typeof s&&(this.optimisticData=this.optimisticData.removeLayer(s)),a&&l.size?(this.broadcastWatches(u(u({},e),{onWatchUpdated:function(e,t){var r=a.call(this,e,t);return!1!==r&&l.delete(e),r}})),l.size&&l.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&&oi(r.result,n.result)||e.callback(e.lastDiff=n,r)},t}(ts);function ta(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const ra=/\r\n|[\n\r]/g;function na(e,t){let r=0,n=1;for(const i of e.body.matchAll(ra)){if("number"==typeof i.index||ta(!1),i.index>=t)break;r=i.index+i[0].length,n+=1}return{line:n,column:t+1-r}}function ia(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+oa([[`${s} |`,r[0]],...r.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",r[e+1]]])}return c+oa([[s-1+" |",l[i-1]],[`${s} |`,h],["|","^".padStart(u)],[`${s+1} |`,l[i+1]]])}function oa(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 sa 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=aa(Array.isArray(o)?o:o?[o]:void 0);const h=aa(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=>na(s,e))):null==h?void 0:h.map((e=>na(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,sa):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"+ia((t=r.loc).source,na(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+ia(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 aa(e){return void 0===e||0===e.length?void 0:e}function ua(e,t,r){return new sa(`Syntax Error: ${r}`,{source:e,positions:[t]})}var ca,la,ha;!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"}(ca||(ca={})),(ha=la||(la={})).SOF="<SOF>",ha.EOF="<EOF>",ha.BANG="!",ha.DOLLAR="$",ha.AMP="&",ha.PAREN_L="(",ha.PAREN_R=")",ha.SPREAD="...",ha.COLON=":",ha.EQUALS="=",ha.AT="@",ha.BRACKET_L="[",ha.BRACKET_R="]",ha.BRACE_L="{",ha.PIPE="|",ha.BRACE_R="}",ha.NAME="Name",ha.INT="Int",ha.FLOAT="Float",ha.STRING="String",ha.BLOCK_STRING="BlockString",ha.COMMENT="Comment";class da{constructor(e){const t=new Qr(la.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!==la.EOF)do{if(e.next)e=e.next;else{const t=ga(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===la.COMMENT);return e}}function fa(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function pa(e,t){return va(e.charCodeAt(t))&&ya(e.charCodeAt(t+1))}function va(e){return e>=55296&&e<=56319}function ya(e){return e>=56320&&e<=57343}function ba(e,t){const r=e.source.body.codePointAt(t);if(void 0===r)return la.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 Qr(t,r,n,o,s,i)}function ga(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 _a(e,i);case 33:return ma(e,la.BANG,i,i+1);case 36:return ma(e,la.DOLLAR,i,i+1);case 38:return ma(e,la.AMP,i,i+1);case 40:return ma(e,la.PAREN_L,i,i+1);case 41:return ma(e,la.PAREN_R,i,i+1);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return ma(e,la.SPREAD,i,i+3);break;case 58:return ma(e,la.COLON,i,i+1);case 61:return ma(e,la.EQUALS,i,i+1);case 64:return ma(e,la.AT,i,i+1);case 91:return ma(e,la.BRACKET_L,i,i+1);case 93:return ma(e,la.BRACKET_R,i,i+1);case 123:return ma(e,la.BRACE_L,i,i+1);case 124:return ma(e,la.PIPE,i,i+1);case 125:return ma(e,la.BRACE_R,i,i+1);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?Ma(e,i):wa(e,i)}if(Tn(t)||45===t)return Oa(e,i,t);if(An(t))return ka(e,i);throw ua(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":fa(t)||pa(r,i)?`Unexpected character: ${ba(e,i)}.`:`Invalid character: ${ba(e,i)}.`)}return ma(e,la.EOF,n,n)}function _a(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(fa(e))++i;else{if(!pa(r,i))break;i+=2}}return ma(e,la.COMMENT,t,i,r.slice(t+1,i))}function Oa(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),Tn(o))throw ua(e.source,i,`Invalid number, unexpected digit after 0: ${ba(e,i)}.`)}else i=Sa(e,i,o),o=n.charCodeAt(i);if(46===o&&(s=!0,o=n.charCodeAt(++i),i=Sa(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=Sa(e,i,o),o=n.charCodeAt(i)),46===o||An(o))throw ua(e.source,i,`Invalid number, expected digit but got: ${ba(e,i)}.`);return ma(e,s?la.FLOAT:la.INT,t,i,n.slice(t,i))}function Sa(e,t,r){if(!Tn(r))throw ua(e.source,t,`Invalid number, expected digit but got: ${ba(e,t)}.`);const n=e.source.body;let i=t+1;for(;Tn(n.charCodeAt(i));)++i;return i}function wa(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,la.STRING,t,i+1,s);if(92!==n){if(10===n||13===n)break;if(fa(n))++i;else{if(!pa(r,i))throw ua(e.source,i,`Invalid character within String: ${ba(e,i)}.`);i+=2}}else{s+=r.slice(o,i);const t=117===r.charCodeAt(i+1)?123===r.charCodeAt(i+2)?Ea(e,i):Ta(e,i):Fa(e,i);s+=t.value,i+=t.size,o=i}}throw ua(e.source,i,"Unterminated string.")}function Ea(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||!fa(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|Aa(e),n<0)break}throw ua(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+i)}".`)}function Ta(e,t){const r=e.source.body,n=Ia(r,t+2);if(fa(n))return{value:String.fromCodePoint(n),size:6};if(va(n)&&92===r.charCodeAt(t+6)&&117===r.charCodeAt(t+7)){const e=Ia(r,t+8);if(ya(e))return{value:String.fromCodePoint(n,e),size:12}}throw ua(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+6)}".`)}function Ia(e,t){return Aa(e.charCodeAt(t))<<12|Aa(e.charCodeAt(t+1))<<8|Aa(e.charCodeAt(t+2))<<4|Aa(e.charCodeAt(t+3))}function Aa(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Fa(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 ua(e.source,t,`Invalid character escape sequence: "${r.slice(t,t+2)}".`)}function Ma(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,la.BLOCK_STRING,t,o+3,Fn(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(fa(n))++o;else{if(!pa(r,o))throw ua(e.source,o,`Invalid character within String: ${ba(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 ua(e.source,o,"Unterminated string.")}function ka(e,t){const r=e.source.body,n=r.length;let i=t+1;for(;i<n&&(In(o=r.charCodeAt(i))||Tn(o)||95===o);)++i;var o;return ma(e,la.NAME,t,i,r.slice(t,i))}class Da{constructor(e,t="GraphQL request",r={line:1,column:1}){"string"==typeof e||Nr(!1,`Body must be a string. Received: ${qr(e)}.`),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||Nr(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Nr(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class ja{constructor(e,t={}){const r=function(e){return e instanceof Da}(e)?e:new Da(e);this._lexer=new da(r),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(la.NAME);return this.node(e,{kind:Wr.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Wr.DOCUMENT,definitions:this.many(la.SOF,this.parseDefinition,la.EOF)})}parseDefinition(){if(this.peek(la.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===la.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 ua(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(la.BRACE_L))return this.node(e,{kind:Wr.OPERATION_DEFINITION,operation:Yr.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let r;return this.peek(la.NAME)&&(r=this.parseName()),this.node(e,{kind:Wr.OPERATION_DEFINITION,operation:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(la.NAME);switch(e.value){case"query":return Yr.QUERY;case"mutation":return Yr.MUTATION;case"subscription":return Yr.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(la.PAREN_L,this.parseVariableDefinition,la.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Wr.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(la.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(la.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(la.DOLLAR),this.node(e,{kind:Wr.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Wr.SELECTION_SET,selections:this.many(la.BRACE_L,this.parseSelection,la.BRACE_R)})}parseSelection(){return this.peek(la.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let r,n;return this.expectOptionalToken(la.COLON)?(r=t,n=this.parseName()):n=t,this.node(e,{kind:Wr.FIELD,alias:r,name:n,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(la.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(la.PAREN_L,t,la.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,r=this.parseName();return this.expectToken(la.COLON),this.node(t,{kind:Wr.ARGUMENT,name:r,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(la.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(la.NAME)?this.node(e,{kind:Wr.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Wr.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:Wr.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:Wr.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 la.BRACKET_L:return this.parseList(e);case la.BRACE_L:return this.parseObject(e);case la.INT:return this.advanceLexer(),this.node(t,{kind:Wr.INT,value:t.value});case la.FLOAT:return this.advanceLexer(),this.node(t,{kind:Wr.FLOAT,value:t.value});case la.STRING:case la.BLOCK_STRING:return this.parseStringLiteral();case la.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Wr.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Wr.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Wr.NULL});default:return this.node(t,{kind:Wr.ENUM,value:t.value})}case la.DOLLAR:if(e){if(this.expectToken(la.DOLLAR),this._lexer.token.kind===la.NAME){const e=this._lexer.token.value;throw ua(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:Wr.STRING,value:e.value,block:e.kind===la.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:Wr.LIST,values:this.any(la.BRACKET_L,(()=>this.parseValueLiteral(e)),la.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:Wr.OBJECT,fields:this.any(la.BRACE_L,(()=>this.parseObjectField(e)),la.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,r=this.parseName();return this.expectToken(la.COLON),this.node(t,{kind:Wr.OBJECT_FIELD,name:r,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(la.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(la.AT),this.node(t,{kind:Wr.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(la.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(la.BRACKET_R),t=this.node(e,{kind:Wr.LIST_TYPE,type:r})}else t=this.parseNamedType();return this.expectOptionalToken(la.BANG)?this.node(e,{kind:Wr.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Wr.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(la.STRING)||this.peek(la.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(la.BRACE_L,this.parseOperationTypeDefinition,la.BRACE_R);return this.node(e,{kind:Wr.SCHEMA_DEFINITION,description:t,directives:r,operationTypes:n})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(la.COLON);const r=this.parseNamedType();return this.node(e,{kind:Wr.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:Wr.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:Wr.OBJECT_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:i,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(la.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(la.BRACE_L,this.parseFieldDefinition,la.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName(),n=this.parseArgumentDefs();this.expectToken(la.COLON);const i=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:Wr.FIELD_DEFINITION,description:t,name:r,arguments:n,type:i,directives:o})}parseArgumentDefs(){return this.optionalMany(la.PAREN_L,this.parseInputValueDef,la.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName();this.expectToken(la.COLON);const n=this.parseTypeReference();let i;this.expectOptionalToken(la.EQUALS)&&(i=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:Wr.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:Wr.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:Wr.UNION_TYPE_DEFINITION,description:t,name:r,directives:n,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(la.EQUALS)?this.delimitedMany(la.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:Wr.ENUM_TYPE_DEFINITION,description:t,name:r,directives:n,values:i})}parseEnumValuesDefinition(){return this.optionalMany(la.BRACE_L,this.parseEnumValueDefinition,la.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseEnumValueName(),n=this.parseConstDirectives();return this.node(e,{kind:Wr.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 ua(this._lexer.source,this._lexer.token.start,`${xa(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:Wr.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:r,directives:n,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(la.BRACE_L,this.parseInputValueDef,la.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===la.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(la.BRACE_L,this.parseOperationTypeDefinition,la.BRACE_R);if(0===t.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:Wr.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:Wr.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:Wr.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:Wr.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:Wr.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:Wr.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:Wr.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:r,fields:n})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(la.AT);const r=this.parseName(),n=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:Wr.DIRECTIVE_DEFINITION,description:t,name:r,arguments:n,repeatable:i,locations:o})}parseDirectiveLocations(){return this.delimitedMany(la.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(ca,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new Br(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 ua(this._lexer.source,t.start,`Expected ${Pa(e)}, found ${xa(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==la.NAME||t.value!==e)throw ua(this._lexer.source,t.start,`Expected "${e}", found ${xa(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===la.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return ua(this._lexer.source,t.start,`Unexpected ${xa(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!==la.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw ua(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function xa(e){const t=e.value;return Pa(e.kind)+(null!=t?` "${t}"`:"")}function Pa(e){return function(e){return e===la.BANG||e===la.DOLLAR||e===la.AMP||e===la.PAREN_L||e===la.PAREN_R||e===la.SPREAD||e===la.COLON||e===la.EQUALS||e===la.AT||e===la.BRACKET_L||e===la.BRACKET_R||e===la.BRACE_L||e===la.PIPE||e===la.BRACE_R}(e)?`"${e}"`:e}var Na=new Map,Ra=new Map,Ca=!0,qa=!1;function La(e){return e.replace(/[\s,]+/g," ").trim()}function Ba(e){var t,r,n,i=La(e);if(!Na.has(i)){var o=function(e,t){return new ja(e,t).parseDocument()}(e,{experimentalFragmentVariables:qa,allowLegacyFragmentVariables:qa});if(!o||"Document"!==o.kind)throw new Error("Not a valid GraphQL document.");Na.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=La((s=e.loc).source.body.substring(s.start,s.end)),o=Ra.get(t);o&&!o.has(i)?Ca&&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||Ra.set(t,o=new Set),o.add(i),r.has(i)||(r.add(i),n.push(e))}else n.push(e);var s})),u(u({},t),{definitions:n}))))}return Na.get(i)}function Qa(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]})),Ba(n)}var Va,Ua=Qa;(Va=Qa||(Qa={})).gql=Ua,Va.resetCaches=function(){Na.clear(),Ra.clear()},Va.disableFragmentWarnings=function(){Ca=!1},Va.enableExperimentalFragmentVariables=function(){qa=!0},Va.disableExperimentalFragmentVariables=function(){qa=!1},Qa.default=Qa;const za=["query","aiData","api","backend-function","webhooks","ws","quota","named-query","native-query","application-kotlin","openapi","secret","queue","mutation","application","storage","internalCodeExecutor"];function Ya(e,t,r){const n=new URL("https://squid.cloud");n.host=`${t}.${e}.${n.host}`;const i=r.replace(/^\//g,"").split("/")[0]||"";Wa(e)&&(n.protocol="http",n.port=za.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 Wa(e){return/^local/.test(e)}class $a{constructor(e,t,r,n){this.rpcManager=e,this.region=r,this.appId=n;const i=Ya(this.region,this.appId,`${t}/graphql`);this.client=new es({link:new ei({uri:i,headers:this.rpcManager.getStaticHeaders()}),cache:new ea})}async query(e){return(await this.client.query({query:Qa`
|
|
1
|
+
(()=>{"use strict";var e={8278:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3910: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(8599);t.default=o.PromisePool,i(r(8278),t),i(r(8599),t),i(r(5607),t),i(r(6784),t),i(r(9446),t),i(r(4204),t)},5607:(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},4027:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePoolExecutor=void 0;const n=r(8599),i=r(5607),o=r(9446),s=r(4204);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())}}},8599:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePool=void 0;const n=r(4027);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")},6784:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9446:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StopThePromisePoolError=void 0;class r extends Error{}t.StopThePromisePoolError=r},4204:(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},8975: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(3355),t)},6676:(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(9862),i=r(4356);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},4810:(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(6676),i=r(4356);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}`)}},4356:(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(6676),i=r(9862);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)))}},9862:(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}},7122:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateRecord=t.validateArray=t.validateObject=t.tryCatch=void 0;const n=r(6676);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)))}},3355: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(6676),t),i(r(4810),t),i(r(4356),t),i(r(9862),t),i(r(7122),t)},511: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(7965),t)},7965:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TrieStore=void 0;const n=r(74),i=r(1964),o=r(9978),s=r(4843);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}}},74:(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(8975);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},4843: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(1419),t)},1419:(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")},7257:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncSubject=void 0;var o=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 i(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(9520).Subject);t.AsyncSubject=o},8042:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.BehaviorSubject=void 0;var o=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return i(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(9520).Subject);t.BehaviorSubject=o},3868:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeNotification=t.Notification=t.NotificationKind=void 0;var n,i=r(1727),o=r(7443),s=r(859),a=r(4432);(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},3380:(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},5271:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var n=r(1403),i=r(7215),o=r(2138),s=r(5966),a=r(3782),u=r(4432),c=r(4770),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},216:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ReplaySubject=void 0;var o=r(9520),s=r(1713),a=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=s.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 i(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}(o.Subject);t.ReplaySubject=a},3980:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Scheduler=void 0;var n=r(1713),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},9520:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=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 s=r(5271),a=r(7215),u=r(7392),c=r(2447),l=r(4770),h=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 i(t,e),t.prototype.lift=function(e){var t=new d(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new u.ObjectUnsubscribedError},t.prototype.next=function(e){var t=this;l.errorContext((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=o(t.currentObservers),s=i.next();!s.done;s=i.next())s.value.next(e)}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;l.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;l.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?a.EMPTY_SUBSCRIPTION:(this.currentObservers=null,o.push(e),new a.Subscription((function(){t.currentObservers=null,c.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 s.Observable;return e.source=this,e},t.create=function(e,t){return new d(e,t)},t}(s.Observable);t.Subject=h;var d=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return i(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:a.EMPTY_SUBSCRIPTION},t}(h);t.AnonymousSubject=d},1403:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_OBSERVER=t.SafeSubscriber=t.Subscriber=void 0;var o=r(4432),s=r(7215),a=r(3782),u=r(7234),c=r(5729),l=r(3380),h=r(8972),d=r(4770),f=function(e){function r(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,s.isSubscription(r)&&r.add(n)):n.destination=t.EMPTY_OBSERVER,n}return i(r,e),r.create=function(e,t,r){return new b(e,t,r)},r.prototype.next=function(e){this.isStopped?g(l.nextNotification(e),this):this._next(e)},r.prototype.error=function(e){this.isStopped?g(l.errorNotification(e),this):(this.isStopped=!0,this._error(e))},r.prototype.complete=function(){this.isStopped?g(l.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}(s.Subscription);t.Subscriber=f;var p=Function.prototype.bind;function v(e,t){return p.call(e,t)}var y=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){m(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){m(e)}else m(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){m(e)}},e}(),b=function(e){function t(t,r,n){var i,s,u=e.call(this)||this;return o.isFunction(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:u&&a.config.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},i={next:t.next&&v(t.next,s),error:t.error&&v(t.error,s),complete:t.complete&&v(t.complete,s)}):i=t,u.destination=new y(i),u}return i(t,e),t}(f);function m(e){a.config.useDeprecatedSynchronousErrorHandling?d.captureError(e):u.reportUnhandledError(e)}function g(e,t){var r=a.config.onStoppedNotification;r&&h.timeoutProvider.setTimeout((function(){return r(e,t)}))}t.SafeSubscriber=b,t.EMPTY_OBSERVER={closed:!0,next:c.noop,error:function(e){throw e},complete:c.noop}},7215: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(4432),a=r(5463),u=r(2447),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)}},3782:(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}},3739:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectableObservable=void 0;var o=r(5271),s=r(7215),a=r(2711),u=r(5079),c=r(4024),l=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,c.hasLift(t)&&(n.lift=t.lift),n}return i(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 s.Subscription;var r=this.getSubject();t.add(this.source.subscribe(u.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=s.Subscription.EMPTY)}return t},t.prototype.refCount=function(){return a.refCount()(this)},t}(o.Observable);t.ConnectableObservable=l},1047:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestInit=t.combineLatest=void 0;var n=r(5271),i=r(4744),o=r(6216),s=r(9144),a=r(4666),u=r(2619),c=r(1589),l=r(5079),h=r(5421);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},79:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concat=void 0;var n=r(4554),i=r(2619),o=r(6216);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)))}},1727:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.empty=t.EMPTY=void 0;var n=r(5271);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}},6216:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.from=void 0;var n=r(3200),i=r(9451);t.from=function(e,t){return t?n.scheduled(e,t):i.innerFrom(e)}},2160:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromSubscribable=void 0;var n=r(5271);t.fromSubscribable=function(e){return new n.Observable((function(t){return e.subscribe(t)}))}},9451: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(8219),u=r(2644),c=r(5271),l=r(3292),h=r(7707),d=r(4883),f=r(6380),p=r(9266),v=r(4432),y=r(7234),b=r(2138);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 w(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 w(e)}throw d.createInvalidObservableTypeError(e)},t.fromInteropObservable=m,t.fromArrayLike=g,t.fromPromise=_,t.fromIterable=O,t.fromAsyncIterable=S,t.fromReadableStreamLike=w},4449:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.interval=void 0;var n=r(4617),i=r(5710);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)}},7443:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.of=void 0;var n=r(2619),i=r(6216);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)}},1282:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.onErrorResumeNext=void 0;var n=r(5271),i=r(4475),o=r(5079),s=r(5729),a=r(9451);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()}))}},7779:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.raceInit=t.race=void 0;var n=r(5271),i=r(9451),o=r(4475),s=r(5079);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},859:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throwError=void 0;var n=r(5271),i=r(4432);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)}},5710:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timer=void 0;var n=r(5271),i=r(4617),o=r(6551),s=r(7761);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)}))}},2042: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(5271),s=r(9451),a=r(4475),u=r(1727),c=r(5079),l=r(2619);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}},5079:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.OperatorSubscriber=t.createOperatorSubscriber=void 0;var o=r(1403);t.createOperatorSubscriber=function(e,t,r,n,i){return new s(e,t,r,n,i)};var s=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 i(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}(o.Subscriber);t.OperatorSubscriber=s},3533:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.audit=void 0;var n=r(4024),i=r(9451),o=r(5079);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()})))}))}},5188:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.auditTime=void 0;var n=r(4617),i=r(3533),o=r(5710);t.auditTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.audit((function(){return o.timer(e,t)}))}},4514:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.buffer=void 0;var n=r(4024),i=r(5729),o=r(5079),s=r(9451);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}}))}},2537: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(4024),o=r(5079),s=r(2447);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})))}))}},8720: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(7215),o=r(4024),s=r(5079),a=r(2447),u=r(4617),c=r(2619),l=r(5421);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)}))}},7932: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(7215),o=r(4024),s=r(9451),a=r(5079),u=r(5729),c=r(2447);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()})))}))}},1445:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bufferWhen=void 0;var n=r(4024),i=r(5729),o=r(5079),s=r(9451);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})))}))}},4418:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.catchError=void 0;var n=r(9451),i=r(5079),o=r(4024);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))}))}},4163:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineAll=void 0;var n=r(9893);t.combineAll=n.combineLatestAll},8169: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(1047),s=r(4024),a=r(4475),u=r(4666),c=r(5966),l=r(2619);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)}))}},9893:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestAll=void 0;var n=r(1047),i=r(7534);t.combineLatestAll=function(e){return i.joinAllInternals(n.combineLatest,e)}},7230: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(8169);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)))}},4098: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(4024),s=r(4554),a=r(2619),u=r(6216);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)}))}},4554:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatAll=void 0;var n=r(4594);t.concatAll=function(){return n.mergeAll(1)}},1048:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatMap=void 0;var n=r(9010),i=r(4432);t.concatMap=function(e,t){return i.isFunction(t)?n.mergeMap(e,t,1):n.mergeMap(e,1)}},381:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.concatMapTo=void 0;var n=r(1048),i=r(4432);t.concatMapTo=function(e,t){return i.isFunction(t)?n.concatMap((function(){return e}),t):n.concatMap((function(){return e}))}},4724: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(4098);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)))}},4347:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.connect=void 0;var n=r(9520),i=r(9451),o=r(4024),s=r(2160),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))}))}},6944:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.count=void 0;var n=r(1386);t.count=function(e){return n.reduce((function(t,r,n){return!e||e(r,n)?t+1:t}),0)}},440:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0;var n=r(4024),i=r(5729),o=r(5079),s=r(9451);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})))}))}},8157:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounceTime=void 0;var n=r(4617),i=r(4024),o=r(5079);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})))}))}},1714:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultIfEmpty=void 0;var n=r(4024),i=r(5079);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()})))}))}},1030:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0;var n=r(4617),i=r(6405),o=r(5710);t.delay=function(e,t){void 0===t&&(t=n.asyncScheduler);var r=o.timer(e,t);return i.delayWhen((function(){return r}))}},6405:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.delayWhen=void 0;var n=r(79),i=r(7138),o=r(3470),s=r(4791),a=r(9010),u=r(9451);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))}))}},9142:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dematerialize=void 0;var n=r(3868),i=r(4024),o=r(5079);t.dematerialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){return n.observeNotification(e,t)})))}))}},2307:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinct=void 0;var n=r(4024),i=r(5079),o=r(5729),s=r(9451);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))}))}},9131:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilChanged=void 0;var n=r(9144),i=r(4024),o=r(5079);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))})))}))}},6659:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilKeyChanged=void 0;var n=r(9131);t.distinctUntilKeyChanged=function(e,t){return n.distinctUntilChanged((function(r,n){return t?t(r[e],n[e]):r[e]===n[e]}))}},4217:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.elementAt=void 0;var n=r(6809),i=r(2763),o=r(8062),s=r(1714),a=r(7138);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})))}}},4707: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(79),s=r(7443);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))))}}},9276:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.every=void 0;var n=r(4024),i=r(5079);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()})))}))}},337:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaust=void 0;var n=r(3977);t.exhaust=n.exhaustAll},3977:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustAll=void 0;var n=r(368),i=r(9144);t.exhaustAll=function(){return n.exhaustMap(i.identity)}},368:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustMap=void 0;var n=r(4338),i=r(9451),o=r(4024),s=r(5079);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()})))}))}},7829:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.expand=void 0;var n=r(4024),i=r(7163);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)}))}},2763:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.filter=void 0;var n=r(4024),i=r(5079);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)})))}))}},4106:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.finalize=void 0;var n=r(4024);t.finalize=function(e){return n.operate((function(t,r){try{t.subscribe(r)}finally{r.add(e)}}))}},8759:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createFind=t.find=void 0;var n=r(4024),i=r(5079);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},3999:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findIndex=void 0;var n=r(4024),i=r(8759);t.findIndex=function(e,t){return n.operate(i.createFind(e,t,"index"))}},5194:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.first=void 0;var n=r(8032),i=r(2763),o=r(7138),s=r(1714),a=r(8062),u=r(9144);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})))}}},2735:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.flatMap=void 0;var n=r(9010);t.flatMap=n.mergeMap},1664:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.groupBy=void 0;var n=r(5271),i=r(9451),o=r(9520),s=r(4024),a=r(5079);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)}))}},3470:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ignoreElements=void 0;var n=r(4024),i=r(5079),o=r(5729);t.ignoreElements=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,o.noop))}))}},9549:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var n=r(4024),i=r(5079);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()})))}))}},7534:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.joinAllInternals=void 0;var n=r(9144),i=r(4666),o=r(5966),s=r(9010),a=r(2378);t.joinAllInternals=function(e,t){return o.pipe(a.toArray(),s.mergeMap((function(t){return e(t)})),t?i.mapOneOrManyArgs(t):n.identity)}},9582:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.last=void 0;var n=r(8032),i=r(2763),o=r(4288),s=r(8062),a=r(1714),u=r(9144);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})))}}},4338:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.map=void 0;var n=r(4024),i=r(5079);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++))})))}))}},4791:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mapTo=void 0;var n=r(4338);t.mapTo=function(e){return n.map((function(){return e}))}},9318:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.materialize=void 0;var n=r(3868),i=r(4024),o=r(5079);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()})))}))}},7446:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.max=void 0;var n=r(1386),i=r(4432);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})}},6094: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(4024),s=r(4475),a=r(4594),u=r(2619),c=r(6216);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)}))}},4594:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=void 0;var n=r(9010),i=r(9144);t.mergeAll=function(e){return void 0===e&&(e=1/0),n.mergeMap(i.identity,e)}},7163:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeInternals=void 0;var n=r(9451),i=r(5421),o=r(5079);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()}}},9010:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMap=void 0;var n=r(4338),i=r(9451),o=r(4024),s=r(7163),a=r(4432);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)})))}},8983:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMapTo=void 0;var n=r(9010),i=r(4432);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))}},2170:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeScan=void 0;var n=r(4024),i=r(7163);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}))}))}},3674: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(6094);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)))}},1446:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.min=void 0;var n=r(1386),i=r(4432);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})}},2318:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.multicast=void 0;var n=r(3739),i=r(4432),o=r(4347);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)}}},3165:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeOn=void 0;var n=r(5421),i=r(4024),o=r(5079);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)})))}))}},2216: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(4475),s=r(1282);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},402:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pairwise=void 0;var n=r(4024),i=r(5079);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})))}))}},5960:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.partition=void 0;var n=r(1574),i=r(2763);t.partition=function(e,t){return function(r){return[i.filter(e,t)(r),i.filter(n.not(e,t))(r)]}}},5658:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pluck=void 0;var n=r(4338);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}))}},3881:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publish=void 0;var n=r(9520),i=r(2318),o=r(4347);t.publish=function(e){return e?function(t){return o.connect(e)(t)}:function(e){return i.multicast(new n.Subject)(e)}}},1755:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishBehavior=void 0;var n=r(8042),i=r(3739);t.publishBehavior=function(e){return function(t){var r=new n.BehaviorSubject(e);return new i.ConnectableObservable(t,(function(){return r}))}}},9801:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishLast=void 0;var n=r(7257),i=r(3739);t.publishLast=function(){return function(e){var t=new n.AsyncSubject;return new i.ConnectableObservable(e,(function(){return t}))}}},5021:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.publishReplay=void 0;var n=r(216),i=r(2318),o=r(4432);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)}}},2749: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(4475),s=r(9925);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))))}},9925: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(7779),s=r(4024),a=r(9144);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}},1386:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reduce=void 0;var n=r(2181),i=r(4024);t.reduce=function(e,t){return i.operate(n.scanInternals(e,t,arguments.length>=2,!1,!0))}},2711:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.refCount=void 0;var n=r(4024),i=r(5079);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())}))}},1194:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeat=void 0;var n=r(1727),i=r(4024),o=r(5079),s=r(9451),a=r(5710);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()}))}},7085:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeatWhen=void 0;var n=r(9451),i=r(9520),o=r(4024),s=r(5079);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()}))}},7524:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retry=void 0;var n=r(4024),i=r(5079),o=r(9144),s=r(5710),a=r(9451);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()}))}},548:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retryWhen=void 0;var n=r(9451),i=r(9520),o=r(4024),s=r(5079);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()}))}},6577:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sample=void 0;var n=r(9451),i=r(4024),o=r(5729),s=r(5079);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))}))}},3815:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sampleTime=void 0;var n=r(4617),i=r(6577),o=r(4449);t.sampleTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.sample(o.interval(e,t))}},7250:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scan=void 0;var n=r(4024),i=r(2181);t.scan=function(e,t){return n.operate(i.scanInternals(e,t,arguments.length>=2,!0))}},2181:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scanInternals=void 0;var n=r(5079);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()}))}}},842:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sequenceEqual=void 0;var n=r(4024),i=r(5079),o=r(9451);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))}))}},9728: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(9451),s=r(9520),a=r(1403),u=r(4024);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)}}},7768:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.shareReplay=void 0;var n=r(216),i=r(9728);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})}},2445:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.single=void 0;var n=r(8032),i=r(6228),o=r(1137),s=r(4024),a=r(5079);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)})))}))}},6262:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skip=void 0;var n=r(2763);t.skip=function(e){return n.filter((function(t,r){return e<=r}))}},7397:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipLast=void 0;var n=r(9144),i=r(4024),o=r(5079);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}}))}},9900:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipUntil=void 0;var n=r(4024),i=r(5079),o=r(9451),s=r(5729);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)})))}))}},1620:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.skipWhile=void 0;var n=r(4024),i=r(5079);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)})))}))}},3424:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.startWith=void 0;var n=r(79),i=r(2619),o=r(4024);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)}))}},831:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.subscribeOn=void 0;var n=r(4024);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))}))}},411:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchAll=void 0;var n=r(7222),i=r(9144);t.switchAll=function(){return n.switchMap(i.identity)}},7222:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchMap=void 0;var n=r(9451),i=r(4024),o=r(5079);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()})))}))}},6464:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchMapTo=void 0;var n=r(7222),i=r(4432);t.switchMapTo=function(e,t){return i.isFunction(t)?n.switchMap((function(){return e}),t):n.switchMap((function(){return e}))}},4434:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.switchScan=void 0;var n=r(7222),i=r(4024);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}}))}},7138:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.take=void 0;var n=r(1727),i=r(4024),o=r(5079);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())})))}))}},4288: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(1727),o=r(4024),s=r(5079);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})))}))}},7341:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.takeUntil=void 0;var n=r(4024),i=r(5079),o=r(9451),s=r(5729);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)}))}},653:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.takeWhile=void 0;var n=r(4024),i=r(5079);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()})))}))}},8668:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tap=void 0;var n=r(4432),i=r(4024),o=r(5079),s=r(9144);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}},9466:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=void 0;var n=r(4024),i=r(5079),o=r(9451);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()})))}))}},9705:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throttleTime=void 0;var n=r(4617),i=r(9466),o=r(5710);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)}},8062:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfEmpty=void 0;var n=r(8032),i=r(4024),o=r(5079);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())})))}))}},6610:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeInterval=t.timeInterval=void 0;var n=r(4617),i=r(4024),o=r(5079);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},6279:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeout=t.TimeoutError=void 0;var n=r(4617),i=r(7761),o=r(4024),s=r(9451),a=r(9876),u=r(5079),c=r(5421);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)}))}},8132:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutWith=void 0;var n=r(4617),i=r(7761),o=r(6279);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})}},4553:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timestamp=void 0;var n=r(1713),i=r(4338);t.timestamp=function(e){return void 0===e&&(e=n.dateTimestampProvider),i.map((function(t){return{value:t,timestamp:e.now()}}))}},2378:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toArray=void 0;var n=r(1386),i=r(4024),o=function(e,t){return e.push(t),e};t.toArray=function(){return i.operate((function(e,t){n.reduce(o,[])(e).subscribe(t)}))}},4768:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.window=void 0;var n=r(9520),i=r(4024),o=r(5079),s=r(5729),a=r(9451);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}}))}},131: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(9520),o=r(4024),s=r(5079);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})))}))}},9579:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.windowTime=void 0;var n=r(9520),i=r(4617),o=r(7215),s=r(4024),a=r(5079),u=r(2447),c=r(2619),l=r(5421);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}}))}},752: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(9520),o=r(7215),s=r(4024),a=r(9451),u=r(5079),c=r(5729),l=r(2447);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()})))}))}},582:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.windowWhen=void 0;var n=r(9520),i=r(4024),o=r(5079),s=r(9451);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})))}))}},4255: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(4024),s=r(5079),a=r(9451),u=r(9144),c=r(5729),l=r(2619);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)}})))}))}},3253: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(2042),s=r(4024);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)}))}},7220:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.zipAll=void 0;var n=r(2042),i=r(7534);t.zipAll=function(e){return i.joinAllInternals(n.zip,e)}},9287: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(3253);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)))}},3584:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleArray=void 0;var n=r(5271);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())}))}))}},1659:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleAsyncIterable=void 0;var n=r(5271),i=r(5421);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)}))}))}},8840:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleIterable=void 0;var n=r(5271),i=r(5686),o=r(4432),s=r(5421);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()}}))}},5704:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleObservable=void 0;var n=r(9451),i=r(3165),o=r(831);t.scheduleObservable=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},4644:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.schedulePromise=void 0;var n=r(9451),i=r(3165),o=r(831);t.schedulePromise=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},3035:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleReadableStreamLike=void 0;var n=r(1659),i=r(9266);t.scheduleReadableStreamLike=function(e,t){return n.scheduleAsyncIterable(i.readableStreamLikeToAsyncGenerator(e),t)}},3200:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scheduled=void 0;var n=r(5704),i=r(4644),o=r(3584),s=r(8840),a=r(1659),u=r(3292),c=r(2644),l=r(8219),h=r(6380),d=r(7707),f=r(4883),p=r(9266),v=r(3035);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)}},4756:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Action=void 0;var o=function(e){function t(t,r){return e.call(this)||this}return i(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(r(7215).Subscription);t.Action=o},1172:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncAction=void 0;var o=r(4756),s=r(9678),a=r(2447),u=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 i(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),s.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&&s.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,a.arrRemove(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(o.Action);t.AsyncAction=u},6759:function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=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])},n(e,t)},function(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncScheduler=void 0;var o=r(3980),s=function(e){function t(t,r){void 0===r&&(r=o.Scheduler.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return i(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}(o.Scheduler);t.AsyncScheduler=s},4617:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.async=t.asyncScheduler=void 0;var n=r(1172),i=r(6759);t.asyncScheduler=new i.AsyncScheduler(n.AsyncAction),t.async=t.asyncScheduler},1713:(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}},9678: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}},8972: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}},5686:(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()},2138:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observable=void 0,t.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},6809:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentOutOfRangeError=void 0;var n=r(9876);t.ArgumentOutOfRangeError=n.createErrorClass((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}}))},8032:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyError=void 0;var n=r(9876);t.EmptyError=n.createErrorClass((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}))},1137:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NotFoundError=void 0;var n=r(9876);t.NotFoundError=n.createErrorClass((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}}))},7392:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectUnsubscribedError=void 0;var n=r(9876);t.ObjectUnsubscribedError=n.createErrorClass((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}))},6228:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SequenceError=void 0;var n=r(9876);t.SequenceError=n.createErrorClass((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}))},5463:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnsubscriptionError=void 0;var n=r(9876);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}}))},2619:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.popNumber=t.popScheduler=t.popResultSelector=void 0;var n=r(4432),i=r(6551);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}},4744:(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}}},4475:(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}},2447:(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)}}},9876:(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}},1589:(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}),{})}},4770:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.captureError=t.errorContext=void 0;var n=r(3782),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)}},5421:(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}},9144:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.identity=void 0,t.identity=function(e){return e}},8219:(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}},7707:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isAsyncIterable=void 0;var n=r(4432);t.isAsyncIterable=function(e){return Symbol.asyncIterator&&n.isFunction(null==e?void 0:e[Symbol.asyncIterator])}},7761:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isValidDate=void 0,t.isValidDate=function(e){return e instanceof Date&&!isNaN(e)}},4432:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e}},3292:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isInteropObservable=void 0;var n=r(2138),i=r(4432);t.isInteropObservable=function(e){return i.isFunction(e[n.observable])}},6380:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isIterable=void 0;var n=r(5686),i=r(4432);t.isIterable=function(e){return i.isFunction(null==e?void 0:e[n.iterator])}},2644:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isPromise=void 0;var n=r(4432);t.isPromise=function(e){return n.isFunction(null==e?void 0:e.then)}},9266: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(4432);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)}},6551:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isScheduler=void 0;var n=r(4432);t.isScheduler=function(e){return e&&n.isFunction(e.schedule)}},4024:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.operate=t.hasLift=void 0;var n=r(4432);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")}}},4666: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(4338),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)}))}},5729:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.noop=void 0,t.noop=function(){}},1574:(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)}}},5966:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pipeFromArray=t.pipe=void 0;var n=r(9144);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},7234:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reportUnhandledError=void 0;var n=r(3782),i=r(8972);t.reportUnhandledError=function(e){i.timeoutProvider.setTimeout((function(){var t=n.config.onUnhandledError;if(!t)throw e;t(e)}))}},4883:(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.")}},9978:(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(3533);Object.defineProperty(t,"audit",{enumerable:!0,get:function(){return n.audit}});var i=r(5188);Object.defineProperty(t,"auditTime",{enumerable:!0,get:function(){return i.auditTime}});var o=r(4514);Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return o.buffer}});var s=r(2537);Object.defineProperty(t,"bufferCount",{enumerable:!0,get:function(){return s.bufferCount}});var a=r(8720);Object.defineProperty(t,"bufferTime",{enumerable:!0,get:function(){return a.bufferTime}});var u=r(7932);Object.defineProperty(t,"bufferToggle",{enumerable:!0,get:function(){return u.bufferToggle}});var c=r(1445);Object.defineProperty(t,"bufferWhen",{enumerable:!0,get:function(){return c.bufferWhen}});var l=r(4418);Object.defineProperty(t,"catchError",{enumerable:!0,get:function(){return l.catchError}});var h=r(4163);Object.defineProperty(t,"combineAll",{enumerable:!0,get:function(){return h.combineAll}});var d=r(9893);Object.defineProperty(t,"combineLatestAll",{enumerable:!0,get:function(){return d.combineLatestAll}});var f=r(8169);Object.defineProperty(t,"combineLatest",{enumerable:!0,get:function(){return f.combineLatest}});var p=r(7230);Object.defineProperty(t,"combineLatestWith",{enumerable:!0,get:function(){return p.combineLatestWith}});var v=r(4098);Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return v.concat}});var y=r(4554);Object.defineProperty(t,"concatAll",{enumerable:!0,get:function(){return y.concatAll}});var b=r(1048);Object.defineProperty(t,"concatMap",{enumerable:!0,get:function(){return b.concatMap}});var m=r(381);Object.defineProperty(t,"concatMapTo",{enumerable:!0,get:function(){return m.concatMapTo}});var g=r(4724);Object.defineProperty(t,"concatWith",{enumerable:!0,get:function(){return g.concatWith}});var _=r(4347);Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return _.connect}});var O=r(6944);Object.defineProperty(t,"count",{enumerable:!0,get:function(){return O.count}});var S=r(440);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return S.debounce}});var w=r(8157);Object.defineProperty(t,"debounceTime",{enumerable:!0,get:function(){return w.debounceTime}});var E=r(1714);Object.defineProperty(t,"defaultIfEmpty",{enumerable:!0,get:function(){return E.defaultIfEmpty}});var T=r(1030);Object.defineProperty(t,"delay",{enumerable:!0,get:function(){return T.delay}});var I=r(6405);Object.defineProperty(t,"delayWhen",{enumerable:!0,get:function(){return I.delayWhen}});var A=r(9142);Object.defineProperty(t,"dematerialize",{enumerable:!0,get:function(){return A.dematerialize}});var F=r(2307);Object.defineProperty(t,"distinct",{enumerable:!0,get:function(){return F.distinct}});var M=r(9131);Object.defineProperty(t,"distinctUntilChanged",{enumerable:!0,get:function(){return M.distinctUntilChanged}});var k=r(6659);Object.defineProperty(t,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return k.distinctUntilKeyChanged}});var D=r(4217);Object.defineProperty(t,"elementAt",{enumerable:!0,get:function(){return D.elementAt}});var j=r(4707);Object.defineProperty(t,"endWith",{enumerable:!0,get:function(){return j.endWith}});var x=r(9276);Object.defineProperty(t,"every",{enumerable:!0,get:function(){return x.every}});var P=r(337);Object.defineProperty(t,"exhaust",{enumerable:!0,get:function(){return P.exhaust}});var N=r(3977);Object.defineProperty(t,"exhaustAll",{enumerable:!0,get:function(){return N.exhaustAll}});var R=r(368);Object.defineProperty(t,"exhaustMap",{enumerable:!0,get:function(){return R.exhaustMap}});var C=r(7829);Object.defineProperty(t,"expand",{enumerable:!0,get:function(){return C.expand}});var q=r(2763);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return q.filter}});var L=r(4106);Object.defineProperty(t,"finalize",{enumerable:!0,get:function(){return L.finalize}});var B=r(8759);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return B.find}});var Q=r(3999);Object.defineProperty(t,"findIndex",{enumerable:!0,get:function(){return Q.findIndex}});var V=r(5194);Object.defineProperty(t,"first",{enumerable:!0,get:function(){return V.first}});var U=r(1664);Object.defineProperty(t,"groupBy",{enumerable:!0,get:function(){return U.groupBy}});var z=r(3470);Object.defineProperty(t,"ignoreElements",{enumerable:!0,get:function(){return z.ignoreElements}});var Y=r(9549);Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return Y.isEmpty}});var W=r(9582);Object.defineProperty(t,"last",{enumerable:!0,get:function(){return W.last}});var $=r(4338);Object.defineProperty(t,"map",{enumerable:!0,get:function(){return $.map}});var G=r(4791);Object.defineProperty(t,"mapTo",{enumerable:!0,get:function(){return G.mapTo}});var H=r(9318);Object.defineProperty(t,"materialize",{enumerable:!0,get:function(){return H.materialize}});var K=r(7446);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return K.max}});var J=r(6094);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return J.merge}});var X=r(4594);Object.defineProperty(t,"mergeAll",{enumerable:!0,get:function(){return X.mergeAll}});var Z=r(2735);Object.defineProperty(t,"flatMap",{enumerable:!0,get:function(){return Z.flatMap}});var ee=r(9010);Object.defineProperty(t,"mergeMap",{enumerable:!0,get:function(){return ee.mergeMap}});var te=r(8983);Object.defineProperty(t,"mergeMapTo",{enumerable:!0,get:function(){return te.mergeMapTo}});var re=r(2170);Object.defineProperty(t,"mergeScan",{enumerable:!0,get:function(){return re.mergeScan}});var ne=r(3674);Object.defineProperty(t,"mergeWith",{enumerable:!0,get:function(){return ne.mergeWith}});var ie=r(1446);Object.defineProperty(t,"min",{enumerable:!0,get:function(){return ie.min}});var oe=r(2318);Object.defineProperty(t,"multicast",{enumerable:!0,get:function(){return oe.multicast}});var se=r(3165);Object.defineProperty(t,"observeOn",{enumerable:!0,get:function(){return se.observeOn}});var ae=r(2216);Object.defineProperty(t,"onErrorResumeNext",{enumerable:!0,get:function(){return ae.onErrorResumeNext}});var ue=r(402);Object.defineProperty(t,"pairwise",{enumerable:!0,get:function(){return ue.pairwise}});var ce=r(5960);Object.defineProperty(t,"partition",{enumerable:!0,get:function(){return ce.partition}});var le=r(5658);Object.defineProperty(t,"pluck",{enumerable:!0,get:function(){return le.pluck}});var he=r(3881);Object.defineProperty(t,"publish",{enumerable:!0,get:function(){return he.publish}});var de=r(1755);Object.defineProperty(t,"publishBehavior",{enumerable:!0,get:function(){return de.publishBehavior}});var fe=r(9801);Object.defineProperty(t,"publishLast",{enumerable:!0,get:function(){return fe.publishLast}});var pe=r(5021);Object.defineProperty(t,"publishReplay",{enumerable:!0,get:function(){return pe.publishReplay}});var ve=r(2749);Object.defineProperty(t,"race",{enumerable:!0,get:function(){return ve.race}});var ye=r(9925);Object.defineProperty(t,"raceWith",{enumerable:!0,get:function(){return ye.raceWith}});var be=r(1386);Object.defineProperty(t,"reduce",{enumerable:!0,get:function(){return be.reduce}});var me=r(1194);Object.defineProperty(t,"repeat",{enumerable:!0,get:function(){return me.repeat}});var ge=r(7085);Object.defineProperty(t,"repeatWhen",{enumerable:!0,get:function(){return ge.repeatWhen}});var _e=r(7524);Object.defineProperty(t,"retry",{enumerable:!0,get:function(){return _e.retry}});var Oe=r(548);Object.defineProperty(t,"retryWhen",{enumerable:!0,get:function(){return Oe.retryWhen}});var Se=r(2711);Object.defineProperty(t,"refCount",{enumerable:!0,get:function(){return Se.refCount}});var we=r(6577);Object.defineProperty(t,"sample",{enumerable:!0,get:function(){return we.sample}});var Ee=r(3815);Object.defineProperty(t,"sampleTime",{enumerable:!0,get:function(){return Ee.sampleTime}});var Te=r(7250);Object.defineProperty(t,"scan",{enumerable:!0,get:function(){return Te.scan}});var Ie=r(842);Object.defineProperty(t,"sequenceEqual",{enumerable:!0,get:function(){return Ie.sequenceEqual}});var Ae=r(9728);Object.defineProperty(t,"share",{enumerable:!0,get:function(){return Ae.share}});var Fe=r(7768);Object.defineProperty(t,"shareReplay",{enumerable:!0,get:function(){return Fe.shareReplay}});var Me=r(2445);Object.defineProperty(t,"single",{enumerable:!0,get:function(){return Me.single}});var ke=r(6262);Object.defineProperty(t,"skip",{enumerable:!0,get:function(){return ke.skip}});var De=r(7397);Object.defineProperty(t,"skipLast",{enumerable:!0,get:function(){return De.skipLast}});var je=r(9900);Object.defineProperty(t,"skipUntil",{enumerable:!0,get:function(){return je.skipUntil}});var xe=r(1620);Object.defineProperty(t,"skipWhile",{enumerable:!0,get:function(){return xe.skipWhile}});var Pe=r(3424);Object.defineProperty(t,"startWith",{enumerable:!0,get:function(){return Pe.startWith}});var Ne=r(831);Object.defineProperty(t,"subscribeOn",{enumerable:!0,get:function(){return Ne.subscribeOn}});var Re=r(411);Object.defineProperty(t,"switchAll",{enumerable:!0,get:function(){return Re.switchAll}});var Ce=r(7222);Object.defineProperty(t,"switchMap",{enumerable:!0,get:function(){return Ce.switchMap}});var qe=r(6464);Object.defineProperty(t,"switchMapTo",{enumerable:!0,get:function(){return qe.switchMapTo}});var Le=r(4434);Object.defineProperty(t,"switchScan",{enumerable:!0,get:function(){return Le.switchScan}});var Be=r(7138);Object.defineProperty(t,"take",{enumerable:!0,get:function(){return Be.take}});var Qe=r(4288);Object.defineProperty(t,"takeLast",{enumerable:!0,get:function(){return Qe.takeLast}});var Ve=r(7341);Object.defineProperty(t,"takeUntil",{enumerable:!0,get:function(){return Ve.takeUntil}});var Ue=r(653);Object.defineProperty(t,"takeWhile",{enumerable:!0,get:function(){return Ue.takeWhile}});var ze=r(8668);Object.defineProperty(t,"tap",{enumerable:!0,get:function(){return ze.tap}});var Ye=r(9466);Object.defineProperty(t,"throttle",{enumerable:!0,get:function(){return Ye.throttle}});var We=r(9705);Object.defineProperty(t,"throttleTime",{enumerable:!0,get:function(){return We.throttleTime}});var $e=r(8062);Object.defineProperty(t,"throwIfEmpty",{enumerable:!0,get:function(){return $e.throwIfEmpty}});var Ge=r(6610);Object.defineProperty(t,"timeInterval",{enumerable:!0,get:function(){return Ge.timeInterval}});var He=r(6279);Object.defineProperty(t,"timeout",{enumerable:!0,get:function(){return He.timeout}});var Ke=r(8132);Object.defineProperty(t,"timeoutWith",{enumerable:!0,get:function(){return Ke.timeoutWith}});var Je=r(4553);Object.defineProperty(t,"timestamp",{enumerable:!0,get:function(){return Je.timestamp}});var Xe=r(2378);Object.defineProperty(t,"toArray",{enumerable:!0,get:function(){return Xe.toArray}});var Ze=r(4768);Object.defineProperty(t,"window",{enumerable:!0,get:function(){return Ze.window}});var et=r(131);Object.defineProperty(t,"windowCount",{enumerable:!0,get:function(){return et.windowCount}});var tt=r(9579);Object.defineProperty(t,"windowTime",{enumerable:!0,get:function(){return tt.windowTime}});var rt=r(752);Object.defineProperty(t,"windowToggle",{enumerable:!0,get:function(){return rt.windowToggle}});var nt=r(582);Object.defineProperty(t,"windowWhen",{enumerable:!0,get:function(){return nt.windowWhen}});var it=r(4255);Object.defineProperty(t,"withLatestFrom",{enumerable:!0,get:function(){return it.withLatestFrom}});var ot=r(3253);Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return ot.zip}});var st=r(7220);Object.defineProperty(t,"zipAll",{enumerable:!0,get:function(){return st.zipAll}});var at=r(9287);Object.defineProperty(t,"zipWith",{enumerable:!0,get:function(){return at.zipWith}})},1964:e=>{e.exports=require("rxjs")},5352: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_IMAGE_GENERATION_MODEL_NAMES:()=>Te,AI_MODEL_NAMES:()=>Ee,ALL_OPERATORS:()=>Ne,AiAssistantClient:()=>e,AiChatbotChatContext:()=>Ie,AiChatbotClient:()=>Y,AiChatbotClientFactory:()=>H,AiChatbotContextReference:()=>$,AiChatbotInstructionReference:()=>G,AiChatbotProfileReference:()=>W,AiClient:()=>J,AiImageClient:()=>K,ApiClient:()=>Z,ApiKeysSecretClient:()=>ju,ApiManager:()=>me,AuthManager:()=>ge,BackendFunctionManager:()=>_e,BaseQueryBuilder:()=>We,Changes:()=>He,ClientConnectionState:()=>qe,ClientIdService:()=>we,CollectionReference:()=>nt,CollectionReferenceFactory:()=>ot,ConnectionDetails:()=>st,CronExpression:()=>Ae,DEFAULT_SHORT_ID_LENGTH:()=>V,DataManager:()=>dt,DestructManager:()=>pt,DistributedLockImpl:()=>yt,DistributedLockManager:()=>vt,DocumentReference:()=>Ve,DocumentReferenceFactory:()=>mt,DocumentStore:()=>gt,ENVIRONMENT_IDS:()=>Fe,FETCH_BEYOND_LIMIT:()=>bu,GraphQLClient:()=>Ga,GraphQLClientFactory:()=>Ha,HttpStatus:()=>ke,IntegrationSchemaType:()=>je,IntegrationType:()=>De,JoinQueryBuilder:()=>Ke,LIMIT_UNDERFLOW_TRIGGER:()=>mu,LimitUnderflowState:()=>du,LocalQueryManager:()=>cu,MutationSender:()=>Ka,NOOP_FN:()=>xu,NativeQueryManager:()=>Ja,Pagination:()=>ze,QueryBuilder:()=>Ge,QueryBuilderFactory:()=>Ye,QuerySender:()=>hu,QuerySubscriptionManager:()=>gu,QueueManagerFactory:()=>wu,QueueManagerImpl:()=>Tu,RateLimiter:()=>Iu,RpcError:()=>Au,RpcManager:()=>ku,SQUID_REGIONS:()=>Re,SUPPORTED_SQUID_REGIONS:()=>Ce,SecretClient:()=>Du,SocketManager:()=>Cu,Squid:()=>Bu,StorageClient:()=>Lu,allEnvironmentIds:()=>Me,deserializeQuery:()=>Xa,generateId:()=>Q,generateShortId:()=>z,isSimpleCondition:()=>Pe,rawSquidHttpPost:()=>Fu,tryDeserializing:()=>Mu});class e{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){const i={assistantId:e,threadId:t,prompt:r,fileIds:n};return(await this.rpcManager.post("ai/assistant/queryAssistant",i)).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 t=r(1964);function i(e){return"function"==typeof e}function o(e){return function(t){if(function(e){return i(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 s=function(e,t){return s=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])},s(e,t)};function a(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}s(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=function(){return u=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},u.apply(this,arguments)};function c(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 l(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 h(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 d(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 f(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 p(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 v,y,b=(v=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}},(y=v((function(e){Error.call(e),e.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),y.prototype.constructor=y,y);function m(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var g=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,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=d(s),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 s.remove(this);var c=this.initialTeardown;if(i(c))try{c()}catch(e){o=e instanceof b?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var h=d(l),v=h.next();!v.done;v=h.next()){var y=v.value;try{_(y)}catch(e){o=null!=o?o:[],e instanceof b?o=p(p([],f(o)),f(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(o)throw new b(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)_(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)&&m(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&m(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function _(e){i(e)?e():e.unsubscribe()}g.EMPTY;var O=null,S=null,w=!1,E=!1,T={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=T.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,p([e,t],f(r))):setTimeout.apply(void 0,p([e,t],f(r)))},clearTimeout:function(e){var t=T.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function I(){}var A=F("C",void 0,void 0);function F(e,t,r){return{kind:e,value:t,error:r}}var M=function(e){function t(t){var r,n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,((r=t)instanceof g||r&&"closed"in r&&i(r.remove)&&i(r.add)&&i(r.unsubscribe))&&t.add(n)):n.destination=R,n}return a(t,e),t.create=function(e,t,r){return new x(e,t,r)},t.prototype.next=function(e){this.isStopped?N(function(e){return F("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?N(F("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?N(A,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}(g),k=Function.prototype.bind;function D(e,t){return k.call(e,t)}var j=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){P(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){P(e)}else P(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){P(e)}},e}(),x=function(e){function t(t,r,n){var o,s,a=e.call(this)||this;return i(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:a&&E?((s=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},o={next:t.next&&D(t.next,s),error:t.error&&D(t.error,s),complete:t.complete&&D(t.complete,s)}):o=t,a.destination=new j(o),a}return a(t,e),t}(M);function P(e){w||function(e){T.setTimeout((function(){if(!O)throw e;O(e)}))}(e)}function N(e,t){var r=S;r&&T.setTimeout((function(){return r(e,t)}))}var R={closed:!0,next:I,error:function(e){throw e},complete:I};function C(e,t,r,n,i){return new q(e,t,r,n,i)}var q=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 a(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}(M);function L(e,t){return o((function(r,n){var i=0;r.subscribe(C(n,(function(r){n.next(e.call(t,r,i++))})))}))}var B=r(8975);function Q(){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 V=18,U="abcdefghijklmnopqrstuvwxyz0123456789";function z(e=V,t=""){(0,B.assertTruthy)(t.length<e,"ID prefix is too long");let r="";for(let t=0;t<e;t++)r+=U.charAt(Math.floor(Math.random()*U.length));return t.length>0&&(r=t+r.substring(t.length)),r}class Y{constructor(e,r,n){this.rpcManager=e,this.socketManager=r,this.integrationId=n,this.ongoingChatSequences={},this.socketManager.observeNotifications().pipe((0,t.filter)((e=>"aiChatbot"===e.type)),L((e=>e))).subscribe((e=>{this.handleChatResponse(e).then()}))}profile(e){return new W(this,this.integrationId,e)}async mutate(e,t){await this.rpcManager.post("ai/chatbot/mutate",e,t?[t]:[])}chat(e,r,n){const i=Q(),o=void 0===(null==n?void 0:n.smoothTyping)||n.smoothTyping;let s="";const a=new t.Subject,u=new t.Subject;this.ongoingChatSequences[i]=u;let c=-1;u.pipe((0,t.tap)((({tokenIndex:e})=>{void 0!==e&&e<c&&console.warn("Received token index out of order",e,c),void 0!==e&&(c=e)})),(0,t.concatMap)((({value:e,complete:r})=>r?(0,t.of)({value:e,complete:r}):(0,t.of)(e).pipe(o?(0,t.delay)(5):(0,t.tap)(),L((e=>({value:e,complete:!1})))))),(0,t.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:r,options:n,integrationId:this.integrationId,clientRequestId:i};return this.rpcManager.post("ai/chatbot/chat",l).catch((e=>{a.error(e),a.complete()})),a.pipe((0,t.finalize)((()=>{delete this.ongoingChatSequences[i]})),(0,t.share)())}ask(e,r,n){return(0,t.lastValueFrom)(this.chat(e,r,Object.assign(Object.assign({},n||{}),{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 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 W{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 $(this.client,this.integrationId,this.profileId,e)}instruction(e){return new G(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 ${constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||Q()}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 G{constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||Q()}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 H{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 Y(this.rpcManager,this.socketManager,e),this.chatbotsMap.set(e,t),t)}}class K{constructor(e){this.rpcManager=e}async generate(e,t){const r={prompt:e,options:t};return this.rpcManager.post("ai/image/generate",r)}}class J{constructor(t,r){this.aiChatbotClientFactory=t,this.rpcManager=r,this.aiAssistantClient=new e(this.rpcManager)}chatbot(e){return this.aiChatbotClientFactory.getChatbot(e)}assistant(){return this.aiAssistantClient}image(){return new K(this.rpcManager)}executeAiQuery(e,t){const r={integrationId:e,prompt:t};return this.rpcManager.post("aiData/executeAiQuery",r)}}const X={headers:{},queryParams:{},pathParams:{}};class Z{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({},X),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)}}const ee=/[.\[\]]/;function te(e,t){if(!e)return;const r=t.split(ee);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 re(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ne(e,t,r,n="."){var i;const o=t.split(n);let s=e;for(;o.length;){const e=(0,B.truthy)(o.shift());if(o.length){const t=s[e],r=re(t)&&null!==(i=le(t))&&void 0!==i?i:{};s[e]=r,s=r}else s[e]=r}}function ie(e,t,r="."){var n;const i=t.split(r);let o=e;for(;i.length;){const e=(0,B.truthy)(i.shift());if(i.length){const t=re(o[e])&&null!==(n=le(o[e]))&&void 0!==n?n:{};o[e]=t,o=t}else delete o[e]}}function oe(e,t,r){if(e.has(t)){const n=e.get(t);e.delete(t),e.set(r,n)}}function se(e){return null==e}function ae(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)||!ae(e[r],t[r]))return!1;return!0}function ue(e,t){const r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=ce(e[n],t);return r}function ce(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 ue(e,t);if(e instanceof Map)return new Map(ue(Array.from(e),t));if(e instanceof Set)return new Set(ue(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]=ce(e[r],t));return i}function le(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 he(e,t){if(e===t||se(e)&&se(t))return 0;if(se(e))return-1;if(se(t))return 1;const r=typeof e,n=typeof t;return r!==n?r<n?-1:1:"number"==typeof e?((0,B.assertTruthy)("number"==typeof t),isNaN(e)&&isNaN(t)?0:isNaN(e)?-1:isNaN(t)?1:e<t?-1:1):"boolean"==typeof e?((0,B.assertTruthy)("boolean"==typeof t),e<t?-1:1):"bigint"==typeof e?((0,B.assertTruthy)("bigint"==typeof t),e<t?-1:1):"string"==typeof e?((0,B.assertTruthy)("string"==typeof t),e.localeCompare(t)):e instanceof Date&&t instanceof Date?Math.sign(e.getTime()-t.getTime()):0}function de(e,t){return e.reduce(((e,r)=>{const n=t(r);return e[n]?e[n].push(r):e[n]=[r],e}),{})}function fe(e){if(Array.isArray(e))return e.map((e=>fe(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]=fe(e[t])})),r}function pe(e){return ve(fe(e))}function ve(e){if(void 0===e)return null;const t=ce(e,(e=>function(e){return"[object Date]"===Object.prototype.toString.call(e)}(e)?{$date:e.toISOString()}:void 0));return JSON.stringify(t)}function ye(e){return ce(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 be(e){if(void 0===e)throw new Error("INVALID_ENCODE_VALUE");const t=ve(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 me{constructor(e,t){this.clientIdService=e,this.rpcManager=t}callApiAndSubscribe(e,r,n,i,o){const s={integrationId:e,endpointId:r,request:n,options:i};return(0,t.race)((0,t.from)(this.rpcManager.post("api/call",s,o?[o]:void 0,o?"file":void 0)).pipe(L((e=>{const t=e.payload?ye(e.payload):void 0;if(e.success)return t;throw new Error(`Got error while calling API (HTTP Status ${e.httpStatus}). Message: ${e.payload}`)}))),this.clientIdService.observeClientTooOld().pipe(L((()=>{throw new Error("CLIENT_NOT_CONNECTED")}))))}}class ge{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}}class _e{constructor(e,t){this.clientIdService=e,this.rpcManager=t}executeFunctionAndSubscribe(e,...r){const n=[],i=[];r.forEach((e=>{"undefined"!=typeof File&&e instanceof File?n.push(e):i.push(e)}));const o={functionName:e,paramsArrayStr:ve(i)},s=`backend-function/execute?${encodeURIComponent(e)}`;return(0,t.race)((0,t.from)(this.rpcManager.post(s,o,n.length>0?n:[])).pipe(L((e=>{if(!e.success)throw new Error(e.payload);return ye(e.payload)}))),this.clientIdService.observeClientTooOld().pipe(L((()=>{throw new Error("CLIENT_NOT_CONNECTED")}))))}}function Oe(){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 Se{static log(...e){Se.info(...e)}static info(...e){console.log(`%c[${Se.getTimestampString()}] INFO`,"color:green",...e)}static warn(...e){console.warn(`%c[${Se.getTimestampString()}] WARN`,"color:yellow",...e)}static error(...e){console.error(`%c[${Se.getTimestampString()}] ERROR`,"color:red",...e)}static debug(...e){(function(){const e=Oe();return e&&e.SQUID_DEBUG_ENABLED})()&&console.log(`%c[${Se.getTimestampString()}] DEBUG`,"color:cyan",...e)}static getTimestampString(){const e=new Date;return`${e.toLocaleTimeString()}.${e.getMilliseconds()}`}}class we{constructor(e){this.destructManager=e,this.clientTooOldSubject=new t.BehaviorSubject(!1),this.isTenant=!0===Oe().squidTenant,this.clientIdSubject=new t.BehaviorSubject(this.generateClientId()),this.destructManager.onDestruct((()=>{this.clientTooOldSubject.complete(),this.clientIdSubject.complete()}))}observeClientId(){return this.clientIdSubject}observeClientTooOld(){return this.clientTooOldSubject.pipe((0,t.filter)((e=>e)),(0,t.map)((()=>{})))}notifyClientTooOld(){this.clientTooOldSubject.next(!0),this.clientIdSubject.next(this.generateClientId())}notifyClientNotTooOld(){this.clientTooOldSubject.next(!1)}observeClientReadyToBeRegenerated(){return this.clientTooOldSubject.pipe((0,t.skip)(1),(0,t.filter)((e=>!e)),(0,t.map)((()=>{})))}getClientId(){return this.clientIdSubject.value}isClientTooOld(){return this.clientTooOldSubject.value}generateClientId(){return`${this.isTenant?"tenant-":""}${Q()}`}}const Ee=["gpt-3.5-turbo","gpt-3.5-turbo-1106","gpt-4","claude-3-opus-20240229","claude-3-sonnet-20240229","claude-3-haiku-20240307","gpt-4-turbo-preview"],Te=["dall-e-3","stable-diffusion-core"];class Ie{constructor(e){this.profileId=e.profileId,this.prompt=e.prompt}}var Ae;!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"}(Ae||(Ae={}));const Fe=["dev","prod"],Me=[...Fe];var ke,De,je,xe;function Pe(e){return"fieldName"in e}(xe=ke||(ke={}))[xe.CONTINUE=100]="CONTINUE",xe[xe.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",xe[xe.PROCESSING=102]="PROCESSING",xe[xe.EARLYHINTS=103]="EARLYHINTS",xe[xe.OK=200]="OK",xe[xe.CREATED=201]="CREATED",xe[xe.ACCEPTED=202]="ACCEPTED",xe[xe.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",xe[xe.NO_CONTENT=204]="NO_CONTENT",xe[xe.RESET_CONTENT=205]="RESET_CONTENT",xe[xe.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",xe[xe.AMBIGUOUS=300]="AMBIGUOUS",xe[xe.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",xe[xe.FOUND=302]="FOUND",xe[xe.SEE_OTHER=303]="SEE_OTHER",xe[xe.NOT_MODIFIED=304]="NOT_MODIFIED",xe[xe.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",xe[xe.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",xe[xe.BAD_REQUEST=400]="BAD_REQUEST",xe[xe.UNAUTHORIZED=401]="UNAUTHORIZED",xe[xe.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",xe[xe.FORBIDDEN=403]="FORBIDDEN",xe[xe.NOT_FOUND=404]="NOT_FOUND",xe[xe.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",xe[xe.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",xe[xe.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",xe[xe.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",xe[xe.CONFLICT=409]="CONFLICT",xe[xe.GONE=410]="GONE",xe[xe.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",xe[xe.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",xe[xe.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",xe[xe.URI_TOO_LONG=414]="URI_TOO_LONG",xe[xe.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",xe[xe.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",xe[xe.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",xe[xe.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",xe[xe.MISDIRECTED=421]="MISDIRECTED",xe[xe.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",xe[xe.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",xe[xe.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",xe[xe.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",xe[xe.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",xe[xe.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",xe[xe.BAD_GATEWAY=502]="BAD_GATEWAY",xe[xe.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",xe[xe.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",xe[xe.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",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.built_in_s3="built_in_s3",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"}(De||(De={})),function(e){e.data="data",e.api="api",e.graphql="graphql"}(je||(je={}));const Ne=["==","!=",">=","<=",">","<","like","not like","like_cs","not like_cs"],Re=["us-east-1.aws","ap-south-1.aws"],Ce=Re;var qe;!function(e){e.CONNECTED="CONNECTED",e.DISCONNECTED="DISCONNECTED",e.REMOVED="REMOVED"}(qe||(qe={}));const Le="__squidId";function Be(e){return ye(e)}function Qe(...e){const[t,r,n]=e,i="object"==typeof t?t:{docId:t,collectionName:r,integrationId:n};return i.integrationId||(i.integrationId=void 0),pe(i)}class Ve{constructor(e,t,r){this._squidDocId=e,this.dataManager=t,this.queryBuilderFactory=r,this.refId=Q()}get squidDocId(){return this._squidDocId}get data(){return ce(this.dataRef)}get dataRef(){return(0,B.truthy)(this.dataManager.getProperties(this.squidDocId),(()=>{const{collectionName:e,integrationId:t,docId:r}=Be(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,B.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,t.map)((e=>((0,B.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:Be(this.squidDocId),properties:r};return this.dataManager.applyOutgoingMutation(n,t)}async setInPath(e,t,r){return this.update({[e]:ce(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:Be(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=Be(this.squidDocId),n=r.integrationId;let i=ye(r.docId);if(i[Le]&&(i={}),n===De.built_in_db&&i.__id)try{const e=ye(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:Be(this.squidDocId)};return this.dataManager.applyOutgoingMutation(t,e)}migrateDocIds(e){const t=e[this.squidDocId];t&&(this._squidDocId=t)}hasSquidPlaceholderId(){const e=ye(this._squidDocId);if("object"==typeof e&&e.docId){const t=ye(e.docId);if("object"==typeof t&&Object.keys(t).includes(Le))return!0}return!1}}function Ue(e){if(!(e instanceof Object))throw new Error("Field sort has to be an object");const t=e;var r,n,i,o;(0,B.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,B.assertTruthy)((i=t.asc,o="boolean",Array.isArray(i)?i.every((e=>typeof e===o)):typeof i===o),"Asc needs to be boolean"),function(e){if(!e||"string"!=typeof e)throw new Error("Field name has to be a non-empty string");if("__docId__"!==e&&!e.match(/^[a-zA-Z_$][a-zA-Z0-9!@#$%^&*~_ ]{0,49}$/))throw new Error("A Field name can contain only a-z, A-Z, 0-9,!@#$%^&*~_, starting with a letter, at least one character, and up to 50. Field name: "+e)}(t.fieldName)}Error;class ze{constructor(e,r={}){this.internalStateObserver=new t.BehaviorSubject(null),this.firstElement=null,this.isDestroyed=new t.BehaviorSubject(!1),this.snapshotSubject=new t.Subject,this.onFirstPage=!0,this.navigatingToLastPage=!1,this.lastElement=null,(0,B.assertTruthy)(e.getSortOrders().length>0,"Unable to paginate results. Please specify a sort order."),this.snapshotSubject.pipe((0,t.switchAll)()).subscribe((e=>this.dataReceived(e))),this.templateSnapshotEmitter=e.clone(),this.paginateOptions=Object.assign({pageSize:100,subscribe:!0},r),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||se(e)&&se(t))return 0;if(se(e))return-1;if(se(t))return 1;const r=this.templateSnapshotEmitter.getSortOrders();for(const{fieldName:n,asc:i}of r){const r=he(te(e,n),te(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,r){if(this.onFirstPage=!1,r){const r=this.templateSnapshotEmitter.clone().limit(3*this.paginateOptions.pageSize).flipSortOrder();e&&r.addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((t=>({fieldName:t.fieldName,operator:t.asc?"<=":">=",value:te(e,t.fieldName)||null})))),this.snapshotSubject.next(r.snapshots(this.paginateOptions.subscribe).pipe((0,t.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:te(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,t.firstValueFrom)((0,t.race)(this.isDestroyed.pipe((0,t.filter)(Boolean),(0,t.map)((()=>({data:[],extractedData:[],numBefore:0,numAfter:0})))),this.internalStateObserver.pipe((0,t.filter)((e=>null!==e)),(0,t.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,t.filter)((e=>null!==e)),(0,t.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.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,t.map)((e=>e.reverse())));return this.snapshotSubject.next(e),await this.waitForData()}}class Ye{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}=Be(e),i=ye(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 Ge(e,t,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this,this.documentIdentityService)}}class We{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)}throwIfInvalidLikePattern(e){if(/\\(?![%_\\])/.test(e))throw new Error("Invalid pattern. Cannot have any \\ which are not followed by _, % or \\")}}class $e{constructor(e){this.queryBuilder=e}peek(){return this.queryBuilder.peek().map((e=>e.data))}snapshot(){return(0,t.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.queryBuilder.snapshots(e).pipe(L((e=>e.map((e=>e.data)))))}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){return new $e(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 ze(this,e)}}class Ge extends We{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,B.assertNumber)(e,"Limit needs to be a number"),-1!==e&&((0,B.assertTruthy)(e>0,"query limit has to be greater than 0"),(0,B.assertTruthy)(Math.floor(e)===e,"query limit has to be an integer"),(0,B.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,B.assertTruthy)(ae(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 Ue(r),(0,B.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=de(this.query.conditions.filter(Pe)||[],(e=>e.fieldName));for(const r of Object.values(t)){const t=de(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)=>he(e.value,t.value))),">"===r||">="===r?e.push(t[t.length-1]):e.push(t[0])}}return[...this.query.conditions.filter((e=>!Pe(e))),...e]}getSortOrder(){return this.query.sortOrder}snapshot(){return(0,t.firstValueFrom)(this.snapshots(!1))}setForceFetchFromServer(){return this.forceFetchFromServer=!0,this}peek(){return this.localQueryManager.peek(this.build())}snapshots(e=!0){if(this.containsEmptyInCondition)return new t.BehaviorSubject([]);const r=this.build();return this.querySubscriptionManager.processQuery(r,this.collectionName,{},{},e,this.forceFetchFromServer).pipe(L((e=>e.map((e=>{(0,B.assertTruthy)(1===Object.keys(e).length);const t=e[this.collectionName],r=Qe((0,B.truthy)(t).__docId__,this.collectionName,this.integrationId);return this.documentReferenceFactory.create(r,this.queryBuilderFactory)})))))}changes(){let e,r=new Set;return this.snapshots().pipe((0,t.combineLatestWith)(this.documentIdentityService.observeChanges().pipe((0,t.switchMap)((r=>(Object.entries(r).forEach((([t,r])=>{!function(e,t,r){const n=e[t];void 0!==n&&(e[r]=n,delete e[t])}(e||{},t,r)})),t.NEVER))),(0,t.startWith)({}))),L((([t])=>{let n=[];const i=[],o=[];if(e){for(const o of t){const t=o.squidDocId,s=o.dataRef;if(r.has(s))delete e[t],r.delete(s);else if(e[t]){i.push(o);const n=e[t];delete e[t],r.delete(n)}else n.push(o)}for(const e of r)o.push(e)}else n=t;e={},r=new Set;for(const n of t){const t=n.dataRef;e[n.squidDocId]=t,r.add(t)}return new He(n,i,o)})))}get hash(){return be(this.build())}dereference(){return new $e(this)}getSortOrders(){return this.query.sortOrder}clone(){const e=new Ge(this.collectionName,this.integrationId,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.queryBuilderFactory,this.documentIdentityService);return e.query=ce(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 ze(this,e)}}class He{constructor(e,t,r){this.inserts=e,this.updates=t,this.deletes=r}}class Ke extends We{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 Ke(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,t.firstValueFrom)(this.snapshots(!1))}snapshots(e=!0){return this.containsEmptyInCondition?new t.BehaviorSubject([]):this.querySubscriptionManager.processQuery(this.build(),this.rootAlias,ce(this.joins),ce(this.joinConditions),e,!1).pipe(L((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?Qe(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 Ze(this)}dereference(){return new Je(this)}build(){return this.queryBuilder.build()}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){const e=new Ke(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,this.rootAlias,this.latestAlias,ce(this.leftToRight),ce(this.joins),ce(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 ze(this,e)}}class Je{constructor(e){this.joinQueryBuilder=e}grouped(){return this.joinQueryBuilder.grouped().dereference()}snapshot(){return(0,t.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(L((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 Je(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 ze(this,e)}serialize(){return Object.assign(Object.assign({},this.joinQueryBuilder.serialize()),{dereference:!0})}getLimit(){return this.joinQueryBuilder.getLimit()}}class Xe{constructor(e){this.groupedJoin=e}snapshot(){return(0,t.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.groupedJoin.snapshots(e).pipe(L((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 Xe(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 ze(this,e)}}class Ze{constructor(e){this.joinQueryBuilder=e}snapshot(){return(0,t.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(L((e=>this.groupData(e,this.joinQueryBuilder.rootAlias))))}peek(){throw new Error("peek is not currently supported for join queries")}dereference(){return new Xe(this)}groupData(e,t){const r=de(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 Ze(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 ze(this,e)}}function et(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 ae(e,t);if("!="===r)return!ae(e,t);switch(r){case"<":return!se(e)&&(!!se(t)||t<e);case"<=":return!!se(t)||!se(e)&&t<=e;case">":return!se(t)&&(!!se(e)||t>e);case">=":return!!se(e)||!se(t)&&t>=e;case"like":return"string"==typeof t&&"string"==typeof e&&tt(t,e,!1);case"not like":return!("string"==typeof t&&"string"==typeof e&&tt(t,e,!1));case"like_cs":return"string"==typeof t&&"string"==typeof e&&tt(t,e,!0);case"not like_cs":return!("string"==typeof t&&"string"==typeof e&&tt(t,e,!0));default:throw new Error(`Unsupported operator comparison: ${r}`)}}function tt(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 rt(e,t){return`${e}_${t}`}class nt{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=Q()}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!==De.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={[Le]:Q()};else e=e&&"string"!=typeof e?{__id:pe(e)}:{__id:e||Q()};const t=Qe(pe(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 Ve?await r.delete(t):await this.doc(r).delete(t)}),t)}query(){return this.queryBuilderFactory.get(this.collectionName,this.integrationId)}joinQuery(e){return new Ke(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,e,e,{[e]:[]},{},{},this.query())}or(...e){return new it(...e)}}class it{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,t.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,...r){return(0,t.combineLatest)([...r]).pipe((0,t.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=te(this.extractData(t),n),o=te(this.extractData(r),n);if(!et(e,o,"=="))return et(o,e,"<")?i?-1:1:i?1:-1}return 0})).slice(0,this.getLimit())})))}clone(){return new it(...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 ze(this,e)}}class ot{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 nt(e,t,this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager,this.dataManager),r.set(e,n)),n}}class st{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 at=r(3910);function ut(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?ce(t.value):t.value;case"removeProperty":return;default:throw new Error("Unknown property mutation type: "+JSON.stringify(t))}}function ct(e){return Object.entries(e.properties).sort((([e],[t])=>e.split(".").length-t.split(".").length))}function lt(e){let r=[];return(0,t.from)(e).pipe((0,t.groupBy)((e=>`${e.squidDocIdObj.integrationId}${e.squidDocIdObj.collectionName}/${e.squidDocIdObj.docId}`)),(0,t.mergeMap)((e=>e.pipe((0,t.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,B.assertTruthy)("update"===t.type,"Invalid mutation type"),"update"===e.type)return function(e,t){const r=ce(e);t=ce(t);for(const[e]of ct(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 ct(t))r.properties[e]=[...r.properties[e]||[],...n];return r}(e,t);const r=ce(e);for(const[e,n]of ct(t)){const t=n;for(const n of t){const t=ut(te(r.properties,e),n);void 0===t?ie(r.properties,e):ne(r.properties,e,t)}}return r}(e,t)))))),(0,t.toArray)()).subscribe((e=>{r=e})),r}const ht="dataManager_runInTransaction";class dt{constructor(e,r,n,i,o,s,a,u,c){this.documentStore=e,this.mutationSender=r,this.socketManager=n,this.querySubscriptionManager=i,this.queryBuilderFactory=o,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 t.Subject,this.outgoingMutationsEmpty=new t.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,B.assertTruthy)(t===this.currentTransactionId,"Transaction already ended."),e(t).then((e=>Promise.resolve(e)));this.lockManager.canGetLock(ht)?this.lockManager.lockSync(ht):await this.lockManager.lock(ht);let r=ft;const n=()=>r!==ft;return new Promise((async(t,i)=>{try{let o;this.currentTransactionId=Q();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(ht)}catch(e){r=n()?r:e}}n()&&i(r)}))}async applyOutgoingMutation(e,t){var r;const n=Qe(e.squidDocIdObj);this.knownDirtyDocs.add(n),t||this.lockManager.canGetLock(ht)||(await this.lockManager.lock(ht),this.lockManager.release(ht)),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=lt([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=ct(t);for(const[e,t]of n){const n=t;for(const t of n){const n=ut(te(r,e),t);void 0===n?ie(r,e):ne(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,B.assertTruthy)(t===this.currentTransactionId,"Transaction already ended."),void e(t);await this.lockManager.lock(ht);try{this.currentTransactionId=Q();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(ht)}}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,t.filter)((e=>"mutations"===e.type)),L((e=>e))).subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,t.filter)(Boolean),(0,t.take)(1)).subscribe((()=>{this.handleIncomingMutations(e.payload)}))})),this.querySubscriptionManager.observeQueryResults().subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,t.filter)(Boolean),(0,t.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=Qe(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||pe(Object.assign(Object.assign({},t),{__ts__:void 0}))!==pe(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 r=this.groupOutgoingMutationsByIntegrationId();try{await at.PromisePool.for(r).withConcurrency(r.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,t.firstValueFrom)(this.pendingOutgoingMutationsChanged.pipe((0,t.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=Qe(e.mutation.squidDocIdObj),r=(0,B.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}=Be(t);this.setExpiration(t,!0);try{const r=e.includes(Le)?[]:await this.queryBuilderFactory.getForDocument(t).setForceFetchFromServer().snapshot();if((0,B.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();for(const e of t)try{await this.queryBuilderFactory.getForDocument(e).snapshot()}catch(e){}}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=Qe(t.mutation.squidDocIdObj),n=e[r];n&&(t.mutation.squidDocIdObj=Be(n))}))})),Object.entries(e).forEach((([e,t])=>{oe(this.pendingOutgoingMutations,e,t),oe(this.docIdToLocalTimestamp,e,t),oe(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 ft=Symbol("undefined");class pt{constructor(){this.preDestructors=[],this.destructors=[],this.isDestructedSubject=new t.BehaviorSubject(!1)}get isDestructing(){return this.isDestructedSubject.value}observeIsDestructing(){return this.isDestructedSubject.asObservable().pipe((0,t.filter)(Boolean),L((()=>{})))}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 vt{constructor(e,r){this.socketManager=e,this.destructManager=r,this.ongoingLocks={},this.acquireLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,t.filter)((e=>"lockAcquired"===e.type))),this.releaseLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,t.filter)((e=>"lockReleased"===e.type))),this.lockWaitForConnectionThreshold=2e3,r.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,r=1e3){if(!await(0,t.firstValueFrom)((0,t.race)((0,t.timer)(this.lockWaitForConnectionThreshold).pipe(L((()=>!1))),this.socketManager.observeConnectionReady().pipe((0,t.filter)(Boolean)),this.destructManager.observeIsDestructing())))return Promise.reject("CLIENT_NOT_CONNECTED");const n=Q(),i={type:"acquireLock",payload:{mutex:e,timeoutMillis:r,clientRequestId:n}};this.socketManager.sendMessage(i);const o=await(0,t.firstValueFrom)((0,t.race)((0,t.timer)(r+4e3).pipe((0,t.take)(1),L((()=>({payload:{error:"TIMEOUT_GETTING_LOCK",lockId:void 0}})))),this.acquireLockMessagesFromServer.pipe((0,t.filter)((e=>e.payload.clientRequestId===n)))));if(this.destructManager.isDestructing)throw new Error("Destructing");if(!o.payload.lockId)throw new Error(`Failed to acquire lock: ${o.payload.error}`);const s=o.payload.lockId,a=new yt(s,n,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 yt{constructor(e,r,n,i){this.lockId=e,this.clientRequestId=r,this.ongoingLocks=n,this.socketManager=i,this.released=!1,this.onReleaseSubject=new t.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 bt{constructor(e,r){this.documentStore=e,this.destructManager=r,this.changeNotifier=new t.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 mt{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 Ve(e,(0,B.truthy)(this.dataManager,"dataManager not found"),t);const{integrationId:n,collectionName:i}=Be(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=Be(e),n=Be(t);oe(this.documents,r.docId,n.docId)}))}getCollectionKey(e,t){return`${e}_${t}`}}class gt{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=ce(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,B.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=he(te(e,n),te(t,n));if(0!==r)return i?r:-r}return 0}group(e,t){return Object.values(de(e,(e=>pe(t.map((t=>te(e,t)))))))}sortAndLimitDocs(e,t){if(0===e.size)return[];const r=[...e].map((e=>this.squidDocIdToDoc.get(e))).filter(B.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;oe(this.squidDocIdToDoc,e,t);const n=Be(t),i=ye(n.docId);this.saveDocument(t,Object.assign(Object.assign(Object.assign({},r),i),{__docId__:n.docId}))}}var _t="Invariant Violation",Ot=Object.setPrototypeOf,St=void 0===Ot?function(e,t){return e.__proto__=t,e}:Ot,wt=function(e){function t(r){void 0===r&&(r=_t);var n=e.call(this,"number"==typeof r?_t+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=_t,St(n,t.prototype),n}return a(t,e),t}(Error);function Et(e,t){if(!e)throw new wt(t)}var Tt,It=["debug","log","warn","error","silent"],At=It.indexOf("log");function Ft(e){return function(){if(It.indexOf(e)>=At)return(console[e]||console.log).apply(console,arguments)}}(Tt=Et||(Et={})).debug=Ft("debug"),Tt.log=Ft("log"),Tt.warn=Ft("warn"),Tt.error=Ft("error");var Mt="3.8.9";function kt(e){try{return e()}catch(e){}}const Dt=kt((function(){return globalThis}))||kt((function(){return window}))||kt((function(){return self}))||kt((function(){return global}))||kt((function(){return kt.constructor("return this")()}));var jt=new Map;function xt(e){var t=jt.get(e)||1;return jt.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function Pt(e,t){void 0===t&&(t=0);var r=xt("stringifyForDisplay");return JSON.stringify(e,(function(e,t){return void 0===t?r:t}),t).split(JSON.stringify(r)).join("<undefined>")}function Nt(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=Bt(i))||(t=Qt(i,r),r=[])}e.apply(void 0,[t].concat(r))}}var Rt=Object.assign((function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];e||Et(e,Bt(t,r)||Qt(t,r))}),{debug:Nt(Et.debug),log:Nt(Et.log),warn:Nt(Et.warn),error:Nt(Et.error)});function Ct(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new wt(Bt(e,t)||Qt(e,t))}var qt=Symbol.for("ApolloErrorMessageHandler_"+Mt);function Lt(e){return"string"==typeof e?e:Pt(e,2).slice(0,1e3)}function Bt(e,t){if(void 0===t&&(t=[]),e)return Dt[qt]&&Dt[qt](e,t.map(Lt))}function Qt(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:Mt,message:e,args:t.map(Lt)})))}function Vt(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 Ut(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&&Ut(e.prototype,t),r&&Ut(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}globalThis.__DEV__;var Yt=function(){return"function"==typeof Symbol},Wt=function(e){return Yt()&&Boolean(Symbol[e])},$t=function(e){return Wt(e)?Symbol[e]:"@@"+e};Yt()&&!Wt("observable")&&(Symbol.observable=Symbol("observable"));var Gt=$t("iterator"),Ht=$t("observable"),Kt=$t("species");function Jt(e,t){var r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function Xt(e){var t=e.constructor;return void 0!==t&&null===(t=t[Kt])&&(t=void 0),void 0!==t?t:ur}function Zt(e){return e instanceof ur}function er(e){er.log?er.log(e):setTimeout((function(){throw e}))}function tr(e){Promise.resolve().then((function(){try{e()}catch(e){er(e)}}))}function rr(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var r=Jt(t,"unsubscribe");r&&r.call(t)}}catch(e){er(e)}}function nr(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function ir(e,t,r){e._state="running";var n=e._observer;try{var i=Jt(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(nr(e),!i)throw r;i.call(n,r);break;case"complete":nr(e),i&&i.call(n)}}catch(e){er(e)}"closed"===e._state?rr(e):"running"===e._state&&(e._state="ready")}function or(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 tr((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(ir(e,t[r].type,t[r].value),"closed"!==e._state);++r);}}(e)}))):void ir(e,t,r);e._queue.push({type:t,value:r})}}var sr=function(){function e(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";var r=new ar(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&&(nr(this),rr(this))},zt(e,[{key:"closed",get:function(){return"closed"===this._state}}]),e}(),ar=function(){function e(e){this._subscription=e}var t=e.prototype;return t.next=function(e){or(this._subscription,"next",e)},t.error=function(e){or(this._subscription,"error",e)},t.complete=function(){or(this._subscription,"complete")},zt(e,[{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),ur=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 sr(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(Xt(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(Xt(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=Xt(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=Xt(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=Xt(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[Ht]=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=Jt(t,Ht);if(n){var i=n.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Zt(i)&&i.constructor===r?i:new r((function(e){return i.subscribe(e)}))}if(Wt("iterator")&&(n=Jt(t,Gt)))return new r((function(e){tr((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 Vt(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)?Vt(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){tr((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){tr((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:Kt,get:function(){return this}}]),e}();function cr(e){return null!==e&&"object"==typeof e}function lr(e,t){var r=t,n=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw Ct(70,e.operation,e.name?" named '".concat(e.name.value,"'"):"");"FragmentDefinition"===e.kind&&n.push(e)})),void 0===r&&(Rt(1===n.length,71,n.length),r=n[0].name.value),u(u({},e),{definitions:p([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],e.definitions,!0)})}function hr(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function dr(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 Rt(n,72,r),n||null;default:return null}}function fr(e){return{__ref:String(e)}}function pr(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function vr(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 vr(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 vr(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 Ct(81,t.value,r.kind);e[t.value]=null}}Yt()&&Object.defineProperty(ur,Symbol("extensions"),{value:{symbol:Ht,hostReportError:er},configurable:!0});var yr=["connection","include","skip","client","rest","export","nonreactive"],br=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(mr(i),")")}return r.connection.key}var o=e;if(t){var s=mr(t);o+="(".concat(s,")")}return r&&Object.keys(r).forEach((function(e){-1===yr.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@".concat(e,"(").concat(mr(r[e]),")"):o+="@".concat(e))})),o}),{setStringify:function(e){var t=mr;return mr=e,t}}),mr=function(e){return JSON.stringify(e,gr)};function gr(e,t){return cr(t)&&!Array.isArray(t)&&(t=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{})),t}function _r(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return vr(r,n,i,t)})),r}return null}function Or(e){return e.alias?e.alias.value:e.name.value}function Sr(e,t,r){for(var n,i=0,o=t.selections;i<o.length;i++)if(wr(u=o[i])){if("__typename"===u.name.value)return e[Or(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=Sr(e,dr(u=a[s],r).selectionSet,r);if("string"==typeof c)return c}}function wr(e){return"Field"===e.kind}function Er(e){Rt(e&&"Document"===e.kind,73);var t=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw Ct(74,e.kind);return e}));return Rt(t.length<=1,75,t.length),e}function Tr(e){return Er(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function Ir(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&!!e.name})).map((function(e){return e.name.value}))[0]||null}function Ar(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function Fr(e){var t=Tr(e);return Rt(t&&"query"===t.operation,76),t}function Mr(e){var t;Er(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 Ct(80)}function kr(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&vr(t,e.variable.name,e.defaultValue)})),t}function Dr(e,t){return t?t(e):ur.of()}function jr(e){return"function"==typeof e?new Pr(e):e}function xr(e){return e.request.length<=1}var Pr=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return ur.of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(jr).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,r,n){var i=jr(r),o=jr(n||new e(Dr));return xr(i)&&xr(o)?new e((function(e){return t(e)?i.request(e)||ur.of():o.request(e)||ur.of()})):new e((function(e,r){return t(e)?i.request(e,r)||ur.of():o.request(e,r)||ur.of()}))},e.execute=function(e,t){return e.request(function(e,t){var r=u({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){r=u(u({},r),"function"==typeof e?e(r):e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return u({},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?Ir(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 Ct(43,i)}return e}(t))))||ur.of()},e.concat=function(t,r){var n=jr(t);if(xr(n))return!1!==globalThis.__DEV__&&Rt.warn(35,n),n;var i=jr(r);return xr(i)?new e((function(e){return n.request(e,(function(e){return i.request(e)||ur.of()}))||ur.of()})):new e((function(e,t){return n.request(e,(function(e){return i.request(e,t)||ur.of()}))||ur.of()}))},e.prototype.split=function(t,r,n){return this.concat(e.split(t,r,n||new e(Dr)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw Ct(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}(),Nr=Pr.execute;function Rr(e,t){if(!Boolean(e))throw new Error(t)}const Cr=10,qr=2;function Lr(e){return Br(e,[])}function Br(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:Br(t,r)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>qr)return"[Array]";const r=Math.min(Cr,e.length),n=e.length-r,i=[];for(let n=0;n<r;++n)i.push(Br(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>qr)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+": "+Br(r,t)));return"{ "+n.join(", ")+" }"}(e,r)}(e,t);default:return String(e)}}class Qr{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 Vr{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 Ur={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(Ur));function Yr(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&zr.has(t)}var Wr,$r,Gr;!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(Wr||(Wr={})),(Gr=$r||($r={})).NAME="Name",Gr.DOCUMENT="Document",Gr.OPERATION_DEFINITION="OperationDefinition",Gr.VARIABLE_DEFINITION="VariableDefinition",Gr.SELECTION_SET="SelectionSet",Gr.FIELD="Field",Gr.ARGUMENT="Argument",Gr.FRAGMENT_SPREAD="FragmentSpread",Gr.INLINE_FRAGMENT="InlineFragment",Gr.FRAGMENT_DEFINITION="FragmentDefinition",Gr.VARIABLE="Variable",Gr.INT="IntValue",Gr.FLOAT="FloatValue",Gr.STRING="StringValue",Gr.BOOLEAN="BooleanValue",Gr.NULL="NullValue",Gr.ENUM="EnumValue",Gr.LIST="ListValue",Gr.OBJECT="ObjectValue",Gr.OBJECT_FIELD="ObjectField",Gr.DIRECTIVE="Directive",Gr.NAMED_TYPE="NamedType",Gr.LIST_TYPE="ListType",Gr.NON_NULL_TYPE="NonNullType",Gr.SCHEMA_DEFINITION="SchemaDefinition",Gr.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",Gr.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",Gr.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",Gr.FIELD_DEFINITION="FieldDefinition",Gr.INPUT_VALUE_DEFINITION="InputValueDefinition",Gr.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",Gr.UNION_TYPE_DEFINITION="UnionTypeDefinition",Gr.ENUM_TYPE_DEFINITION="EnumTypeDefinition",Gr.ENUM_VALUE_DEFINITION="EnumValueDefinition",Gr.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",Gr.DIRECTIVE_DEFINITION="DirectiveDefinition",Gr.SCHEMA_EXTENSION="SchemaExtension",Gr.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",Gr.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",Gr.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",Gr.UNION_TYPE_EXTENSION="UnionTypeExtension",Gr.ENUM_TYPE_EXTENSION="EnumTypeExtension",Gr.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension";const Hr=Object.freeze({});function Kr(e,t,r=Ur){const n=new Map;for(const e of Object.values($r))n.set(e,Jr(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;Yr(h)||Rr(!1,`Invalid AST Node: ${Lr(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===Hr)break;if(!1===m){if(!e){d.pop();continue}}else if(void 0!==m&&(l.push([o,m]),!e)){if(!Yr(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 Jr(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 Xr(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;Rt(r&&1===r.length,67,n);var i=r[0];Rt(i.name&&"if"===i.name.value,68,n);var o=i.value;Rt(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],Rt(void 0!==i,66,r.name.value)):i=n.value.value,"skip"===r.name.value?!i:i}))}function Zr(e,t,r){var n=new Set(e),i=n.size;return Kr(t,{Directive:function(e){if(n.delete(e.name.value)&&(!r||!n.size))return Hr}}),r?!n.size:n.size<i}function en(e){return e&&Zr(["client","export"],e,!0)}var tn=function(e,t){var r;try{r=JSON.stringify(e)}catch(e){var n=Ct(39,t,e.message);throw n.parseError=e,n}return r},rn="function"==typeof WeakMap&&"ReactNative"!==kt((function(){return navigator.product})),nn="function"==typeof WeakSet,on="function"==typeof Symbol&&"function"==typeof Symbol.for,sn=on&&Symbol.asyncIterator;function an(e){var t={next:function(){return e.read()}};return sn&&(t[Symbol.asyncIterator]=function(){return this}),t}function un(e){var t,r,n,i,o=e;if(e.body&&(o=e.body),i=o,sn&&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 an(o.getReader());if(function(e){return!!e.stream}(o))return an(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)})))}},sn&&(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 sn&&(c[Symbol.asyncIterator]=function(){return this}),c}(o);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}kt((function(){return window.document.createElement})),kt((function(){return navigator.userAgent.indexOf("jsdom")>=0}));var cn=function(e,t,r){var n=new Error(r);throw n.name="ServerError",n.response=e,n.statusCode=e.status,n.result=t,n},ln=Symbol(),hn=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=p(p(p([],(n=h).graphQLErrors,!0),n.clientErrors,!0),n.protocolErrors,!0),n.networkError&&i.push(n.networkError),i.map((function(e){return cr(e)&&e.message||"Error message not found."})).join("\n")),h.extraInfo=l,h.__proto__=t.prototype,h}return a(t,e),t}(Error),dn=Array.isArray;function fn(e){return Array.isArray(e)&&e.length>0}var pn=Object.prototype.hasOwnProperty;function vn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return yn(e)}function yn(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new mn,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var bn=function(e,t,r){return this.merge(e[r],t[r])},mn=function(){function e(e){void 0===e&&(e=bn),this.reconciler=e,this.isObject=cr,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 cr(t)&&cr(e)?(Object.keys(t).forEach((function(i){if(pn.call(e,i)){var o=e[i];if(t[i]!==o){var s=r.reconciler.apply(r,p([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 cr(e)&&(this.pastCopies.has(e)||(e=Array.isArray(e)?e.slice(0):u({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},e}();function gn(e){return"incremental"in e}function _n(e){return cr(e)&&"payload"in e}function On(e,t){var r=e,n=new mn;return gn(t)&&fn(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 Sn=Object.prototype.hasOwnProperty;function wn(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 En(e,t){e.status>=300&&cn(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 Tn(e){return 9===e||32===e}function In(e){return e>=48&&e<=57}function An(e){return e>=97&&e<=122||e>=65&&e<=90}function Fn(e){return An(e)||95===e}function Mn(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=kn(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 kn(e){let t=0;for(;t<e.length&&Tn(e.charCodeAt(t));)++t;return t}const Dn=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function jn(e){return xn[e.charCodeAt(0)]}const xn=["\\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"],Pn={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>Nn(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Cn("(",Nn(e.variableDefinitions,", "),")"),r=Nn([e.operation,Nn([e.name,t]),Nn(e.directives," ")]," ");return("query"===r?"":r+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:r,directives:n})=>e+": "+t+Cn(" = ",r)+Cn(" ",Nn(n," "))},SelectionSet:{leave:({selections:e})=>Rn(e)},Field:{leave({alias:e,name:t,arguments:r,directives:n,selectionSet:i}){const o=Cn("",e,": ")+t;let s=o+Cn("(",Nn(r,", "),")");return s.length>80&&(s=o+Cn("(\n",qn(Nn(r,"\n")),"\n)")),Nn([s,Nn(n," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Cn(" ",Nn(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:r})=>Nn(["...",Cn("on ",e),Nn(t," "),r]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:r,directives:n,selectionSet:i})=>`fragment ${e}${Cn("(",Nn(r,", "),")")} on ${t} ${Cn("",Nn(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||Tn(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&&Tn(e.charCodeAt(0));return(l&&!d||o)&&(h+="\n"),h+=r,(l||c)&&(h+="\n"),'"""'+h+'"""'}(e):`"${e.replace(Dn,jn)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+Nn(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+Nn(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Cn("(",Nn(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:r})=>Cn("",e,"\n")+Nn(["schema",Nn(t," "),Rn(r)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:r})=>Cn("",e,"\n")+Nn(["scalar",t,Nn(r," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Cn("",e,"\n")+Nn(["type",t,Cn("implements ",Nn(r," & ")),Nn(n," "),Rn(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:r,type:n,directives:i})=>Cn("",e,"\n")+t+(Ln(r)?Cn("(\n",qn(Nn(r,"\n")),"\n)"):Cn("(",Nn(r,", "),")"))+": "+n+Cn(" ",Nn(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:r,defaultValue:n,directives:i})=>Cn("",e,"\n")+Nn([t+": "+r,Cn("= ",n),Nn(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Cn("",e,"\n")+Nn(["interface",t,Cn("implements ",Nn(r," & ")),Nn(n," "),Rn(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:r,types:n})=>Cn("",e,"\n")+Nn(["union",t,Nn(r," "),Cn("= ",Nn(n," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:r,values:n})=>Cn("",e,"\n")+Nn(["enum",t,Nn(r," "),Rn(n)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:r})=>Cn("",e,"\n")+Nn([t,Nn(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:r,fields:n})=>Cn("",e,"\n")+Nn(["input",t,Nn(r," "),Rn(n)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:r,repeatable:n,locations:i})=>Cn("",e,"\n")+"directive @"+t+(Ln(r)?Cn("(\n",qn(Nn(r,"\n")),"\n)"):Cn("(",Nn(r,", "),")"))+(n?" repeatable":"")+" on "+Nn(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>Nn(["extend schema",Nn(e," "),Rn(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>Nn(["extend scalar",e,Nn(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>Nn(["extend type",e,Cn("implements ",Nn(t," & ")),Nn(r," "),Rn(n)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>Nn(["extend interface",e,Cn("implements ",Nn(t," & ")),Nn(r," "),Rn(n)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:r})=>Nn(["extend union",e,Nn(t," "),Cn("= ",Nn(r," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:r})=>Nn(["extend enum",e,Nn(t," "),Rn(r)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:r})=>Nn(["extend input",e,Nn(t," "),Rn(r)]," ")}};function Nn(e,t=""){var r;return null!==(r=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==r?r:""}function Rn(e){return Cn("{\n",qn(Nn(e,"\n")),"\n}")}function Cn(e,t,r=""){return null!=t&&""!==t?e+t+r:""}function qn(e){return Cn(" ",e.replace(/\n/g,"\n "))}function Ln(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}var Bn=rn?new WeakMap:void 0,Qn=function(e){var t;return(t=null==Bn?void 0:Bn.get(e))||(t=function(e){return Kr(e,Pn)}(e),null==Bn||Bn.set(e,t)),t},Vn={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},Un=function(e,t){return t(e)};function zn(e){return new ur((function(t){t.error(e)}))}var Yn={kind:$r.FIELD,name:{kind:$r.NAME,value:"__typename"}};function Wn(e,t){return!e||e.selectionSet.selections.every((function(e){return e.kind===$r.FRAGMENT_SPREAD&&Wn(t[e.name.value],t)}))}function $n(e){return Wn(Tr(e)||function(e){Rt("Document"===e.kind,77),Rt(e.definitions.length<=1,78);var t=e.definitions[0];return Rt("FragmentDefinition"===t.kind,79),t}(e),hr(Ar(e)))?null:e}function Gn(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 Hn(e,t){Er(t);for(var r=Gn(""),n=Gn(""),i=function(e){for(var t=0,i=void 0;t<e.length&&(i=e[t]);++t)if(!dn(i)){if(i.kind===$r.OPERATION_DEFINITION)return r(i.name&&i.name.value);if(i.kind===$r.FRAGMENT_DEFINITION)return n(i.name.value)}return!1!==globalThis.__DEV__&&Rt.error(82),null},o=0,s=t.definitions.length-1;s>=0;--s)t.definitions[s].kind===$r.OPERATION_DEFINITION&&++o;var a,c,l,h=(a=e,c=new Map,l=new Map,a.forEach((function(e){e&&(e.name?c.set(e.name,e):e.test&&l.set(e.test,e))})),function(e){var t=c.get(e.name.value);return!t&&l.size&&l.forEach((function(r,n){n(e)&&(t=r)})),t}),d=function(e){return fn(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=Kr(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===$r.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===$r.OPERATION_DEFINITION?b(r(e.name&&e.name.value)).fragmentSpreads.forEach((function(e){m.add(e)})):e.kind!==$r.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 $n(Kr(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 u(u({},e),{variableDefinitions:e.variableDefinitions.filter((function(e){return t.has(e.variable.name.value)}))})}}}}))}var Kn=Object.assign((function(e){return Kr(e,{SelectionSet:{enter:function(e,t,r){if(!r||r.kind!==$r.OPERATION_DEFINITION){var n=e.selections;if(n&&!n.some((function(e){return wr(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var i=r;if(!(wr(i)&&i.directives&&i.directives.some((function(e){return"export"===e.name.value}))))return u(u({},e),{selections:p(p([],n,!0),[Yn],!1)})}}}}})}),{added:function(e){return e===Yn}});function Jn(e){return"query"===Mr(e).operation?e:Kr(e,{OperationDefinition:{enter:function(e){return u(u({},e),{operation:"query"})}}})}function Xn(e){return Er(e),Hn([{test:function(e){return"client"===e.name.value},remove:!0}],e)}var Zn=kt((function(){return fetch})),ei=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?Un:i,s=e.includeExtensions,a=e.preserveHeaderCase,d=e.useGETForQueries,f=e.includeUnusedVariables,p=void 0!==f&&f,v=c(e,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);!1!==globalThis.__DEV__&&function(e){if(!e&&"undefined"==typeof fetch)throw Ct(37)}(n||Zn);var y={http:{includeExtensions:s,preserveHeaderCase:a},options:v.fetchOptions,credentials:v.credentials,headers:v.headers};return new Pr((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,f=a.version;c&&(s["apollographql-client-name"]=c),f&&(s["apollographql-client-version"]=f)}var v=u(u({},s),i.headers),b={http:i.http,options:i.fetchOptions,credentials:i.credentials,headers:v};if(Zr(["client"],e.query)){var m=Xn(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,w,E=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=u(u(u({},i),e.options),{headers:u(u({},i.headers),e.headers)}),e.credentials&&(i.credentials=e.credentials),o=u(u({},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,c=e.variables,l=e.query,h={operationName:s,variables:c};return o.includeExtensions&&(h.extensions=a),o.includeQuery&&(h.query=t(l,Qn)),{options:i,body:h}}(e,o,Vn,y,b),T=E.options,I=E.body;I.variables&&!p&&(I.variables=(g=I.variables,_=e.query,O=u({},g),S=new Set(Object.keys(g)),Kr(_,{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||(w=new AbortController,T.signal=w.signal);var A,F="OperationDefinition"===(A=Mr(e.query)).kind&&"subscription"===A.operation,M=Zr(["defer"],e.query);if(d&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(T.method="GET"),M||F){T.headers=T.headers||{};var k="multipart/mixed;";F&&M&&!1!==globalThis.__DEV__&&Rt.warn(38),F?k+="boundary=graphql;subscriptionSpec=1.0,application/json":M&&(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=tn(t.variables,"Variables map")}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=tn(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=tn(I,"Payload")}catch(x){return zn(x)}return new ur((function(r){var i=n||kt((function(){return fetch}))||Zn,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 l(this,void 0,void 0,(function(){var n,i,o,s,a,c,l,d,f,p,v,y,b,m,g,_,O,S,w,E,T,I,A;return h(this,(function(h){switch(h.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),c="",l=un(e),d=!0,h.label=1;case 1:return d?[4,l.next()]:[3,3];case 2:for(f=h.sent(),p=f.value,v=f.done,y="string"==typeof p?p:n.decode(p),b=c.length-a.length+1,d=!v,m=(c+=y).indexOf(a,b);m>-1;){if(g=void 0,I=[c.slice(0,m),c.slice(m+a.length)],c=I[1],_=(g=I[0]).indexOf("\r\n\r\n"),O=wn(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(w=g.slice(_))if(E=En(e,w),Object.keys(E).length>1||"data"in E||"incremental"in E||"errors"in E||"payload"in E)_n(E)?(T={},"payload"in E&&(T=u({},E.payload)),"errors"in E&&(T=u(u({},T),{extensions:u(u({},"extensions"in T?T.extensions:null),(A={},A[ln]=E.errors,A))})),t(T)):t(E);else if(1===Object.keys(E).length&&"hasNext"in E&&!E.hasNext)return[2];m=c.indexOf(a)}return[3,1];case 3:return[2]}}))}))}(t,o):(n=e,function(e){return e.text().then((function(t){return En(e,t)})).then((function(t){return Array.isArray(t)||Sn.call(t,"data")||Sn.call(t,"errors")||cn(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(){w=void 0,r.complete()})).catch((function(e){w=void 0,function(e,t){e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e)}(e,r)})),function(){w&&w.abort()}}))}))},ti=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,ei(t).request)||this;return r.options=t,r}return a(t,e),t}(Pr);const{toString:ri,hasOwnProperty:ni}=Object.prototype,ii=Function.prototype.toString,oi=new Map;function si(e,t){try{return ui(e,t)}finally{oi.clear()}}const ai=si;function ui(e,t){if(e===t)return!0;const r=ri.call(e);if(r!==ri.call(t))return!1;switch(r){case"[object Array]":if(e.length!==t.length)return!1;case"[object Object]":{if(di(e,t))return!0;const r=ci(e),n=ci(t),i=r.length;if(i!==n.length)return!1;for(let e=0;e<i;++e)if(!ni.call(t,r[e]))return!1;for(let n=0;n<i;++n){const i=r[n];if(!ui(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(di(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&&!ui(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=ii.call(e);return r===ii.call(t)&&!function(e,t){const r=e.length-t.length;return r>=0&&e.indexOf(t,r)===r}(r,hi)}}return!1}function ci(e){return Object.keys(e).filter(li,e)}function li(e){return void 0!==this[e]}const hi="{ [native code] }";function di(e,t){let r=oi.get(e);if(r){if(r.has(t))return!0}else oi.set(e,r=new Set);return r.add(t),!1}const fi=()=>Object.create(null),{forEach:pi,slice:vi}=Array.prototype,{hasOwnProperty:yi}=Object.prototype;class bi{constructor(e=!0,t=fi){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return pi.call(e,(e=>t=t.getChildTrie(e))),yi.call(t,"data")?t.data:t.data=this.makeData(vi.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(vi.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 bi(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 mi,gi,_i=function(){function e(){this.known=new(nn?WeakSet:Set),this.pool=new bi(rn),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return cr(e)&&this.known.has(e)},e.prototype.pass=function(e){if(cr(e)){var t=function(e){return cr(e)?dn(e)?e.slice(0):u({__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(cr(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}(),Oi=Object.assign((function(e){if(cr(e)){void 0===mi&&Si();var t=mi.admit(e),r=gi.get(t);return void 0===r&&gi.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:Si});function Si(){mi=new _i,gi=new(rn?WeakMap:Map)}function wi(e){return e}var Ei=function(){function e(e,t){void 0===t&&(t=Object.create(null)),this.resultCache=nn?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),!1!==t.cache&&(this.stableCacheKeys=new bi(rn,(function(e){return{key:e}})))}return e.prototype.getCacheKey=function(e){return[e]},e.identity=function(){return new e(wi,{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;Er(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?(Rt(Array.isArray(t),65),this.stableCacheKeys.lookupArray(t)):void 0}},e}();function Ti(e,t,r){return new ur((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 Ii(e){return fn(Ai(e))}function Ai(e){var t=fn(e.errors)?e.errors.slice(0):[];return gn(e)&&fn(e.incremental)&&e.incremental.forEach((function(e){e.errors&&t.push.apply(t,e.errors)})),t}function Fi(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function Mi(e){function t(t){Object.defineProperty(e,t,{value:ur})}return on&&Symbol.species&&t(Symbol.species),t("@@species"),e}function ki(e){return e&&"function"==typeof e.then}var Di,ji=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),Fi(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),Fi(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?ki(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"),Fi(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 ur(t)]),ki(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return a(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}(ur);function xi(e){return!!e&&e<7}function Pi(){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}Mi(ji),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"}(Di||(Di={}));var Ni=Object.prototype.toString;function Ri(e){return Ci(e)}function Ci(e,t){switch(Ni.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]=Ci(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]=Ci(e[r],t)})),n;default:return e}}function qi(e,t,r,n){var i=t.data,o=c(t,["data"]),s=r.data,a=c(r,["data"]);return ai(o,a)&&Li(Mr(e).selectionSet,i,s,{fragmentMap:hr(Ar(e)),variables:n})}function Li(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),!Xr(e,n.variables))return!0;if(Bi(e))return!0;if(wr(e)){var o=Or(e),s=t&&t[o],a=r&&r[o],u=e.selectionSet;if(!u)return ai(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(!Li(u,s[d],a[d],n))return!1;return!0}return Li(u,s,a,n)}var f=dr(e,n.fragmentMap);return f?!!Bi(f)||Li(f.selectionSet,t,r,n):void 0}))}function Bi(e){return!!e.directives&&e.directives.some(Qi)}function Qi(e){return"nonreactive"===e.name.value}var Vi=Object.assign,Ui=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=Wi)}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=Gi(i.fetchPolicy),o.isTornDown=!1;var s=r.defaultOptions.watchQuery,a=(void 0===s?{}:s).fetchPolicy,c=void 0===a?"cache-first":a,l=i.fetchPolicy,h=void 0===l?c:l,d=i.initialFetchPolicy,f=void 0===d?"standby"===h?c:h:d;o.options=u(u({},i),{initialFetchPolicy:f,fetchPolicy:h}),o.queryId=n.queryId||r.generateQueryId();var p=Tr(o.query);return o.queryName=p&&p.name&&p.name.value,o}return a(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||Di.ready,n=u(u({},t),{loading:xi(r),networkStatus:r}),i=this.options.fetchPolicy,o=void 0===i?"cache-first":i;if(Gi(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),si(n.data,{})&&(n.data=void 0),s.complete?(delete n.partial,!s.complete||n.networkStatus!==Di.loading||"cache-first"!==o&&"cache-only"!==o||(n.networkStatus=Di.ready,n.loading=!1)):n.partial=!0,!1===globalThis.__DEV__||s.complete||this.options.partialRefetch||n.loading||n.data||n.error||$i(s.missing)}return e&&this.updateLastResult(n),n},t.prototype.isDifferentFromLastResult=function(e,t){return!this.last||(this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective?!qi(this.query,this.last.result,e,this.variables):!si(this.last.result,e))||t&&!si(this.last.variables,t)},t.prototype.getLast=function(e,t){var r=this.last;if(r&&r[e]&&(!t||si(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&&Ui.call(e,"variables")){var i=Fr(this.query),o=i.variableDefinitions;o&&o.some((function(e){return"variables"===e.variable.name.value}))||!1!==globalThis.__DEV__&&Rt.warn(20,e,(null===(t=i.name)||void 0===t?void 0:t.value)||i)}return e&&!si(this.options.variables,e)&&(r.variables=this.options.variables=u(u({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(r,Di.refetch)},t.prototype.fetchMore=function(e){var t=this,r=u(u({},e.query?e:u(u(u(u({},this.options),{query:this.options.query}),e),{variables:u(u({},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=Di.fetchMore,r.notifyOnNetworkStatusChange&&this.observe();var s=new Set;return this.queryManager.fetchQuery(n,r,Di.fetchMore).then((function(a){return t.queryManager.removeQuery(n),i.networkStatus===Di.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)||Yi(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__&&Rt.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=Pi(this.options,e||{});Vi(this.options,t)},t.prototype.setVariables=function(e){return si(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},Di.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){Rt(r,22),(t||(this.pollingInfo={})).interval=r;var n=function(){e.pollingInfo&&(xi(e.queryInfo.networkStatus)?i():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"network-only"},Di.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&&!si(t,this.last.variables)&&(r=void 0),this.last=u({result:this.queryManager.assumeImmutableResults?e:Ri(e),variables:t},r?{error:r}:null)},t.prototype.reobserveAsConcast=function(e,t){var r=this;this.isTornDown=!1;var n=t===Di.refetch||t===Di.fetchMore||t===Di.poll,i=this.options.variables,o=this.options.fetchPolicy,s=Pi(this.options,e||{}),a=n?s:Vi(this.options,s),c=this.transformDocument(a.query);this.lastQuery=c,n||(this.updatePolling(),e&&e.variables&&!si(e.variables,i)&&"standby"!==a.fetchPolicy&&a.fetchPolicy===o&&(this.applyNextFetchPolicy("variables-changed",a),void 0===t&&(t=Di.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=Gi(a.fetchPolicy));var l=function(){r.concast===f&&(r.waitForOwnResult=!1)},h=a.variables&&u({},a.variables),d=this.fetch(a,t,c),f=d.concast,p=d.fromLink,v={next:function(e){l(),r.reportResult(e,h)},error:function(e){l(),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)&&Fi(this.observers,"next",e)},t.prototype.reportError=function(e,t){var r=u(u({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:Di.error,loading:!1});this.updateLastResult(r,t),Fi(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}(ur);function Yi(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 Wi(e){!1!==globalThis.__DEV__&&Rt.error(23,e.message,e.stack)}function $i(e){!1!==globalThis.__DEV__&&e&&!1!==globalThis.__DEV__&&Rt.debug(24,e)}function Gi(e){return"network-only"===e||"no-cache"===e||"standby"===e}function Hi(e){return e.kind===$r.FIELD||e.kind===$r.FRAGMENT_SPREAD||e.kind===$r.INLINE_FRAGMENT}Mi(zi);const Ki=()=>Object.create(null),{forEach:Ji,slice:Xi}=Array.prototype,{hasOwnProperty:Zi}=Object.prototype;class eo{constructor(e=!0,t=Ki){this.weakness=e,this.makeData=t}lookup(...e){return this.lookupArray(e)}lookupArray(e){let t=this;return Ji.call(e,(e=>t=t.getChildTrie(e))),Zi.call(t,"data")?t.data:t.data=this.makeData(Xi.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&&to(e[r])?t.weak:t.strong;t=n&&n.get(e[r])}return t&&t.data}getChildTrie(e){const t=this.weakness&&to(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 eo(this.weakness,this.makeData)),r}}function to(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}function ro(){}class no{constructor(e=1/0,t=ro){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 io=null,oo={},so=1;function ao(e){try{return e()}catch(e){}}var uo="@wry/context:Slot",co=ao((function(){return globalThis}))||ao((function(){return r.g}))||Object.create(null),lo=co[uo]||Array[uo]||function(e){try{Object.defineProperty(co,uo,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}}(function(){function e(){this.id=["slot",so++,Date.now(),Math.random().toString(36).slice(2)].join(":")}return e.prototype.hasValue=function(){for(var e=io;e;e=e.parent)if(this.id in e.slots){var t=e.slots[this.id];if(t===oo)break;return e!==io&&(io.slots[this.id]=t),!0}return io&&(io.slots[this.id]=oo),!1},e.prototype.getValue=function(){if(this.hasValue())return io.slots[this.id]},e.prototype.withValue=function(e,t,r,n){var i,o=((i={__proto__:null})[this.id]=e,i),s=io;io={parent:s,slots:o};try{return t.apply(n,r)}finally{io=s}},e.bind=function(e){var t=io;return function(){var r=io;try{return io=t,e.apply(this,arguments)}finally{io=r}}},e.noContext=function(e,t,r){if(!io)return e.apply(r,t);var n=io;try{return io=null,e.apply(r,t)}finally{io=n}},e}());lo.bind,lo.noContext;const ho=new lo,{hasOwnProperty:fo}=Object.prototype,po=Array.from||function(e){const t=[];return e.forEach((e=>t.push(e))),t};function vo(e){const{unsubscribe:t}=e;"function"==typeof t&&(e.unsubscribe=void 0,t())}const yo=[],bo=100;function mo(e,t){if(!e)throw new Error(t||"assertion failure")}function go(e,t){const r=e.length;return r>0&&r===t.length&&e[r-1]===t[r-1]}function _o(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}function Oo(e){return e.slice(0)}class So{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,++So.count}peek(){if(1===this.value.length&&!To(this))return wo(this),this.value[0]}recompute(e){return mo(!this.recomputing,"already recomputing"),wo(this),To(this)?function(e,t){return jo(e),ho.withValue(e,Eo,[e,t]),function(e,t){if("function"==typeof e.subscribe)try{vo(e),e.unsubscribe=e.subscribe.apply(null,t)}catch(t){return e.setDirty(),!1}return!0}(e,t)&&function(e){e.dirty=!1,To(e)||Ao(e)}(e),_o(e.value)}(this,e):_o(this.value)}setDirty(){this.dirty||(this.dirty=!0,Io(this),vo(this))}dispose(){this.setDirty(),jo(this),Fo(this,((e,t)=>{e.setDirty(),xo(e,this)}))}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=yo.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(po(this.deps).forEach((e=>e.delete(this))),this.deps.clear(),yo.push(this.deps),this.deps=null)}}function wo(e){const t=ho.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),To(e)?Mo(t,e):ko(t,e),t}function Eo(e,t){e.recomputing=!0;const{normalizeResult:r}=e;let n;r&&1===e.value.length&&(n=Oo(e.value)),e.value.length=0;try{if(e.value[0]=e.fn.apply(null,t),r&&n&&!go(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 To(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function Io(e){Fo(e,Mo)}function Ao(e){Fo(e,ko)}function Fo(e,t){const r=e.parents.size;if(r){const n=po(e.parents);for(let i=0;i<r;++i)t(n[i],e)}}function Mo(e,t){mo(e.childValues.has(t)),mo(To(t));const r=!To(e);if(e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=yo.pop()||new Set;e.dirtyChildren.add(t),r&&Io(e)}function ko(e,t){mo(e.childValues.has(t)),mo(!To(t));const r=e.childValues.get(t);0===r.length?e.childValues.set(t,Oo(t.value)):go(r,t.value)||e.setDirty(),Do(e,t),To(e)||Ao(e)}function Do(e,t){const r=e.dirtyChildren;r&&(r.delete(t),0===r.size&&(yo.length<bo&&yo.push(r),e.dirtyChildren=null))}function jo(e){e.childValues.size>0&&e.childValues.forEach(((t,r)=>{xo(e,r)})),e.forgetDeps(),mo(null===e.dirtyChildren)}function xo(e,t){t.parents.delete(e),e.childValues.delete(t),Do(e,t)}So.count=0;const Po={setDirty:!0,dispose:!0,forget:!0};function No(e){const t=new Map,r=e&&e.subscribe;function n(e){const n=ho.getValue();if(n){let i=t.get(e);i||t.set(e,i=new Set),n.dependOn(i),"function"==typeof r&&(vo(i),i.unsubscribe=r(e))}}return n.dirty=function(e,r){const n=t.get(e);if(n){const i=r&&fo.call(Po,r)?r:"setDirty";po(n).forEach((e=>e[i]())),t.delete(e),vo(n)}},n}let Ro;function Co(...e){return(Ro||(Ro=new eo("function"==typeof WeakMap))).lookupArray(e)}const qo=new Set;function Lo(e,{max:t=Math.pow(2,16),keyArgs:r,makeCacheKey:n=Co,normalizeResult:i,subscribe:o,cache:s=no}=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 So(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),qo.add(a),ho.hasValue()||(qo.forEach((e=>e.clean())),qo.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 Bo=new lo,Qo=new WeakMap;function Vo(e){var t=Qo.get(e);return t||Qo.set(e,t={vars:new Set,dep:No()}),t}function Uo(e){Vo(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){Vo(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=Bo.getValue();a&&(i(a),Vo(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),Vo(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}var Yo=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=vn(t.resolvers,e)})):this.resolvers=vn(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 l(this,void 0,void 0,(function(){return h(this,(function(e){return t?[2,this.resolveDocument(t,r.data,n,i,this.fragmentMatcher,s).then((function(e){return u(u({},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 Zr(["client"],e)&&this.resolvers?e:null},e.prototype.serverQuery=function(e){return Xn(e)},e.prototype.prepareContext=function(e){var t=this.cache;return u(u({},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={}),l(this,void 0,void 0,(function(){return h(this,(function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(r),t).then((function(e){return u(u({},t),e.exportedVariables)}))]:[2,u({},t)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return Kr(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 Hr}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:Jn(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),l(this,void 0,void 0,(function(){var s,a,c,l,d,f,p,v,y,b;return h(this,(function(h){return s=Mr(e),a=Ar(e),c=hr(a),l=this.collectSelectionsToResolve(s,c),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",v=(p=this).cache,y=p.client,b={fragmentMap:c,context:u(u({},r),{cache:v,client:y}),variables:n,fragmentMatcher:i,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,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 l(this,void 0,void 0,(function(){var i,o,s,a,u,c=this;return h(this,(function(d){return i=n.fragmentMap,o=n.context,s=n.variables,a=[r],u=function(e){return l(c,void 0,void 0,(function(){var u,c;return h(this,(function(l){return(t||n.selectionsToResolve.has(e))&&Xr(e,s)?wr(e)?[2,this.resolveField(e,t,r,n).then((function(t){var r;void 0!==t&&a.push(((r={})[Or(e)]=t,r))}))]:(function(e){return"InlineFragment"===e.kind}(e)?u=e:(u=i[e.name.value],Rt(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 yn(a)}))]}))}))},e.prototype.resolveField=function(e,t,r,n){return l(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,d,f,p=this;return h(this,(function(h){return r?(i=n.variables,o=e.name.value,s=Or(e),a=o!==s,u=r[s]||r[o],c=Promise.resolve(u),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=r.__typename||n.defaultOperationType,(d=this.resolvers&&this.resolvers[l])&&(f=d[a?o:s])&&(c=Promise.resolve(Bo.withValue(this.cache,f,[r,_r(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),Kr(i,{Directive:function(e,t,n,i,s){"client"===e.name.value&&s.forEach((function(e){r(e)&&Hi(e)&&o.add(e)}))},FragmentSpread:function(n,i,s,a,u){var c=t[n.name.value];Rt(c,19,n.name.value);var l=e(c);l.size>0&&(u.forEach((function(e){r(e)&&Hi(e)&&o.add(e)})),o.add(n),l.forEach((function(e){o.add(e)})))}})}return n.get(i)}(e)},e}(),Wo=new(rn?WeakMap:Map);function $o(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return Wo.set(e,(Wo.get(e)+1)%1e15),r.apply(this,arguments)})}function Go(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var Ho=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;Wo.has(r)||(Wo.set(r,0),$o(r,"evict"),$o(r,"modify"),$o(r,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||Di.loading;return this.variables&&this.networkStatus!==Di.loading&&!si(this.variables,e.variables)&&(t=Di.setVariables),si(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(){Go(this),this.dirty=!1},e.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&si(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||si(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():Yi(e)})):delete this.oqListener)},e.prototype.notify=function(){var e=this;Go(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(xi(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=u(u({},this.getDiffOptions(e)),{watcher:this,callback:function(e){return t.setDiff(e)}});this.lastWatch&&si(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===Wo.get(this.cache)&&si(t,r.variables)&&si(e.data,r.result.data))},e.prototype.markResult=function(e,t,r,n){var i=this,o=new mn,s=fn(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&fn(e.incremental)){var a=On(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&&(Ko(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:Wo.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&&si(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=Di.ready},e.prototype.markError=function(e){return this.networkStatus=Di.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function Ko(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!Ii(e);return!n&&r&&e.data&&(n=!0),n}var Jo=Object.prototype.hasOwnProperty,Xo=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(rn?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map;var y=new Ei((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 Yo({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(Ct(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,c=void 0===a?[]:a,d=e.awaitRefetchQueries,f=void 0!==d&&d,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 l(this,void 0,void 0,(function(){var e,t,r,a;return h(this,(function(l){switch(l.label){case 0:return Rt(n,26),Rt("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=l.sent(),l.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,l){return Ti(a.getObservableFromLink(n,u(u({},O),{optimisticResponse:o}),i,!1),(function(t){if(Ii(t)&&"none"===g)throw new hn({graphQLErrors:Ai(t)});r&&(r.loading=!1,r.error=null);var l=u({},t);return"function"==typeof c&&(c=c(l)),"ignore"===g&&Ii(l)&&delete l.errors,a.markMutationResult({mutationId:e,result:l,document:n,variables:i,fetchPolicy:b,errorPolicy:g,context:O,update:p,updateQueries:s,awaitRefetchQueries:f,refetchQueries:c,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(),l(t instanceof hn?t:new hn({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&&Ko(n,e.errorPolicy)){if(gn(n)||i.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),gn(n)&&fn(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=On(s.result,n)),void 0!==a&&(n.data=a,i.push({result:a,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var c=e.updateQueries;c&&this.queries.forEach((function(e,o){var s=e.observableQuery,a=s&&s.queryName;if(a&&Jo.call(c,a)){var u=c[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=u(p,{mutationResult:n,queryName:h&&Ir(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 l=[];if(this.refetchQueries({updateCache:function(t){o||i.forEach((function(e){return t.write(e)}));var s,a=e.update,c=!(gn(s=n)||function(e){return"hasNext"in e&&"data"in e}(s))||gn(n)&&!n.hasNext;if(a){if(!o){var l=t.diff({id:"ROOT_MUTATION",query:r.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});l.complete&&("incremental"in(n=u(u({},n),{data:l.result}))&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}c&&a(t,n,{context:e.context,variables:e.variables})}o||e.keepRootFields||!c||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 l.push(e)})),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).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(u(u({},t),{result:{data:n}}),e)}catch(e){!1!==globalThis.__DEV__&&Rt.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:en(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:Zr(["nonreactive"],e),clientQuery:this.localState.clientQuery(e),serverQuery:Hn([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"}],e),defaultVars:kr(Tr(e)),asQuery:u(u({},e),{definitions:e.definitions.map((function(e){return"OperationDefinition"===e.kind&&"query"!==e.operation?u(u({},e),{operation:"query"}):e}))})};t.set(e,r)}return t.get(e)},e.prototype.getVariables=function(e,t){return u(u({},this.getDocumentInfo(e).defaultVars),t)},e.prototype.watchQuery=function(e){var t=this.transform(e.query);void 0===(e=u(u({},e),{variables:this.getVariables(t,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var r=new Ho(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()),Rt(e.query,28),Rt("Document"===e.query.kind,29),Rt(!e.returnPartialData,30),Rt(!e.pollInterval,31),this.fetchQuery(t,u(u({},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(Ct(32)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=Di.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):cr(r=e)&&"Document"===r.kind&&Array.isArray(r.definitions)?n.set(t.transform(e),!1):cr(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=xt("legacyOneTimeQuery"),i=t.getQuery(n).init({document:e.query,variables:e.variables}),o=new zi({queryManager:t,queryInfo:i,options:u(u({},e),{fetchPolicy:"network-only"})});Rt(o.queryId===n),i.setObservableQuery(o),r.set(n,o)})),!1!==globalThis.__DEV__&&n.size&&n.forEach((function(e,t){e||!1!==globalThis.__DEV__&&Rt.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&&(Ko(i,o)&&t.cache.write({query:r,result:i.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries());var s=Ii(i),a=function(e){return!!e.extensions&&Array.isArray(e.extensions[ln])}(i);if(s||a){var u={};if(s&&(u.graphQLErrors=i.errors),a&&(u.protocolErrors=i.extensions[ln]),"none"===o||a)throw new hn(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 ur((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),c=a.serverQuery,l=a.clientQuery;if(c){var h=this.inFlightLinkObservables,d=this.link,f={query:c,variables:r,operationName:Ir(c)||void 0,context:this.prepareContext(u(u({},t),{forceFetch:!n}))};if(t=f.context,n){var p=Qn(c),v=h.get(p)||new Map;h.set(p,v);var y=Oi(r);if(!(o=v.get(y))){var b=new ji([Nr(d,f)]);v.set(y,o=b),b.beforeNext((function(){v.delete(y)&&v.size<1&&h.delete(p)}))}}else o=new ji([Nr(d,f)])}else o=new ji([ur.of({data:{}})]),t=this.prepareContext(t);return l&&(o=Ti(o,(function(e){return s.localState.runResolvers({document:l,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 Ti(this.getObservableFromLink(i,r.context,r.variables),(function(o){var s=Ai(o),a=s.length>0;if(n>=e.lastRequestId){if(a&&"none"===r.errorPolicy)throw e.markError(new hn({graphQLErrors:s}));e.markResult(o,i,r,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:Di.ready};return a&&"ignore"!==r.errorPolicy&&(u.errors=s,u.networkStatus=Di.error),u}),(function(t){var r=t.hasOwnProperty("graphQLErrors")?t:new hn({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=Di.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 ji(this.localState.addExportedVariables(_.query,_.variables,_.context).then(O).then((function(e){return e.sources}))),s=!0;else{var w=O(_.variables);s=w.fromLink,o=new ji(w.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?xt("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 Ho&&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,c=t.errorPolicy,l=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||Di.loading);var s=t.result;!1===globalThis.__DEV__||l||si(s,{})||$i(t.missing);var a=function(e){return ur.of(u({data:e,loading:xi(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"===c&&r===Di.refetch&&Array.isArray(t.missing)?a(void 0):a(s)},y="no-cache"===s?0:r===Di.refetch&&"merge"!==a?1:2,b=function(){return n.getResultsFromLink(e,y,{query:i,variables:o,context:h,fetchPolicy:s,errorPolicy:c})},m=d&&"number"==typeof f&&f!==r&&xi(r);switch(s){default:case"cache-first":return(g=p()).complete?{fromLink:!1,sources:[v(g,e.markReady())]}:l||m?{fromLink:!0,sources:[v(g),b()]}:{fromLink:!0,sources:[b()]};case"cache-and-network":var g;return(g=p()).complete||l||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 Ho(this,e)),this.queries.get(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return u(u({},t),{clientAwareness:this.clientAwareness})},e}();function Zo(e,t){return Pi(e,t,t.variables&&{variables:Pi(u(u({},e&&e.variables),t.variables))})}var es=!1,ts=function(){function e(e){var t=this;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw Ct(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,w=e.link;w||(w=r?new ti({uri:r,credentials:n,headers:i}):Pr.empty()),this.link=w,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=Mt,this.localState=new Yo({cache:o,client:this,resolvers:m,fragmentMatcher:_}),this.queryManager=new Xo({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}es||!1===globalThis.__DEV__||(es=!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__&&Rt.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=Zo(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=u(u({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=Zo(this.defaultOptions.query,e)),Rt("cache-and-network"!==e.fetchPolicy,16),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=u(u({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Zo(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 Nr(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__&&Rt.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}(),rs=function(){function e(){this.assumeImmutableResults=!1,this.getFragmentDoc=Lo(lr)}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(u(u({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(u(u({},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=c(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=c(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(u(u({},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(u(u({},e),{data:i})),i)}})},e}(),ns=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 a(t,e),t}(Error);function is(e){return!1!==globalThis.__DEV__&&(t=e,(r=new Set([t])).forEach((function(e){cr(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){cr(e[t])&&r.add(e[t])}))}))),e;var t,r}var os=Object.prototype.hasOwnProperty;function ss(e){return null==e}function as(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=ss(n)?ss(i)?void 0:{_id:i}:{id:n}),ss(n)&&!ss(i)&&(n=i),!ss(n)))return"".concat(r,":").concat("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))}var us={dataIdFromObject:as,addTypename:!0,resultCaching:!0,canonizeResults:!1};function cs(e){var t=e.canonizeResults;return void 0===t?us.canonizeResults:t}var ls=/^[_a-z][_0-9a-z]*/i;function hs(e){var t=e.match(ls);return t?t[0]:e}function ds(e,t,r){return!!cr(t)&&(dn(t)?t.every((function(t){return ds(e,t,r)})):e.selections.every((function(e){if(wr(e)&&Xr(e,r)){var n=Or(e);return os.call(t,n)&&(!e.selectionSet||ds(e.selectionSet,t[n],r))}return!0})))}function fs(e){return cr(e)&&!pr(e)&&!dn(e)}function ps(e,t){var r=hr(Ar(e));return{fragmentMap:r,lookupFragment:function(e){var n=r[e];return!n&&t&&(n=t.lookup(e)),n||null}}}var vs=Object.create(null),ys=function(){return vs},bs=Object.create(null),ms=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 is(pr(e)?r.get(e.__ref,t):e&&e[t])},this.canRead=function(e){return pr(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return fr(e);if(pr(e))return e;var n=r.policies.identify(e)[0];if(n){var i=fr(n);return t&&r.merge(n,e),i}}}return e.prototype.toObject=function(){return u({},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),os.call(this.data,e)){var r=this.data[e];if(r&&os.call(r,t))return r[t]}return"__typename"===t&&os.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Ss?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),os.call(this.data,e)?this.data[e]:this instanceof Ss?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},e.prototype.merge=function(e,t){var r,n=this;pr(e)&&(e=e.__ref),pr(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){Rt("string"==typeof r,1);var s=new mn(Es).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=hs(e);t===e||n.policies.hasKeyArgs(s.__typename,t)||(a[t]=1),void 0!==s[e]||n instanceof Ss||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:vs,INVALIDATE:bs,isReference:pr,toReference:this.toReference,canRead:this.canRead,readField:function(t,n){return r.policies.readField("string"==typeof t?{fieldName:t,from:n||fr(e)}:t,{store:r})}};if(Object.keys(n).forEach((function(c){var l=hs(c),h=n[c];if(void 0!==h){var d="function"==typeof t?t:t[c]||t[l];if(d){var f=d===ys?vs:d(is(h),u(u({},a),{fieldName:l,storeFieldName:c,storage:r.getStorage(e,c)}));if(f===bs)r.group.dirty(e,c);else if(f===vs&&(f=void 0),f!==h&&(i[c]=f,o=!0,h=f,!1!==globalThis.__DEV__)){var p=function(e){if(void 0===r.lookup(e.__ref))return!1!==globalThis.__DEV__&&Rt.warn(2,e),!0};if(pr(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(pr(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__&&Rt.warn(3,y);break}}}}void 0!==h&&(s=!1)}})),o)return this.merge(e,i),s&&(this instanceof Ss?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]=ys,n):ys)}return!1},e.prototype.evict=function(e,t){var r=!1;return e.id&&(os.call(this.data,e.id)&&(r=this.delete(e.id,e.fieldName,e.args)),this instanceof Ss&&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){os.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&&os.call(e,r)||t.delete(r)})),e){var r=e.__META,n=c(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 Ss?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){os.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 Ss;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},e.prototype.findChildRefIds=function(e){if(!os.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){pr(e)&&(t[e.__ref]=!0),cr(e)&&Object.keys(e).forEach((function(t){var r=e[t];cr(r)&&n.add(r)}))}))}return this.refs[e]},e.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},e}(),gs=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?No():null,this.keyMaker=new bi(rn)},e.prototype.depend=function(e,t){if(this.d){this.d(_s(e,t));var r=hs(t);r!==t&&this.d(_s(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(_s(e,t),"__exists"===t?"forget":"setDirty")},e}();function _s(e,t){return t+"#"+e}function Os(e,t){Ts(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 gs(i))||this;return s.stump=new ws(s),s.storageTrie=new bi(rn),o&&s.replace(o),s}return a(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}(ms||(ms={}));var Ss=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 a(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){si(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 u(u({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var r=this.parent.findChildRefIds(t);return os.call(this.data,t)?u(u({},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}(ms),ws=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,(function(){}),new gs(t.group.caching,t.group))||this}return a(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(e,t){return this.parent.merge(e,t)},t}(Ss);function Es(e,t,r){var n=e[r],i=t[r];return si(n,i)?n:i}function Ts(e){return!!(e instanceof ms&&e.group.caching)}function Is(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var As=function(){function e(e){var t=this;this.knownResults=new(rn?WeakMap:Map),this.config=Pi(e,{addTypename:!1!==e.addTypename,canonizeResults:cs(e)}),this.canon=e.canon||new _i,this.executeSelectionSet=Lo((function(e){var r,n=e.context.canonizeResults,i=Is(e);i[3]=!n;var o=(r=t.executeSelectionSet).peek.apply(r,i);return o?n?u(u({},o),{result:t.canon.admit(o.result)}):o:(Os(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))}),{max:this.config.resultCacheMaxSize,keyArgs:Is,makeCacheKey:function(e,t,r,n){if(Ts(r.store))return r.store.makeCacheKey(e,pr(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=Lo((function(e){return Os(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(Ts(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return e.prototype.resetCanon=function(){this.canon=new _i},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,c=e.canonizeResults,l=void 0===c?this.config.canonizeResults:c,h=this.config.cache.policies;o=u(u({},kr(Fr(r))),o);var d,f=fr(i),p=this.executeSelectionSet({selectionSet:Mr(r).selectionSet,objectOrReference:f,enclosingRef:f,context:u({store:t,query:r,policies:h,variables:o,varString:Oi(o),canonizeResults:l},ps(r,this.config.fragments))});if(p.missing&&(d=[new ns(Fs(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(Ts(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(pr(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 mn;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(Xr(e,a))if(wr(e)){var v=u.readField({fieldName:e.name.value,field:e,variables:o.variables,from:n},o),y=Or(e);void 0===v?Kn.added(e)||(s=h.merge(s,((r={})[y]="Can't find field '".concat(e.name.value,"' on ").concat(pr(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),r))):dn(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:pr(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=dr(e,o.lookupFragment);if(!b&&e.kind===$r.FRAGMENT_SPREAD)throw Ct(9,e.name.value);b&&u.fragmentMatches(b,c)&&b.selectionSet.selections.forEach(f.add,f)}}));var p={result:yn(l),missing:s},v=o.canonizeResults?this.canon.admit(p):is(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 mn;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:dn(e)?u(r.executeSubSelectedArray({field:n,array:e,enclosingRef:o,context:s}),t):n.selectionSet?u(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:e,enclosingRef:pr(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){cr(r)&&(Rt(!pr(r),10,function(e,t){return pr(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 Fs(e){try{JSON.stringify(e,(function(e,t){if("string"==typeof t)throw t;return t}))}catch(e){return e}}var Ms=Object.create(null);function ks(e){var t=JSON.stringify(e);return Ms[t]||(Ms[t]=Object.create(null))}function Ds(e){var t=ks(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,r){var n=function(e,t){return r.readField(t,e)},i=r.keyObject=xs(e,(function(e){var i=Rs(r.storeObject,e,n);return void 0===i&&t!==r.storeObject&&os.call(t,e[0])&&(i=Rs(t,e,Ns)),Rt(void 0!==i,4,e.join("."),t),i}));return"".concat(r.typename,":").concat(JSON.stringify(i))})}function js(e){var t=ks(e);return t.keyArgsFn||(t.keyArgsFn=function(t,r){var n=r.field,i=r.variables,o=r.fieldName,s=xs(e,(function(e){var r=e[0],o=r.charAt(0);if("@"!==o)if("$"!==o){if(t)return Rs(t,e)}else{var s=r.slice(1);if(i&&os.call(i,s)){var a=e.slice(0);return a[0]=s,Rs(i,a)}}else if(n&&fn(n.directives)){var u=r.slice(1),c=n.directives.find((function(e){return e.name.value===u})),l=c&&_r(c,i);return l&&Rs(l,e.slice(1))}})),a=JSON.stringify(s);return(t||"{}"!==a)&&(o+=":"+a),o})}function xs(e,t){var r=new mn;return Ps(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 Ps(e){var t=ks(e);if(!t.paths){var r=t.paths=[],n=[];e.forEach((function(t,i){dn(t)?(Ps(t).forEach((function(e){return r.push(n.concat(e))})),n.length=0):(n.push(t),dn(e[i+1])||(r.push(n.slice(0)),n.length=0))}))}return t.paths}function Ns(e,t){return e[t]}function Rs(e,t,r){return r=r||Ns,Cs(t.reduce((function e(t,n){return dn(t)?t.map((function(t){return e(t,n)})):t&&r(t,n)}),e))}function Cs(e){return cr(e)?dn(e)?e.map(Cs):xs(Object.keys(e).sort(),(function(t){return Rs(e,t)})):e}function qs(e){return void 0!==e.args?e.args:e.field?_r(e.field,e.variables):null}br.setStringify(Oi);var Ls=function(){},Bs=function(e,t){return t.fieldName},Qs=function(e,t,r){return(0,r.mergeObjects)(e,t)},Vs=function(e,t){return t},Us=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=u({dataIdFromObject:as},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=u(u({},t),{typename:i,storeObject:s,readField:t&&t.readField||function(){var e=Ys(arguments,s);return n.readField(e,{store:n.cache.data,variables:e.variables})}}),c=i&&this.getTypePolicy(i),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var h=l(u(u({},e),s),a);if(!dn(h)){o=h;break}l=Ds(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=c(n,["queryType","mutationType","subscriptionType"]);i&&t.setRootTypename("Query",r),o&&t.setRootTypename("Mutation",r),s&&t.setRootTypename("Subscription",r),os.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?Qs:!1===t?Vs:e.merge}s(n,t.merge),n.keyFn=!1===i?Ls:dn(i)?Ds(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?Bs:dn(a)?js(a):"function"==typeof a?a:n.keyFn,"function"==typeof u&&(n.read=u),s(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||Bs)}))},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var r="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[r];t!==n&&(Rt(!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(ls);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},e.prototype.getTypePolicy=function(e){var t=this;if(!os.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=c(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__&&Rt.warn(6,t,o),s.add(o)),!0;d.forEach(u),c&&h===a.length-1&&ds(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=qs(e);o;){var u=o(a,s);if(!dn(u)){t=u||n;break}o=js(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 vr(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 vr(n,r,i,t)}))),br(e.name.value,n,r)}(e.field,e.variables):br(n,qs(e))),!1===t?n:n===hs(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=hs(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(pr(r)?r.__ref:r,i));return Bo.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===Qs?Ws(n.store)(e,t):a===Vs?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=hs(o),a=r.variables||n.variables,u=n.store,c=u.toReference,l=u.canRead;return{args:qs(r),field:r.field||null,fieldName:s,storeFieldName:o,variables:a,isReference:pr,toReference:c,storage:i,cache:e.cache,canRead:l,readField:function(){return e.readField(Ys(arguments,t,a),n)},mergeObjects:Ws(n.store)}}function Ys(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=u({},i),os.call(n,"from")||(n.from=t)),!1!==globalThis.__DEV__&&void 0===n.from&&!1!==globalThis.__DEV__&&Rt.warn(7,Pt(Array.from(e))),void 0===n.variables&&(n.variables=r),n}function Ws(e){return function(t,r){if(dn(t)||dn(r))throw Ct(8);if(cr(t)&&cr(r)){var n=e.getFieldValue(t,"__typename"),i=e.getFieldValue(r,"__typename");if(n&&i&&n!==i)return r;if(pr(t)&&fs(r))return e.merge(t.__ref,r),t;if(fs(t)&&pr(r))return e.merge(t,r.__ref),r;if(fs(t)&&fs(r))return u(u({},t),r)}return r}}function $s(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:u(u({},e),{clientOnly:t,deferred:r})),i}var Gs=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,c=Tr(n),l=new mn;s=u(u({},kr(c)),s);var h=u(u({store:e,written:Object.create(null),merge:function(e,t){return l.merge(e,t)},variables:s,varString:Oi(s)},ps(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:c.selectionSet,mergeTree:{map:new Map},context:h});if(!pr(d))throw Ct(11,i);return h.incomingById.forEach((function(t,n){var i=t.storeObject,o=t.mergeTree,s=t.fieldNodeSet,a=fr(n);if(o&&o.map.size){var u=r.applyMerges(o,a,i,h);if(pr(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[hs(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&&!pr(o)&&!si(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=hs(r),c="".concat(a,".").concat(u);if(!ea.has(c)){ea.add(c);var l=[];dn(o)||dn(s)||[o,s].forEach((function(e){var t=n.getFieldValue(e,"__typename");"string"!=typeof t||l.includes(t)||l.push(t)})),!1!==globalThis.__DEV__&&Rt.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,c=Object.create(null),l=r&&a.rootTypenamesById[r]||Sr(n,i,o.fragmentMap)||r&&o.store.get(r,"__typename");"string"==typeof l&&(c.__typename=l);var h=function(){var e=Ys(arguments,c,o.variables);if(pr(e.from)){var t=o.incomingById.get(e.from.__ref);if(t){var r=a.readField(u(u({},e),{from:t.storeObject}),o);if(void 0!==r)return r}}return a.readField(e,o)},d=new Set;this.flattenFields(i,n,o,l).forEach((function(e,r){var i,o=Or(r),u=n[o];if(d.add(r),void 0!==u){var f=a.getStoreFieldName({typename:l,fieldName:r.name.value,field:r,variables:e.variables}),p=Ks(s,f),v=t.processFieldValue(u,r,r.selectionSet?$s(e,!1,!1):e,p),y=void 0;r.selectionSet&&(pr(v)||fs(v))&&(y=h("__typename",v));var b=a.getMergeFunction(l,r.name.value,y);b?p.info={field:r,typename:l,merge:b}:Zs(s,f),c=e.merge(c,((i={})[f]=v,i))}else!1===globalThis.__DEV__||e.clientOnly||e.deferred||Kn.added(r)||a.getReadFunction(l,r.name.value)||!1!==globalThis.__DEV__&&Rt.error(12,Or(r),n)}));try{var f=a.identify(n,{typename:l,selectionSet:i,fragmentMap:o.fragmentMap,storeObject:c,readField:h}),p=f[0],v=f[1];r=r||p,v&&(c=o.merge(c,v))}catch(e){if(!r)throw e}if("string"==typeof r){var y=fr(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,c),m.mergeTree=Js(m.mergeTree,s),d.forEach((function(e){return m.fieldNodeSet.add(e)}))):o.incomingById.set(r,{storeObject:c,mergeTree:Xs(s)?void 0:s,fieldNodeSet:d}),y}return c},e.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?dn(e)?e.map((function(e,o){var s=i.processFieldValue(e,t,r,Ks(n,o));return Zs(n,o),s})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):!1!==globalThis.__DEV__?Ri(e):e},e.prototype.flattenFields=function(e,t,r,n){void 0===n&&(n=Sr(t,e,r.fragmentMap));var i=new Map,o=this.cache.policies,s=new bi(!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(Xr(s,r.variables)){var a=u.clientOnly,c=u.deferred;if(a&&c||!fn(s.directives)||s.directives.forEach((function(e){var t=e.name.value;if("client"===t&&(a=!0),"defer"===t){var n=_r(e,r.variables);n&&!1===n.if||(c=!0)}})),wr(s)){var l=i.get(s);l&&(a=a&&l.clientOnly,c=c&&l.deferred),i.set(s,$s(r,a,c))}else{var h=dr(s,r.lookupFragment);if(!h&&s.kind===$r.FRAGMENT_SPREAD)throw Ct(13,s.name.value);h&&o.fragmentMatches(h,n,t,r.variables)&&e(h.selectionSet,$s(r,a,c))}}})))}(e,r),i},e.prototype.applyMerges=function(e,t,r,n,i){var o,s=this;if(e.map.size&&!pr(r)){var a,c=dn(r)||!pr(t)&&!fs(t)?void 0:t,l=r;c&&!i&&(i=[pr(c)?c.__ref:c]);var h=function(e,t){return dn(e)?"number"==typeof t?e[t]:void 0:n.store.getFieldValue(e,String(t))};e.map.forEach((function(e,t){var r=h(c,t),o=h(l,t);if(void 0!==o){i&&i.push(t);var u=s.applyMerges(e,r,o,n,i);u!==o&&(a=a||new Map).set(t,u),i&&Rt(i.pop()===t)}})),a&&(r=dn(l)?l.slice(0):u({},l),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}(),Hs=[];function Ks(e,t){var r=e.map;return r.has(t)||r.set(t,Hs.pop()||{map:new Map}),r.get(t)}function Js(e,t){if(e===t||!t||Xs(t))return e;if(!e||Xs(e))return t;var r=e.info&&t.info?u(u({},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,Js(e,t.map.get(r))),o.delete(r)})),o.forEach((function(r){i.map.set(r,Js(t.map.get(r),e.map.get(r)))}))}return i}function Xs(e){return!e||!(e.info||e.map.size)}function Zs(e,t){var r=e.map,n=r.get(t);n&&Xs(n)&&(Hs.push(n),r.delete(t))}var ea=new Set,ta=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.watches=new Set,r.addTypenameTransform=new Ei(Kn),r.assumeImmutableResults=!0,r.makeVar=zo,r.txCount=0,r.config=function(e){return Pi(us,e)}(t),r.addTypename=!!r.config.addTypename,r.policies=new Us({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return a(t,e),t.prototype.init=function(){var e=this.data=new ms.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 Gs(this,this.storeReader=new As({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:cs(this.config),canon:e?void 0:r&&r.canon,fragments:n}),n),this.maybeBroadcastWatch=Lo((function(e,r){return t.broadcastWatch(e,r)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var r=e.optimistic?t.optimisticData:t.data;if(Ts(r)){var n=e.optimistic,i=e.id,o=e.variables;return r.makeCacheKey(e.query,e.callback,Oi({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(u(u({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:r})).result||null}catch(e){if(e instanceof ns)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(os.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(u(u({},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||Vo(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&&Uo(r),r.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){Oi.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(pr(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(e){!1!==globalThis.__DEV__&&Rt.warn(e)}},t.prototype.evict=function(e){if(!e.id){if(os.call(e,"id"))return!1;e=u(u({},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(),Oi.reset(),e&&e.discardWatches?(this.watches.forEach((function(e){return t.maybeBroadcastWatch.forget(e)})),this.watches.clear(),Uo(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,c=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}},l=new Set;return a&&!this.txCount&&this.broadcastWatches(u(u({},e),{onWatchUpdated:function(e){return l.add(e),!1}})),"string"==typeof o?this.optimisticData=this.optimisticData.addLayer(o,c):!1===o?c(this.data):c(),"string"==typeof s&&(this.optimisticData=this.optimisticData.removeLayer(s)),a&&l.size?(this.broadcastWatches(u(u({},e),{onWatchUpdated:function(e,t){var r=a.call(this,e,t);return!1!==r&&l.delete(e),r}})),l.size&&l.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&&si(r.result,n.result)||e.callback(e.lastDiff=n,r)},t}(rs);function ra(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const na=/\r\n|[\n\r]/g;function ia(e,t){let r=0,n=1;for(const i of e.body.matchAll(na)){if("number"==typeof i.index||ra(!1),i.index>=t)break;r=i.index+i[0].length,n+=1}return{line:n,column:t+1-r}}function oa(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+sa([[`${s} |`,r[0]],...r.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",r[e+1]]])}return c+sa([[s-1+" |",l[i-1]],[`${s} |`,h],["|","^".padStart(u)],[`${s+1} |`,l[i+1]]])}function sa(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 aa 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=ua(Array.isArray(o)?o:o?[o]:void 0);const h=ua(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=>ia(s,e))):null==h?void 0:h.map((e=>ia(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,aa):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"+oa((t=r.loc).source,ia(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+oa(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 ua(e){return void 0===e||0===e.length?void 0:e}function ca(e,t,r){return new aa(`Syntax Error: ${r}`,{source:e,positions:[t]})}var la,ha,da;!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"}(la||(la={})),(da=ha||(ha={})).SOF="<SOF>",da.EOF="<EOF>",da.BANG="!",da.DOLLAR="$",da.AMP="&",da.PAREN_L="(",da.PAREN_R=")",da.SPREAD="...",da.COLON=":",da.EQUALS="=",da.AT="@",da.BRACKET_L="[",da.BRACKET_R="]",da.BRACE_L="{",da.PIPE="|",da.BRACE_R="}",da.NAME="Name",da.INT="Int",da.FLOAT="Float",da.STRING="String",da.BLOCK_STRING="BlockString",da.COMMENT="Comment";class fa{constructor(e){const t=new Vr(ha.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!==ha.EOF)do{if(e.next)e=e.next;else{const t=_a(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===ha.COMMENT);return e}}function pa(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function va(e,t){return ya(e.charCodeAt(t))&&ba(e.charCodeAt(t+1))}function ya(e){return e>=55296&&e<=56319}function ba(e){return e>=56320&&e<=57343}function ma(e,t){const r=e.source.body.codePointAt(t);if(void 0===r)return ha.EOF;if(r>=32&&r<=126){const e=String.fromCodePoint(r);return'"'===e?"'\"'":`"${e}"`}return"U+"+r.toString(16).toUpperCase().padStart(4,"0")}function ga(e,t,r,n,i){const o=e.line,s=1+r-e.lineStart;return new Vr(t,r,n,o,s,i)}function _a(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 Oa(e,i);case 33:return ga(e,ha.BANG,i,i+1);case 36:return ga(e,ha.DOLLAR,i,i+1);case 38:return ga(e,ha.AMP,i,i+1);case 40:return ga(e,ha.PAREN_L,i,i+1);case 41:return ga(e,ha.PAREN_R,i,i+1);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return ga(e,ha.SPREAD,i,i+3);break;case 58:return ga(e,ha.COLON,i,i+1);case 61:return ga(e,ha.EQUALS,i,i+1);case 64:return ga(e,ha.AT,i,i+1);case 91:return ga(e,ha.BRACKET_L,i,i+1);case 93:return ga(e,ha.BRACKET_R,i,i+1);case 123:return ga(e,ha.BRACE_L,i,i+1);case 124:return ga(e,ha.PIPE,i,i+1);case 125:return ga(e,ha.BRACE_R,i,i+1);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?ka(e,i):Ea(e,i)}if(In(t)||45===t)return Sa(e,i,t);if(Fn(t))return Da(e,i);throw ca(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":pa(t)||va(r,i)?`Unexpected character: ${ma(e,i)}.`:`Invalid character: ${ma(e,i)}.`)}return ga(e,ha.EOF,n,n)}function Oa(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(pa(e))++i;else{if(!va(r,i))break;i+=2}}return ga(e,ha.COMMENT,t,i,r.slice(t+1,i))}function Sa(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),In(o))throw ca(e.source,i,`Invalid number, unexpected digit after 0: ${ma(e,i)}.`)}else i=wa(e,i,o),o=n.charCodeAt(i);if(46===o&&(s=!0,o=n.charCodeAt(++i),i=wa(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=wa(e,i,o),o=n.charCodeAt(i)),46===o||Fn(o))throw ca(e.source,i,`Invalid number, expected digit but got: ${ma(e,i)}.`);return ga(e,s?ha.FLOAT:ha.INT,t,i,n.slice(t,i))}function wa(e,t,r){if(!In(r))throw ca(e.source,t,`Invalid number, expected digit but got: ${ma(e,t)}.`);const n=e.source.body;let i=t+1;for(;In(n.charCodeAt(i));)++i;return i}function Ea(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),ga(e,ha.STRING,t,i+1,s);if(92!==n){if(10===n||13===n)break;if(pa(n))++i;else{if(!va(r,i))throw ca(e.source,i,`Invalid character within String: ${ma(e,i)}.`);i+=2}}else{s+=r.slice(o,i);const t=117===r.charCodeAt(i+1)?123===r.charCodeAt(i+2)?Ta(e,i):Ia(e,i):Ma(e,i);s+=t.value,i+=t.size,o=i}}throw ca(e.source,i,"Unterminated string.")}function Ta(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||!pa(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|Fa(e),n<0)break}throw ca(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+i)}".`)}function Ia(e,t){const r=e.source.body,n=Aa(r,t+2);if(pa(n))return{value:String.fromCodePoint(n),size:6};if(ya(n)&&92===r.charCodeAt(t+6)&&117===r.charCodeAt(t+7)){const e=Aa(r,t+8);if(ba(e))return{value:String.fromCodePoint(n,e),size:12}}throw ca(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+6)}".`)}function Aa(e,t){return Fa(e.charCodeAt(t))<<12|Fa(e.charCodeAt(t+1))<<8|Fa(e.charCodeAt(t+2))<<4|Fa(e.charCodeAt(t+3))}function Fa(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Ma(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 ca(e.source,t,`Invalid character escape sequence: "${r.slice(t,t+2)}".`)}function ka(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=ga(e,ha.BLOCK_STRING,t,o+3,Mn(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(pa(n))++o;else{if(!va(r,o))throw ca(e.source,o,`Invalid character within String: ${ma(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 ca(e.source,o,"Unterminated string.")}function Da(e,t){const r=e.source.body,n=r.length;let i=t+1;for(;i<n&&(An(o=r.charCodeAt(i))||In(o)||95===o);)++i;var o;return ga(e,ha.NAME,t,i,r.slice(t,i))}class ja{constructor(e,t="GraphQL request",r={line:1,column:1}){"string"==typeof e||Rr(!1,`Body must be a string. Received: ${Lr(e)}.`),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||Rr(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Rr(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class xa{constructor(e,t={}){const r=function(e){return e instanceof ja}(e)?e:new ja(e);this._lexer=new fa(r),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(ha.NAME);return this.node(e,{kind:$r.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:$r.DOCUMENT,definitions:this.many(ha.SOF,this.parseDefinition,ha.EOF)})}parseDefinition(){if(this.peek(ha.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===ha.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 ca(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(ha.BRACE_L))return this.node(e,{kind:$r.OPERATION_DEFINITION,operation:Wr.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let r;return this.peek(ha.NAME)&&(r=this.parseName()),this.node(e,{kind:$r.OPERATION_DEFINITION,operation:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(ha.NAME);switch(e.value){case"query":return Wr.QUERY;case"mutation":return Wr.MUTATION;case"subscription":return Wr.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(ha.PAREN_L,this.parseVariableDefinition,ha.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:$r.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(ha.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(ha.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(ha.DOLLAR),this.node(e,{kind:$r.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:$r.SELECTION_SET,selections:this.many(ha.BRACE_L,this.parseSelection,ha.BRACE_R)})}parseSelection(){return this.peek(ha.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let r,n;return this.expectOptionalToken(ha.COLON)?(r=t,n=this.parseName()):n=t,this.node(e,{kind:$r.FIELD,alias:r,name:n,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(ha.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(ha.PAREN_L,t,ha.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,r=this.parseName();return this.expectToken(ha.COLON),this.node(t,{kind:$r.ARGUMENT,name:r,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(ha.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(ha.NAME)?this.node(e,{kind:$r.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:$r.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:$r.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:$r.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 ha.BRACKET_L:return this.parseList(e);case ha.BRACE_L:return this.parseObject(e);case ha.INT:return this.advanceLexer(),this.node(t,{kind:$r.INT,value:t.value});case ha.FLOAT:return this.advanceLexer(),this.node(t,{kind:$r.FLOAT,value:t.value});case ha.STRING:case ha.BLOCK_STRING:return this.parseStringLiteral();case ha.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:$r.BOOLEAN,value:!0});case"false":return this.node(t,{kind:$r.BOOLEAN,value:!1});case"null":return this.node(t,{kind:$r.NULL});default:return this.node(t,{kind:$r.ENUM,value:t.value})}case ha.DOLLAR:if(e){if(this.expectToken(ha.DOLLAR),this._lexer.token.kind===ha.NAME){const e=this._lexer.token.value;throw ca(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:$r.STRING,value:e.value,block:e.kind===ha.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:$r.LIST,values:this.any(ha.BRACKET_L,(()=>this.parseValueLiteral(e)),ha.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:$r.OBJECT,fields:this.any(ha.BRACE_L,(()=>this.parseObjectField(e)),ha.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,r=this.parseName();return this.expectToken(ha.COLON),this.node(t,{kind:$r.OBJECT_FIELD,name:r,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(ha.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(ha.AT),this.node(t,{kind:$r.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(ha.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(ha.BRACKET_R),t=this.node(e,{kind:$r.LIST_TYPE,type:r})}else t=this.parseNamedType();return this.expectOptionalToken(ha.BANG)?this.node(e,{kind:$r.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:$r.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(ha.STRING)||this.peek(ha.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(ha.BRACE_L,this.parseOperationTypeDefinition,ha.BRACE_R);return this.node(e,{kind:$r.SCHEMA_DEFINITION,description:t,directives:r,operationTypes:n})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(ha.COLON);const r=this.parseNamedType();return this.node(e,{kind:$r.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:$r.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:$r.OBJECT_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:i,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(ha.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(ha.BRACE_L,this.parseFieldDefinition,ha.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName(),n=this.parseArgumentDefs();this.expectToken(ha.COLON);const i=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:$r.FIELD_DEFINITION,description:t,name:r,arguments:n,type:i,directives:o})}parseArgumentDefs(){return this.optionalMany(ha.PAREN_L,this.parseInputValueDef,ha.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName();this.expectToken(ha.COLON);const n=this.parseTypeReference();let i;this.expectOptionalToken(ha.EQUALS)&&(i=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:$r.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:$r.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:$r.UNION_TYPE_DEFINITION,description:t,name:r,directives:n,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(ha.EQUALS)?this.delimitedMany(ha.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:$r.ENUM_TYPE_DEFINITION,description:t,name:r,directives:n,values:i})}parseEnumValuesDefinition(){return this.optionalMany(ha.BRACE_L,this.parseEnumValueDefinition,ha.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseEnumValueName(),n=this.parseConstDirectives();return this.node(e,{kind:$r.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 ca(this._lexer.source,this._lexer.token.start,`${Pa(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:$r.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:r,directives:n,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(ha.BRACE_L,this.parseInputValueDef,ha.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===ha.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(ha.BRACE_L,this.parseOperationTypeDefinition,ha.BRACE_R);if(0===t.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:$r.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:$r.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:$r.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:$r.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:$r.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:$r.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:$r.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:r,fields:n})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(ha.AT);const r=this.parseName(),n=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:$r.DIRECTIVE_DEFINITION,description:t,name:r,arguments:n,repeatable:i,locations:o})}parseDirectiveLocations(){return this.delimitedMany(ha.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(la,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new Qr(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 ca(this._lexer.source,t.start,`Expected ${Na(e)}, found ${Pa(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==ha.NAME||t.value!==e)throw ca(this._lexer.source,t.start,`Expected "${e}", found ${Pa(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===ha.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return ca(this._lexer.source,t.start,`Unexpected ${Pa(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!==ha.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw ca(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function Pa(e){const t=e.value;return Na(e.kind)+(null!=t?` "${t}"`:"")}function Na(e){return function(e){return e===ha.BANG||e===ha.DOLLAR||e===ha.AMP||e===ha.PAREN_L||e===ha.PAREN_R||e===ha.SPREAD||e===ha.COLON||e===ha.EQUALS||e===ha.AT||e===ha.BRACKET_L||e===ha.BRACKET_R||e===ha.BRACE_L||e===ha.PIPE||e===ha.BRACE_R}(e)?`"${e}"`:e}var Ra=new Map,Ca=new Map,qa=!0,La=!1;function Ba(e){return e.replace(/[\s,]+/g," ").trim()}function Qa(e){var t,r,n,i=Ba(e);if(!Ra.has(i)){var o=function(e,t){return new xa(e,t).parseDocument()}(e,{experimentalFragmentVariables:La,allowLegacyFragmentVariables:La});if(!o||"Document"!==o.kind)throw new Error("Not a valid GraphQL document.");Ra.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=Ba((s=e.loc).source.body.substring(s.start,s.end)),o=Ca.get(t);o&&!o.has(i)?qa&&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||Ca.set(t,o=new Set),o.add(i),r.has(i)||(r.add(i),n.push(e))}else n.push(e);var s})),u(u({},t),{definitions:n}))))}return Ra.get(i)}function Va(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]})),Qa(n)}var Ua,za=Va;(Ua=Va||(Va={})).gql=za,Ua.resetCaches=function(){Ra.clear(),Ca.clear()},Ua.disableFragmentWarnings=function(){qa=!1},Ua.enableExperimentalFragmentVariables=function(){La=!0},Ua.disableExperimentalFragmentVariables=function(){La=!1},Va.default=Va;const Ya=["query","aiData","api","backend-function","webhooks","ws","quota","named-query","native-query","application-kotlin","openapi","secret","queue","mutation","application","storage","internalCodeExecutor"];function Wa(e,t,r){const n=new URL("https://squid.cloud");n.host=`${t}.${e}.${n.host}`;const i=r.replace(/^\//g,"").split("/")[0]||"";$a(e)&&(n.protocol="http",n.port=Ya.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 $a(e){return/^local/.test(e)}class Ga{constructor(e,t,r,n){this.rpcManager=e,this.region=r,this.appId=n;const i=Wa(this.region,this.appId,`${t}/graphql`);this.client=new ts({link:new ti({uri:i,headers:this.rpcManager.getStaticHeaders()}),cache:new ta})}async query(e){return(await this.client.query({query:Va`
|
|
2
2
|
${e.query}
|
|
3
|
-
`,variables:e.variables})).data}async mutate(e){return(await this.client.mutate({mutation:
|
|
3
|
+
`,variables:e.variables})).data}async mutate(e){return(await this.client.mutate({mutation:Va`
|
|
4
4
|
${e.query}
|
|
5
|
-
`})).data}}class Ga{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 $a(this.rpcManager,e,this.region,this.appId),this.clientsMap.set(e,t),t)}}class Ha{constructor(e,t,r){this.rpcManager=e,this.lockManager=t,this.querySender=r}async sendMutations(e,t){const r=ct(e),n=r.map((e=>`sendMutation_${Be(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 Se.debug("Error while sending mutations",{error:e,mutations:JSON.stringify(r,null,2)}),e}finally{this.lockManager.release(...n)}}}class Ka{constructor(e){this.rpcManager=e}async executeNativeQuery(e){return this.rpcManager.post("native-query/execute",e)}}function Ja(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=Xa(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=Xa(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=Xa(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}=Za(r[0]),o=r.map((t=>Ja(e,t)));return e.collection(n,i).or(...o)}(e,t)}}function Xa(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 Za(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 Za(e.queries[0])}}const eu={"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)=>tu(e.toLowerCase(),t.toLowerCase()),"like_cs:like":(e,t)=>tu(e.toLowerCase(),t.toLowerCase()),"like:like_cs":(e,t)=>tu(e,t)&&nu(t),"like_cs:like_cs":(e,t)=>tu(e,t),"like:not like":(e,t)=>!ru(e.toLowerCase(),t.toLowerCase()),"like_cs:not like":(e,t)=>!ru(e.toLowerCase(),t.toLowerCase()),"like:not like_cs":(e,t)=>!ru(e.toLowerCase(),t.toLowerCase()),"like_cs:not like_cs":(e,t)=>!ru(e,t),"not like:like":(e,t)=>ou(e,t),"not like_cs:like":(e,t)=>ou(e,t),"not like:like_cs":(e,t)=>ou(e,t),"not like_cs:like_cs":(e,t)=>ou(e,t),"not like:not like":(e,t)=>tu(t.toLowerCase(),e.toLowerCase()),"not like_cs:not like":(e,t)=>tu(t,e)&&nu(e),"not like:not like_cs":(e,t)=>tu(t.toLowerCase(),e.toLowerCase()),"not like_cs:not like_cs":(e,t)=>tu(t,e),"in:like":(e,t)=>e.every((e=>Ze(t,e,"like"))),"in:like_cs":(e,t)=>e.every((e=>Ze(t,e,"like_cs"))),"in:not like":(e,t)=>e.every((e=>Ze(t,e,"not like"))),"in:not like_cs":(e,t)=>e.every((e=>Ze(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&&iu(e)||su(e)&&t.includes(""),"not like_cs:in":(e,t)=>e.length>0&&iu(e)||su(e)&&t.includes(""),"not in:like":(e,t)=>t.length>0&&iu(t)||su(t)&&e.includes(""),"not in:like_cs":(e,t)=>t.length>0&&iu(t)||su(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=>Ze(e,t,"not like"))),"like_cs:not in":(e,t)=>t.every((t=>Ze(e,t,"not like_cs"))),"not like:not in":(e,t)=>t.every((t=>Ze(e,t,"like"))),"not like_cs:not in":(e,t)=>t.every((t=>Ze(e,t,"like_cs")))};function tu(e,t,r=0,n=0){if(n>=t.length)return r>=e.length;if(r>=e.length)return iu(t.substring(n));const i=e[r],o=t[n];return"%"===i&&"%"===o?tu(e,t,r+1,n+1)||tu(e,t,r+1,n):"%"!==i&&("%"===o?tu(e,t,r,n+1)||tu(e,t,r+1,n):(i===o||"_"===o)&&tu(e,t,r+1,n+1))}function ru(e,t,r=0,n=0){if(r>=e.length&&n>=t.length)return!0;if(r>=e.length)return iu(t.substring(n));if(n>=t.length)return iu(e.substring(r));const i=r<e.length?e[r]:"",o=n<t.length?t[n]:"";return"%"===i&&"%"===o?ru(e,t,r+1,n+1)||ru(e,t,r,n+1)||ru(e,t,r+1,n):"%"===i||"%"===o?ru(e,t,r,n+1)||ru(e,t,r+1,n):(i===o||"_"===i||"_"===o)&&ru(e,t,r+1,n+1)}function nu(e){return!/[a-zA-Z]/.test(e)}function iu(e){return e.split("").every((e=>"%"===e))}function ou(e,t){return e.length>0&&iu(e)||t.length>0&&iu(t)||su(e)&&0===t.length}function su(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 au{constructor(e){this.query=e,this.query=e,this.parsedConditions=this.parseConditions(this.query.conditions.filter(xe))}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!ae(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(xe),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=te(e,r);if("in"===n){if(t.value.includes(i))continue;return!1}if("not in"!==n){if(!Ze(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=eu[`${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&&ae(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 uu{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 au(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[Be(e.__docId__,r,t)]))}}function cu(e,t){return o((function(r,n){var i=0;r.subscribe(C(n,(function(r){return e.call(t,r,i++)&&n.next(r)})))}))}class lu{constructor(e,r){this.rpcManager=e,this.destructManager=r,this.pendingQueryRequests=[],this.safeToSendQueriesToServer=new t.BehaviorSubject(!0),this.inflightQueriesCount=new t.BehaviorSubject(0),this.destructManager.onPreDestruct((()=>{this.preDestruct()}))}async sendQuery(e){const r=new t.Subject,n=(0,t.firstValueFrom)(r);return this.pendingQueryRequests.push({queryRequest:e,responseSubject:r}),this.pendingQueryBatchTimeout&&(clearTimeout(this.pendingQueryBatchTimeout),this.pendingQueryBatchTimeout=void 0),this.pendingQueryRequests.length>=10?(this.processQueryBatch(),n):(this.pendingQueryBatchTimeout=setTimeout((()=>{this.safeToSendQueriesToServer.pipe(cu(Boolean),(0,t.take)(1)).subscribe((()=>{this.processQueryBatch()}))}),0),n)}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,t.firstValueFrom)(this.inflightQueriesCount.pipe(cu((e=>0===e)))).then((()=>{}))}preDestruct(){this.safeToSendQueriesToServer.next(!1),this.safeToSendQueriesToServer.complete()}}var hu,du=r(511);function fu(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?fu(e,t,r,o+1,i):fu(e,t,r,n,o-1)}function pu(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){if(-1!==fu(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 vu(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){const n=fu(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"}(hu||(hu={}));const yu=100,bu=20;class mu{constructor(e,r,n,i,o,s){this.rpcManager=e,this.clientIdService=r,this.documentStore=n,this.destructManager=i,this.documentIdentityService=o,this.querySender=s,this.onOrphanDocuments=new t.Subject,this.ongoingQueries=new Map,this.clientRequestIdToLocalDocuments=new Map,this.localDocumentToClientRequestIds=new Map,this.queryMappingManager=new _u,this.queryResultsSubject=new t.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,B.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}=Le(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=ye(n);let s;if(xe(e)){const n=null!==(r=te(t,e.fieldName))&&void 0!==r?r:null;s=Ze(e.value,n,e.operator)}else s=gu(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,B.truthy)(null==s?void 0:s.supportingOngoingQuery);if(o&&t.add(s),e.query.limit>0)switch(e.limitUnderflowState){case hu.UNKNOWN:e.limitUnderflowState=n.size===e.query.limit+yu?hu.ENABLED:hu.DISABLED;break;case hu.DISABLED:break;case hu.ENABLED:if(n.size<e.query.limit+bu){e.limitUnderflowState=hu.UNKNOWN,this.sendQueryToServerOrUseParentQuery(e);continue}}e.dataSubject.next(i)}for(const e of t){const t=this.collectAllObservables(e);(0,B.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 au(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 au(e);for(const e of this.ongoingQueries.values())if(this.isValidParent(e)&&t.isSubqueryOfQuery(e.query))return e}processQuery(e,r,n,i,o,s){return(0,t.defer)((()=>{const a=this.createOngoingQueryGraph(e,r,n,i,o,!0);s&&(a.forceFetchFromServer=!0),this.sendQueryToServerOrUseParentQuery(a),a.allObservables=new t.ReplaySubject(1);const u=a.allObservables.pipe((0,t.switchMap)((e=>(0,t.combineLatest)(e).pipe(L((e=>this.joinResults(e,i,a)))))),cu((()=>this.allOngoingQueriesGotInitialResult(a))),(0,t.startWith)(void 0),(0,t.pairwise)(),cu((([e,t])=>!ae(e,t))),L((([,e])=>e)),o?(0,t.tap)():(0,t.take)(1),(0,t.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,t.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,B.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 r=e.clientRequestId,n=tt(this.clientIdService.getClientId(),r);e.dataSubject.pipe((0,t.finalize)((async()=>{if(e.unsubscribeBlockerCount.value>0&&await(0,t.firstValueFrom)((0,t.race)(this.destructManager.observeIsDestructing(),e.unsubscribeBlockerCount.pipe(cu((e=>0===e))))),this.queryMappingManager.removeQuery(n).then(),this.ongoingQueries.delete(r),e.subscribe&&!e.isEmptyForJoin&&e.activated){const t={clientRequestId:r};this.rpcManager.post("query/unsubscribe",t).catch((t=>{this.destructManager.isDestructing||console.error("Got error while unsubscribing from query",e.query,t)}))}this.removeClientRequestIdMapping(r),this.ongoingQueries.delete(r)})),cu(Boolean)).subscribe({error:()=>{}})}createOngoingQueryGraph(e,r,n,i,o,s,a={}){if(a[r])return a[r];const u=Q(),c=[],l={clientRequestId:u,activated:s,alias:r,query:e,subscribe:o,dataSubject:new t.BehaviorSubject(null),supportedQueries:c,supportingOngoingQuery:void 0,joinCondition:void 0,gotInitialResponse:!1,isEmptyForJoin:!1,canExpandForJoin:!0,unsubscribeBlockerCount:new t.BehaviorSubject(0),queryRegistered:new t.BehaviorSubject(!1),done:!1,isInFlight:!1,forceFetchFromServer:!1,limitUnderflowState:o?hu.UNKNOWN:hu.DISABLED};this.registerQueryFinalizer(l),this.ongoingQueries.set(u,l),a[r]=l;for(const[e,t]of Object.entries(i)){const s=t.leftAlias;if(s!==r&&e!==r)continue;const u=s===r?e:s;if(s===r){const e=this.createOngoingQueryGraph(n[u],u,n,i,o,!1,a);e.joinCondition=t,c.push(e)}else l.supportingOngoingQuery=this.createOngoingQueryGraph(n[u],u,n,i,o,!1,a)}return l}collectAllObservables(e,t=[]){if(e.isEmptyForJoin)return t;const r=e.alias;t.push(e.dataSubject.pipe(cu(Boolean),L((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,B.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,B.truthy)(r.shift());e.isEmptyForJoin||(t.push(e),r.push(...e.supportedQueries))}return t}updateOngoingQueryWithNewDataFromSupportingQuery(e,r){var n;const i=(0,B.truthy)(r.joinCondition),o=r.query;if(r.activated){if(!r.canExpandForJoin)return!1;const s=(0,B.truthy)(null===(n=r.supportingOngoingQuery)||void 0===n?void 0:n.supportedQueries).filter((e=>e.alias===r.alias)),a=new Set(e.map((e=>{var t;return null!==(t=e[i.left])&&void 0!==t?t:null})));for(const e of s)e.query.conditions.filter(xe).filter((e=>e.fieldName===i.right)).forEach((e=>{a.delete(e.value)}));if(0===a.size)return!1;const u=ce(o);u.conditions=u.conditions.filter((e=>!xe(e)||e.fieldName!==i.right)),[...a].forEach((e=>{u.conditions.push({fieldName:i.right,operator:"==",value:e})}));const c=Object.assign(Object.assign({},r),{query:u,activated:!0,gotInitialResponse:!1,dataSubject:new t.BehaviorSubject(null),clientRequestId:Q(),isEmptyForJoin:!1});return this.registerQueryFinalizer(c),this.ongoingQueries.set(c.clientRequestId,c),(0,B.truthy)(r.supportingOngoingQuery).supportedQueries.push(c),this.sendQueryToServerOrUseParentQuery(c),!0}{if(r.activated=!0,o.conditions.filter(xe).filter((e=>e.fieldName===i.right&&"=="===e.operator)).map((e=>e.value)).length)return this.sendQueryToServerOrUseParentQuery(r),r.canExpandForJoin=!1,!0;const t=e.map((e=>{var t;return null!==(t=e[i.left])&&void 0!==t?t:null})).map((e=>({fieldName:i.right,operator:"==",value:e})));return t.length?(o.conditions.push(...t),this.sendQueryToServerOrUseParentQuery(r)):r.isEmptyForJoin=!0,!0}}allOngoingQueriesGotInitialResult(e){return!!e.isEmptyForJoin||!!e.gotInitialResponse&&(!e.supportedQueries.length||e.supportedQueries.every((e=>this.allOngoingQueriesGotInitialResult(e))))}async completeAllSupportedQueries(e){const r=[...e.supportedQueries||[]];for(;r.length;){const e=(0,B.truthy)(r.shift());r.push(...e.supportedQueries||[]),await(0,t.firstValueFrom)(e.unsubscribeBlockerCount.pipe(cu((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){if(this.destructManager.isDestructing)return;const t=e.query,r=e.clientRequestId,n=tt(this.clientIdService.getClientId(),r);this.queryMappingManager.addQuery(t,n);const i=this.findValidParentOfOngoingQuery(e);this.ongoingQueries.set(r,e),i?this.useParentOngoingQuery(e,i).then():this.sendQueryToServer(e)}async useParentOngoingQuery(e,r){const n={clientRequestId:e.clientRequestId,query:e.query,parentClientRequestId:r.clientRequestId},i=new au(e.query);r.unsubscribeBlockerCount.next(r.unsubscribeBlockerCount.value+1);try{await(0,t.firstValueFrom)(r.queryRegistered.pipe(cu(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",n).then((()=>{e.isInFlight=!1,e.queryRegistered.next(!0)})).catch((t=>{e.isInFlight=!1,this.destructManager.isDestructing?e.dataSubject.complete():(console.error("Query error",e.query,r.query,t),e.dataSubject.error(t)),e.done=!0})).finally((()=>{r.unsubscribeBlockerCount.next(r.unsubscribeBlockerCount.value-1)}));const o=(0,t.race)(e.queryRegistered.pipe(cu(Boolean),(0,t.delay)(2e3),(0,t.take)(1)),this.destructManager.observeIsDestructing().pipe((0,t.take)(1)));r.dataSubject.pipe((0,t.takeWhile)((()=>!e.done)),(0,t.takeUntil)(o),cu(Boolean),(0,t.tap)((()=>{e.gotInitialResponse||this.setGotInitialResult(e.clientRequestId)})),L((e=>e.filter((e=>i.documentMatchesQuery(e)))))).subscribe({next:t=>{for(const r of t)this.setClientRequestIdsForLocalDoc(Be(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+yu: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()):(Se.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)}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=>{oe(this.localDocumentToClientRequestIds,t,e[t])}))}}function gu(e,t){var r;for(const n of e.fields){const e=null!==(r=te(t,n.fieldName))&&void 0!==r?r:null;if(Ze(n.value,e,n.operator))return!0;if(Ze(n.value,e,"!="))return!1}return!1}class _u{constructor(){this.stateService=new du.TrieStore({}),this.querySubscriptionIdToQuery={}}addQuery(e,t){this.stateService.runInBatch((()=>{let r=0;const n=new Set;for(const i of e.conditions){if(xe(i)&&["=="].includes(i.operator)){const e=be(i.fieldName);n.has(e)||(r++,n.add(e))}else r++;const o=this.getConditionStatePath(e,i),s=[...this.stateService.get(o)||[]];pu(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)||[]];pu(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)||[]];vu(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)||[]];vu(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,pe(r))];var r}}class Ou{constructor(){this.locks={}}async lock(...e){if(this.canGetLock(...e))return void this.lockSync(...e);const r=Object.entries(this.locks).filter((([t])=>e.includes(t))).map((([,e])=>e));await(0,t.lastValueFrom)((0,t.combineLatest)(r).pipe((0,t.filter)((e=>!e.includes(!0))),(0,t.take)(1))),await this.lock(...e)}release(...e){for(const t of e){const e=(0,B.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,B.assertTruthy)(this.canGetLock(...e),"Cannot acquire lock sync");for(const r of e)this.locks[r]=new t.BehaviorSubject(!0)}}class Su{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 Eu(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 wu="subscriptionMutex";class Eu{constructor(e,r,n){this.integrationId=e,this.topicName=r,this.rpcManager=n,this.messagesSubject=new t.Subject,this.subscriberCount=0,this.lockManager=new Ou}async produce(e){await this.lockManager.lock(wu);try{await this.rpcManager.post("queue/produceMessages",{integrationId:this.integrationId,topicName:this.topicName,messages:e})}finally{this.lockManager.release(wu)}}consume(){return(0,t.defer)((()=>(this.subscriberCount++,1===this.subscriberCount&&this.performSubscribe(),this.messagesSubject.asObservable().pipe((0,t.finalize)((()=>{this.subscriberCount--,0===this.subscriberCount&&this.performUnsubscribe()}))))))}async performSubscribe(){await this.lockManager.lock(wu);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 t.Subject}finally{this.lockManager.release(wu)}}async performUnsubscribe(){await this.lockManager.lock(wu);try{await this.rpcManager.post("queue/unsubscribe",{integrationId:this.integrationId,topicName:this.topicName})}finally{this.lockManager.release(wu)}}onMessages(e){for(const t of e)this.messagesSubject.next(t)}destruct(){this.messagesSubject.complete()}}class Tu{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,t.firstValueFrom)((0,t.interval)(10).pipe((0,t.filter)((()=>this.attemptConsume())),(0,t.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 Iu 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 Au(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=n instanceof Blob?void 0:n.name;e.append(r,t,i)}e.append("body",ve(n)),a.body=e}else s.append("Content-Type","application/json"),a.body=ve(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=Fu(r);if(!o)throw new Iu(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 Iu(e.status,e.statusText,i,t,n,s)}const r=await e.text();return Se.debug(`received response from url ${i}: ${JSON.stringify(r)}`),{body:r,headers:t,status:e.status,statusText:e.statusText}}catch(e){throw Se.debug(`Unable to perform fetch request to url: ${i}`,e),e}}(e);return t.body=Fu(t.body),t}function Fu(e){if(e){try{return ye(e)}catch(e){}return e}}class Mu{constructor(e,r,n,i,o,s){this.region=e,this.appId=r,this.authManager=o,this.clientIdService=s,this.staticHeaders={},this.onGoingRpcCounter=new t.BehaviorSubject(0);for(const[e,t]of Object.entries(i))this.setStaticHeader(e,t);this.clientIdService.observeClientId().subscribe((e=>{e?this.setStaticHeader("x-squid-clientid",e):this.deleteStaticHeader("x-squid-clientid")})),n.onDestruct((async()=>{await this.awaitAllSettled()}));const a=this.authManager.getApiKey()?5:1;this.rateLimiters={default:new Tu(60*a,5),ai:new Tu(20*a,5),secret:new Tu(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,t.firstValueFrom)(this.onGoingRpcCounter.pipe((0,t.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);Se.debug(`sending request: path: ${e} message: ${JSON.stringify(t)}`);const a=Ya(this.region,this.appId,e);return await Au({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,B.truthy)(this.rateLimiters.ai,"MISSING_RATE_LIMITER_AI"):e.startsWith("secret/")?(0,B.truthy)(this.rateLimiters.secret,"MISSING_RATE_LIMITER_SECRETS"):(0,B.truthy)(this.rateLimiters.default,"MISSING_RATE_LIMITER_DEFAULT")}}class ku{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 Du(this.rpcManager)}}class Du{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 ju=e=>e();var xu;function Pu(){}const Nu=null!==(xu=Oe().WebSocket)&&void 0!==xu?xu:r(5352);class Ru{constructor(e,r,n,i=ju,o,s){this.clientIdService=e,this.region=r,this.appId=n,this.messageNotificationWrapper=i,this.destructManager=o,this.authManager=s,this.webSocketObserver=new t.Subject,this.allMessagesObserver=new t.Subject,this.connectionReady=new t.BehaviorSubject(!1),this.seenMessageIds=new Set,this.destructSubject=new t.Subject,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,t.skip)(1),(0,t.filter)((e=>!e)),(0,t.switchMap)((()=>(0,t.race)((0,t.timer)(this.clientTooOldThreshold),this.connectionReady.pipe((0,t.filter)(Boolean)),this.destructManager.observeIsDestructing())))).subscribe((()=>{this.connectionReady.value?Se.debug(this.clientIdService.getClientId(),"Client reconnected before becoming too old. Ignoring..."):this.destructManager.isDestructing||(Se.debug(this.clientIdService.getClientId(),"Client disconnected for a long period - refreshing"),this.refreshClient())})),this.observeConnectionReady().pipe((0,t.filter)(Boolean)).subscribe((()=>{this.clientIdService.isClientTooOld()&&this.clientIdService.notifyClientNotTooOld()}))}refreshClient(){this.destructManager.isDestructing?Se.debug(this.clientIdService.getClientId(),"Client too old but is destructed. Ignoring..."):this.clientIdService.isClientTooOld()?Se.debug(this.clientIdService.getClientId(),"Client is already marked as too old. Ignoring..."):(Se.debug(this.clientIdService.getClientId(),"Notifying client too old"),this.clientIdService.notifyClientTooOld(),Se.debug(this.clientIdService.getClientId(),"Client too old. Reconnecting..."),this.connect())}tick(){Math.abs(Date.now()-this.lastTick.getTime())>this.clientTooOldThreshold&&(Se.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,t.distinctUntilChanged)())}sendMessage(e){this.sendMessageAsync(e).then()}async sendMessageAsync(e){var r;await(0,t.firstValueFrom)(this.connectionReady.pipe((0,t.filter)(Boolean)));const n=await this.authManager.getToken();if(this.connectionReady.value)try{(0,B.assertTruthy)(this.socket,"Socket is undefined in sendMessageAsync");const t=ve({message:e,authToken:n});Se.debug(this.clientIdService.getClientId(),"Sending message to socket: ",t),this.socket.send(t)}catch(t){(null===(r=this.socket)||void 0===r?void 0:r.connected)?console.error("Websocket message is ignored due to a non-recoverable error",t):(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(ve({message:{type:"kill"}}))}connect(){var e;null===(e=this.socket)||void 0===e||e.close(),this.connectionReady.value&&this.connectionReady.next(!1);const t=Ya(this.region,this.appId,"ws/general").replace("https","wss").replace("http","ws"),r=this.clientIdService.getClientId();Se.debug(this.clientIdService.getClientId(),"Connecting to socket at:",t);const n=`${t}?clientId=${r}`;this.socket=function(e,t={}){let r,n=0,i=1;const o={connected:!1,open(){var i;const s=null!==(i=null==Nu?void 0:Nu.WebSocket)&&void 0!==i?i:Nu;r=new s(e,t.protocols||[]),r.onmessage=t.onmessage||Pu,r.onopen=function(e){o.connected=!0,(t.onopen||Pu)(e),n=0},r.onclose=function(e){if(o.connected=!1,4999!==e.code&&4001!==e.code)return Se.debug("WebSocket closed. Reconnecting. Close code: ",e.code),(t.onclose||Pu)(e),void o.reconnect(e);(t.onclose||Pu)(e)},r.onerror=function(e){o.connected=!1,e&&"ECONNREFUSED"===e.code?o.reconnect(e):(t.onerror||Pu)(e)}},reconnect(e){const r=void 0!==t.maxAttempts?t.maxAttempts:1/0;i&&n++<r?i=setTimeout((function(){(t.onreconnect||Pu)(e),Se.debug("WebSocket trying to reconnect..."),o.open()}),t.timeout||1e3):(t.onmaximum||Pu)(e)},json(e){r.send(JSON.stringify(e))},send(e){r.send(e)},close(e=4999,t){try{o.connected=!1,clearTimeout(i),i=void 0,r.close(e,t)}catch(e){}}};return o.open(),o}(n,{timeout:5e3,onmessage:e=>this.onMessage(e.data),onopen:()=>{Se.debug(this.clientIdService.getClientId(),`Connection to socket established. Endpoint: ${t}`)},onreconnect:()=>{Se.debug(r,"WebSocket reconnect event triggered"),this.clientIdService.getClientId()===r?this.connectionReady.value&&this.connectionReady.next(!1):Se.debug(r,`WebSocket reconnect event triggered - ignored because the client id changed. Old: ${this.clientIdService.getClientId()}`)},onclose:()=>{Se.debug(r,"WebSocket onclose event triggered"),this.clientIdService.getClientId()===r?this.connectionReady.value&&this.connectionReady.next(!1):Se.debug(r,`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.sendMessage({type:"catchup"})}onMessage(e){if("connectionReady"===e)return Se.debug(this.clientIdService.getClientId(),"Got socket message: connectionReady"),void this.onConnectionReady();const t=ye(e);for(const e of t)this.allMessagesObserver.next(e),this.seenMessageIds.has(e.messageId)||(this.seenMessageIds.add(e.messageId),Se.debug(this.clientIdService.getClientId(),new Date,"Got socket message",JSON.stringify(e,null,2)),this.messageNotificationWrapper((()=>{this.webSocketObserver.next(e)})))}setupMessageAcknowledgments(){const e=new t.Subject;this.allMessagesObserver.subscribe((t=>{(null==t?void 0:t.messageId)&&e.next(t.messageId)}));const r=[];e.pipe((0,t.tap)((e=>r.push(e))),(0,t.debounceTime)(100)).subscribe((async()=>{const e=[...r.splice(0)];this.sendMessage({type:"acknowledge",payload:e})}))}async destruct(){var e;this.sendKillMessage(),await(0,t.firstValueFrom)((0,t.timer)(0)),this.connectionReady.next(!1),await(0,t.firstValueFrom)((0,t.timer)(0)),clearInterval(this.tickInterval),null===(e=this.socket)||void 0===e||e.close(),this.webSocketObserver.complete(),this.allMessagesObserver.complete(),this.destructSubject.next()}}function Cu(e,t){return`${function(e){const[t,r,n,i]=e.split("-");return(0,B.assertTruthy)(!i,"Invalid appId: "+e),{appId:t,environmentId:null!=r?r:"prod",squidDeveloperId:n}}(e).appId}${t&&"prod"!==t?`-${t}`:""}`}class qu{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 Lu{constructor(e){this.options=e,this.destructManager=new ft,(0,B.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`${Cu(e,t)}${r?`-${r}`:""}`}(e.appId,e.environmentId,t?e.squidDeveloperId:void 0),n=function(e,t){const r={};return Wa(e)&&(r["x-squid-appid"]=t),r}(e.region,r);this.clientIdService=new we(this.destructManager),this.authManager=new ge(e.apiKey,e.authProvider),this.socketManager=new Ru(this.clientIdService,e.region,r,e.messageNotificationWrapper,this.destructManager,this.authManager),this.rpcManager=new Mu(e.region,r,this.destructManager,n,this.authManager,this.clientIdService),this.aiClientFactory=new H(this.rpcManager,this.socketManager),this.aiClient=new J(this.aiClientFactory,this.rpcManager),this.apiClient=new Z(this.rpcManager),this.documentStore=new mt,this.lockManager=new Ou,this.distributedLockManager=new pt(this.socketManager,this.destructManager),this.documentIdentityService=new yt(this.documentStore,this.destructManager),this.documentReferenceFactory=new bt(this.documentIdentityService),this.querySender=new lu(this.rpcManager,this.destructManager),this.querySubscriptionManager=new mu(this.rpcManager,this.clientIdService,this.documentStore,this.destructManager,this.documentIdentityService,this.querySender),this.localQueryManager=new uu(this.documentStore,this.documentReferenceFactory,this.querySubscriptionManager);const i=new Ha(this.rpcManager,this.lockManager,this.querySender);this.queryBuilderFactory=new ze(this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.documentIdentityService),this.dataManager=new ht(this.documentStore,i,this.socketManager,this.querySubscriptionManager,this.queryBuilderFactory,this.lockManager,this.destructManager,this.documentIdentityService,this.querySender),this.collectionReferenceFactory=new it(this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager,this.dataManager),this.documentReferenceFactory.setDataManager(this.dataManager),this.backendFunctionManager=new _e(this.clientIdService,this.rpcManager),this.nativeQueryManager=new Ka(this.rpcManager),this.apiManager=new me(this.clientIdService,this.rpcManager),this.graphqlClientFactory=new Ga(this.rpcManager,e.region,r),this.secretClient=new ku(this.rpcManager),this._connectionDetails=new ot(this.clientIdService,this.socketManager),this.queueManagerFactory=new Su(this.rpcManager,this.socketManager,this.destructManager)}static getInstance(e){const t=pe(e);let r=Lu.squidInstancesMap[t];return r||(r=new Lu(e),Lu.squidInstancesMap[t]=r,r)}static getInstances(){return Object.values(Lu.squidInstancesMap)}setAuthProvider(e){this.authManager.setAuthProvider(e)}collection(e,t=ke.built_in_db){return this._validateNotDestructed(),this.collectionReferenceFactory.get(e,t)}runInTransaction(e){return this._validateNotDestructed(),this.dataManager.runInTransaction(e)}executeFunction(e,...r){return this._validateNotDestructed(),(0,t.firstValueFrom)(this.backendFunctionManager.executeFunctionAndSubscribe(e,...r))}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)}callApi(e,r,n={},i,o){return this._validateNotDestructed(),(0,t.firstValueFrom)(this.apiManager.callApiAndSubscribe(e,r,n,i||{},o))}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 qu(e,this.rpcManager)}get secrets(){return this.secretClient}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=ke.built_in_queue){return this._validateNotDestructed(),this.queueManagerFactory.get(t,e)}async destruct(){return this.destructManager.destruct().finally((()=>{const e=Object.entries(Lu.squidInstancesMap).find((([,e])=>e===this));e&&delete Lu.squidInstancesMap[e[0]]}))}connectionDetails(){return this._validateNotDestructed(),this._connectionDetails}async _unsubscribe(){this.querySubscriptionManager.unsubscribe(),await this.rpcManager.awaitAllSettled()}_validateNotDestructed(){(0,B.assertTruthy)(!this.destructManager.isDestructing,"The client was already destructed.")}}Lu.squidInstancesMap={}})();var i=exports;for(var o in n)i[o]=n[o];n.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
|
|
5
|
+
`})).data}}class Ha{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 Ga(this.rpcManager,e,this.region,this.appId),this.clientsMap.set(e,t),t)}}class Ka{constructor(e,t,r){this.rpcManager=e,this.lockManager=t,this.querySender=r}async sendMutations(e,t){const r=lt(e),n=r.map((e=>`sendMutation_${Qe(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 Se.debug("Error while sending mutations",{error:e,mutations:JSON.stringify(r,null,2)}),e}finally{this.lockManager.release(...n)}}}class Ja{constructor(e){this.rpcManager=e}async executeNativeQuery(e){return this.rpcManager.post("native-query/execute",e)}}function Xa(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=Za(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=Za(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=Za(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}=eu(r[0]),o=r.map((t=>Xa(e,t)));return e.collection(n,i).or(...o)}(e,t)}}function Za(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 eu(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 eu(e.queries[0])}}const tu={"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)=>ru(e.toLowerCase(),t.toLowerCase()),"like_cs:like":(e,t)=>ru(e.toLowerCase(),t.toLowerCase()),"like:like_cs":(e,t)=>ru(e,t)&&iu(t),"like_cs:like_cs":(e,t)=>ru(e,t),"like:not like":(e,t)=>!nu(e.toLowerCase(),t.toLowerCase()),"like_cs:not like":(e,t)=>!nu(e.toLowerCase(),t.toLowerCase()),"like:not like_cs":(e,t)=>!nu(e.toLowerCase(),t.toLowerCase()),"like_cs:not like_cs":(e,t)=>!nu(e,t),"not like:like":(e,t)=>su(e,t),"not like_cs:like":(e,t)=>su(e,t),"not like:like_cs":(e,t)=>su(e,t),"not like_cs:like_cs":(e,t)=>su(e,t),"not like:not like":(e,t)=>ru(t.toLowerCase(),e.toLowerCase()),"not like_cs:not like":(e,t)=>ru(t,e)&&iu(e),"not like:not like_cs":(e,t)=>ru(t.toLowerCase(),e.toLowerCase()),"not like_cs:not like_cs":(e,t)=>ru(t,e),"in:like":(e,t)=>e.every((e=>et(t,e,"like"))),"in:like_cs":(e,t)=>e.every((e=>et(t,e,"like_cs"))),"in:not like":(e,t)=>e.every((e=>et(t,e,"not like"))),"in:not like_cs":(e,t)=>e.every((e=>et(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&&ou(e)||au(e)&&t.includes(""),"not like_cs:in":(e,t)=>e.length>0&&ou(e)||au(e)&&t.includes(""),"not in:like":(e,t)=>t.length>0&&ou(t)||au(t)&&e.includes(""),"not in:like_cs":(e,t)=>t.length>0&&ou(t)||au(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=>et(e,t,"not like"))),"like_cs:not in":(e,t)=>t.every((t=>et(e,t,"not like_cs"))),"not like:not in":(e,t)=>t.every((t=>et(e,t,"like"))),"not like_cs:not in":(e,t)=>t.every((t=>et(e,t,"like_cs")))};function ru(e,t,r=0,n=0){if(n>=t.length)return r>=e.length;if(r>=e.length)return ou(t.substring(n));const i=e[r],o=t[n];return"%"===i&&"%"===o?ru(e,t,r+1,n+1)||ru(e,t,r+1,n):"%"!==i&&("%"===o?ru(e,t,r,n+1)||ru(e,t,r+1,n):(i===o||"_"===o)&&ru(e,t,r+1,n+1))}function nu(e,t,r=0,n=0){if(r>=e.length&&n>=t.length)return!0;if(r>=e.length)return ou(t.substring(n));if(n>=t.length)return ou(e.substring(r));const i=r<e.length?e[r]:"",o=n<t.length?t[n]:"";return"%"===i&&"%"===o?nu(e,t,r+1,n+1)||nu(e,t,r,n+1)||nu(e,t,r+1,n):"%"===i||"%"===o?nu(e,t,r,n+1)||nu(e,t,r+1,n):(i===o||"_"===i||"_"===o)&&nu(e,t,r+1,n+1)}function iu(e){return!/[a-zA-Z]/.test(e)}function ou(e){return e.split("").every((e=>"%"===e))}function su(e,t){return e.length>0&&ou(e)||t.length>0&&ou(t)||au(e)&&0===t.length}function au(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 uu{constructor(e){this.query=e,this.query=e,this.parsedConditions=this.parseConditions(this.query.conditions.filter(Pe))}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!ae(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(Pe),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=te(e,r);if("in"===n){if(t.value.includes(i))continue;return!1}if("not in"!==n){if(!et(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=tu[`${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&&ae(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 cu{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 uu(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[Qe(e.__docId__,r,t)]))}}function lu(e,t){return o((function(r,n){var i=0;r.subscribe(C(n,(function(r){return e.call(t,r,i++)&&n.next(r)})))}))}class hu{constructor(e,r){this.rpcManager=e,this.destructManager=r,this.pendingQueryRequests=[],this.safeToSendQueriesToServer=new t.BehaviorSubject(!0),this.inflightQueriesCount=new t.BehaviorSubject(0),this.destructManager.onPreDestruct((()=>{this.preDestruct()}))}async sendQuery(e){const r=new t.Subject,n=(0,t.firstValueFrom)(r);return this.pendingQueryRequests.push({queryRequest:e,responseSubject:r}),this.pendingQueryBatchTimeout&&(clearTimeout(this.pendingQueryBatchTimeout),this.pendingQueryBatchTimeout=void 0),this.pendingQueryRequests.length>=10?(this.processQueryBatch(),n):(this.pendingQueryBatchTimeout=setTimeout((()=>{this.safeToSendQueriesToServer.pipe(lu(Boolean),(0,t.take)(1)).subscribe((()=>{this.processQueryBatch()}))}),0),n)}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,t.firstValueFrom)(this.inflightQueriesCount.pipe(lu((e=>0===e)))).then((()=>{}))}preDestruct(){this.safeToSendQueriesToServer.next(!1),this.safeToSendQueriesToServer.complete()}}var du,fu=r(511);function pu(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?pu(e,t,r,o+1,i):pu(e,t,r,n,o-1)}function vu(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){if(-1!==pu(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 yu(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){const n=pu(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"}(du||(du={}));const bu=100,mu=20;class gu{constructor(e,r,n,i,o,s){this.rpcManager=e,this.clientIdService=r,this.documentStore=n,this.destructManager=i,this.documentIdentityService=o,this.querySender=s,this.onOrphanDocuments=new t.Subject,this.ongoingQueries=new Map,this.clientRequestIdToLocalDocuments=new Map,this.localDocumentToClientRequestIds=new Map,this.queryMappingManager=new Ou,this.queryResultsSubject=new t.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,B.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}=Be(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=ye(n);let s;if(Pe(e)){const n=null!==(r=te(t,e.fieldName))&&void 0!==r?r:null;s=et(e.value,n,e.operator)}else s=_u(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,B.truthy)(null==s?void 0:s.supportingOngoingQuery);if(o&&t.add(s),e.query.limit>0)switch(e.limitUnderflowState){case du.UNKNOWN:e.limitUnderflowState=n.size===e.query.limit+bu?du.ENABLED:du.DISABLED;break;case du.DISABLED:break;case du.ENABLED:if(n.size<e.query.limit+mu){e.limitUnderflowState=du.UNKNOWN,this.sendQueryToServerOrUseParentQuery(e);continue}}e.dataSubject.next(i)}for(const e of t){const t=this.collectAllObservables(e);(0,B.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 uu(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 uu(e);for(const e of this.ongoingQueries.values())if(this.isValidParent(e)&&t.isSubqueryOfQuery(e.query))return e}processQuery(e,r,n,i,o,s){return(0,t.defer)((()=>{const a=this.createOngoingQueryGraph(e,r,n,i,o,!0);s&&(a.forceFetchFromServer=!0),this.sendQueryToServerOrUseParentQuery(a),a.allObservables=new t.ReplaySubject(1);const u=a.allObservables.pipe((0,t.switchMap)((e=>(0,t.combineLatest)(e).pipe(L((e=>this.joinResults(e,i,a)))))),lu((()=>this.allOngoingQueriesGotInitialResult(a))),(0,t.startWith)(void 0),(0,t.pairwise)(),lu((([e,t])=>!ae(e,t))),L((([,e])=>e)),o?(0,t.tap)():(0,t.take)(1),(0,t.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,t.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,B.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 r=e.clientRequestId,n=rt(this.clientIdService.getClientId(),r);e.dataSubject.pipe((0,t.finalize)((async()=>{if(e.unsubscribeBlockerCount.value>0&&await(0,t.firstValueFrom)((0,t.race)(this.destructManager.observeIsDestructing(),e.unsubscribeBlockerCount.pipe(lu((e=>0===e))))),this.queryMappingManager.removeQuery(n).then(),this.ongoingQueries.delete(r),e.subscribe&&!e.isEmptyForJoin&&e.activated){const t={clientRequestId:r};this.rpcManager.post("query/unsubscribe",t).catch((t=>{this.destructManager.isDestructing||console.error("Got error while unsubscribing from query",e.query,t)}))}this.removeClientRequestIdMapping(r),this.ongoingQueries.delete(r)})),lu(Boolean)).subscribe({error:()=>{}})}createOngoingQueryGraph(e,r,n,i,o,s,a={}){if(a[r])return a[r];const u=Q(),c=[],l={clientRequestId:u,activated:s,alias:r,query:e,subscribe:o,dataSubject:new t.BehaviorSubject(null),supportedQueries:c,supportingOngoingQuery:void 0,joinCondition:void 0,gotInitialResponse:!1,isEmptyForJoin:!1,canExpandForJoin:!0,unsubscribeBlockerCount:new t.BehaviorSubject(0),queryRegistered:new t.BehaviorSubject(!1),done:!1,isInFlight:!1,forceFetchFromServer:!1,limitUnderflowState:o?du.UNKNOWN:du.DISABLED};this.registerQueryFinalizer(l),this.ongoingQueries.set(u,l),a[r]=l;for(const[e,t]of Object.entries(i)){const s=t.leftAlias;if(s!==r&&e!==r)continue;const u=s===r?e:s;if(s===r){const e=this.createOngoingQueryGraph(n[u],u,n,i,o,!1,a);e.joinCondition=t,c.push(e)}else l.supportingOngoingQuery=this.createOngoingQueryGraph(n[u],u,n,i,o,!1,a)}return l}collectAllObservables(e,t=[]){if(e.isEmptyForJoin)return t;const r=e.alias;t.push(e.dataSubject.pipe(lu(Boolean),L((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,B.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,B.truthy)(r.shift());e.isEmptyForJoin||(t.push(e),r.push(...e.supportedQueries))}return t}updateOngoingQueryWithNewDataFromSupportingQuery(e,r){var n;const i=(0,B.truthy)(r.joinCondition),o=r.query;if(r.activated){if(!r.canExpandForJoin)return!1;const s=(0,B.truthy)(null===(n=r.supportingOngoingQuery)||void 0===n?void 0:n.supportedQueries).filter((e=>e.alias===r.alias)),a=new Set(e.map((e=>{var t;return null!==(t=e[i.left])&&void 0!==t?t:null})));for(const e of s)e.query.conditions.filter(Pe).filter((e=>e.fieldName===i.right)).forEach((e=>{a.delete(e.value)}));if(0===a.size)return!1;const u=ce(o);u.conditions=u.conditions.filter((e=>!Pe(e)||e.fieldName!==i.right)),[...a].forEach((e=>{u.conditions.push({fieldName:i.right,operator:"==",value:e})}));const c=Object.assign(Object.assign({},r),{query:u,activated:!0,gotInitialResponse:!1,dataSubject:new t.BehaviorSubject(null),clientRequestId:Q(),isEmptyForJoin:!1});return this.registerQueryFinalizer(c),this.ongoingQueries.set(c.clientRequestId,c),(0,B.truthy)(r.supportingOngoingQuery).supportedQueries.push(c),this.sendQueryToServerOrUseParentQuery(c),!0}{if(r.activated=!0,o.conditions.filter(Pe).filter((e=>e.fieldName===i.right&&"=="===e.operator)).map((e=>e.value)).length)return this.sendQueryToServerOrUseParentQuery(r),r.canExpandForJoin=!1,!0;const t=e.map((e=>{var t;return null!==(t=e[i.left])&&void 0!==t?t:null})).map((e=>({fieldName:i.right,operator:"==",value:e})));return t.length?(o.conditions.push(...t),this.sendQueryToServerOrUseParentQuery(r)):r.isEmptyForJoin=!0,!0}}allOngoingQueriesGotInitialResult(e){return!!e.isEmptyForJoin||!!e.gotInitialResponse&&(!e.supportedQueries.length||e.supportedQueries.every((e=>this.allOngoingQueriesGotInitialResult(e))))}async completeAllSupportedQueries(e){const r=[...e.supportedQueries||[]];for(;r.length;){const e=(0,B.truthy)(r.shift());r.push(...e.supportedQueries||[]),await(0,t.firstValueFrom)(e.unsubscribeBlockerCount.pipe(lu((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){if(this.destructManager.isDestructing)return;const t=e.query,r=e.clientRequestId,n=rt(this.clientIdService.getClientId(),r);this.queryMappingManager.addQuery(t,n);const i=this.findValidParentOfOngoingQuery(e);this.ongoingQueries.set(r,e),i?this.useParentOngoingQuery(e,i).then():this.sendQueryToServer(e)}async useParentOngoingQuery(e,r){const n={clientRequestId:e.clientRequestId,query:e.query,parentClientRequestId:r.clientRequestId},i=new uu(e.query);r.unsubscribeBlockerCount.next(r.unsubscribeBlockerCount.value+1);try{await(0,t.firstValueFrom)(r.queryRegistered.pipe(lu(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",n).then((()=>{e.isInFlight=!1,e.queryRegistered.next(!0)})).catch((t=>{e.isInFlight=!1,this.destructManager.isDestructing?e.dataSubject.complete():(console.error("Query error",e.query,r.query,t),e.dataSubject.error(t)),e.done=!0})).finally((()=>{r.unsubscribeBlockerCount.next(r.unsubscribeBlockerCount.value-1)}));const o=(0,t.race)(e.queryRegistered.pipe(lu(Boolean),(0,t.delay)(2e3),(0,t.take)(1)),this.destructManager.observeIsDestructing().pipe((0,t.take)(1)));r.dataSubject.pipe((0,t.takeWhile)((()=>!e.done)),(0,t.takeUntil)(o),lu(Boolean),(0,t.tap)((()=>{e.gotInitialResponse||this.setGotInitialResult(e.clientRequestId)})),L((e=>e.filter((e=>i.documentMatchesQuery(e)))))).subscribe({next:t=>{for(const r of t)this.setClientRequestIdsForLocalDoc(Qe(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+bu: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()):(Se.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)}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=>{oe(this.localDocumentToClientRequestIds,t,e[t])}))}}function _u(e,t){var r;for(const n of e.fields){const e=null!==(r=te(t,n.fieldName))&&void 0!==r?r:null;if(et(n.value,e,n.operator))return!0;if(et(n.value,e,"!="))return!1}return!1}class Ou{constructor(){this.stateService=new fu.TrieStore({}),this.querySubscriptionIdToQuery={}}addQuery(e,t){this.stateService.runInBatch((()=>{let r=0;const n=new Set;for(const i of e.conditions){if(Pe(i)&&["=="].includes(i.operator)){const e=be(i.fieldName);n.has(e)||(r++,n.add(e))}else r++;const o=this.getConditionStatePath(e,i),s=[...this.stateService.get(o)||[]];vu(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)||[]];vu(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)||[]];yu(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)||[]];yu(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,pe(r))];var r}}class Su{constructor(){this.locks={}}async lock(...e){if(this.canGetLock(...e))return void this.lockSync(...e);const r=Object.entries(this.locks).filter((([t])=>e.includes(t))).map((([,e])=>e));await(0,t.lastValueFrom)((0,t.combineLatest)(r).pipe((0,t.filter)((e=>!e.includes(!0))),(0,t.take)(1))),await this.lock(...e)}release(...e){for(const t of e){const e=(0,B.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,B.assertTruthy)(this.canGetLock(...e),"Cannot acquire lock sync");for(const r of e)this.locks[r]=new t.BehaviorSubject(!0)}}class wu{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 Tu(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 Eu="subscriptionMutex";class Tu{constructor(e,r,n){this.integrationId=e,this.topicName=r,this.rpcManager=n,this.messagesSubject=new t.Subject,this.subscriberCount=0,this.lockManager=new Su}async produce(e){await this.lockManager.lock(Eu);try{await this.rpcManager.post("queue/produceMessages",{integrationId:this.integrationId,topicName:this.topicName,messages:e})}finally{this.lockManager.release(Eu)}}consume(){return(0,t.defer)((()=>(this.subscriberCount++,1===this.subscriberCount&&this.performSubscribe(),this.messagesSubject.asObservable().pipe((0,t.finalize)((()=>{this.subscriberCount--,0===this.subscriberCount&&this.performUnsubscribe()}))))))}async performSubscribe(){await this.lockManager.lock(Eu);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 t.Subject}finally{this.lockManager.release(Eu)}}async performUnsubscribe(){await this.lockManager.lock(Eu);try{await this.rpcManager.post("queue/unsubscribe",{integrationId:this.integrationId,topicName:this.topicName})}finally{this.lockManager.release(Eu)}}onMessages(e){for(const t of e)this.messagesSubject.next(t)}destruct(){this.messagesSubject.complete()}}class Iu{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,t.firstValueFrom)((0,t.interval)(10).pipe((0,t.filter)((()=>this.attemptConsume())),(0,t.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 Au 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 Fu(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=n instanceof Blob?void 0:n.name;e.append(r,t,i)}e.append("body",ve(n)),a.body=e}else s.append("Content-Type","application/json"),a.body=ve(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=Mu(r);if(!o)throw new Au(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 Au(e.status,e.statusText,i,t,n,s)}const r=await e.text();return Se.debug(`received response from url ${i}: ${JSON.stringify(r)}`),{body:r,headers:t,status:e.status,statusText:e.statusText}}catch(e){throw Se.debug(`Unable to perform fetch request to url: ${i}`,e),e}}(e);return t.body=Mu(t.body),t}function Mu(e){if(e){try{return ye(e)}catch(e){}return e}}class ku{constructor(e,r,n,i,o,s){this.region=e,this.appId=r,this.authManager=o,this.clientIdService=s,this.staticHeaders={},this.onGoingRpcCounter=new t.BehaviorSubject(0);for(const[e,t]of Object.entries(i))this.setStaticHeader(e,t);this.clientIdService.observeClientId().subscribe((e=>{e?this.setStaticHeader("x-squid-clientid",e):this.deleteStaticHeader("x-squid-clientid")})),n.onDestruct((async()=>{await this.awaitAllSettled()}));const a=this.authManager.getApiKey()?5:1;this.rateLimiters={default:new Iu(60*a,5),ai:new Iu(20*a,5),secret:new Iu(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,t.firstValueFrom)(this.onGoingRpcCounter.pipe((0,t.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);Se.debug(`sending request: path: ${e} message: ${JSON.stringify(t)}`);const a=Wa(this.region,this.appId,e);return await Fu({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,B.truthy)(this.rateLimiters.ai,"MISSING_RATE_LIMITER_AI"):e.startsWith("secret/")?(0,B.truthy)(this.rateLimiters.secret,"MISSING_RATE_LIMITER_SECRETS"):(0,B.truthy)(this.rateLimiters.default,"MISSING_RATE_LIMITER_DEFAULT")}}class Du{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 ju(this.rpcManager)}}class ju{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 xu=e=>e();var Pu;function Nu(){}const Ru=null!==(Pu=Oe().WebSocket)&&void 0!==Pu?Pu:r(5352);class Cu{constructor(e,r,n,i=xu,o,s){this.clientIdService=e,this.region=r,this.appId=n,this.messageNotificationWrapper=i,this.destructManager=o,this.authManager=s,this.webSocketObserver=new t.Subject,this.allMessagesObserver=new t.Subject,this.connectionReady=new t.BehaviorSubject(!1),this.seenMessageIds=new Set,this.destructSubject=new t.Subject,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,t.skip)(1),(0,t.filter)((e=>!e)),(0,t.switchMap)((()=>(0,t.race)((0,t.timer)(this.clientTooOldThreshold),this.connectionReady.pipe((0,t.filter)(Boolean)),this.destructManager.observeIsDestructing())))).subscribe((()=>{this.connectionReady.value?Se.debug(this.clientIdService.getClientId(),"Client reconnected before becoming too old. Ignoring..."):this.destructManager.isDestructing||(Se.debug(this.clientIdService.getClientId(),"Client disconnected for a long period - refreshing"),this.refreshClient())})),this.observeConnectionReady().pipe((0,t.filter)(Boolean)).subscribe((()=>{this.clientIdService.isClientTooOld()&&this.clientIdService.notifyClientNotTooOld()}))}refreshClient(){this.destructManager.isDestructing?Se.debug(this.clientIdService.getClientId(),"Client too old but is destructed. Ignoring..."):this.clientIdService.isClientTooOld()?Se.debug(this.clientIdService.getClientId(),"Client is already marked as too old. Ignoring..."):(Se.debug(this.clientIdService.getClientId(),"Notifying client too old"),this.clientIdService.notifyClientTooOld(),Se.debug(this.clientIdService.getClientId(),"Client too old. Reconnecting..."),this.connect())}tick(){Math.abs(Date.now()-this.lastTick.getTime())>this.clientTooOldThreshold&&(Se.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,t.distinctUntilChanged)())}sendMessage(e){this.sendMessageAsync(e).then()}async sendMessageAsync(e){var r;await(0,t.firstValueFrom)(this.connectionReady.pipe((0,t.filter)(Boolean)));const n=await this.authManager.getToken();if(this.connectionReady.value)try{(0,B.assertTruthy)(this.socket,"Socket is undefined in sendMessageAsync");const t=ve({message:e,authToken:n});Se.debug(this.clientIdService.getClientId(),"Sending message to socket: ",t),this.socket.send(t)}catch(t){(null===(r=this.socket)||void 0===r?void 0:r.connected)?console.error("Websocket message is ignored due to a non-recoverable error",t):(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(ve({message:{type:"kill"}}))}connect(){var e;null===(e=this.socket)||void 0===e||e.close(),this.connectionReady.value&&this.connectionReady.next(!1);const t=Wa(this.region,this.appId,"ws/general").replace("https","wss").replace("http","ws"),r=this.clientIdService.getClientId();Se.debug(this.clientIdService.getClientId(),"Connecting to socket at:",t);const n=`${t}?clientId=${r}`;this.socket=function(e,t={}){let r,n=0,i=1;const o={connected:!1,open(){var i;const s=null!==(i=null==Ru?void 0:Ru.WebSocket)&&void 0!==i?i:Ru;r=new s(e,t.protocols||[]),r.onmessage=t.onmessage||Nu,r.onopen=function(e){o.connected=!0,(t.onopen||Nu)(e),n=0},r.onclose=function(e){if(o.connected=!1,4999!==e.code&&4001!==e.code)return Se.debug("WebSocket closed. Reconnecting. Close code: ",e.code),(t.onclose||Nu)(e),void o.reconnect(e);(t.onclose||Nu)(e)},r.onerror=function(e){o.connected=!1,e&&"ECONNREFUSED"===e.code?o.reconnect(e):(t.onerror||Nu)(e)}},reconnect(e){const r=void 0!==t.maxAttempts?t.maxAttempts:1/0;i&&n++<r?i=setTimeout((function(){(t.onreconnect||Nu)(e),Se.debug("WebSocket trying to reconnect..."),o.open()}),t.timeout||1e3):(t.onmaximum||Nu)(e)},json(e){r.send(JSON.stringify(e))},send(e){r.send(e)},close(e=4999,t){try{o.connected=!1,clearTimeout(i),i=void 0,r.close(e,t)}catch(e){}}};return o.open(),o}(n,{timeout:5e3,onmessage:e=>this.onMessage(e.data),onopen:()=>{Se.debug(this.clientIdService.getClientId(),`Connection to socket established. Endpoint: ${t}`)},onreconnect:()=>{Se.debug(r,"WebSocket reconnect event triggered"),this.clientIdService.getClientId()===r?this.connectionReady.value&&this.connectionReady.next(!1):Se.debug(r,`WebSocket reconnect event triggered - ignored because the client id changed. Old: ${this.clientIdService.getClientId()}`)},onclose:()=>{Se.debug(r,"WebSocket onclose event triggered"),this.clientIdService.getClientId()===r?this.connectionReady.value&&this.connectionReady.next(!1):Se.debug(r,`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.sendMessage({type:"catchup"})}onMessage(e){if("connectionReady"===e)return Se.debug(this.clientIdService.getClientId(),"Got socket message: connectionReady"),void this.onConnectionReady();const t=ye(e);for(const e of t)this.allMessagesObserver.next(e),this.seenMessageIds.has(e.messageId)||(this.seenMessageIds.add(e.messageId),Se.debug(this.clientIdService.getClientId(),new Date,"Got socket message",JSON.stringify(e,null,2)),this.messageNotificationWrapper((()=>{this.webSocketObserver.next(e)})))}setupMessageAcknowledgments(){const e=new t.Subject;this.allMessagesObserver.subscribe((t=>{(null==t?void 0:t.messageId)&&e.next(t.messageId)}));const r=[];e.pipe((0,t.tap)((e=>r.push(e))),(0,t.debounceTime)(100)).subscribe((async()=>{const e=[...r.splice(0)];this.sendMessage({type:"acknowledge",payload:e})}))}async destruct(){var e;this.sendKillMessage(),await(0,t.firstValueFrom)((0,t.timer)(0)),this.connectionReady.next(!1),await(0,t.firstValueFrom)((0,t.timer)(0)),clearInterval(this.tickInterval),null===(e=this.socket)||void 0===e||e.close(),this.webSocketObserver.complete(),this.allMessagesObserver.complete(),this.destructSubject.next()}}function qu(e,t){return`${function(e){const[t,r,n,i]=e.split("-");return(0,B.assertTruthy)(!i,"Invalid appId: "+e),{appId:t,environmentId:null!=r?r:"prod",squidDeveloperId:n}}(e).appId}${t&&"prod"!==t?`-${t}`:""}`}class Lu{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 Bu{constructor(e){this.options=e,this.destructManager=new pt,(0,B.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`${qu(e,t)}${r?`-${r}`:""}`}(e.appId,e.environmentId,t?e.squidDeveloperId:void 0),n=function(e,t){const r={};return $a(e)&&(r["x-squid-appid"]=t),r}(e.region,r);this.clientIdService=new we(this.destructManager),this.authManager=new ge(e.apiKey,e.authProvider),this.socketManager=new Cu(this.clientIdService,e.region,r,e.messageNotificationWrapper,this.destructManager,this.authManager),this.rpcManager=new ku(e.region,r,this.destructManager,n,this.authManager,this.clientIdService),this.aiClientFactory=new H(this.rpcManager,this.socketManager),this.aiClient=new J(this.aiClientFactory,this.rpcManager),this.apiClient=new Z(this.rpcManager),this.documentStore=new gt,this.lockManager=new Su,this.distributedLockManager=new vt(this.socketManager,this.destructManager),this.documentIdentityService=new bt(this.documentStore,this.destructManager),this.documentReferenceFactory=new mt(this.documentIdentityService),this.querySender=new hu(this.rpcManager,this.destructManager),this.querySubscriptionManager=new gu(this.rpcManager,this.clientIdService,this.documentStore,this.destructManager,this.documentIdentityService,this.querySender),this.localQueryManager=new cu(this.documentStore,this.documentReferenceFactory,this.querySubscriptionManager);const i=new Ka(this.rpcManager,this.lockManager,this.querySender);this.queryBuilderFactory=new Ye(this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.documentIdentityService),this.dataManager=new dt(this.documentStore,i,this.socketManager,this.querySubscriptionManager,this.queryBuilderFactory,this.lockManager,this.destructManager,this.documentIdentityService,this.querySender),this.collectionReferenceFactory=new ot(this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager,this.dataManager),this.documentReferenceFactory.setDataManager(this.dataManager),this.backendFunctionManager=new _e(this.clientIdService,this.rpcManager),this.nativeQueryManager=new Ja(this.rpcManager),this.apiManager=new me(this.clientIdService,this.rpcManager),this.graphqlClientFactory=new Ha(this.rpcManager,e.region,r),this.secretClient=new Du(this.rpcManager),this._connectionDetails=new st(this.clientIdService,this.socketManager),this.queueManagerFactory=new wu(this.rpcManager,this.socketManager,this.destructManager)}static getInstance(e){const t=pe(e);let r=Bu.squidInstancesMap[t];return r||(r=new Bu(e),Bu.squidInstancesMap[t]=r,r)}static getInstances(){return Object.values(Bu.squidInstancesMap)}setAuthProvider(e){this.authManager.setAuthProvider(e)}collection(e,t=De.built_in_db){return this._validateNotDestructed(),this.collectionReferenceFactory.get(e,t)}runInTransaction(e){return this._validateNotDestructed(),this.dataManager.runInTransaction(e)}executeFunction(e,...r){return this._validateNotDestructed(),(0,t.firstValueFrom)(this.backendFunctionManager.executeFunctionAndSubscribe(e,...r))}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)}callApi(e,r,n={},i,o){return this._validateNotDestructed(),(0,t.firstValueFrom)(this.apiManager.callApiAndSubscribe(e,r,n,i||{},o))}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 Lu(e,this.rpcManager)}get secrets(){return this.secretClient}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=De.built_in_queue){return this._validateNotDestructed(),this.queueManagerFactory.get(t,e)}async destruct(){return this.destructManager.destruct().finally((()=>{const e=Object.entries(Bu.squidInstancesMap).find((([,e])=>e===this));e&&delete Bu.squidInstancesMap[e[0]]}))}connectionDetails(){return this._validateNotDestructed(),this._connectionDetails}async _unsubscribe(){this.querySubscriptionManager.unsubscribe(),await this.rpcManager.awaitAllSettled()}_validateNotDestructed(){(0,B.assertTruthy)(!this.destructManager.isDestructing,"The client was already destructed.")}}Bu.squidInstancesMap={}})();var i=exports;for(var o in n)i[o]=n[o];n.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
|