@squidcloud/client 1.0.101 → 1.0.102
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 +4 -4
- package/dist/common/src/ai-assistant.context.d.ts +12 -12
- package/dist/common/src/ai-assistant.schemas.d.ts +1 -1
- package/dist/common/src/ai-assistant.types.d.ts +12 -12
- package/dist/common/src/api-call.context.d.ts +13 -13
- package/dist/common/src/api.types.d.ts +4 -4
- package/dist/common/src/application.schemas.d.ts +66 -1
- package/dist/common/src/application.types.d.ts +140 -184
- package/dist/common/src/backend-function.schemas.d.ts +1 -1
- package/dist/common/src/backend-function.types.d.ts +1 -1
- package/dist/common/src/backend-run.types.d.ts +2 -2
- package/dist/common/src/bundle-api.types.d.ts +36 -36
- package/dist/common/src/bundle-data.types.d.ts +4 -4
- package/dist/common/src/communication.types.d.ts +12 -12
- package/dist/common/src/context.types.d.ts +40 -40
- package/dist/common/src/distributed-lock.context.d.ts +5 -5
- package/dist/common/src/document.types.d.ts +22 -22
- package/dist/common/src/graphql.context.d.ts +7 -7
- package/dist/common/src/graphql.types.d.ts +9 -9
- package/dist/common/src/heartbeat.types.d.ts +1 -1
- package/dist/common/src/http-status.enum.d.ts +50 -50
- package/dist/common/src/index.d.ts +53 -53
- package/dist/common/src/integrations/ai_assistant.types.d.ts +24 -30
- package/dist/common/src/integrations/api.types.d.ts +80 -80
- package/dist/common/src/integrations/auth.types.d.ts +39 -39
- package/dist/common/src/integrations/database.types.d.ts +231 -236
- package/dist/common/src/integrations/index.d.ts +124 -101
- package/dist/common/src/integrations/observability.types.d.ts +23 -23
- package/dist/common/src/logger.types.d.ts +21 -21
- package/dist/common/src/metrics.types.d.ts +1 -1
- package/dist/common/src/mutation.context.d.ts +14 -14
- package/dist/common/src/mutation.schemas.d.ts +1 -1
- package/dist/common/src/mutation.types.d.ts +53 -53
- package/dist/common/src/named-query.context.d.ts +4 -4
- package/dist/common/src/named-query.schemas.d.ts +1 -1
- package/dist/common/src/named-query.types.d.ts +1 -1
- package/dist/common/src/query/base-query-builder.d.ts +147 -196
- package/dist/common/src/query/index.d.ts +4 -3
- package/dist/common/src/query/pagination.d.ts +44 -0
- package/dist/common/src/query/query-context.d.ts +137 -137
- package/dist/common/src/query/serialized-query.types.d.ts +24 -24
- package/dist/common/src/query.types.d.ts +64 -59
- package/dist/common/src/regions.d.ts +1 -1
- package/dist/common/src/schema/schema.types.d.ts +54 -54
- package/dist/common/src/secret.schemas.d.ts +1 -1
- package/dist/common/src/secret.types.d.ts +8 -8
- package/dist/common/src/security.types.d.ts +1 -1
- package/dist/common/src/socket.schemas.d.ts +1 -1
- package/dist/common/src/socket.types.d.ts +1 -1
- package/dist/common/src/time-units.d.ts +1 -1
- package/dist/common/src/trigger.types.d.ts +1 -1
- package/dist/common/src/types.d.ts +14 -14
- package/dist/common/src/utils/array.d.ts +1 -1
- package/dist/common/src/utils/assert.d.ts +1 -1
- package/dist/common/src/utils/error.d.ts +4 -4
- package/dist/common/src/utils/http.d.ts +2 -2
- package/dist/common/src/utils/id.d.ts +2 -2
- package/dist/common/src/utils/lock.manager.d.ts +14 -14
- package/dist/common/src/utils/nullish.d.ts +2 -2
- package/dist/common/src/utils/object.d.ts +5 -5
- package/dist/common/src/utils/serialization.d.ts +6 -6
- package/dist/common/src/utils/transforms.d.ts +18 -18
- package/dist/common/src/utils/url.d.ts +1 -1
- package/dist/common/src/utils/validation.d.ts +30 -30
- package/dist/common/src/webhook-response.d.ts +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
- package/dist/typescript-client/src/ai-assistant-client.d.ts +167 -167
- package/dist/typescript-client/src/ai-client.factory.d.ts +11 -11
- package/dist/typescript-client/src/api.manager.d.ts +15 -15
- package/dist/typescript-client/src/auth.manager.d.ts +23 -23
- package/dist/typescript-client/src/backend-function.manager.d.ts +13 -13
- package/dist/typescript-client/src/client-id.service.d.ts +25 -25
- package/dist/typescript-client/src/collection-reference.d.ts +81 -81
- package/dist/typescript-client/src/collection-reference.factory.d.ts +13 -13
- package/dist/typescript-client/src/connection-details.d.ts +23 -23
- package/dist/typescript-client/src/data.manager.d.ts +172 -172
- package/dist/typescript-client/src/destruct.manager.d.ts +12 -12
- package/dist/typescript-client/src/distributed-lock.manager.d.ts +19 -19
- package/dist/typescript-client/src/document-identity.service.d.ts +12 -12
- package/dist/typescript-client/src/document-reference.d.ts +140 -140
- package/dist/typescript-client/src/document-reference.factory.d.ts +13 -13
- package/dist/typescript-client/src/document-store.d.ts +11 -11
- package/dist/typescript-client/src/graphql-client.d.ts +14 -14
- package/dist/typescript-client/src/graphql-client.factory.d.ts +11 -11
- package/dist/typescript-client/src/index.d.ts +8 -8
- package/dist/typescript-client/src/mutation/mutation-sender.d.ts +10 -10
- package/dist/typescript-client/src/named-query.manager.d.ts +12 -12
- package/dist/typescript-client/src/query/deserializer.d.ts +3 -3
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +161 -161
- package/dist/typescript-client/src/query/local-query-manager.d.ts +9 -9
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +76 -76
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +186 -186
- package/dist/typescript-client/src/rpc.manager.d.ts +29 -29
- package/dist/typescript-client/src/socket.manager.d.ts +33 -33
- package/dist/typescript-client/src/squid.d.ts +218 -218
- package/dist/typescript-client/src/state/action.applier.d.ts +7 -7
- package/dist/typescript-client/src/state/actions.d.ts +29 -29
- package/dist/typescript-client/src/state/path_trie.d.ts +27 -27
- package/dist/typescript-client/src/state/state.service.d.ts +22 -22
- package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
- package/dist/typescript-client/src/testing/setup-tests.d.ts +1 -1
- package/dist/typescript-client/src/types.d.ts +2 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
(()=>{var e={8278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3910:function(e,t,r){"use strict";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)=>{"use strict";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)=>{"use strict";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)=>{"use strict";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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9446:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StopThePromisePoolError=void 0;class r extends Error{}t.StopThePromisePoolError=r},4204:(e,t)=>{"use strict";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},3747:(e,t)=>{"use strict";function r(e,t){return{validate:e,compare:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(o,s),time:r(c,u),"date-time":r((function(e){const t=e.split(l);return 2===t.length&&o(t[0])&&c(t[1],!0)}),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return f.test(e)&&d.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(g.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return p.lastIndex=0,p.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=y&&e>=m}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:v},double:{type:"number",validate:v},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);const n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(e){const t=n.exec(e);if(!t)return!1;const r=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(2===o&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(r)?29:i[o])}function s(e,t){if(e&&t)return e>t?1:e<t?-1:0}const a=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function c(e,t){const r=a.exec(e);if(!r)return!1;const n=+r[1],i=+r[2],o=+r[3],s=r[5];return(n<=23&&i<=59&&o<=59||23===n&&59===i&&60===o)&&(!t||""!==s)}function u(e,t){if(!e||!t)return;const r=a.exec(e),n=a.exec(t);return r&&n?(e=r[1]+r[2]+r[3]+(r[4]||""))>(t=n[1]+n[2]+n[3]+(n[4]||""))?1:e<t?-1:0:void 0}const l=/t|\s/i;function h(e,t){if(!e||!t)return;const[r,n]=e.split(l),[i,o]=t.split(l),a=s(r,i);return void 0!==a?a||u(n,o):void 0}const f=/\/|:/,d=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,p=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,m=-(2**31),y=2**31-1;function v(){return!0}const g=/[^\\]\\Z/},8414:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3747),i=r(9262),o=r(5669),s=new o.Name("fullFormats"),a=new o.Name("fastFormats"),c=(e,t={keywords:!0})=>{if(Array.isArray(t))return u(e,t,n.fullFormats,s),e;const[r,o]="fast"===t.mode?[n.fastFormats,a]:[n.fullFormats,s];return u(e,t.formats||n.formatNames,r,o),t.keywords&&i.default(e),e};function u(e,t,r,n){var i,s;null!==(i=(s=e.opts.code).formats)&&void 0!==i||(s.formats=o._`require("ajv-formats/dist/formats").${n}`);for(const n of t)e.addFormat(n,r[n])}c.get=(e,t="full")=>{const r=("fast"===t?n.fastFormats:n.fullFormats)[e];if(!r)throw new Error(`Unknown format "${e}"`);return r},e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c},9262:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const n=r(6236),i=r(5669),o=i.operators,s={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},a={message:({keyword:e,schemaCode:t})=>i.str`should be ${s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>i._`{comparison: ${s[e].okStr}, limit: ${t}}`};t.formatLimitDefinition={keyword:Object.keys(s),type:"string",schemaType:"string",$data:!0,error:a,code(e){const{gen:t,data:r,schemaCode:o,keyword:a,it:c}=e,{opts:u,self:l}=c;if(!u.validateFormats)return;const h=new n.KeywordCxt(c,l.RULES.all.format.definition,"format");function f(e){return i._`${e}.compare(${r}, ${o}) ${s[a].fail} 0`}h.$data?function(){const r=t.scopeValue("formats",{ref:l.formats,code:u.code.formats}),n=t.const("fmt",i._`${r}[${h.schemaCode}]`);e.fail$data(i.or(i._`typeof ${n} != "object"`,i._`${n} instanceof RegExp`,i._`typeof ${n}.compare != "function"`,f(n)))}():function(){const r=h.schema,n=l.formats[r];if(!n||!0===n)return;if("object"!=typeof n||n instanceof RegExp||"function"!=typeof n.compare)throw new Error(`"${a}": format "${r}" does not define "compare" function`);const o=t.scopeValue("formats",{key:r,ref:n,code:u.code.formats?i._`${u.code.formats}${i.getProperty(r)}`:void 0});e.fail$data(f(o))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.formatLimitDefinition),e)},6236:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const n=r(8355),i=r(5671),o=r(2),s=r(1512),a=["/properties"],c="http://json-schema.org/draft-07/schema";class u extends n.default{_addVocabularies(){super._addVocabularies(),i.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(e,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}e.exports=t=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var l=r(1686);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var h=r(5669);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var f=r(6448);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var d=r(1578);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return d.default}})},6545:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class i extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function o(e,...t){const r=[e[0]];let n=0;for(;n<t.length;)c(r,t[n]),r.push(e[++n]);return new i(r)}t._Code=i,t.nil=new i(""),t._=o;const s=new i("+");function a(e,...t){const r=[l(e[0])];let n=0;for(;n<t.length;)r.push(s),c(r,t[n]),r.push(s,l(e[++n]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===s){const r=u(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new i(r)}function c(e,t){var r;t instanceof i?e.push(...t._items):t instanceof n?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:l(Array.isArray(r)?r.join(","):r))}function u(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof n||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof n?void 0:`"${e}${t.slice(1)}`}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=a,t.addCodeArg=c,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new i(l(e))},t.safeStringify=l,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new i(`.${e}`):o`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new i(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new i(e.toString())}},5669:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const n=r(6545),i=r(9187);var o=r(6545);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var s=r(9187);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),t.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class c extends a{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const r=e?i.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=x(this.rhs,e,t)),this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class u extends a{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof n.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=x(this.rhs,e,t),this}get names(){return A(this.lhs instanceof n.Name?{}:{...this.lhs.names},this.rhs)}}class l extends u{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class h extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class f extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class d extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=x(this.code,e,t),this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class m extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const i=r[n];i.optimizeNames(e,t)||(R(e,i.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>N(e,t.names)),{})}}class y extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class v extends m{}class g extends y{}g.kind="else";class b extends y{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof b?t:t.nodes:this.nodes.length?this:new b(P(e),t instanceof b?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=x(this.condition,e,t),this}get names(){const e=super.names;return A(e,this.condition),this.else&&N(e,this.else.names),e}}b.kind="if";class _ extends y{}_.kind="for";class w extends _{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=x(this.iteration,e,t),this}get names(){return N(super.names,this.iteration.names)}}class E extends _{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?i.varKinds.var:this.varKind,{name:r,from:n,to:o}=this;return`for(${t} ${r}=${n}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){const e=A(super.names,this.from);return A(e,this.to)}}class S extends _{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=x(this.iterable,e,t),this}get names(){return N(super.names,this.iterable.names)}}class O extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}O.kind="func";class I extends m{render(e){return"return "+super.render(e)}}I.kind="return";class T extends y{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&N(e,this.catch.names),this.finally&&N(e,this.finally.names),e}}class k extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}k.kind="catch";class D extends y{render(e){return"finally"+super.render(e)}}function N(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function A(e,t){return t instanceof n._CodeOrName?N(e,t.names):e}function x(e,t,r){return e instanceof n.Name?o(e):(i=e)instanceof n._Code&&i._items.some((e=>e instanceof n.Name&&1===t[e.str]&&void 0!==r[e.str]))?new n._Code(e._items.reduce(((e,t)=>(t instanceof n.Name&&(t=o(t)),t instanceof n._Code?e.push(...t._items):e.push(t),e)),[])):e;var i;function o(e){const n=r[e.str];return void 0===n||1!==t[e.str]?e:(delete t[e.str],n)}}function R(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function P(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:n._`!${M(e)}`}D.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new i.Scope({parent:e}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const i=this._scope.toName(t);return void 0!==r&&n&&(this._constants[i.str]=r),this._leafNode(new c(e,i,r)),i}const(e,t,r){return this._def(i.varKinds.const,e,t,r)}let(e,t,r){return this._def(i.varKinds.let,e,t,r)}var(e,t,r){return this._def(i.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new u(e,t,r))}add(e,r){return this._leafNode(new l(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==n.nil&&this._leafNode(new p(e)),this}object(...e){const t=["{"];for(const[r,i]of e)t.length>1&&t.push(","),t.push(r),(r!==i||this.opts.es5)&&(t.push(":"),(0,n.addCodeArg)(t,i));return t.push("}"),new n._Code(t)}if(e,t,r){if(this._blockNode(new b(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new b(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(b,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,n,o=(this.opts.es5?i.varKinds.var:i.varKinds.let)){const s=this._scope.toName(e);return this._for(new E(o,s,t,r),(()=>n(s)))}forOf(e,t,r,o=i.varKinds.const){const s=this._scope.toName(e);if(this.opts.es5){const e=t instanceof n.Name?t:this.var("_arr",t);return this.forRange("_i",0,n._`${e}.length`,(t=>{this.var(s,n._`${e}[${t}]`),r(s)}))}return this._for(new S("of",o,s,t),(()=>r(s)))}forIn(e,t,r,o=(this.opts.es5?i.varKinds.var:i.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,n._`Object.keys(${t})`,r);const s=this._scope.toName(e);return this._for(new S("in",o,s,t),(()=>r(s)))}endFor(){return this._endBlockNode(_)}label(e){return this._leafNode(new h(e))}break(e){return this._leafNode(new f(e))}return(e){const t=new I;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(I)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new T;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new k(e),t(e)}return r&&(this._currNode=n.finally=new D,this.code(r)),this._endBlockNode(k,D)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=n.nil,r,i){return this._blockNode(new O(e,t,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(O)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof b))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},t.not=P;const j=$(t.operators.AND);t.and=function(...e){return e.reduce(j)};const C=$(t.operators.OR);function $(e){return(t,r)=>t===n.nil?r:r===n.nil?t:n._`${M(t)} ${e} ${M(r)}`}function M(e){return e instanceof n.Name?e:n._`(${e})`}t.or=function(...e){return e.reduce(C)}},9187:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const n=r(6545);class i extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var o;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(o=t.UsedValueState||(t.UsedValueState={})),t.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class s{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof n.Name?e:this.name(e)}name(e){return new n.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=s;class a extends n.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=n._`.${new n.Name(t)}[${r}]`}}t.ValueScopeName=a;const c=n._`\n`;t.ValueScope=class extends s{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?c:n.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:i}=n,o=null!==(r=t.key)&&void 0!==r?r:t.ref;let s=this._values[i];if(s){const e=s.get(o);if(e)return e}else s=this._values[i]=new Map;s.set(o,n);const a=this._scope[i]||(this._scope[i]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:i,itemIndex:c}),n}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return n._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(e,r,s={},a){let c=n.nil;for(const u in e){const l=e[u];if(!l)continue;const h=s[u]=s[u]||new Map;l.forEach((e=>{if(h.has(e))return;h.set(e,o.Started);let s=r(e);if(s){const r=this.opts.es5?t.varKinds.var:t.varKinds.const;c=n._`${c}${r} ${e} = ${s};${this.opts._n}`}else{if(!(s=null==a?void 0:a(e)))throw new i(e);c=n._`${c}${s}${this.opts._n}`}h.set(e,o.Completed)}))}return c}}},6930:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const n=r(5669),i=r(8936),o=r(7250);function s(e,t){const r=e.const("err",t);e.if(n._`${o.default.vErrors} === null`,(()=>e.assign(o.default.vErrors,n._`[${r}]`)),n._`${o.default.vErrors}.push(${r})`),e.code(n._`${o.default.errors}++`)}function a(e,t){const{gen:r,validateName:i,schemaEnv:o}=e;o.$async?r.throw(n._`new ${e.ValidationError}(${t})`):(r.assign(n._`${i}.errors`,t),r.return(!1))}t.keywordError={message:({keyword:e})=>n.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?n.str`"${e}" keyword must be ${t} ($data)`:n.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.keywordError,i,o){const{it:c}=e,{gen:l,compositeRule:h,allErrors:f}=c,d=u(e,r,i);(null!=o?o:h||f)?s(l,d):a(c,n._`[${d}]`)},t.reportExtraError=function(e,r=t.keywordError,n){const{it:i}=e,{gen:c,compositeRule:l,allErrors:h}=i;s(c,u(e,r,n)),l||h||a(i,o.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(o.default.errors,t),e.if(n._`${o.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(n._`${o.default.vErrors}.length`,t)),(()=>e.assign(o.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:i,errsCount:s,it:a}){if(void 0===s)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",s,o.default.errors,(s=>{e.const(c,n._`${o.default.vErrors}[${s}]`),e.if(n._`${c}.instancePath === undefined`,(()=>e.assign(n._`${c}.instancePath`,(0,n.strConcat)(o.default.instancePath,a.errorPath)))),e.assign(n._`${c}.schemaPath`,n.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(n._`${c}.schema`,r),e.assign(n._`${c}.data`,i))}))};const c={keyword:new n.Name("keyword"),schemaPath:new n.Name("schemaPath"),params:new n.Name("params"),propertyName:new n.Name("propertyName"),message:new n.Name("message"),schema:new n.Name("schema"),parentSchema:new n.Name("parentSchema")};function u(e,t,r){const{createErrors:i}=e.it;return!1===i?n._`{}`:function(e,t,r={}){const{gen:i,it:s}=e,a=[l(s,r),h(e,r)];return function(e,{params:t,message:r},i){const{keyword:s,data:a,schemaValue:u,it:l}=e,{opts:h,propertyName:f,topSchemaRef:d,schemaPath:p}=l;i.push([c.keyword,s],[c.params,"function"==typeof t?t(e):t||n._`{}`]),h.messages&&i.push([c.message,"function"==typeof r?r(e):r]),h.verbose&&i.push([c.schema,u],[c.parentSchema,n._`${d}${p}`],[o.default.data,a]),f&&i.push([c.propertyName,f])}(e,t,a),i.object(...a)}(e,t,r)}function l({errorPath:e},{instancePath:t}){const r=t?n.str`${e}${(0,i.getErrorPath)(t,i.Type.Str)}`:e;return[o.default.instancePath,(0,n.strConcat)(o.default.instancePath,r)]}function h({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let s=o?t:n.str`${t}/${e}`;return r&&(s=n.str`${s}${(0,i.getErrorPath)(r,i.Type.Str)}`),[c.schemaPath,s]}},7382:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const n=r(5669),i=r(6448),o=r(7250),s=r(6696),a=r(8936),c=r(1686);class u{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,s.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function l(e){const t=f.call(this,e);if(t)return t;const r=(0,s.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:u}=this.opts.code,{ownProperties:l}=this.opts,h=new n.CodeGen(this.scope,{es5:a,lines:u,ownProperties:l});let d;e.$async&&(d=h.scopeValue("Error",{ref:i.default,code:n._`require("ajv/dist/runtime/validation_error").default`}));const p=h.scopeName("validate");e.validateName=p;const m={gen:h,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[n.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,n.stringify)(e.schema)}:{ref:e.schema}),validateName:p,ValidationError:d,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:n.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:n._`""`,opts:this.opts,self:this};let y;try{this._compilations.add(e),(0,c.validateFunctionCode)(m),h.optimize(this.opts.code.optimize);const t=h.toString();y=`${h.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(y=this.opts.code.process(y,e));const r=new Function(`${o.default.self}`,`${o.default.scope}`,y)(this,this.scope.get());if(this.scope.value(p,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:p,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){const{props:e,items:t}=m;r.evaluated={props:e instanceof n.Name?void 0:e,items:t instanceof n.Name?void 0:t,dynamicProps:e instanceof n.Name,dynamicItems:t instanceof n.Name},r.source&&(r.source.evaluated=(0,n.stringify)(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,y&&this.logger.error("Error compiling schema, function code:",y),t}finally{this._compilations.delete(e)}}function h(e){return(0,s.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:l.call(this,e)}function f(e){for(const n of this._compilations)if(r=e,(t=n).schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return n;var t,r}function d(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){const r=this.opts.uriResolver.parse(t),n=(0,s._getFullPath)(this.opts.uriResolver,r);let i=(0,s.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return y.call(this,r,e);const o=(0,s.normalizeId)(n),a=this.refs[o]||this.schemas[o];if("string"==typeof a){const t=p.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,r,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||l.call(this,a),o===(0,s.normalizeId)(t)){const{schema:t}=a,{schemaId:r}=this.opts,n=t[r];return n&&(i=(0,s.resolveUrl)(this.opts.uriResolver,i,n)),new u({schema:t,schemaId:r,root:e,baseId:i})}return y.call(this,r,a)}}t.SchemaEnv=u,t.compileSchema=l,t.resolveRef=function(e,t,r){var n;r=(0,s.resolveUrl)(this.opts.uriResolver,t,r);const i=e.refs[r];if(i)return i;let o=d.call(this,e,r);if(void 0===o){const i=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:s}=this.opts;i&&(o=new u({schema:i,schemaId:s,root:e,baseId:t}))}return void 0!==o?e.refs[r]=h.call(this,o):void 0},t.getCompilingSchema=f,t.resolveSchema=p;const m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(e,{baseId:t,schema:r,root:n}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const n of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,a.unescapeFragment)(n)];if(void 0===e)return;const i="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(n)&&i&&(t=(0,s.resolveUrl)(this.opts.uriResolver,t,i))}let o;if("boolean"!=typeof r&&r.$ref&&!(0,a.schemaHasRulesButRef)(r,this.RULES)){const e=(0,s.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=p.call(this,n,e)}const{schemaId:c}=this.opts;return o=o||new u({schema:r,schemaId:c,root:n,baseId:t}),o.schema!==o.root.schema?o:void 0}},7250:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i={data:new n.Name("data"),valCxt:new n.Name("valCxt"),instancePath:new n.Name("instancePath"),parentData:new n.Name("parentData"),parentDataProperty:new n.Name("parentDataProperty"),rootData:new n.Name("rootData"),dynamicAnchors:new n.Name("dynamicAnchors"),vErrors:new n.Name("vErrors"),errors:new n.Name("errors"),this:new n.Name("this"),self:new n.Name("self"),scope:new n.Name("scope"),json:new n.Name("json"),jsonPos:new n.Name("jsonPos"),jsonLen:new n.Name("jsonLen"),jsonPart:new n.Name("jsonPart")};t.default=i},1578:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6696);class i extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,n.resolveUrl)(e,t,r),this.missingSchema=(0,n.normalizeId)((0,n.getFullPath)(e,this.missingRef))}}t.default=i},6696:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const n=r(8936),i=r(6471),o=r(2943),s=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!c(e):!!t&&u(e)<=t)};const a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(e){for(const t in e){if(a.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(c))return!0;if("object"==typeof r&&c(r))return!0}return!1}function u(e){let t=0;for(const r in e){if("$ref"===r)return 1/0;if(t++,!s.has(r)&&("object"==typeof e[r]&&(0,n.eachItem)(e[r],(e=>t+=u(e))),t===1/0))return 1/0}return t}function l(e,t="",r){!1!==r&&(t=d(t));const n=e.parse(t);return h(e,n)}function h(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=l,t._getFullPath=h;const f=/#\/?$/;function d(e){return e?e.replace(f,""):""}t.normalizeId=d,t.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};const p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:r,uriResolver:n}=this.opts,s=d(e[r]||t),a={"":s},c=l(n,s,!1),u={},h=new Set;return o(e,{allKeys:!0},((e,t,n,i)=>{if(void 0===i)return;const o=c+t;let s=a[i];function l(t){const r=this.opts.uriResolver.resolve;if(t=d(s?r(s,t):t),h.has(t))throw m(t);h.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?f(e,n.schema,t):t!==d(o)&&("#"===t[0]?(f(e,u[t],t),u[t]=e):this.refs[t]=o),t}function y(e){if("string"==typeof e){if(!p.test(e))throw new Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}"string"==typeof e[r]&&(s=l.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),a[t]=s})),u;function f(e,t,r){if(void 0!==t&&!i(e,t))throw m(r)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},2881:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;const r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},8936:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const n=r(5669),i=r(6545);function o(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const i=n.RULES.keywords;for(const r in t)i[r]||p(e,`unknown keyword: "${r}"`)}function s(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function a(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(o,s,a,c)=>{const u=void 0===a?s:a instanceof n.Name?(s instanceof n.Name?e(o,s,a):t(o,s,a),a):s instanceof n.Name?(t(o,a,s),s):r(s,a);return c!==n.Name||u instanceof n.Name?u:i(o,u)}}function l(e,t){if(!0===t)return e.var("props",!0);const r=e.var("props",n._`{}`);return void 0!==t&&h(e,r,t),r}function h(e,t,r){Object.keys(r).forEach((r=>e.assign(n._`${t}${(0,n.getProperty)(r)}`,!0)))}t.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!s(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=s,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,i,o){if(!o){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return n._`${r}`}return n._`${e}${t}${(0,n.getProperty)(i)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},t.mergeEvaluated={props:u({mergeNames:(e,t,r)=>e.if(n._`${r} !== true && ${t} !== undefined`,(()=>{e.if(n._`${t} === true`,(()=>e.assign(r,!0)),(()=>e.assign(r,n._`${r} || {}`).code(n._`Object.assign(${r}, ${t})`)))})),mergeToName:(e,t,r)=>e.if(n._`${r} !== true`,(()=>{!0===t?e.assign(r,!0):(e.assign(r,n._`${r} || {}`),h(e,r,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:l}),items:u({mergeNames:(e,t,r)=>e.if(n._`${r} !== true && ${t} !== undefined`,(()=>e.assign(r,n._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`))),mergeToName:(e,t,r)=>e.if(n._`${r} !== true`,(()=>e.assign(r,!0===t||n._`${r} > ${t} ? ${r} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=l,t.setEvaluated=h;const f={};var d;function p(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:f[t.code]||(f[t.code]=new i._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(d=t.Type||(t.Type={})),t.getErrorPath=function(e,t,r){if(e instanceof n.Name){const i=t===d.Num;return r?i?n._`"[" + ${e} + "]"`:n._`"['" + ${e} + "']"`:i?n._`"/" + ${e}`:n._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,n.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=p},9073:(e,t)=>{"use strict";function r(e,t){return t.rules.some((t=>n(e,t)))}function n(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some((t=>void 0!==e[t])))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},n){const i=t.RULES.types[n];return i&&!0!==i&&r(e,i)},t.shouldUseGroup=r,t.shouldUseRule=n},2171:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const n=r(6930),i=r(5669),o=r(7250),s={message:"boolean schema is false"};function a(e,t){const{gen:r,data:i}=e,o={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,n.reportError)(o,s,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:r,validateName:n}=e;!1===r?a(e,!1):"object"==typeof r&&!0===r.$async?t.return(o.default.data):(t.assign(i._`${n}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),a(e)):r.var(t,!0)}},7332:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const n=r(2881),i=r(9073),o=r(6930),s=r(5669),a=r(8936);var c;function u(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(n.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(c=t.DataType||(t.DataType={})),t.getSchemaTypes=function(e){const t=u(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=u,t.coerceAndCheckDataType=function(e,t){const{gen:r,data:n,opts:o}=e,a=function(e,t){return t?e.filter((e=>l.has(e)||"array"===t&&"array"===e)):[]}(t,o.coerceTypes),u=t.length>0&&!(0===a.length&&1===t.length&&(0,i.schemaHasRulesForType)(e,t[0]));if(u){const i=f(t,n,o.strictNumbers,c.Wrong);r.if(i,(()=>{a.length?function(e,t,r){const{gen:n,data:i,opts:o}=e,a=n.let("dataType",s._`typeof ${i}`),c=n.let("coerced",s._`undefined`);"array"===o.coerceTypes&&n.if(s._`${a} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,(()=>n.assign(i,s._`${i}[0]`).assign(a,s._`typeof ${i}`).if(f(t,i,o.strictNumbers),(()=>n.assign(c,i))))),n.if(s._`${c} !== undefined`);for(const e of r)(l.has(e)||"array"===e&&"array"===o.coerceTypes)&&u(e);function u(e){switch(e){case"string":return void n.elseIf(s._`${a} == "number" || ${a} == "boolean"`).assign(c,s._`"" + ${i}`).elseIf(s._`${i} === null`).assign(c,s._`""`);case"number":return void n.elseIf(s._`${a} == "boolean" || ${i} === null
|
|
2
|
+
(()=>{var e={8278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3910:function(e,t,r){"use strict";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)=>{"use strict";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)=>{"use strict";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)=>{"use strict";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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9446:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StopThePromisePoolError=void 0;class r extends Error{}t.StopThePromisePoolError=r},4204:(e,t)=>{"use strict";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},3747:(e,t)=>{"use strict";function r(e,t){return{validate:e,compare:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(o,s),time:r(c,u),"date-time":r((function(e){const t=e.split(l);return 2===t.length&&o(t[0])&&c(t[1],!0)}),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return f.test(e)&&d.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(g.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return p.lastIndex=0,p.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=y&&e>=m}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:v},double:{type:"number",validate:v},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);const n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(e){const t=n.exec(e);if(!t)return!1;const r=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(2===o&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(r)?29:i[o])}function s(e,t){if(e&&t)return e>t?1:e<t?-1:0}const a=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function c(e,t){const r=a.exec(e);if(!r)return!1;const n=+r[1],i=+r[2],o=+r[3],s=r[5];return(n<=23&&i<=59&&o<=59||23===n&&59===i&&60===o)&&(!t||""!==s)}function u(e,t){if(!e||!t)return;const r=a.exec(e),n=a.exec(t);return r&&n?(e=r[1]+r[2]+r[3]+(r[4]||""))>(t=n[1]+n[2]+n[3]+(n[4]||""))?1:e<t?-1:0:void 0}const l=/t|\s/i;function h(e,t){if(!e||!t)return;const[r,n]=e.split(l),[i,o]=t.split(l),a=s(r,i);return void 0!==a?a||u(n,o):void 0}const f=/\/|:/,d=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,p=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,m=-(2**31),y=2**31-1;function v(){return!0}const g=/[^\\]\\Z/},8414:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3747),i=r(9262),o=r(5669),s=new o.Name("fullFormats"),a=new o.Name("fastFormats"),c=(e,t={keywords:!0})=>{if(Array.isArray(t))return u(e,t,n.fullFormats,s),e;const[r,o]="fast"===t.mode?[n.fastFormats,a]:[n.fullFormats,s];return u(e,t.formats||n.formatNames,r,o),t.keywords&&i.default(e),e};function u(e,t,r,n){var i,s;null!==(i=(s=e.opts.code).formats)&&void 0!==i||(s.formats=o._`require("ajv-formats/dist/formats").${n}`);for(const n of t)e.addFormat(n,r[n])}c.get=(e,t="full")=>{const r=("fast"===t?n.fastFormats:n.fullFormats)[e];if(!r)throw new Error(`Unknown format "${e}"`);return r},e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c},9262:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const n=r(6236),i=r(5669),o=i.operators,s={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},a={message:({keyword:e,schemaCode:t})=>i.str`should be ${s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>i._`{comparison: ${s[e].okStr}, limit: ${t}}`};t.formatLimitDefinition={keyword:Object.keys(s),type:"string",schemaType:"string",$data:!0,error:a,code(e){const{gen:t,data:r,schemaCode:o,keyword:a,it:c}=e,{opts:u,self:l}=c;if(!u.validateFormats)return;const h=new n.KeywordCxt(c,l.RULES.all.format.definition,"format");function f(e){return i._`${e}.compare(${r}, ${o}) ${s[a].fail} 0`}h.$data?function(){const r=t.scopeValue("formats",{ref:l.formats,code:u.code.formats}),n=t.const("fmt",i._`${r}[${h.schemaCode}]`);e.fail$data(i.or(i._`typeof ${n} != "object"`,i._`${n} instanceof RegExp`,i._`typeof ${n}.compare != "function"`,f(n)))}():function(){const r=h.schema,n=l.formats[r];if(!n||!0===n)return;if("object"!=typeof n||n instanceof RegExp||"function"!=typeof n.compare)throw new Error(`"${a}": format "${r}" does not define "compare" function`);const o=t.scopeValue("formats",{key:r,ref:n,code:u.code.formats?i._`${u.code.formats}${i.getProperty(r)}`:void 0});e.fail$data(f(o))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.formatLimitDefinition),e)},6236:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const n=r(8355),i=r(5671),o=r(2),s=r(1512),a=["/properties"],c="http://json-schema.org/draft-07/schema";class u extends n.default{_addVocabularies(){super._addVocabularies(),i.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(e,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}e.exports=t=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var l=r(1686);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var h=r(5669);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var f=r(6448);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var d=r(1578);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return d.default}})},6545:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class i extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function o(e,...t){const r=[e[0]];let n=0;for(;n<t.length;)c(r,t[n]),r.push(e[++n]);return new i(r)}t._Code=i,t.nil=new i(""),t._=o;const s=new i("+");function a(e,...t){const r=[l(e[0])];let n=0;for(;n<t.length;)r.push(s),c(r,t[n]),r.push(s,l(e[++n]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===s){const r=u(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new i(r)}function c(e,t){var r;t instanceof i?e.push(...t._items):t instanceof n?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:l(Array.isArray(r)?r.join(","):r))}function u(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof n||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof n?void 0:`"${e}${t.slice(1)}`}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=a,t.addCodeArg=c,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new i(l(e))},t.safeStringify=l,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new i(`.${e}`):o`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new i(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new i(e.toString())}},5669:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const n=r(6545),i=r(9187);var o=r(6545);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var s=r(9187);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),t.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class c extends a{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const r=e?i.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=x(this.rhs,e,t)),this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class u extends a{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof n.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=x(this.rhs,e,t),this}get names(){return A(this.lhs instanceof n.Name?{}:{...this.lhs.names},this.rhs)}}class l extends u{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class h extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class f extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class d extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=x(this.code,e,t),this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class m extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const i=r[n];i.optimizeNames(e,t)||(R(e,i.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>D(e,t.names)),{})}}class y extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class v extends m{}class g extends y{}g.kind="else";class b extends y{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof b?t:t.nodes:this.nodes.length?this:new b(P(e),t instanceof b?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=x(this.condition,e,t),this}get names(){const e=super.names;return A(e,this.condition),this.else&&D(e,this.else.names),e}}b.kind="if";class _ extends y{}_.kind="for";class w extends _{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=x(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}}class E extends _{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?i.varKinds.var:this.varKind,{name:r,from:n,to:o}=this;return`for(${t} ${r}=${n}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){const e=A(super.names,this.from);return A(e,this.to)}}class S extends _{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=x(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}}class O extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}O.kind="func";class I extends m{render(e){return"return "+super.render(e)}}I.kind="return";class T extends y{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}}class k extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}k.kind="catch";class N extends y{render(e){return"finally"+super.render(e)}}function D(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function A(e,t){return t instanceof n._CodeOrName?D(e,t.names):e}function x(e,t,r){return e instanceof n.Name?o(e):(i=e)instanceof n._Code&&i._items.some((e=>e instanceof n.Name&&1===t[e.str]&&void 0!==r[e.str]))?new n._Code(e._items.reduce(((e,t)=>(t instanceof n.Name&&(t=o(t)),t instanceof n._Code?e.push(...t._items):e.push(t),e)),[])):e;var i;function o(e){const n=r[e.str];return void 0===n||1!==t[e.str]?e:(delete t[e.str],n)}}function R(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function P(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:n._`!${M(e)}`}N.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new i.Scope({parent:e}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const i=this._scope.toName(t);return void 0!==r&&n&&(this._constants[i.str]=r),this._leafNode(new c(e,i,r)),i}const(e,t,r){return this._def(i.varKinds.const,e,t,r)}let(e,t,r){return this._def(i.varKinds.let,e,t,r)}var(e,t,r){return this._def(i.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new u(e,t,r))}add(e,r){return this._leafNode(new l(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==n.nil&&this._leafNode(new p(e)),this}object(...e){const t=["{"];for(const[r,i]of e)t.length>1&&t.push(","),t.push(r),(r!==i||this.opts.es5)&&(t.push(":"),(0,n.addCodeArg)(t,i));return t.push("}"),new n._Code(t)}if(e,t,r){if(this._blockNode(new b(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new b(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(b,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,n,o=(this.opts.es5?i.varKinds.var:i.varKinds.let)){const s=this._scope.toName(e);return this._for(new E(o,s,t,r),(()=>n(s)))}forOf(e,t,r,o=i.varKinds.const){const s=this._scope.toName(e);if(this.opts.es5){const e=t instanceof n.Name?t:this.var("_arr",t);return this.forRange("_i",0,n._`${e}.length`,(t=>{this.var(s,n._`${e}[${t}]`),r(s)}))}return this._for(new S("of",o,s,t),(()=>r(s)))}forIn(e,t,r,o=(this.opts.es5?i.varKinds.var:i.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,n._`Object.keys(${t})`,r);const s=this._scope.toName(e);return this._for(new S("in",o,s,t),(()=>r(s)))}endFor(){return this._endBlockNode(_)}label(e){return this._leafNode(new h(e))}break(e){return this._leafNode(new f(e))}return(e){const t=new I;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(I)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new T;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new k(e),t(e)}return r&&(this._currNode=n.finally=new N,this.code(r)),this._endBlockNode(k,N)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=n.nil,r,i){return this._blockNode(new O(e,t,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(O)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof b))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},t.not=P;const C=$(t.operators.AND);t.and=function(...e){return e.reduce(C)};const j=$(t.operators.OR);function $(e){return(t,r)=>t===n.nil?r:r===n.nil?t:n._`${M(t)} ${e} ${M(r)}`}function M(e){return e instanceof n.Name?e:n._`(${e})`}t.or=function(...e){return e.reduce(j)}},9187:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const n=r(6545);class i extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var o;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(o=t.UsedValueState||(t.UsedValueState={})),t.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class s{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof n.Name?e:this.name(e)}name(e){return new n.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=s;class a extends n.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=n._`.${new n.Name(t)}[${r}]`}}t.ValueScopeName=a;const c=n._`\n`;t.ValueScope=class extends s{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?c:n.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:i}=n,o=null!==(r=t.key)&&void 0!==r?r:t.ref;let s=this._values[i];if(s){const e=s.get(o);if(e)return e}else s=this._values[i]=new Map;s.set(o,n);const a=this._scope[i]||(this._scope[i]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:i,itemIndex:c}),n}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return n._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(e,r,s={},a){let c=n.nil;for(const u in e){const l=e[u];if(!l)continue;const h=s[u]=s[u]||new Map;l.forEach((e=>{if(h.has(e))return;h.set(e,o.Started);let s=r(e);if(s){const r=this.opts.es5?t.varKinds.var:t.varKinds.const;c=n._`${c}${r} ${e} = ${s};${this.opts._n}`}else{if(!(s=null==a?void 0:a(e)))throw new i(e);c=n._`${c}${s}${this.opts._n}`}h.set(e,o.Completed)}))}return c}}},6930:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const n=r(5669),i=r(8936),o=r(7250);function s(e,t){const r=e.const("err",t);e.if(n._`${o.default.vErrors} === null`,(()=>e.assign(o.default.vErrors,n._`[${r}]`)),n._`${o.default.vErrors}.push(${r})`),e.code(n._`${o.default.errors}++`)}function a(e,t){const{gen:r,validateName:i,schemaEnv:o}=e;o.$async?r.throw(n._`new ${e.ValidationError}(${t})`):(r.assign(n._`${i}.errors`,t),r.return(!1))}t.keywordError={message:({keyword:e})=>n.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?n.str`"${e}" keyword must be ${t} ($data)`:n.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.keywordError,i,o){const{it:c}=e,{gen:l,compositeRule:h,allErrors:f}=c,d=u(e,r,i);(null!=o?o:h||f)?s(l,d):a(c,n._`[${d}]`)},t.reportExtraError=function(e,r=t.keywordError,n){const{it:i}=e,{gen:c,compositeRule:l,allErrors:h}=i;s(c,u(e,r,n)),l||h||a(i,o.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(o.default.errors,t),e.if(n._`${o.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(n._`${o.default.vErrors}.length`,t)),(()=>e.assign(o.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:i,errsCount:s,it:a}){if(void 0===s)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",s,o.default.errors,(s=>{e.const(c,n._`${o.default.vErrors}[${s}]`),e.if(n._`${c}.instancePath === undefined`,(()=>e.assign(n._`${c}.instancePath`,(0,n.strConcat)(o.default.instancePath,a.errorPath)))),e.assign(n._`${c}.schemaPath`,n.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(n._`${c}.schema`,r),e.assign(n._`${c}.data`,i))}))};const c={keyword:new n.Name("keyword"),schemaPath:new n.Name("schemaPath"),params:new n.Name("params"),propertyName:new n.Name("propertyName"),message:new n.Name("message"),schema:new n.Name("schema"),parentSchema:new n.Name("parentSchema")};function u(e,t,r){const{createErrors:i}=e.it;return!1===i?n._`{}`:function(e,t,r={}){const{gen:i,it:s}=e,a=[l(s,r),h(e,r)];return function(e,{params:t,message:r},i){const{keyword:s,data:a,schemaValue:u,it:l}=e,{opts:h,propertyName:f,topSchemaRef:d,schemaPath:p}=l;i.push([c.keyword,s],[c.params,"function"==typeof t?t(e):t||n._`{}`]),h.messages&&i.push([c.message,"function"==typeof r?r(e):r]),h.verbose&&i.push([c.schema,u],[c.parentSchema,n._`${d}${p}`],[o.default.data,a]),f&&i.push([c.propertyName,f])}(e,t,a),i.object(...a)}(e,t,r)}function l({errorPath:e},{instancePath:t}){const r=t?n.str`${e}${(0,i.getErrorPath)(t,i.Type.Str)}`:e;return[o.default.instancePath,(0,n.strConcat)(o.default.instancePath,r)]}function h({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let s=o?t:n.str`${t}/${e}`;return r&&(s=n.str`${s}${(0,i.getErrorPath)(r,i.Type.Str)}`),[c.schemaPath,s]}},7382:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const n=r(5669),i=r(6448),o=r(7250),s=r(6696),a=r(8936),c=r(1686);class u{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,s.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function l(e){const t=f.call(this,e);if(t)return t;const r=(0,s.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:u}=this.opts.code,{ownProperties:l}=this.opts,h=new n.CodeGen(this.scope,{es5:a,lines:u,ownProperties:l});let d;e.$async&&(d=h.scopeValue("Error",{ref:i.default,code:n._`require("ajv/dist/runtime/validation_error").default`}));const p=h.scopeName("validate");e.validateName=p;const m={gen:h,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[n.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,n.stringify)(e.schema)}:{ref:e.schema}),validateName:p,ValidationError:d,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:n.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:n._`""`,opts:this.opts,self:this};let y;try{this._compilations.add(e),(0,c.validateFunctionCode)(m),h.optimize(this.opts.code.optimize);const t=h.toString();y=`${h.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(y=this.opts.code.process(y,e));const r=new Function(`${o.default.self}`,`${o.default.scope}`,y)(this,this.scope.get());if(this.scope.value(p,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:p,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){const{props:e,items:t}=m;r.evaluated={props:e instanceof n.Name?void 0:e,items:t instanceof n.Name?void 0:t,dynamicProps:e instanceof n.Name,dynamicItems:t instanceof n.Name},r.source&&(r.source.evaluated=(0,n.stringify)(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,y&&this.logger.error("Error compiling schema, function code:",y),t}finally{this._compilations.delete(e)}}function h(e){return(0,s.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:l.call(this,e)}function f(e){for(const n of this._compilations)if(r=e,(t=n).schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return n;var t,r}function d(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){const r=this.opts.uriResolver.parse(t),n=(0,s._getFullPath)(this.opts.uriResolver,r);let i=(0,s.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return y.call(this,r,e);const o=(0,s.normalizeId)(n),a=this.refs[o]||this.schemas[o];if("string"==typeof a){const t=p.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,r,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||l.call(this,a),o===(0,s.normalizeId)(t)){const{schema:t}=a,{schemaId:r}=this.opts,n=t[r];return n&&(i=(0,s.resolveUrl)(this.opts.uriResolver,i,n)),new u({schema:t,schemaId:r,root:e,baseId:i})}return y.call(this,r,a)}}t.SchemaEnv=u,t.compileSchema=l,t.resolveRef=function(e,t,r){var n;r=(0,s.resolveUrl)(this.opts.uriResolver,t,r);const i=e.refs[r];if(i)return i;let o=d.call(this,e,r);if(void 0===o){const i=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:s}=this.opts;i&&(o=new u({schema:i,schemaId:s,root:e,baseId:t}))}return void 0!==o?e.refs[r]=h.call(this,o):void 0},t.getCompilingSchema=f,t.resolveSchema=p;const m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(e,{baseId:t,schema:r,root:n}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const n of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,a.unescapeFragment)(n)];if(void 0===e)return;const i="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(n)&&i&&(t=(0,s.resolveUrl)(this.opts.uriResolver,t,i))}let o;if("boolean"!=typeof r&&r.$ref&&!(0,a.schemaHasRulesButRef)(r,this.RULES)){const e=(0,s.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=p.call(this,n,e)}const{schemaId:c}=this.opts;return o=o||new u({schema:r,schemaId:c,root:n,baseId:t}),o.schema!==o.root.schema?o:void 0}},7250:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i={data:new n.Name("data"),valCxt:new n.Name("valCxt"),instancePath:new n.Name("instancePath"),parentData:new n.Name("parentData"),parentDataProperty:new n.Name("parentDataProperty"),rootData:new n.Name("rootData"),dynamicAnchors:new n.Name("dynamicAnchors"),vErrors:new n.Name("vErrors"),errors:new n.Name("errors"),this:new n.Name("this"),self:new n.Name("self"),scope:new n.Name("scope"),json:new n.Name("json"),jsonPos:new n.Name("jsonPos"),jsonLen:new n.Name("jsonLen"),jsonPart:new n.Name("jsonPart")};t.default=i},1578:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6696);class i extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,n.resolveUrl)(e,t,r),this.missingSchema=(0,n.normalizeId)((0,n.getFullPath)(e,this.missingRef))}}t.default=i},6696:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const n=r(8936),i=r(6471),o=r(2943),s=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!c(e):!!t&&u(e)<=t)};const a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(e){for(const t in e){if(a.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(c))return!0;if("object"==typeof r&&c(r))return!0}return!1}function u(e){let t=0;for(const r in e){if("$ref"===r)return 1/0;if(t++,!s.has(r)&&("object"==typeof e[r]&&(0,n.eachItem)(e[r],(e=>t+=u(e))),t===1/0))return 1/0}return t}function l(e,t="",r){!1!==r&&(t=d(t));const n=e.parse(t);return h(e,n)}function h(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=l,t._getFullPath=h;const f=/#\/?$/;function d(e){return e?e.replace(f,""):""}t.normalizeId=d,t.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};const p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:r,uriResolver:n}=this.opts,s=d(e[r]||t),a={"":s},c=l(n,s,!1),u={},h=new Set;return o(e,{allKeys:!0},((e,t,n,i)=>{if(void 0===i)return;const o=c+t;let s=a[i];function l(t){const r=this.opts.uriResolver.resolve;if(t=d(s?r(s,t):t),h.has(t))throw m(t);h.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?f(e,n.schema,t):t!==d(o)&&("#"===t[0]?(f(e,u[t],t),u[t]=e):this.refs[t]=o),t}function y(e){if("string"==typeof e){if(!p.test(e))throw new Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}"string"==typeof e[r]&&(s=l.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),a[t]=s})),u;function f(e,t,r){if(void 0!==t&&!i(e,t))throw m(r)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},2881:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;const r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},8936:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const n=r(5669),i=r(6545);function o(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const i=n.RULES.keywords;for(const r in t)i[r]||p(e,`unknown keyword: "${r}"`)}function s(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function a(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(o,s,a,c)=>{const u=void 0===a?s:a instanceof n.Name?(s instanceof n.Name?e(o,s,a):t(o,s,a),a):s instanceof n.Name?(t(o,a,s),s):r(s,a);return c!==n.Name||u instanceof n.Name?u:i(o,u)}}function l(e,t){if(!0===t)return e.var("props",!0);const r=e.var("props",n._`{}`);return void 0!==t&&h(e,r,t),r}function h(e,t,r){Object.keys(r).forEach((r=>e.assign(n._`${t}${(0,n.getProperty)(r)}`,!0)))}t.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!s(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=s,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,i,o){if(!o){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return n._`${r}`}return n._`${e}${t}${(0,n.getProperty)(i)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},t.mergeEvaluated={props:u({mergeNames:(e,t,r)=>e.if(n._`${r} !== true && ${t} !== undefined`,(()=>{e.if(n._`${t} === true`,(()=>e.assign(r,!0)),(()=>e.assign(r,n._`${r} || {}`).code(n._`Object.assign(${r}, ${t})`)))})),mergeToName:(e,t,r)=>e.if(n._`${r} !== true`,(()=>{!0===t?e.assign(r,!0):(e.assign(r,n._`${r} || {}`),h(e,r,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:l}),items:u({mergeNames:(e,t,r)=>e.if(n._`${r} !== true && ${t} !== undefined`,(()=>e.assign(r,n._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`))),mergeToName:(e,t,r)=>e.if(n._`${r} !== true`,(()=>e.assign(r,!0===t||n._`${r} > ${t} ? ${r} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=l,t.setEvaluated=h;const f={};var d;function p(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:f[t.code]||(f[t.code]=new i._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(d=t.Type||(t.Type={})),t.getErrorPath=function(e,t,r){if(e instanceof n.Name){const i=t===d.Num;return r?i?n._`"[" + ${e} + "]"`:n._`"['" + ${e} + "']"`:i?n._`"/" + ${e}`:n._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,n.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=p},9073:(e,t)=>{"use strict";function r(e,t){return t.rules.some((t=>n(e,t)))}function n(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some((t=>void 0!==e[t])))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},n){const i=t.RULES.types[n];return i&&!0!==i&&r(e,i)},t.shouldUseGroup=r,t.shouldUseRule=n},2171:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const n=r(6930),i=r(5669),o=r(7250),s={message:"boolean schema is false"};function a(e,t){const{gen:r,data:i}=e,o={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,n.reportError)(o,s,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:r,validateName:n}=e;!1===r?a(e,!1):"object"==typeof r&&!0===r.$async?t.return(o.default.data):(t.assign(i._`${n}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),a(e)):r.var(t,!0)}},7332:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const n=r(2881),i=r(9073),o=r(6930),s=r(5669),a=r(8936);var c;function u(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(n.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(c=t.DataType||(t.DataType={})),t.getSchemaTypes=function(e){const t=u(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=u,t.coerceAndCheckDataType=function(e,t){const{gen:r,data:n,opts:o}=e,a=function(e,t){return t?e.filter((e=>l.has(e)||"array"===t&&"array"===e)):[]}(t,o.coerceTypes),u=t.length>0&&!(0===a.length&&1===t.length&&(0,i.schemaHasRulesForType)(e,t[0]));if(u){const i=f(t,n,o.strictNumbers,c.Wrong);r.if(i,(()=>{a.length?function(e,t,r){const{gen:n,data:i,opts:o}=e,a=n.let("dataType",s._`typeof ${i}`),c=n.let("coerced",s._`undefined`);"array"===o.coerceTypes&&n.if(s._`${a} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,(()=>n.assign(i,s._`${i}[0]`).assign(a,s._`typeof ${i}`).if(f(t,i,o.strictNumbers),(()=>n.assign(c,i))))),n.if(s._`${c} !== undefined`);for(const e of r)(l.has(e)||"array"===e&&"array"===o.coerceTypes)&&u(e);function u(e){switch(e){case"string":return void n.elseIf(s._`${a} == "number" || ${a} == "boolean"`).assign(c,s._`"" + ${i}`).elseIf(s._`${i} === null`).assign(c,s._`""`);case"number":return void n.elseIf(s._`${a} == "boolean" || ${i} === null
|
|
3
3
|
|| (${a} == "string" && ${i} && ${i} == +${i})`).assign(c,s._`+${i}`);case"integer":return void n.elseIf(s._`${a} === "boolean" || ${i} === null
|
|
4
4
|
|| (${a} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(c,s._`+${i}`);case"boolean":return void n.elseIf(s._`${i} === "false" || ${i} === 0 || ${i} === null`).assign(c,!1).elseIf(s._`${i} === "true" || ${i} === 1`).assign(c,!0);case"null":return n.elseIf(s._`${i} === "" || ${i} === 0 || ${i} === false`),void n.assign(c,null);case"array":n.elseIf(s._`${a} === "string" || ${a} === "number"
|
|
5
|
-
|| ${a} === "boolean" || ${i} === null`).assign(c,s._`[${i}]`)}}n.else(),p(e),n.endIf(),n.if(s._`${c} !== undefined`,(()=>{n.assign(i,c),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(s._`${t} !== undefined`,(()=>e.assign(s._`${t}[${r}]`,n)))}(e,c)}))}(e,t,a):p(e)}))}return u};const l=new Set(["string","number","integer","boolean","null"]);function h(e,t,r,n=c.Correct){const i=n===c.Correct?s.operators.EQ:s.operators.NEQ;let o;switch(e){case"null":return s._`${t} ${i} null`;case"array":o=s._`Array.isArray(${t})`;break;case"object":o=s._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=a(s._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=a();break;default:return s._`typeof ${t} ${i} ${e}`}return n===c.Correct?o:(0,s.not)(o);function a(e=s.nil){return(0,s.and)(s._`typeof ${t} == "number"`,e,r?s._`isFinite(${t})`:s.nil)}}function f(e,t,r,n){if(1===e.length)return h(e[0],t,r,n);let i;const o=(0,a.toHash)(e);if(o.array&&o.object){const e=s._`typeof ${t} != "object"`;i=o.null?e:s._`!${t} || ${e}`,delete o.null,delete o.array,delete o.object}else i=s.nil;o.number&&delete o.integer;for(const e in o)i=(0,s.and)(i,h(e,t,r,n));return i}t.checkDataType=h,t.checkDataTypes=f;const d={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?s._`{type: ${e}}`:s._`{type: ${t}}`};function p(e){const t=function(e){const{gen:t,data:r,schema:n}=e,i=(0,a.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}(e);(0,o.reportError)(t,d)}t.reportTypeError=p},1481:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const n=r(5669),i=r(8936);function o(e,t,r){const{gen:o,compositeRule:s,data:a,opts:c}=e;if(void 0===r)return;const u=n._`${a}${(0,n.getProperty)(t)}`;if(s)return void(0,i.checkStrictMode)(e,`default is ignored for: ${u}`);let l=n._`${u} === undefined`;"empty"===c.useDefaults&&(l=n._`${l} || ${u} === null || ${u} === ""`),o.if(l,n._`${u} = ${(0,n.stringify)(r)}`)}t.assignDefaults=function(e,t){const{properties:r,items:n}=e.schema;if("object"===t&&r)for(const t in r)o(e,t,r[t].default);else"array"===t&&Array.isArray(n)&&n.forEach(((t,r)=>o(e,r,t.default)))}},1686:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const n=r(2171),i=r(7332),o=r(9073),s=r(7332),a=r(1481),c=r(5782),u=r(8878),l=r(5669),h=r(7250),f=r(6696),d=r(8936),p=r(6930);function m({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},o){i.code.es5?e.func(t,l._`${h.default.data}, ${h.default.valCxt}`,n.$async,(()=>{e.code(l._`"use strict"; ${y(r,i)}`),function(e,t){e.if(h.default.valCxt,(()=>{e.var(h.default.instancePath,l._`${h.default.valCxt}.${h.default.instancePath}`),e.var(h.default.parentData,l._`${h.default.valCxt}.${h.default.parentData}`),e.var(h.default.parentDataProperty,l._`${h.default.valCxt}.${h.default.parentDataProperty}`),e.var(h.default.rootData,l._`${h.default.valCxt}.${h.default.rootData}`),t.dynamicRef&&e.var(h.default.dynamicAnchors,l._`${h.default.valCxt}.${h.default.dynamicAnchors}`)}),(()=>{e.var(h.default.instancePath,l._`""`),e.var(h.default.parentData,l._`undefined`),e.var(h.default.parentDataProperty,l._`undefined`),e.var(h.default.rootData,h.default.data),t.dynamicRef&&e.var(h.default.dynamicAnchors,l._`{}`)}))}(e,i),e.code(o)})):e.func(t,l._`${h.default.data}, ${function(e){return l._`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${e.dynamicRef?l._`, ${h.default.dynamicAnchors}={}`:l.nil}}={}`}(i)}`,n.$async,(()=>e.code(y(r,i)).code(o)))}function y(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?l._`/*# sourceURL=${r} */`:l.nil}function v({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function g(e){return"boolean"!=typeof e.schema}function b(e){(0,d.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function _(e,t){if(e.opts.jtd)return E(e,[],!1,t);const r=(0,i.getSchemaTypes)(e.schema);E(e,r,!(0,i.coerceAndCheckDataType)(e,r),t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){const o=r.$comment;if(!0===i.$comment)e.code(l._`${h.default.self}.logger.log(${o})`);else if("function"==typeof i.$comment){const r=l.str`${n}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code(l._`${h.default.self}.opts.$comment(${o}, ${r}, ${i}.schema)`)}}function E(e,t,r,n){const{gen:i,schema:a,data:c,allErrors:u,opts:f,self:p}=e,{RULES:m}=p;function y(d){(0,o.shouldUseGroup)(a,d)&&(d.type?(i.if((0,s.checkDataType)(d.type,c,f.strictNumbers)),S(e,d),1===t.length&&t[0]===d.type&&r&&(i.else(),(0,s.reportTypeError)(e)),i.endIf()):S(e,d),u||i.if(l._`${h.default.errors} === ${n||0}`))}!a.$ref||!f.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(a,m)?(f.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach((t=>{O(e.dataTypes,t)||I(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const r=[];for(const n of e.dataTypes)O(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&I(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const r=e.self.RULES.all;for(const n in r){const i=r[n];if("object"==typeof i&&(0,o.shouldUseRule)(e.schema,i)){const{type:r}=i.definition;r.length&&!r.some((e=>{return n=e,(r=t).includes(n)||"number"===n&&r.includes("integer");var r,n}))&&I(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes))}(e,t),i.block((()=>{for(const e of m.rules)y(e);y(m.post)}))):i.block((()=>k(e,"$ref",m.all.$ref.definition)))}function S(e,t){const{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,a.assignDefaults)(e,t.type),r.block((()=>{for(const r of t.rules)(0,o.shouldUseRule)(n,r)&&k(e,r.keyword,r.definition,t.type)}))}function O(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function I(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){g(e)&&(b(e),v(e))?function(e){const{schema:t,opts:r,gen:n}=e;m(e,(()=>{r.$comment&&t.$comment&&w(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(h.default.vErrors,null),n.let(h.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",l._`${r}.evaluated`),t.if(l._`${e.evaluated}.dynamicProps`,(()=>t.assign(l._`${e.evaluated}.props`,l._`undefined`))),t.if(l._`${e.evaluated}.dynamicItems`,(()=>t.assign(l._`${e.evaluated}.items`,l._`undefined`)))}(e),_(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=e;r.$async?t.if(l._`${h.default.errors} === 0`,(()=>t.return(h.default.data)),(()=>t.throw(l._`new ${i}(${h.default.vErrors})`))):(t.assign(l._`${n}.errors`,h.default.vErrors),o.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof l.Name&&e.assign(l._`${t}.props`,r),n instanceof l.Name&&e.assign(l._`${t}.items`,n)}(e),t.return(l._`${h.default.errors} === 0`))}(e)}))}(e):m(e,(()=>(0,n.topBoolOrEmptySchema)(e)))};class T{constructor(e,t,r){if((0,c.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",A(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,c.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",h.default.errors))}result(e,t,r){this.failResult((0,l.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,l.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(l._`${t} !== undefined && (${(0,l.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?p.reportExtraError:p.reportError)(this,this.def.error,t)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=l.nil){this.gen.block((()=>{this.check$data(e,r),t()}))}check$data(e=l.nil,t=l.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:i,def:o}=this;r.if((0,l.or)(l._`${n} === undefined`,t)),e!==l.nil&&r.assign(e,!0),(i.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==l.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:i}=this;return(0,l.or)(function(){if(r.length){if(!(t instanceof l.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return l._`${(0,s.checkDataTypes)(e,t,i.opts.strictNumbers,s.DataType.Wrong)}`}return l.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return l._`!${r}(${t})`}return l.nil}())}subschema(e,t){const r=(0,u.getSubschema)(this.it,e);(0,u.extendSubschemaData)(r,this.it,e),(0,u.extendSubschemaMode)(r,e);const i={...this.it,...r,items:void 0,props:void 0};return function(e,t){g(e)&&(b(e),v(e))?function(e,t){const{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&w(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,f.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const o=n.const("_errs",h.default.errors);_(e,o),n.var(t,l._`${o} === ${h.default.errors}`)}(e,t):(0,n.boolOrEmptySchema)(e,t)}(i,t),i}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,(()=>this.mergeEvaluated(e,l.Name))),!0}}function k(e,t,r,n){const i=new T(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,c.funcKeywordCode)(i,r):"macro"in r?(0,c.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,c.funcKeywordCode)(i,r)}t.KeywordCxt=T;const D=/^\/(?:[^~]|~0|~1)*$/,N=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function A(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,o;if(""===e)return h.default.rootData;if("/"===e[0]){if(!D.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,o=h.default.rootData}else{const s=N.exec(e);if(!s)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+s[1];if(i=s[2],"#"===i){if(a>=t)throw new Error(c("property/index",a));return n[t-a]}if(a>t)throw new Error(c("data",a));if(o=r[t-a],!i)return o}let s=o;const a=i.split("/");for(const e of a)e&&(o=l._`${o}${(0,l.getProperty)((0,d.unescapeJsonPointer)(e))}`,s=l._`${s} && ${o}`);return s;function c(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=A},5782:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const n=r(5669),i=r(7250),o=r(3499),s=r(6930);function a(e){const{gen:t,data:r,it:i}=e;t.if(i.parentData,(()=>t.assign(r,n._`${i.parentData}[${i.parentDataProperty}]`)))}function c(e,t,r){if(void 0===r)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,n.stringify)(r)})}t.macroKeywordCode=function(e,t){const{gen:r,keyword:i,schema:o,parentSchema:s,it:a}=e,u=t.macro.call(a.self,o,s,a),l=c(r,i,u);!1!==a.opts.validateSchema&&a.self.validateSchema(u,!0);const h=r.name("valid");e.subschema({schema:u,schemaPath:n.nil,errSchemaPath:`${a.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},h),e.pass(h,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var r;const{gen:u,keyword:l,schema:h,parentSchema:f,$data:d,it:p}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(p,t);const m=!d&&t.compile?t.compile.call(p.self,h,f,p):t.validate,y=c(u,l,m),v=u.let("valid");function g(r=(t.async?n._`await `:n.nil)){const s=p.opts.passContext?i.default.this:i.default.self,a=!("compile"in t&&!d||!1===t.schema);u.assign(v,n._`${r}${(0,o.callValidateCode)(e,y,s,a)}`,t.modifying)}function b(e){var r;u.if((0,n.not)(null!==(r=t.valid)&&void 0!==r?r:v),e)}e.block$data(v,(function(){if(!1===t.errors)g(),t.modifying&&a(e),b((()=>e.error()));else{const r=t.async?function(){const e=u.let("ruleErrs",null);return u.try((()=>g(n._`await `)),(t=>u.assign(v,!1).if(n._`${t} instanceof ${p.ValidationError}`,(()=>u.assign(e,n._`${t}.errors`)),(()=>u.throw(t))))),e}():function(){const e=n._`${y}.errors`;return u.assign(e,null),g(n.nil),e}();t.modifying&&a(e),b((()=>function(e,t){const{gen:r}=e;r.if(n._`Array.isArray(${t})`,(()=>{r.assign(i.default.vErrors,n._`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,n._`${i.default.vErrors}.length`),(0,s.extendErrors)(e)}),(()=>e.error()))}(e,r)))}})),e.ok(null!==(r=t.valid)&&void 0!==r?r:v)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");const s=i.dependencies;if(null==s?void 0:s.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[o])){const e=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},8878:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const n=r(5669),i=r(8936);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:o,schemaPath:s,errSchemaPath:a,topSchemaRef:c}){if(void 0!==t&&void 0!==o)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const o=e.schema[t];return void 0===r?{schema:o,schemaPath:n._`${e.schemaPath}${(0,n.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:o[r],schemaPath:n._`${e.schemaPath}${(0,n.getProperty)(t)}${(0,n.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(r)}`}}if(void 0!==o){if(void 0===s||void 0===a||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:s,topSchemaRef:c,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:o,data:s,dataTypes:a,propertyName:c}){if(void 0!==s&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=t;if(void 0!==r){const{errorPath:s,dataPathArr:a,opts:c}=t;l(u.let("data",n._`${t.data}${(0,n.getProperty)(r)}`,!0)),e.errorPath=n.str`${s}${(0,i.getErrorPath)(r,o,c.jsPropertySyntax)}`,e.parentDataProperty=n._`${r}`,e.dataPathArr=[...a,e.parentDataProperty]}function l(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==s&&(l(s instanceof n.Name?s:u.let("data",s,!0)),void 0!==c&&(e.propertyName=c)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){void 0!==n&&(e.compositeRule=n),void 0!==i&&(e.createErrors=i),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}},8355:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var n=r(1686);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return n.KeywordCxt}});var i=r(5669);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});const o=r(6448),s=r(1578),a=r(2881),c=r(7382),u=r(5669),l=r(6696),h=r(7332),f=r(8936),d=r(1143),p=r(407),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";const y=["removeAdditional","useDefaults","coerceTypes"],v=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},b={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function _(e){var t,r,n,i,o,s,a,c,u,l,h,f,d,y,v,g,b,_,w,E,S,O,I,T,k;const D=e.strict,N=null===(t=e.code)||void 0===t?void 0:t.optimize,A=!0===N||void 0===N?1:N||0,x=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:m,R=null!==(i=e.uriResolver)&&void 0!==i?i:p.default;return{strictSchema:null===(s=null!==(o=e.strictSchema)&&void 0!==o?o:D)||void 0===s||s,strictNumbers:null===(c=null!==(a=e.strictNumbers)&&void 0!==a?a:D)||void 0===c||c,strictTypes:null!==(l=null!==(u=e.strictTypes)&&void 0!==u?u:D)&&void 0!==l?l:"log",strictTuples:null!==(f=null!==(h=e.strictTuples)&&void 0!==h?h:D)&&void 0!==f?f:"log",strictRequired:null!==(y=null!==(d=e.strictRequired)&&void 0!==d?d:D)&&void 0!==y&&y,code:e.code?{...e.code,optimize:A,regExp:x}:{optimize:A,regExp:x},loopRequired:null!==(v=e.loopRequired)&&void 0!==v?v:200,loopEnum:null!==(g=e.loopEnum)&&void 0!==g?g:200,meta:null===(b=e.meta)||void 0===b||b,messages:null===(_=e.messages)||void 0===_||_,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==(E=e.schemaId)&&void 0!==E?E:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(O=e.validateSchema)||void 0===O||O,validateFormats:null===(I=e.validateFormats)||void 0===I||I,unicodeRegExp:null===(T=e.unicodeRegExp)||void 0===T||T,int32range:null===(k=e.int32range)||void 0===k||k,uriResolver:R}}class w{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,..._(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:v,es5:t,lines:r}),this.logger=function(e){if(!1===e)return D;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),E.call(this,g,e,"NOT SUPPORTED"),E.call(this,b,e,"DEPRECATED","warn"),this._metaOpts=k.call(this),e.formats&&I.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&T.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),O.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=d;"id"===r&&(n={...d},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await i.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||o.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof s.default))throw t;return a.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await u.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let i;if("object"==typeof e){const{schemaId:t}=this.opts;if(i=e[t],void 0!==i&&"string"!=typeof i)throw new Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new c.SchemaEnv({schema:{},schemaId:r});if(t=c.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=S.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,l.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(A.call(this,r,t),!t)return(0,f.eachItem)(r,(e=>x.call(this,e))),this;P.call(this,t);const n={...t,type:(0,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)};return(0,f.eachItem)(r,0===n.type.length?e=>x.call(this,e,n):e=>n.type.forEach((t=>x.call(this,e,n,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex((t=>t.keyword===e));t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map((e=>`${r}${e.instancePath} ${e.message}`)).reduce(((e,r)=>e+t+r)):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let i=e;for(const e of t)i=i[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,o=i[e];n&&o&&(i[e]=C(o))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let o;const{schemaId:s}=this.opts;if("object"==typeof e)o=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let a=this._cache.get(e);if(void 0!==a)return a;r=(0,l.normalizeId)(o||r);const u=l.getSchemaRefs.call(this,e,r);return a=new c.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:u}),this._cache.set(a.schema,a),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=a),n&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):c.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{c.compileSchema.call(this,e)}finally{this.opts=t}}}function E(e,t,r,n="error"){for(const i in e){const o=i;o in t&&this.logger[n](`${r}: option ${i}. ${e[o]}`)}}function S(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function O(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function I(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function T(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function k(){const e={...this.opts};for(const t of y)delete e[t];return e}t.default=w,w.ValidationError=o.default,w.MissingRefError=s.default;const D={log(){},warn(){},error(){}},N=/^[a-z_$][a-z0-9_$:-]*$/i;function A(e,t){const{RULES:r}=this;if((0,f.eachItem)(e,(e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!N.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function x(e,t,r){var n;const i=null==t?void 0:t.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let s=i?o.post:o.rules.find((({type:e})=>e===r));if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)}};t.before?R.call(this,s,a,t.before):s.rules.push(a),o.all[e]=a,null===(n=t.implements)||void 0===n||n.forEach((e=>this.addKeyword(e)))}function R(e,t,r){const n=e.rules.findIndex((e=>e.keyword===r));n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function P(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=C(t)),e.validateSchema=this.compile(t,!0))}const j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function C(e){return{anyOf:[e,j]}}},4285:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6471);n.code='require("ajv/dist/runtime/equal").default',t.default=n},9161:(e,t)=>{"use strict";function r(e){const t=e.length;let r,n=0,i=0;for(;i<t;)n++,r=e.charCodeAt(i++),r>=55296&&r<=56319&&i<t&&(r=e.charCodeAt(i),56320==(64512&r)&&i++);return n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},407:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2371);n.code='require("ajv/dist/runtime/uri").default',t.default=n},6448:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=r},8891:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const n=r(5669),i=r(8936),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{parentSchema:t,it:r}=e,{items:n}=t;Array.isArray(n)?s(e,n):(0,i.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function s(e,t){const{gen:r,schema:o,data:s,keyword:a,it:c}=e;c.items=!0;const u=r.const("len",n._`${s}.length`);if(!1===o)e.setParams({len:t.length}),e.pass(n._`${u} <= ${t.length}`);else if("object"==typeof o&&!(0,i.alwaysValidSchema)(c,o)){const o=r.var("valid",n._`${u} <= ${t.length}`);r.if((0,n.not)(o),(()=>function(o){r.forRange("i",t.length,u,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:i.Type.Num},o),c.allErrors||r.if((0,n.not)(o),(()=>r.break()))}))}(o))),e.ok(o)}}t.validateAdditionalItems=s,t.default=o},4943:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3499),i=r(5669),o=r(7250),s=r(8936),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>i._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:r,parentSchema:a,data:c,errsCount:u,it:l}=e;if(!u)throw new Error("ajv implementation error");const{allErrors:h,opts:f}=l;if(l.props=!0,"all"!==f.removeAdditional&&(0,s.alwaysValidSchema)(l,r))return;const d=(0,n.allSchemaProperties)(a.properties),p=(0,n.allSchemaProperties)(a.patternProperties);function m(e){t.code(i._`delete ${c}[${e}]`)}function y(n){if("all"===f.removeAdditional||f.removeAdditional&&!1===r)m(n);else{if(!1===r)return e.setParams({additionalProperty:n}),e.error(),void(h||t.break());if("object"==typeof r&&!(0,s.alwaysValidSchema)(l,r)){const r=t.name("valid");"failing"===f.removeAdditional?(v(n,r,!1),t.if((0,i.not)(r),(()=>{e.reset(),m(n)}))):(v(n,r),h||t.if((0,i.not)(r),(()=>t.break())))}}}function v(t,r,n){const i={keyword:"additionalProperties",dataProp:t,dataPropType:s.Type.Str};!1===n&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,r)}t.forIn("key",c,(r=>{d.length||p.length?t.if(function(r){let o;if(d.length>8){const e=(0,s.schemaRefOrVal)(l,a.properties,"properties");o=(0,n.isOwnProperty)(t,e,r)}else o=d.length?(0,i.or)(...d.map((e=>i._`${r} === ${e}`))):i.nil;return p.length&&(o=(0,i.or)(o,...p.map((t=>i._`${(0,n.usePattern)(e,t)}.test(${r})`)))),(0,i.not)(o)}(r),(()=>y(r))):y(r)})),e.ok(i._`${u} === ${o.default.errors}`)}};t.default=a},2609:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8936),i={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const o=t.name("valid");r.forEach(((t,r)=>{if((0,n.alwaysValidSchema)(i,t))return;const s=e.subschema({keyword:"allOf",schemaProp:r},o);e.ok(o),e.mergeEvaluated(s)}))}};t.default=i},4279:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(3499).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=n},5609:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?n.str`must contain at least ${e} valid item(s)`:n.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?n._`{minContains: ${e}}`:n._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:r,parentSchema:o,data:s,it:a}=e;let c,u;const{minContains:l,maxContains:h}=o;a.opts.next?(c=void 0===l?1:l,u=h):c=1;const f=t.const("len",n._`${s}.length`);if(e.setParams({min:c,max:u}),void 0===u&&0===c)return void(0,i.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==u&&c>u)return(0,i.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,i.alwaysValidSchema)(a,r)){let t=n._`${f} >= ${c}`;return void 0!==u&&(t=n._`${t} && ${f} <= ${u}`),void e.pass(t)}a.items=!0;const d=t.name("valid");function p(){const e=t.name("_valid"),r=t.let("count",0);m(e,(()=>t.if(e,(()=>function(e){t.code(n._`${e}++`),void 0===u?t.if(n._`${e} >= ${c}`,(()=>t.assign(d,!0).break())):(t.if(n._`${e} > ${u}`,(()=>t.assign(d,!1).break())),1===c?t.assign(d,!0):t.if(n._`${e} >= ${c}`,(()=>t.assign(d,!0))))}(r)))))}function m(r,n){t.forRange("i",0,f,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:i.Type.Num,compositeRule:!0},r),n()}))}void 0===u&&1===c?m(d,(()=>t.if(d,(()=>t.break())))):0===c?(t.let(d,!0),void 0!==u&&t.if(n._`${s}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,(()=>e.reset()))}};t.default=o},5463:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const n=r(5669),i=r(8936),o=r(3499);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>{const i=1===t?"property":"properties";return n.str`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>n._`{property: ${e},
|
|
5
|
+
|| ${a} === "boolean" || ${i} === null`).assign(c,s._`[${i}]`)}}n.else(),p(e),n.endIf(),n.if(s._`${c} !== undefined`,(()=>{n.assign(i,c),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(s._`${t} !== undefined`,(()=>e.assign(s._`${t}[${r}]`,n)))}(e,c)}))}(e,t,a):p(e)}))}return u};const l=new Set(["string","number","integer","boolean","null"]);function h(e,t,r,n=c.Correct){const i=n===c.Correct?s.operators.EQ:s.operators.NEQ;let o;switch(e){case"null":return s._`${t} ${i} null`;case"array":o=s._`Array.isArray(${t})`;break;case"object":o=s._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=a(s._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=a();break;default:return s._`typeof ${t} ${i} ${e}`}return n===c.Correct?o:(0,s.not)(o);function a(e=s.nil){return(0,s.and)(s._`typeof ${t} == "number"`,e,r?s._`isFinite(${t})`:s.nil)}}function f(e,t,r,n){if(1===e.length)return h(e[0],t,r,n);let i;const o=(0,a.toHash)(e);if(o.array&&o.object){const e=s._`typeof ${t} != "object"`;i=o.null?e:s._`!${t} || ${e}`,delete o.null,delete o.array,delete o.object}else i=s.nil;o.number&&delete o.integer;for(const e in o)i=(0,s.and)(i,h(e,t,r,n));return i}t.checkDataType=h,t.checkDataTypes=f;const d={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?s._`{type: ${e}}`:s._`{type: ${t}}`};function p(e){const t=function(e){const{gen:t,data:r,schema:n}=e,i=(0,a.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}(e);(0,o.reportError)(t,d)}t.reportTypeError=p},1481:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const n=r(5669),i=r(8936);function o(e,t,r){const{gen:o,compositeRule:s,data:a,opts:c}=e;if(void 0===r)return;const u=n._`${a}${(0,n.getProperty)(t)}`;if(s)return void(0,i.checkStrictMode)(e,`default is ignored for: ${u}`);let l=n._`${u} === undefined`;"empty"===c.useDefaults&&(l=n._`${l} || ${u} === null || ${u} === ""`),o.if(l,n._`${u} = ${(0,n.stringify)(r)}`)}t.assignDefaults=function(e,t){const{properties:r,items:n}=e.schema;if("object"===t&&r)for(const t in r)o(e,t,r[t].default);else"array"===t&&Array.isArray(n)&&n.forEach(((t,r)=>o(e,r,t.default)))}},1686:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const n=r(2171),i=r(7332),o=r(9073),s=r(7332),a=r(1481),c=r(5782),u=r(8878),l=r(5669),h=r(7250),f=r(6696),d=r(8936),p=r(6930);function m({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},o){i.code.es5?e.func(t,l._`${h.default.data}, ${h.default.valCxt}`,n.$async,(()=>{e.code(l._`"use strict"; ${y(r,i)}`),function(e,t){e.if(h.default.valCxt,(()=>{e.var(h.default.instancePath,l._`${h.default.valCxt}.${h.default.instancePath}`),e.var(h.default.parentData,l._`${h.default.valCxt}.${h.default.parentData}`),e.var(h.default.parentDataProperty,l._`${h.default.valCxt}.${h.default.parentDataProperty}`),e.var(h.default.rootData,l._`${h.default.valCxt}.${h.default.rootData}`),t.dynamicRef&&e.var(h.default.dynamicAnchors,l._`${h.default.valCxt}.${h.default.dynamicAnchors}`)}),(()=>{e.var(h.default.instancePath,l._`""`),e.var(h.default.parentData,l._`undefined`),e.var(h.default.parentDataProperty,l._`undefined`),e.var(h.default.rootData,h.default.data),t.dynamicRef&&e.var(h.default.dynamicAnchors,l._`{}`)}))}(e,i),e.code(o)})):e.func(t,l._`${h.default.data}, ${function(e){return l._`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${e.dynamicRef?l._`, ${h.default.dynamicAnchors}={}`:l.nil}}={}`}(i)}`,n.$async,(()=>e.code(y(r,i)).code(o)))}function y(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?l._`/*# sourceURL=${r} */`:l.nil}function v({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function g(e){return"boolean"!=typeof e.schema}function b(e){(0,d.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function _(e,t){if(e.opts.jtd)return E(e,[],!1,t);const r=(0,i.getSchemaTypes)(e.schema);E(e,r,!(0,i.coerceAndCheckDataType)(e,r),t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){const o=r.$comment;if(!0===i.$comment)e.code(l._`${h.default.self}.logger.log(${o})`);else if("function"==typeof i.$comment){const r=l.str`${n}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code(l._`${h.default.self}.opts.$comment(${o}, ${r}, ${i}.schema)`)}}function E(e,t,r,n){const{gen:i,schema:a,data:c,allErrors:u,opts:f,self:p}=e,{RULES:m}=p;function y(d){(0,o.shouldUseGroup)(a,d)&&(d.type?(i.if((0,s.checkDataType)(d.type,c,f.strictNumbers)),S(e,d),1===t.length&&t[0]===d.type&&r&&(i.else(),(0,s.reportTypeError)(e)),i.endIf()):S(e,d),u||i.if(l._`${h.default.errors} === ${n||0}`))}!a.$ref||!f.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(a,m)?(f.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach((t=>{O(e.dataTypes,t)||I(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const r=[];for(const n of e.dataTypes)O(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&I(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const r=e.self.RULES.all;for(const n in r){const i=r[n];if("object"==typeof i&&(0,o.shouldUseRule)(e.schema,i)){const{type:r}=i.definition;r.length&&!r.some((e=>{return n=e,(r=t).includes(n)||"number"===n&&r.includes("integer");var r,n}))&&I(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes))}(e,t),i.block((()=>{for(const e of m.rules)y(e);y(m.post)}))):i.block((()=>k(e,"$ref",m.all.$ref.definition)))}function S(e,t){const{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,a.assignDefaults)(e,t.type),r.block((()=>{for(const r of t.rules)(0,o.shouldUseRule)(n,r)&&k(e,r.keyword,r.definition,t.type)}))}function O(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function I(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){g(e)&&(b(e),v(e))?function(e){const{schema:t,opts:r,gen:n}=e;m(e,(()=>{r.$comment&&t.$comment&&w(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(h.default.vErrors,null),n.let(h.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",l._`${r}.evaluated`),t.if(l._`${e.evaluated}.dynamicProps`,(()=>t.assign(l._`${e.evaluated}.props`,l._`undefined`))),t.if(l._`${e.evaluated}.dynamicItems`,(()=>t.assign(l._`${e.evaluated}.items`,l._`undefined`)))}(e),_(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=e;r.$async?t.if(l._`${h.default.errors} === 0`,(()=>t.return(h.default.data)),(()=>t.throw(l._`new ${i}(${h.default.vErrors})`))):(t.assign(l._`${n}.errors`,h.default.vErrors),o.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof l.Name&&e.assign(l._`${t}.props`,r),n instanceof l.Name&&e.assign(l._`${t}.items`,n)}(e),t.return(l._`${h.default.errors} === 0`))}(e)}))}(e):m(e,(()=>(0,n.topBoolOrEmptySchema)(e)))};class T{constructor(e,t,r){if((0,c.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",A(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,c.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",h.default.errors))}result(e,t,r){this.failResult((0,l.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,l.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(l._`${t} !== undefined && (${(0,l.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?p.reportExtraError:p.reportError)(this,this.def.error,t)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=l.nil){this.gen.block((()=>{this.check$data(e,r),t()}))}check$data(e=l.nil,t=l.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:i,def:o}=this;r.if((0,l.or)(l._`${n} === undefined`,t)),e!==l.nil&&r.assign(e,!0),(i.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==l.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:i}=this;return(0,l.or)(function(){if(r.length){if(!(t instanceof l.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return l._`${(0,s.checkDataTypes)(e,t,i.opts.strictNumbers,s.DataType.Wrong)}`}return l.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return l._`!${r}(${t})`}return l.nil}())}subschema(e,t){const r=(0,u.getSubschema)(this.it,e);(0,u.extendSubschemaData)(r,this.it,e),(0,u.extendSubschemaMode)(r,e);const i={...this.it,...r,items:void 0,props:void 0};return function(e,t){g(e)&&(b(e),v(e))?function(e,t){const{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&w(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,f.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const o=n.const("_errs",h.default.errors);_(e,o),n.var(t,l._`${o} === ${h.default.errors}`)}(e,t):(0,n.boolOrEmptySchema)(e,t)}(i,t),i}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,(()=>this.mergeEvaluated(e,l.Name))),!0}}function k(e,t,r,n){const i=new T(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,c.funcKeywordCode)(i,r):"macro"in r?(0,c.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,c.funcKeywordCode)(i,r)}t.KeywordCxt=T;const N=/^\/(?:[^~]|~0|~1)*$/,D=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function A(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,o;if(""===e)return h.default.rootData;if("/"===e[0]){if(!N.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,o=h.default.rootData}else{const s=D.exec(e);if(!s)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+s[1];if(i=s[2],"#"===i){if(a>=t)throw new Error(c("property/index",a));return n[t-a]}if(a>t)throw new Error(c("data",a));if(o=r[t-a],!i)return o}let s=o;const a=i.split("/");for(const e of a)e&&(o=l._`${o}${(0,l.getProperty)((0,d.unescapeJsonPointer)(e))}`,s=l._`${s} && ${o}`);return s;function c(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=A},5782:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const n=r(5669),i=r(7250),o=r(3499),s=r(6930);function a(e){const{gen:t,data:r,it:i}=e;t.if(i.parentData,(()=>t.assign(r,n._`${i.parentData}[${i.parentDataProperty}]`)))}function c(e,t,r){if(void 0===r)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,n.stringify)(r)})}t.macroKeywordCode=function(e,t){const{gen:r,keyword:i,schema:o,parentSchema:s,it:a}=e,u=t.macro.call(a.self,o,s,a),l=c(r,i,u);!1!==a.opts.validateSchema&&a.self.validateSchema(u,!0);const h=r.name("valid");e.subschema({schema:u,schemaPath:n.nil,errSchemaPath:`${a.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},h),e.pass(h,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var r;const{gen:u,keyword:l,schema:h,parentSchema:f,$data:d,it:p}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(p,t);const m=!d&&t.compile?t.compile.call(p.self,h,f,p):t.validate,y=c(u,l,m),v=u.let("valid");function g(r=(t.async?n._`await `:n.nil)){const s=p.opts.passContext?i.default.this:i.default.self,a=!("compile"in t&&!d||!1===t.schema);u.assign(v,n._`${r}${(0,o.callValidateCode)(e,y,s,a)}`,t.modifying)}function b(e){var r;u.if((0,n.not)(null!==(r=t.valid)&&void 0!==r?r:v),e)}e.block$data(v,(function(){if(!1===t.errors)g(),t.modifying&&a(e),b((()=>e.error()));else{const r=t.async?function(){const e=u.let("ruleErrs",null);return u.try((()=>g(n._`await `)),(t=>u.assign(v,!1).if(n._`${t} instanceof ${p.ValidationError}`,(()=>u.assign(e,n._`${t}.errors`)),(()=>u.throw(t))))),e}():function(){const e=n._`${y}.errors`;return u.assign(e,null),g(n.nil),e}();t.modifying&&a(e),b((()=>function(e,t){const{gen:r}=e;r.if(n._`Array.isArray(${t})`,(()=>{r.assign(i.default.vErrors,n._`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,n._`${i.default.vErrors}.length`),(0,s.extendErrors)(e)}),(()=>e.error()))}(e,r)))}})),e.ok(null!==(r=t.valid)&&void 0!==r?r:v)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");const s=i.dependencies;if(null==s?void 0:s.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[o])){const e=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},8878:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const n=r(5669),i=r(8936);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:o,schemaPath:s,errSchemaPath:a,topSchemaRef:c}){if(void 0!==t&&void 0!==o)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const o=e.schema[t];return void 0===r?{schema:o,schemaPath:n._`${e.schemaPath}${(0,n.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:o[r],schemaPath:n._`${e.schemaPath}${(0,n.getProperty)(t)}${(0,n.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(r)}`}}if(void 0!==o){if(void 0===s||void 0===a||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:s,topSchemaRef:c,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:o,data:s,dataTypes:a,propertyName:c}){if(void 0!==s&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=t;if(void 0!==r){const{errorPath:s,dataPathArr:a,opts:c}=t;l(u.let("data",n._`${t.data}${(0,n.getProperty)(r)}`,!0)),e.errorPath=n.str`${s}${(0,i.getErrorPath)(r,o,c.jsPropertySyntax)}`,e.parentDataProperty=n._`${r}`,e.dataPathArr=[...a,e.parentDataProperty]}function l(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==s&&(l(s instanceof n.Name?s:u.let("data",s,!0)),void 0!==c&&(e.propertyName=c)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){void 0!==n&&(e.compositeRule=n),void 0!==i&&(e.createErrors=i),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}},8355:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var n=r(1686);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return n.KeywordCxt}});var i=r(5669);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});const o=r(6448),s=r(1578),a=r(2881),c=r(7382),u=r(5669),l=r(6696),h=r(7332),f=r(8936),d=r(1143),p=r(407),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";const y=["removeAdditional","useDefaults","coerceTypes"],v=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},b={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function _(e){var t,r,n,i,o,s,a,c,u,l,h,f,d,y,v,g,b,_,w,E,S,O,I,T,k;const N=e.strict,D=null===(t=e.code)||void 0===t?void 0:t.optimize,A=!0===D||void 0===D?1:D||0,x=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:m,R=null!==(i=e.uriResolver)&&void 0!==i?i:p.default;return{strictSchema:null===(s=null!==(o=e.strictSchema)&&void 0!==o?o:N)||void 0===s||s,strictNumbers:null===(c=null!==(a=e.strictNumbers)&&void 0!==a?a:N)||void 0===c||c,strictTypes:null!==(l=null!==(u=e.strictTypes)&&void 0!==u?u:N)&&void 0!==l?l:"log",strictTuples:null!==(f=null!==(h=e.strictTuples)&&void 0!==h?h:N)&&void 0!==f?f:"log",strictRequired:null!==(y=null!==(d=e.strictRequired)&&void 0!==d?d:N)&&void 0!==y&&y,code:e.code?{...e.code,optimize:A,regExp:x}:{optimize:A,regExp:x},loopRequired:null!==(v=e.loopRequired)&&void 0!==v?v:200,loopEnum:null!==(g=e.loopEnum)&&void 0!==g?g:200,meta:null===(b=e.meta)||void 0===b||b,messages:null===(_=e.messages)||void 0===_||_,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==(E=e.schemaId)&&void 0!==E?E:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(O=e.validateSchema)||void 0===O||O,validateFormats:null===(I=e.validateFormats)||void 0===I||I,unicodeRegExp:null===(T=e.unicodeRegExp)||void 0===T||T,int32range:null===(k=e.int32range)||void 0===k||k,uriResolver:R}}class w{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,..._(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:v,es5:t,lines:r}),this.logger=function(e){if(!1===e)return N;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),E.call(this,g,e,"NOT SUPPORTED"),E.call(this,b,e,"DEPRECATED","warn"),this._metaOpts=k.call(this),e.formats&&I.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&T.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),O.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=d;"id"===r&&(n={...d},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await i.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||o.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof s.default))throw t;return a.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await u.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let i;if("object"==typeof e){const{schemaId:t}=this.opts;if(i=e[t],void 0!==i&&"string"!=typeof i)throw new Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new c.SchemaEnv({schema:{},schemaId:r});if(t=c.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=S.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,l.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(A.call(this,r,t),!t)return(0,f.eachItem)(r,(e=>x.call(this,e))),this;P.call(this,t);const n={...t,type:(0,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)};return(0,f.eachItem)(r,0===n.type.length?e=>x.call(this,e,n):e=>n.type.forEach((t=>x.call(this,e,n,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex((t=>t.keyword===e));t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map((e=>`${r}${e.instancePath} ${e.message}`)).reduce(((e,r)=>e+t+r)):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let i=e;for(const e of t)i=i[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,o=i[e];n&&o&&(i[e]=j(o))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let o;const{schemaId:s}=this.opts;if("object"==typeof e)o=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let a=this._cache.get(e);if(void 0!==a)return a;r=(0,l.normalizeId)(o||r);const u=l.getSchemaRefs.call(this,e,r);return a=new c.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:u}),this._cache.set(a.schema,a),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=a),n&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):c.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{c.compileSchema.call(this,e)}finally{this.opts=t}}}function E(e,t,r,n="error"){for(const i in e){const o=i;o in t&&this.logger[n](`${r}: option ${i}. ${e[o]}`)}}function S(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function O(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function I(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function T(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function k(){const e={...this.opts};for(const t of y)delete e[t];return e}t.default=w,w.ValidationError=o.default,w.MissingRefError=s.default;const N={log(){},warn(){},error(){}},D=/^[a-z_$][a-z0-9_$:-]*$/i;function A(e,t){const{RULES:r}=this;if((0,f.eachItem)(e,(e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!D.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function x(e,t,r){var n;const i=null==t?void 0:t.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let s=i?o.post:o.rules.find((({type:e})=>e===r));if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)}};t.before?R.call(this,s,a,t.before):s.rules.push(a),o.all[e]=a,null===(n=t.implements)||void 0===n||n.forEach((e=>this.addKeyword(e)))}function R(e,t,r){const n=e.rules.findIndex((e=>e.keyword===r));n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function P(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=j(t)),e.validateSchema=this.compile(t,!0))}const C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function j(e){return{anyOf:[e,C]}}},4285:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6471);n.code='require("ajv/dist/runtime/equal").default',t.default=n},9161:(e,t)=>{"use strict";function r(e){const t=e.length;let r,n=0,i=0;for(;i<t;)n++,r=e.charCodeAt(i++),r>=55296&&r<=56319&&i<t&&(r=e.charCodeAt(i),56320==(64512&r)&&i++);return n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},407:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2371);n.code='require("ajv/dist/runtime/uri").default',t.default=n},6448:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=r},8891:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const n=r(5669),i=r(8936),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{parentSchema:t,it:r}=e,{items:n}=t;Array.isArray(n)?s(e,n):(0,i.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function s(e,t){const{gen:r,schema:o,data:s,keyword:a,it:c}=e;c.items=!0;const u=r.const("len",n._`${s}.length`);if(!1===o)e.setParams({len:t.length}),e.pass(n._`${u} <= ${t.length}`);else if("object"==typeof o&&!(0,i.alwaysValidSchema)(c,o)){const o=r.var("valid",n._`${u} <= ${t.length}`);r.if((0,n.not)(o),(()=>function(o){r.forRange("i",t.length,u,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:i.Type.Num},o),c.allErrors||r.if((0,n.not)(o),(()=>r.break()))}))}(o))),e.ok(o)}}t.validateAdditionalItems=s,t.default=o},4943:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3499),i=r(5669),o=r(7250),s=r(8936),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>i._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:r,parentSchema:a,data:c,errsCount:u,it:l}=e;if(!u)throw new Error("ajv implementation error");const{allErrors:h,opts:f}=l;if(l.props=!0,"all"!==f.removeAdditional&&(0,s.alwaysValidSchema)(l,r))return;const d=(0,n.allSchemaProperties)(a.properties),p=(0,n.allSchemaProperties)(a.patternProperties);function m(e){t.code(i._`delete ${c}[${e}]`)}function y(n){if("all"===f.removeAdditional||f.removeAdditional&&!1===r)m(n);else{if(!1===r)return e.setParams({additionalProperty:n}),e.error(),void(h||t.break());if("object"==typeof r&&!(0,s.alwaysValidSchema)(l,r)){const r=t.name("valid");"failing"===f.removeAdditional?(v(n,r,!1),t.if((0,i.not)(r),(()=>{e.reset(),m(n)}))):(v(n,r),h||t.if((0,i.not)(r),(()=>t.break())))}}}function v(t,r,n){const i={keyword:"additionalProperties",dataProp:t,dataPropType:s.Type.Str};!1===n&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,r)}t.forIn("key",c,(r=>{d.length||p.length?t.if(function(r){let o;if(d.length>8){const e=(0,s.schemaRefOrVal)(l,a.properties,"properties");o=(0,n.isOwnProperty)(t,e,r)}else o=d.length?(0,i.or)(...d.map((e=>i._`${r} === ${e}`))):i.nil;return p.length&&(o=(0,i.or)(o,...p.map((t=>i._`${(0,n.usePattern)(e,t)}.test(${r})`)))),(0,i.not)(o)}(r),(()=>y(r))):y(r)})),e.ok(i._`${u} === ${o.default.errors}`)}};t.default=a},2609:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8936),i={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const o=t.name("valid");r.forEach(((t,r)=>{if((0,n.alwaysValidSchema)(i,t))return;const s=e.subschema({keyword:"allOf",schemaProp:r},o);e.ok(o),e.mergeEvaluated(s)}))}};t.default=i},4279:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(3499).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=n},5609:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?n.str`must contain at least ${e} valid item(s)`:n.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?n._`{minContains: ${e}}`:n._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:r,parentSchema:o,data:s,it:a}=e;let c,u;const{minContains:l,maxContains:h}=o;a.opts.next?(c=void 0===l?1:l,u=h):c=1;const f=t.const("len",n._`${s}.length`);if(e.setParams({min:c,max:u}),void 0===u&&0===c)return void(0,i.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==u&&c>u)return(0,i.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,i.alwaysValidSchema)(a,r)){let t=n._`${f} >= ${c}`;return void 0!==u&&(t=n._`${t} && ${f} <= ${u}`),void e.pass(t)}a.items=!0;const d=t.name("valid");function p(){const e=t.name("_valid"),r=t.let("count",0);m(e,(()=>t.if(e,(()=>function(e){t.code(n._`${e}++`),void 0===u?t.if(n._`${e} >= ${c}`,(()=>t.assign(d,!0).break())):(t.if(n._`${e} > ${u}`,(()=>t.assign(d,!1).break())),1===c?t.assign(d,!0):t.if(n._`${e} >= ${c}`,(()=>t.assign(d,!0))))}(r)))))}function m(r,n){t.forRange("i",0,f,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:i.Type.Num,compositeRule:!0},r),n()}))}void 0===u&&1===c?m(d,(()=>t.if(d,(()=>t.break())))):0===c?(t.let(d,!0),void 0!==u&&t.if(n._`${s}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,(()=>e.reset()))}};t.default=o},5463:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const n=r(5669),i=r(8936),o=r(3499);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>{const i=1===t?"property":"properties";return n.str`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>n._`{property: ${e},
|
|
6
6
|
missingProperty: ${i},
|
|
7
7
|
depsCount: ${t},
|
|
8
|
-
deps: ${r}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e)"__proto__"!==n&&((Array.isArray(e[n])?t:r)[n]=e[n]);return[t,r]}(e);a(e,t),c(e,r)}};function a(e,t=e.schema){const{gen:r,data:i,it:s}=e;if(0===Object.keys(t).length)return;const a=r.let("missing");for(const c in t){const u=t[c];if(0===u.length)continue;const l=(0,o.propertyInData)(r,i,c,s.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")}),s.allErrors?r.if(l,(()=>{for(const t of u)(0,o.checkReportMissingProp)(e,t)})):(r.if(n._`${l} && (${(0,o.checkMissingProp)(e,u,a)})`),(0,o.reportMissingProp)(e,a),r.else())}}function c(e,t=e.schema){const{gen:r,data:n,keyword:s,it:a}=e,c=r.name("valid");for(const u in t)(0,i.alwaysValidSchema)(a,t[u])||(r.if((0,o.propertyInData)(r,n,u,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:s,schemaProp:u},c);e.mergeValidEvaluated(t,c)}),(()=>r.var(c,!0))),e.ok(c))}t.validatePropertyDeps=a,t.validateSchemaDeps=c,t.default=s},76:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>n.str`must match "${e.ifClause}" schema`,params:({params:e})=>n._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:r,it:o}=e;void 0===r.then&&void 0===r.else&&(0,i.checkStrictMode)(o,'"if" without "then" and "else" is ignored');const a=s(o,"then"),c=s(o,"else");if(!a&&!c)return;const u=t.let("valid",!0),l=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(t)}(),e.reset(),a&&c){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(l,h("then",r),h("else",r))}else a?t.if(l,h("then")):t.if((0,n.not)(l),h("else"));function h(r,i){return()=>{const o=e.subschema({keyword:r},l);t.assign(u,l),e.mergeValidEvaluated(o,u),i?t.assign(i,n._`${r}`):e.setParams({ifClause:r})}}e.pass(u,(()=>e.error(!0)))}};function s(e,t){const r=e.schema[t];return void 0!==r&&!(0,i.alwaysValidSchema)(e,r)}t.default=o},6951:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8891),i=r(1162),o=r(8634),s=r(5151),a=r(5609),c=r(5463),u=r(3021),l=r(4943),h=r(4243),f=r(8103),d=r(2869),p=r(4279),m=r(4880),y=r(2609),v=r(76),g=r(5316);t.default=function(e=!1){const t=[d.default,p.default,m.default,y.default,v.default,g.default,u.default,l.default,c.default,h.default,f.default];return e?t.push(i.default,s.default):t.push(n.default,o.default),t.push(a.default),t}},8634:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const n=r(5669),i=r(8936),o=r(3499),s={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return a(e,"additionalItems",t);r.items=!0,(0,i.alwaysValidSchema)(r,t)||e.ok((0,o.validateArray)(e))}};function a(e,t,r=e.schema){const{gen:o,parentSchema:s,data:a,keyword:c,it:u}=e;!function(e){const{opts:n,errSchemaPath:o}=u,s=r.length,a=s===e.minItems&&(s===e.maxItems||!1===e[t]);if(n.strictTuples&&!a){const e=`"${c}" is ${s}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,i.checkStrictMode)(u,e,n.strictTuples)}}(s),u.opts.unevaluated&&r.length&&!0!==u.items&&(u.items=i.mergeEvaluated.items(o,r.length,u.items));const l=o.name("valid"),h=o.const("len",n._`${a}.length`);r.forEach(((t,r)=>{(0,i.alwaysValidSchema)(u,t)||(o.if(n._`${h} > ${r}`,(()=>e.subschema({keyword:c,schemaProp:r,dataProp:r},l))),e.ok(l))}))}t.validateTuple=a,t.default=s},5151:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o=r(3499),s=r(8891),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:a}=r;n.items=!0,(0,i.alwaysValidSchema)(n,t)||(a?(0,s.validateAdditionalItems)(e,a):e.ok((0,o.validateArray)(e)))}};t.default=a},2869:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8936),i={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:i}=e;if((0,n.alwaysValidSchema)(i,r))return void e.fail();const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=i},4880:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>n._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:r,parentSchema:o,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&o.discriminator)return;const a=r,c=t.let("valid",!1),u=t.let("passing",null),l=t.name("_valid");e.setParams({passing:u}),t.block((function(){a.forEach(((r,o)=>{let a;(0,i.alwaysValidSchema)(s,r)?t.var(l,!0):a=e.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},l),o>0&&t.if(n._`${l} && ${c}`).assign(c,!1).assign(u,n._`[${u}, ${o}]`).else(),t.if(l,(()=>{t.assign(c,!0),t.assign(u,o),a&&e.mergeEvaluated(a,n.Name)}))}))})),e.result(c,(()=>e.reset()),(()=>e.error(!0)))}};t.default=o},8103:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3499),i=r(5669),o=r(8936),s=r(8936),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:a,parentSchema:c,it:u}=e,{opts:l}=u,h=(0,n.allSchemaProperties)(r),f=h.filter((e=>(0,o.alwaysValidSchema)(u,r[e])));if(0===h.length||f.length===h.length&&(!u.opts.unevaluated||!0===u.props))return;const d=l.strictSchema&&!l.allowMatchingProperties&&c.properties,p=t.name("valid");!0===u.props||u.props instanceof i.Name||(u.props=(0,s.evaluatedPropsToName)(t,u.props));const{props:m}=u;function y(e){for(const t in d)new RegExp(e).test(t)&&(0,o.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){t.forIn("key",a,(o=>{t.if(i._`${(0,n.usePattern)(e,r)}.test(${o})`,(()=>{const n=f.includes(r);n||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:o,dataPropType:s.Type.Str},p),u.opts.unevaluated&&!0!==m?t.assign(i._`${m}[${o}]`,!0):n||u.allErrors||t.if((0,i.not)(p),(()=>t.break()))}))}))}!function(){for(const e of h)d&&y(e),u.allErrors?v(e):(t.var(p,!0),v(e),t.if(p))}()}};t.default=a},1162:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8634),i={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,n.validateTuple)(e,"items")};t.default=i},4243:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1686),i=r(3499),o=r(8936),s=r(4943),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:a,data:c,it:u}=e;"all"===u.opts.removeAdditional&&void 0===a.additionalProperties&&s.default.code(new n.KeywordCxt(u,s.default,"additionalProperties"));const l=(0,i.allSchemaProperties)(r);for(const e of l)u.definedProperties.add(e);u.opts.unevaluated&&l.length&&!0!==u.props&&(u.props=o.mergeEvaluated.props(t,(0,o.toHash)(l),u.props));const h=l.filter((e=>!(0,o.alwaysValidSchema)(u,r[e])));if(0===h.length)return;const f=t.name("valid");for(const r of h)d(r)?p(r):(t.if((0,i.propertyInData)(t,c,r,u.opts.ownProperties)),p(r),u.allErrors||t.else().var(f,!0),t.endIf()),e.it.definedProperties.add(r),e.ok(f);function d(e){return u.opts.useDefaults&&!u.compositeRule&&void 0!==r[e].default}function p(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},f)}}};t.default=a},3021:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>n._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:r,data:o,it:s}=e;if((0,i.alwaysValidSchema)(s,r))return;const a=t.name("valid");t.forIn("key",o,(r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},a),t.if((0,n.not)(a),(()=>{e.error(!0),s.allErrors||t.break()}))})),e.ok(a)}};t.default=o},5316:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8936),i={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,n.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};t.default=i},3499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const n=r(5669),i=r(8936),o=r(7250),s=r(8936);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:n._`Object.prototype.hasOwnProperty`})}function c(e,t,r){return n._`${a(e)}.call(${t}, ${r})`}function u(e,t,r,i){const o=n._`${t}${(0,n.getProperty)(r)} === undefined`;return i?(0,n.or)(o,(0,n.not)(c(e,t,r))):o}function l(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:r,data:i,it:o}=e;r.if(u(r,i,t,o.opts.ownProperties),(()=>{e.setParams({missingProperty:n._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},i,o){return(0,n.or)(...i.map((i=>(0,n.and)(u(e,t,i,r.ownProperties),n._`${o} = ${i}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=c,t.propertyInData=function(e,t,r,i){const o=n._`${t}${(0,n.getProperty)(r)} !== undefined`;return i?n._`${o} && ${c(e,t,r)}`:o},t.noPropertyInData=u,t.allSchemaProperties=l,t.schemaProperties=function(e,t){return l(t).filter((r=>!(0,i.alwaysValidSchema)(e,t[r])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:s,errorPath:a},it:c},u,l,h){const f=h?n._`${e}, ${t}, ${i}${s}`:t,d=[[o.default.instancePath,(0,n.strConcat)(o.default.instancePath,a)],[o.default.parentData,c.parentData],[o.default.parentDataProperty,c.parentDataProperty],[o.default.rootData,o.default.rootData]];c.opts.dynamicRef&&d.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);const p=n._`${f}, ${r.object(...d)}`;return l!==n.nil?n._`${u}.call(${l}, ${p})`:n._`${u}(${p})`};const h=n._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){const i=t.unicodeRegExp?"u":"",{regExp:o}=t.code,a=o(r,i);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:n._`${"new RegExp"===o.code?h:(0,s.useFunc)(e,o)}(${r}, ${i})`})},t.validateArray=function(e){const{gen:t,data:r,keyword:o,it:s}=e,a=t.name("valid");if(s.allErrors){const e=t.let("valid",!0);return c((()=>t.assign(e,!1))),e}return t.var(a,!0),c((()=>t.break())),a;function c(s){const c=t.const("len",n._`${r}.length`);t.forRange("i",0,c,(r=>{e.subschema({keyword:o,dataProp:r,dataPropType:i.Type.Num},a),t.if((0,n.not)(a),s)}))}},t.validateUnion=function(e){const{gen:t,schema:r,keyword:o,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some((e=>(0,i.alwaysValidSchema)(s,e)))&&!s.opts.unevaluated)return;const a=t.let("valid",!1),c=t.name("_valid");t.block((()=>r.forEach(((r,i)=>{const s=e.subschema({keyword:o,schemaProp:i,compositeRule:!0},c);t.assign(a,n._`${a} || ${c}`),e.mergeValidEvaluated(s,c)||t.if((0,n.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},1018:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=r},2101:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1018),i=r(1939),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",n.default,i.default];t.default=o},1939:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const n=r(1578),i=r(3499),o=r(5669),s=r(7250),a=r(7382),c=r(8936),u={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:i}=e,{baseId:s,schemaEnv:c,validateName:u,opts:f,self:d}=i,{root:p}=c;if(("#"===r||"#/"===r)&&s===p.baseId)return function(){if(c===p)return h(e,u,c,c.$async);const r=t.scopeValue("root",{ref:p});return h(e,o._`${r}.validate`,p,p.$async)}();const m=a.resolveRef.call(d,p,s,r);if(void 0===m)throw new n.default(i.opts.uriResolver,s,r);return m instanceof a.SchemaEnv?function(t){const r=l(e,t);h(e,r,t,t.$async)}(m):function(n){const i=t.scopeValue("schema",!0===f.code.source?{ref:n,code:(0,o.stringify)(n)}:{ref:n}),s=t.name("valid"),a=e.subschema({schema:n,dataTypes:[],schemaPath:o.nil,topSchemaRef:i,errSchemaPath:r},s);e.mergeEvaluated(a),e.ok(s)}(m)}};function l(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):o._`${r.scopeValue("wrapper",{ref:t})}.validate`}function h(e,t,r,n){const{gen:a,it:u}=e,{allErrors:l,schemaEnv:h,opts:f}=u,d=f.passContext?s.default.this:o.nil;function p(e){const t=o._`${e}.errors`;a.assign(s.default.vErrors,o._`${s.default.vErrors} === null ? ${t} : ${s.default.vErrors}.concat(${t})`),a.assign(s.default.errors,o._`${s.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;const n=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==u.props)if(n&&!n.dynamicProps)void 0!==n.props&&(u.props=c.mergeEvaluated.props(a,n.props,u.props));else{const t=a.var("props",o._`${e}.evaluated.props`);u.props=c.mergeEvaluated.props(a,t,u.props,o.Name)}if(!0!==u.items)if(n&&!n.dynamicItems)void 0!==n.items&&(u.items=c.mergeEvaluated.items(a,n.items,u.items));else{const t=a.var("items",o._`${e}.evaluated.items`);u.items=c.mergeEvaluated.items(a,t,u.items,o.Name)}}n?function(){if(!h.$async)throw new Error("async schema referenced by sync schema");const r=a.let("valid");a.try((()=>{a.code(o._`await ${(0,i.callValidateCode)(e,t,d)}`),m(t),l||a.assign(r,!0)}),(e=>{a.if(o._`!(${e} instanceof ${u.ValidationError})`,(()=>a.throw(e))),p(e),l||a.assign(r,!1)})),e.ok(r)}():e.result((0,i.callValidateCode)(e,t,d),(()=>m(t)),(()=>p(t)))}t.getValidate=l,t.callRef=h,t.default=u},2:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(7421),o=r(7382),s=r(8936),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>n._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){const{gen:t,data:r,schema:a,parentSchema:c,it:u}=e,{oneOf:l}=c;if(!u.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=a.propertyName;if("string"!=typeof h)throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const f=t.let("valid",!1),d=t.const("tag",n._`${r}${(0,n.getProperty)(h)}`);function p(r){const i=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},i);return e.mergeEvaluated(o,n.Name),i}t.if(n._`typeof ${d} == "string"`,(()=>function(){const r=function(){var e;const t={},r=i(c);let n=!0;for(let t=0;t<l.length;t++){let c=l[t];(null==c?void 0:c.$ref)&&!(0,s.schemaHasRulesButRef)(c,u.self.RULES)&&(c=o.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,null==c?void 0:c.$ref),c instanceof o.SchemaEnv&&(c=c.schema));const f=null===(e=null==c?void 0:c.properties)||void 0===e?void 0:e[h];if("object"!=typeof f)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);n=n&&(r||i(c)),a(f,t)}if(!n)throw new Error(`discriminator: "${h}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(h)}function a(e,t){if(e.const)f(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`);for(const r of e.enum)f(r,t)}}function f(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${h}" values must be unique strings`);t[e]=r}}();t.if(!1);for(const e in r)t.elseIf(n._`${d} === ${e}`),t.assign(f,p(r[e]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:d,tagName:h}),t.endIf()}()),(()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:d,tagName:h}))),e.ok(f)}};t.default=a},7421:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(r=t.DiscrError||(t.DiscrError={})).Tag="tag",r.Mapping="mapping"},5671:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2101),i=r(7499),o=r(6951),s=r(4480),a=r(2480),c=[n.default,i.default,(0,o.default)(),s.default,a.metadataVocabulary,a.contentVocabulary];t.default=c},3599:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>n.str`must match format "${e}"`,params:({schemaCode:e})=>n._`{format: ${e}}`},code(e,t){const{gen:r,data:i,$data:o,schema:s,schemaCode:a,it:c}=e,{opts:u,errSchemaPath:l,schemaEnv:h,self:f}=c;u.validateFormats&&(o?function(){const o=r.scopeValue("formats",{ref:f.formats,code:u.code.formats}),s=r.const("fDef",n._`${o}[${a}]`),c=r.let("fType"),l=r.let("format");r.if(n._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,(()=>r.assign(c,n._`${s}.type || "string"`).assign(l,n._`${s}.validate`)),(()=>r.assign(c,n._`"string"`).assign(l,s))),e.fail$data((0,n.or)(!1===u.strictSchema?n.nil:n._`${a} && !${l}`,function(){const e=h.$async?n._`(${s}.async ? await ${l}(${i}) : ${l}(${i}))`:n._`${l}(${i})`,r=n._`(typeof ${l} == "function" ? ${e} : ${l}.test(${i}))`;return n._`${l} && ${l} !== true && ${c} === ${t} && !${r}`}()))}():function(){const o=f.formats[s];if(!o)return void function(){if(!1!==u.strictSchema)throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${l}"`}f.logger.warn(e())}();if(!0===o)return;const[a,c,d]=function(e){const t=e instanceof RegExp?(0,n.regexpCode)(e):u.code.formats?n._`${u.code.formats}${(0,n.getProperty)(s)}`:void 0,i=r.scopeValue("formats",{key:s,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,i]:[e.type||"string",e.validate,n._`${i}.validate`]}(o);a===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!h.$async)throw new Error("async format in sync schema");return n._`await ${d}(${i})`}return"function"==typeof c?n._`${d}(${i})`:n._`${d}.test(${i})`}())}())}};t.default=i},4480:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=[r(3599).default];t.default=n},2480:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},6577:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o=r(4285),s={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>n._`{allowedValue: ${e}}`},code(e){const{gen:t,data:r,$data:s,schemaCode:a,schema:c}=e;s||c&&"object"==typeof c?e.fail$data(n._`!${(0,i.useFunc)(t,o.default)}(${r}, ${a})`):e.fail(n._`${c} !== ${r}`)}};t.default=s},9450:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o=r(4285),s={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>n._`{allowedValues: ${e}}`},code(e){const{gen:t,data:r,$data:s,schema:a,schemaCode:c,it:u}=e;if(!s&&0===a.length)throw new Error("enum must have non-empty array");const l=a.length>=u.opts.loopEnum;let h;const f=()=>null!=h?h:h=(0,i.useFunc)(t,o.default);let d;if(l||s)d=t.let("valid"),e.block$data(d,(function(){t.assign(d,!1),t.forOf("v",c,(e=>t.if(n._`${f()}(${r}, ${e})`,(()=>t.assign(d,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",c);d=(0,n.or)(...a.map(((t,i)=>function(e,t){const i=a[t];return"object"==typeof i&&null!==i?n._`${f()}(${r}, ${e}[${t}])`:n._`${r} === ${i}`}(e,i))))}e.pass(d)}};t.default=s},7499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1337),i=r(9706),o=r(9507),s=r(1216),a=r(34),c=r(6962),u=r(1135),l=r(194),h=r(6577),f=r(9450),d=[n.default,i.default,o.default,s.default,a.default,c.default,u.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},h.default,f.default];t.default=d},1135:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxItems"===e?"more":"fewer";return n.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:i}=e,o="maxItems"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`${r}.length ${o} ${i}`)}};t.default=i},9507:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o=r(9161),s={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxLength"===e?"more":"fewer";return n.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:s,it:a}=e,c="maxLength"===t?n.operators.GT:n.operators.LT,u=!1===a.opts.unicode?n._`${r}.length`:n._`${(0,i.useFunc)(e.gen,o.default)}(${r})`;e.fail$data(n._`${u} ${c} ${s}`)}};t.default=s},1337:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=n.operators,o={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},s={message:({keyword:e,schemaCode:t})=>n.str`must be ${o[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>n._`{comparison: ${o[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:s,code(e){const{keyword:t,data:r,schemaCode:i}=e;e.fail$data(n._`${r} ${o[t].fail} ${i} || isNaN(${r})`)}};t.default=a},34:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxProperties"===e?"more":"fewer";return n.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:i}=e,o="maxProperties"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`Object.keys(${r}).length ${o} ${i}`)}};t.default=i},9706:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>n.str`must be multiple of ${e}`,params:({schemaCode:e})=>n._`{multipleOf: ${e}}`},code(e){const{gen:t,data:r,schemaCode:i,it:o}=e,s=o.opts.multipleOfPrecision,a=t.let("res"),c=s?n._`Math.abs(Math.round(${a}) - ${a}) > 1e-${s}`:n._`${a} !== parseInt(${a})`;e.fail$data(n._`(${i} === 0 || (${a} = ${r}/${i}, ${c}))`)}};t.default=i},1216:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3499),i=r(5669),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match pattern "${e}"`,params:({schemaCode:e})=>i._`{pattern: ${e}}`},code(e){const{data:t,$data:r,schema:o,schemaCode:s,it:a}=e,c=a.opts.unicodeRegExp?"u":"",u=r?i._`(new RegExp(${s}, ${c}))`:(0,n.usePattern)(e,o);e.fail$data(i._`!${u}.test(${t})`)}};t.default=o},6962:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3499),i=r(5669),o=r(8936),s={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>i.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>i._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:r,schemaCode:s,data:a,$data:c,it:u}=e,{opts:l}=u;if(!c&&0===r.length)return;const h=r.length>=l.loopRequired;if(u.allErrors?function(){if(h||c)e.block$data(i.nil,f);else for(const t of r)(0,n.checkReportMissingProp)(e,t)}():function(){const o=t.let("missing");if(h||c){const r=t.let("valid",!0);e.block$data(r,(()=>function(r,o){e.setParams({missingProperty:r}),t.forOf(r,s,(()=>{t.assign(o,(0,n.propertyInData)(t,a,r,l.ownProperties)),t.if((0,i.not)(o),(()=>{e.error(),t.break()}))}),i.nil)}(o,r))),e.ok(r)}else t.if((0,n.checkMissingProp)(e,r,o)),(0,n.reportMissingProp)(e,o),t.else()}(),l.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=`required property "${e}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(u,t,u.opts.strictRequired)}}function f(){t.forOf("prop",s,(r=>{e.setParams({missingProperty:r}),t.if((0,n.noPropertyInData)(t,a,r,l.ownProperties),(()=>e.error()))}))}}};t.default=s},194:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(7332),i=r(5669),o=r(8936),s=r(4285),a={message:({params:{i:e,j:t}})=>i.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>i._`{i: ${e}, j: ${t}}`},c={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:a,code(e){const{gen:t,data:r,$data:a,schema:c,parentSchema:u,schemaCode:l,it:h}=e;if(!a&&!c)return;const f=t.let("valid"),d=u.items?(0,n.getSchemaTypes)(u.items):[];function p(o,s){const a=t.name("item"),c=(0,n.checkDataTypes)(d,a,h.opts.strictNumbers,n.DataType.Wrong),u=t.const("indices",i._`{}`);t.for(i._`;${o}--;`,(()=>{t.let(a,i._`${r}[${o}]`),t.if(c,i._`continue`),d.length>1&&t.if(i._`typeof ${a} == "string"`,i._`${a} += "_"`),t.if(i._`typeof ${u}[${a}] == "number"`,(()=>{t.assign(s,i._`${u}[${a}]`),e.error(),t.assign(f,!1).break()})).code(i._`${u}[${a}] = ${o}`)}))}function m(n,a){const c=(0,o.useFunc)(t,s.default),u=t.name("outer");t.label(u).for(i._`;${n}--;`,(()=>t.for(i._`${a} = ${n}; ${a}--;`,(()=>t.if(i._`${c}(${r}[${n}], ${r}[${a}])`,(()=>{e.error(),t.assign(f,!1).break(u)}))))))}e.block$data(f,(function(){const n=t.let("i",i._`${r}.length`),o=t.let("j");e.setParams({i:n,j:o}),t.assign(f,!0),t.if(i._`${n} > 1`,(()=>(d.length>0&&!d.some((e=>"object"===e||"array"===e))?p:m)(n,o)))}),i._`${l} === false`),e.ok(f)}};t.default=c},2943:e=>{"use strict";var t=e.exports=function(e,t,n){"function"==typeof t&&(n=t,t={}),r(t,"function"==typeof(n=t.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function r(e,n,i,o,s,a,c,u,l,h){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var f in n(o,s,a,c,u,l,h),o){var d=o[f];if(Array.isArray(d)){if(f in t.arrayKeywords)for(var p=0;p<d.length;p++)r(e,n,i,d[p],s+"/"+f+"/"+p,a,s,f,o,p)}else if(f in t.propsKeywords){if(d&&"object"==typeof d)for(var m in d)r(e,n,i,d[m],s+"/"+f+"/"+m.replace(/~/g,"~0").replace(/\//g,"~1"),a,s,f,o,m)}else(f in t.keywords||e.allKeys&&!(f in t.skipKeywords))&&r(e,n,i,d,s+"/"+f,a,s,f,o)}i(o,s,a,c,u,l,h)}}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},2091:function(e,t,r){var n,i;i=function(e){var t=["N","E","A","D"];function r(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function n(e,t){Object.defineProperty(this,"kind",{value:e,enumerable:!0}),t&&t.length&&Object.defineProperty(this,"path",{value:t,enumerable:!0})}function i(e,t,r){i.super_.call(this,"E",e),Object.defineProperty(this,"lhs",{value:t,enumerable:!0}),Object.defineProperty(this,"rhs",{value:r,enumerable:!0})}function o(e,t){o.super_.call(this,"N",e),Object.defineProperty(this,"rhs",{value:t,enumerable:!0})}function s(e,t){s.super_.call(this,"D",e),Object.defineProperty(this,"lhs",{value:t,enumerable:!0})}function a(e,t,r){a.super_.call(this,"A",e),Object.defineProperty(this,"index",{value:t,enumerable:!0}),Object.defineProperty(this,"item",{value:r,enumerable:!0})}function c(e,t,r){var n=e.slice((r||t)+1||e.length);return e.length=t<0?e.length+t:t,e.push.apply(e,n),e}function u(e){var t=typeof e;return"object"!==t?t:e===Math?"math":null===e?"null":Array.isArray(e)?"array":"[object Date]"===Object.prototype.toString.call(e)?"date":"function"==typeof e.toString&&/^\/.*\//.test(e.toString())?"regexp":"object"}function l(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}function h(e){var t=0,r=u(e);if("array"===r)return e.forEach((function(e){t+=h(e)})),t+l("[type: array, hash: "+t+"]");if("object"===r){for(var n in e)if(e.hasOwnProperty(n)){var i="[ type: object, key: "+n+", value hash: "+h(e[n])+"]";t+=l(i)}return t}return t+l("[ type: "+r+" ; value: "+e+"]")}function f(e,t,r,n,c,l,d,p){r=r||[],d=d||[];var m=(c=c||[]).slice(0);if(null!=l){if(n){if("function"==typeof n&&n(m,l))return;if("object"==typeof n){if(n.prefilter&&n.prefilter(m,l))return;if(n.normalize){var y=n.normalize(m,l,e,t);y&&(e=y[0],t=y[1])}}}m.push(l)}"regexp"===u(e)&&"regexp"===u(t)&&(e=e.toString(),t=t.toString());var v,g,b,_,w=typeof e,E=typeof t,S="undefined"!==w||d&&d.length>0&&d[d.length-1].lhs&&Object.getOwnPropertyDescriptor(d[d.length-1].lhs,l),O="undefined"!==E||d&&d.length>0&&d[d.length-1].rhs&&Object.getOwnPropertyDescriptor(d[d.length-1].rhs,l);if(!S&&O)r.push(new o(m,t));else if(!O&&S)r.push(new s(m,e));else if(u(e)!==u(t))r.push(new i(m,e,t));else if("date"===u(e)&&e-t!=0)r.push(new i(m,e,t));else if("object"===w&&null!==e&&null!==t){for(v=d.length-1;v>-1;--v)if(d[v].lhs===e){_=!0;break}if(_)e!==t&&r.push(new i(m,e,t));else{if(d.push({lhs:e,rhs:t}),Array.isArray(e)){for(p&&(e.sort((function(e,t){return h(e)-h(t)})),t.sort((function(e,t){return h(e)-h(t)}))),v=t.length-1,g=e.length-1;v>g;)r.push(new a(m,v,new o(void 0,t[v--])));for(;g>v;)r.push(new a(m,g,new s(void 0,e[g--])));for(;v>=0;--v)f(e[v],t[v],r,n,m,v,d,p)}else{var I=Object.keys(e),T=Object.keys(t);for(v=0;v<I.length;++v)b=I[v],(_=T.indexOf(b))>=0?(f(e[b],t[b],r,n,m,b,d,p),T[_]=null):f(e[b],void 0,r,n,m,b,d,p);for(v=0;v<T.length;++v)(b=T[v])&&f(void 0,t[b],r,n,m,b,d,p)}d.length=d.length-1}}else e!==t&&("number"===w&&isNaN(e)&&isNaN(t)||r.push(new i(m,e,t)))}function d(e,t,r,n,i){var o=[];if(f(e,t,o,n,null,null,null,i),r)for(var s=0;s<o.length;++s)r(o[s]);return o}function p(e,t,r,n){var i=d(e,t,n?function(e){e&&n.push(e)}:void 0,r);return n||(i.length?i:void 0)}function m(e,t,r){if(r.path&&r.path.length){var n,i=e[t],o=r.path.length-1;for(n=0;n<o;n++)i=i[r.path[n]];switch(r.kind){case"A":m(i[r.path[n]],r.index,r.item);break;case"D":delete i[r.path[n]];break;case"E":case"N":i[r.path[n]]=r.rhs}}else switch(r.kind){case"A":m(e[t],r.index,r.item);break;case"D":e=c(e,t);break;case"E":case"N":e[t]=r.rhs}return e}function y(e,r,n){if(void 0===n&&r&&~t.indexOf(r.kind)&&(n=r),e&&n&&n.kind){for(var i=e,o=-1,s=n.path?n.path.length-1:0;++o<s;)void 0===i[n.path[o]]&&(i[n.path[o]]=void 0!==n.path[o+1]&&"number"==typeof n.path[o+1]?[]:{}),i=i[n.path[o]];switch(n.kind){case"A":n.path&&void 0===i[n.path[o]]&&(i[n.path[o]]=[]),m(n.path?i[n.path[o]]:i,n.index,n.item);break;case"D":delete i[n.path[o]];break;case"E":case"N":i[n.path[o]]=n.rhs}}}function v(e,t,r){if(r.path&&r.path.length){var n,i=e[t],o=r.path.length-1;for(n=0;n<o;n++)i=i[r.path[n]];switch(r.kind){case"A":v(i[r.path[n]],r.index,r.item);break;case"D":case"E":i[r.path[n]]=r.lhs;break;case"N":delete i[r.path[n]]}}else switch(r.kind){case"A":v(e[t],r.index,r.item);break;case"D":case"E":e[t]=r.lhs;break;case"N":e=c(e,t)}return e}return r(i,n),r(o,n),r(s,n),r(a,n),Object.defineProperties(p,{diff:{value:p,enumerable:!0},orderIndependentDiff:{value:function(e,t,r,n){var i=d(e,t,n?function(e){e&&n.push(e)}:void 0,r,!0);return n||(i.length?i:void 0)},enumerable:!0},observableDiff:{value:d,enumerable:!0},orderIndependentObservableDiff:{value:function(e,t,r,n,i,o,s){return f(e,t,r,n,i,o,s,!0)},enumerable:!0},orderIndepHash:{value:h,enumerable:!0},applyDiff:{value:function(e,t,r){e&&t&&d(e,t,(function(n){r&&!r(e,t,n)||y(e,t,n)}))},enumerable:!0},applyChange:{value:y,enumerable:!0},revertChange:{value:function(e,t,r){if(e&&t&&r&&r.kind){var n,i,o=e;for(i=r.path.length-1,n=0;n<i;n++)void 0===o[r.path[n]]&&(o[r.path[n]]={}),o=o[r.path[n]];switch(r.kind){case"A":v(o[r.path[n]],r.index,r.item);break;case"D":case"E":o[r.path[n]]=r.lhs;break;case"N":delete o[r.path[n]]}}},enumerable:!0},isConflict:{value:function(){return"undefined"!=typeof $conflict},enumerable:!0}}),p.DeepDiff=p,e&&(e.DeepDiff=p),p}(this),void 0===(n=function(){return i}.call(t,r,t,e))||(e.exports=n)},6471:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!=i--;){var s=o[i];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}},8784:function(e,t,r){var n;e=r.nmd(e),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",c=32,u=128,l=1/0,h=9007199254740991,f=NaN,d=4294967295,p=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",c],["partialRight",64],["rearg",256]],m="[object Arguments]",y="[object Array]",v="[object Boolean]",g="[object Date]",b="[object Error]",_="[object Function]",w="[object GeneratorFunction]",E="[object Map]",S="[object Number]",O="[object Object]",I="[object Promise]",T="[object RegExp]",k="[object Set]",D="[object String]",N="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",R="[object DataView]",P="[object Float32Array]",j="[object Float64Array]",C="[object Int8Array]",$="[object Int16Array]",M="[object Int32Array]",F="[object Uint8Array]",q="[object Uint8ClampedArray]",L="[object Uint16Array]",V="[object Uint32Array]",Q=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,B=/(__e\(.*?\)|\b__t\)) \+\n'';/g,z=/&(?:amp|lt|gt|quot|#39);/g,Y=/[&<>"']/g,W=RegExp(z.source),K=RegExp(Y.source),H=/<%-([\s\S]+?)%>/g,G=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,re=RegExp(te.source),ne=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,ce=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,fe=/\w*$/,de=/^[-+]0x[0-9a-f]+$/i,pe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ve=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,be=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Ee="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Oe="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",Te="\\ufe0e\\ufe0f",ke="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",De="["+we+"]",Ne="["+ke+"]",Ae="["+Ee+"]",xe="\\d+",Re="["+Se+"]",Pe="["+Oe+"]",je="[^"+we+ke+xe+Se+Oe+Ie+"]",Ce="\\ud83c[\\udffb-\\udfff]",$e="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Fe="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+Ie+"]",Le="\\u200d",Ve="(?:"+Pe+"|"+je+")",Qe="(?:"+qe+"|"+je+")",Ue="(?:['’](?:d|ll|m|re|s|t|ve))?",Be="(?:['’](?:D|LL|M|RE|S|T|VE))?",ze="(?:"+Ae+"|"+Ce+")?",Ye="["+Te+"]?",We=Ye+ze+"(?:"+Le+"(?:"+[$e,Me,Fe].join("|")+")"+Ye+ze+")*",Ke="(?:"+[Re,Me,Fe].join("|")+")"+We,He="(?:"+[$e+Ae+"?",Ae,Me,Fe,De].join("|")+")",Ge=RegExp("['’]","g"),Je=RegExp(Ae,"g"),Ze=RegExp(Ce+"(?="+Ce+")|"+He+We,"g"),Xe=RegExp([qe+"?"+Pe+"+"+Ue+"(?="+[Ne,qe,"$"].join("|")+")",Qe+"+"+Be+"(?="+[Ne,qe+Ve,"$"].join("|")+")",qe+"?"+Ve+"+"+Ue,qe+"+"+Be,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xe,Ke].join("|"),"g"),et=RegExp("["+Le+we+Ee+Te+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],nt=-1,it={};it[P]=it[j]=it[C]=it[$]=it[M]=it[F]=it[q]=it[L]=it[V]=!0,it[m]=it[y]=it[x]=it[v]=it[R]=it[g]=it[b]=it[_]=it[E]=it[S]=it[O]=it[T]=it[k]=it[D]=it[A]=!1;var ot={};ot[m]=ot[y]=ot[x]=ot[R]=ot[v]=ot[g]=ot[P]=ot[j]=ot[C]=ot[$]=ot[M]=ot[E]=ot[S]=ot[O]=ot[T]=ot[k]=ot[D]=ot[N]=ot[F]=ot[q]=ot[L]=ot[V]=!0,ot[b]=ot[_]=ot[A]=!1;var st={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},at=parseFloat,ct=parseInt,ut="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,lt="object"==typeof self&&self&&self.Object===Object&&self,ht=ut||lt||Function("return this")(),ft=t&&!t.nodeType&&t,dt=ft&&e&&!e.nodeType&&e,pt=dt&&dt.exports===ft,mt=pt&&ut.process,yt=function(){try{return dt&&dt.require&&dt.require("util").types||mt&&mt.binding&&mt.binding("util")}catch(e){}}(),vt=yt&&yt.isArrayBuffer,gt=yt&&yt.isDate,bt=yt&&yt.isMap,_t=yt&&yt.isRegExp,wt=yt&&yt.isSet,Et=yt&&yt.isTypedArray;function St(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Ot(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(n,s,r(s),e)}return n}function It(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function Tt(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function kt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function Dt(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[i++]=s)}return o}function Nt(e,t){return!(null==e||!e.length)&&qt(e,t,0)>-1}function At(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function xt(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Rt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Pt(e,t,r,n){var i=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function jt(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function Ct(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var $t=Ut("length");function Mt(e,t,r){var n;return r(e,(function(e,r,i){if(t(e,r,i))return n=r,!1})),n}function Ft(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function qt(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):Ft(e,Vt,r)}function Lt(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function Vt(e){return e!=e}function Qt(e,t){var r=null==e?0:e.length;return r?Yt(e,t)/r:f}function Ut(e){return function(t){return null==t?i:t[e]}}function Bt(e){return function(t){return null==e?i:e[t]}}function zt(e,t,r,n,i){return i(e,(function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)})),r}function Yt(e,t){for(var r,n=-1,o=e.length;++n<o;){var s=t(e[n]);s!==i&&(r=r===i?s:r+s)}return r}function Wt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Kt(e){return e?e.slice(0,hr(e)+1).replace(ne,""):e}function Ht(e){return function(t){return e(t)}}function Gt(e,t){return xt(t,(function(t){return e[t]}))}function Jt(e,t){return e.has(t)}function Zt(e,t){for(var r=-1,n=e.length;++r<n&&qt(t,e[r],0)>-1;);return r}function Xt(e,t){for(var r=e.length;r--&&qt(t,e[r],0)>-1;);return r}var er=Bt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tr=Bt({"&":"&","<":"<",">":">",'"':""","'":"'"});function rr(e){return"\\"+st[e]}function nr(e){return et.test(e)}function ir(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function or(e,t){return function(r){return e(t(r))}}function sr(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r];s!==t&&s!==a||(e[r]=a,o[i++]=r)}return o}function ar(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}function cr(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=[e,e]})),r}function ur(e){return nr(e)?function(e){for(var t=Ze.lastIndex=0;Ze.test(e);)++t;return t}(e):$t(e)}function lr(e){return nr(e)?function(e){return e.match(Ze)||[]}(e):function(e){return e.split("")}(e)}function hr(e){for(var t=e.length;t--&&ie.test(e.charAt(t)););return t}var fr=Bt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),dr=function e(t){var r,n=(t=null==t?ht:dr.defaults(ht.Object(),t,dr.pick(ht,rt))).Array,ie=t.Date,we=t.Error,Ee=t.Function,Se=t.Math,Oe=t.Object,Ie=t.RegExp,Te=t.String,ke=t.TypeError,De=n.prototype,Ne=Ee.prototype,Ae=Oe.prototype,xe=t["__core-js_shared__"],Re=Ne.toString,Pe=Ae.hasOwnProperty,je=0,Ce=(r=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",$e=Ae.toString,Me=Re.call(Oe),Fe=ht._,qe=Ie("^"+Re.call(Pe).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=pt?t.Buffer:i,Ve=t.Symbol,Qe=t.Uint8Array,Ue=Le?Le.allocUnsafe:i,Be=or(Oe.getPrototypeOf,Oe),ze=Oe.create,Ye=Ae.propertyIsEnumerable,We=De.splice,Ke=Ve?Ve.isConcatSpreadable:i,He=Ve?Ve.iterator:i,Ze=Ve?Ve.toStringTag:i,et=function(){try{var e=co(Oe,"defineProperty");return e({},"",{}),e}catch(e){}}(),st=t.clearTimeout!==ht.clearTimeout&&t.clearTimeout,ut=ie&&ie.now!==ht.Date.now&&ie.now,lt=t.setTimeout!==ht.setTimeout&&t.setTimeout,ft=Se.ceil,dt=Se.floor,mt=Oe.getOwnPropertySymbols,yt=Le?Le.isBuffer:i,$t=t.isFinite,Bt=De.join,pr=or(Oe.keys,Oe),mr=Se.max,yr=Se.min,vr=ie.now,gr=t.parseInt,br=Se.random,_r=De.reverse,wr=co(t,"DataView"),Er=co(t,"Map"),Sr=co(t,"Promise"),Or=co(t,"Set"),Ir=co(t,"WeakMap"),Tr=co(Oe,"create"),kr=Ir&&new Ir,Dr={},Nr=Mo(wr),Ar=Mo(Er),xr=Mo(Sr),Rr=Mo(Or),Pr=Mo(Ir),jr=Ve?Ve.prototype:i,Cr=jr?jr.valueOf:i,$r=jr?jr.toString:i;function Mr(e){if(ea(e)&&!Us(e)&&!(e instanceof Vr)){if(e instanceof Lr)return e;if(Pe.call(e,"__wrapped__"))return Fo(e)}return new Lr(e)}var Fr=function(){function e(){}return function(t){if(!Xs(t))return{};if(ze)return ze(t);e.prototype=t;var r=new e;return e.prototype=i,r}}();function qr(){}function Lr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Vr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Qr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ur(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Br(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function zr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Br;++t<r;)this.add(e[t])}function Yr(e){var t=this.__data__=new Ur(e);this.size=t.size}function Wr(e,t){var r=Us(e),n=!r&&Qs(e),i=!r&&!n&&Ws(e),o=!r&&!n&&!i&&ca(e),s=r||n||i||o,a=s?Wt(e.length,Te):[],c=a.length;for(var u in e)!t&&!Pe.call(e,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||yo(u,c))||a.push(u);return a}function Kr(e){var t=e.length;return t?e[zn(0,t-1)]:i}function Hr(e,t){return Ro(Ti(e),on(t,0,e.length))}function Gr(e){return Ro(Ti(e))}function Jr(e,t,r){(r!==i&&!qs(e[t],r)||r===i&&!(t in e))&&rn(e,t,r)}function Zr(e,t,r){var n=e[t];Pe.call(e,t)&&qs(n,r)&&(r!==i||t in e)||rn(e,t,r)}function Xr(e,t){for(var r=e.length;r--;)if(qs(e[r][0],t))return r;return-1}function en(e,t,r,n){return ln(e,(function(e,i,o){t(n,e,r(e),o)})),n}function tn(e,t){return e&&ki(t,Aa(t),e)}function rn(e,t,r){"__proto__"==t&&et?et(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function nn(e,t){for(var r=-1,o=t.length,s=n(o),a=null==e;++r<o;)s[r]=a?i:Ia(e,t[r]);return s}function on(e,t,r){return e==e&&(r!==i&&(e=e<=r?e:r),t!==i&&(e=e>=t?e:t)),e}function sn(e,t,r,n,o,s){var a,c=1&t,u=2&t,l=4&t;if(r&&(a=o?r(e,n,o,s):r(e)),a!==i)return a;if(!Xs(e))return e;var h=Us(e);if(h){if(a=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Pe.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!c)return Ti(e,a)}else{var f=ho(e),d=f==_||f==w;if(Ws(e))return _i(e,c);if(f==O||f==m||d&&!o){if(a=u||d?{}:po(e),!c)return u?function(e,t){return ki(e,lo(e),t)}(e,function(e,t){return e&&ki(t,xa(t),e)}(a,e)):function(e,t){return ki(e,uo(e),t)}(e,tn(a,e))}else{if(!ot[f])return o?e:{};a=function(e,t,r){var n,i=e.constructor;switch(t){case x:return wi(e);case v:case g:return new i(+e);case R:return function(e,t){var r=t?wi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case P:case j:case C:case $:case M:case F:case q:case L:case V:return Ei(e,r);case E:return new i;case S:case D:return new i(e);case T:return function(e){var t=new e.constructor(e.source,fe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case k:return new i;case N:return n=e,Cr?Oe(Cr.call(n)):{}}}(e,f,c)}}s||(s=new Yr);var p=s.get(e);if(p)return p;s.set(e,a),oa(e)?e.forEach((function(n){a.add(sn(n,t,r,n,e,s))})):ta(e)&&e.forEach((function(n,i){a.set(i,sn(n,t,r,i,e,s))}));var y=h?i:(l?u?to:eo:u?xa:Aa)(e);return It(y||e,(function(n,i){y&&(n=e[i=n]),Zr(a,i,sn(n,t,r,i,e,s))})),a}function an(e,t,r){var n=r.length;if(null==e)return!n;for(e=Oe(e);n--;){var o=r[n],s=t[o],a=e[o];if(a===i&&!(o in e)||!s(a))return!1}return!0}function cn(e,t,r){if("function"!=typeof e)throw new ke(o);return Do((function(){e.apply(i,r)}),t)}function un(e,t,r,n){var i=-1,o=Nt,s=!0,a=e.length,c=[],u=t.length;if(!a)return c;r&&(t=xt(t,Ht(r))),n?(o=At,s=!1):t.length>=200&&(o=Jt,s=!1,t=new zr(t));e:for(;++i<a;){var l=e[i],h=null==r?l:r(l);if(l=n||0!==l?l:0,s&&h==h){for(var f=u;f--;)if(t[f]===h)continue e;c.push(l)}else o(t,h,n)||c.push(l)}return c}Mr.templateSettings={escape:H,evaluate:G,interpolate:J,variable:"",imports:{_:Mr}},Mr.prototype=qr.prototype,Mr.prototype.constructor=Mr,Lr.prototype=Fr(qr.prototype),Lr.prototype.constructor=Lr,Vr.prototype=Fr(qr.prototype),Vr.prototype.constructor=Vr,Qr.prototype.clear=function(){this.__data__=Tr?Tr(null):{},this.size=0},Qr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Qr.prototype.get=function(e){var t=this.__data__;if(Tr){var r=t[e];return r===s?i:r}return Pe.call(t,e)?t[e]:i},Qr.prototype.has=function(e){var t=this.__data__;return Tr?t[e]!==i:Pe.call(t,e)},Qr.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Tr&&t===i?s:t,this},Ur.prototype.clear=function(){this.__data__=[],this.size=0},Ur.prototype.delete=function(e){var t=this.__data__,r=Xr(t,e);return!(r<0||(r==t.length-1?t.pop():We.call(t,r,1),--this.size,0))},Ur.prototype.get=function(e){var t=this.__data__,r=Xr(t,e);return r<0?i:t[r][1]},Ur.prototype.has=function(e){return Xr(this.__data__,e)>-1},Ur.prototype.set=function(e,t){var r=this.__data__,n=Xr(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Br.prototype.clear=function(){this.size=0,this.__data__={hash:new Qr,map:new(Er||Ur),string:new Qr}},Br.prototype.delete=function(e){var t=so(this,e).delete(e);return this.size-=t?1:0,t},Br.prototype.get=function(e){return so(this,e).get(e)},Br.prototype.has=function(e){return so(this,e).has(e)},Br.prototype.set=function(e,t){var r=so(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},zr.prototype.add=zr.prototype.push=function(e){return this.__data__.set(e,s),this},zr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.clear=function(){this.__data__=new Ur,this.size=0},Yr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Yr.prototype.get=function(e){return this.__data__.get(e)},Yr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ur){var n=r.__data__;if(!Er||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Br(n)}return r.set(e,t),this.size=r.size,this};var ln=Ai(gn),hn=Ai(bn,!0);function fn(e,t){var r=!0;return ln(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function dn(e,t,r){for(var n=-1,o=e.length;++n<o;){var s=e[n],a=t(s);if(null!=a&&(c===i?a==a&&!aa(a):r(a,c)))var c=a,u=s}return u}function pn(e,t){var r=[];return ln(e,(function(e,n,i){t(e,n,i)&&r.push(e)})),r}function mn(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=mo),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?mn(a,t-1,r,n,i):Rt(i,a):n||(i[i.length]=a)}return i}var yn=xi(),vn=xi(!0);function gn(e,t){return e&&yn(e,t,Aa)}function bn(e,t){return e&&vn(e,t,Aa)}function _n(e,t){return Dt(t,(function(t){return Gs(e[t])}))}function wn(e,t){for(var r=0,n=(t=yi(t,e)).length;null!=e&&r<n;)e=e[$o(t[r++])];return r&&r==n?e:i}function En(e,t,r){var n=t(e);return Us(e)?n:Rt(n,r(e))}function Sn(e){return null==e?e===i?"[object Undefined]":"[object Null]":Ze&&Ze in Oe(e)?function(e){var t=Pe.call(e,Ze),r=e[Ze];try{e[Ze]=i;var n=!0}catch(e){}var o=$e.call(e);return n&&(t?e[Ze]=r:delete e[Ze]),o}(e):function(e){return $e.call(e)}(e)}function On(e,t){return e>t}function In(e,t){return null!=e&&Pe.call(e,t)}function Tn(e,t){return null!=e&&t in Oe(e)}function kn(e,t,r){for(var o=r?At:Nt,s=e[0].length,a=e.length,c=a,u=n(a),l=1/0,h=[];c--;){var f=e[c];c&&t&&(f=xt(f,Ht(t))),l=yr(f.length,l),u[c]=!r&&(t||s>=120&&f.length>=120)?new zr(c&&f):i}f=e[0];var d=-1,p=u[0];e:for(;++d<s&&h.length<l;){var m=f[d],y=t?t(m):m;if(m=r||0!==m?m:0,!(p?Jt(p,y):o(h,y,r))){for(c=a;--c;){var v=u[c];if(!(v?Jt(v,y):o(e[c],y,r)))continue e}p&&p.push(y),h.push(m)}}return h}function Dn(e,t,r){var n=null==(e=Io(e,t=yi(t,e)))?e:e[$o(Ho(t))];return null==n?i:St(n,e,r)}function Nn(e){return ea(e)&&Sn(e)==m}function An(e,t,r,n,o){return e===t||(null==e||null==t||!ea(e)&&!ea(t)?e!=e&&t!=t:function(e,t,r,n,o,s){var a=Us(e),c=Us(t),u=a?y:ho(e),l=c?y:ho(t),h=(u=u==m?O:u)==O,f=(l=l==m?O:l)==O,d=u==l;if(d&&Ws(e)){if(!Ws(t))return!1;a=!0,h=!1}if(d&&!h)return s||(s=new Yr),a||ca(e)?Zi(e,t,r,n,o,s):function(e,t,r,n,i,o,s){switch(r){case R:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!o(new Qe(e),new Qe(t)));case v:case g:case S:return qs(+e,+t);case b:return e.name==t.name&&e.message==t.message;case T:case D:return e==t+"";case E:var a=ir;case k:var c=1&n;if(a||(a=ar),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;n|=2,s.set(e,t);var l=Zi(a(e),a(t),n,i,o,s);return s.delete(e),l;case N:if(Cr)return Cr.call(e)==Cr.call(t)}return!1}(e,t,u,r,n,o,s);if(!(1&r)){var p=h&&Pe.call(e,"__wrapped__"),_=f&&Pe.call(t,"__wrapped__");if(p||_){var w=p?e.value():e,I=_?t.value():t;return s||(s=new Yr),o(w,I,r,n,s)}}return!!d&&(s||(s=new Yr),function(e,t,r,n,o,s){var a=1&r,c=eo(e),u=c.length;if(u!=eo(t).length&&!a)return!1;for(var l=u;l--;){var h=c[l];if(!(a?h in t:Pe.call(t,h)))return!1}var f=s.get(e),d=s.get(t);if(f&&d)return f==t&&d==e;var p=!0;s.set(e,t),s.set(t,e);for(var m=a;++l<u;){var y=e[h=c[l]],v=t[h];if(n)var g=a?n(v,y,h,t,e,s):n(y,v,h,e,t,s);if(!(g===i?y===v||o(y,v,r,n,s):g)){p=!1;break}m||(m="constructor"==h)}if(p&&!m){var b=e.constructor,_=t.constructor;b==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(p=!1)}return s.delete(e),s.delete(t),p}(e,t,r,n,o,s))}(e,t,r,n,An,o))}function xn(e,t,r,n){var o=r.length,s=o,a=!n;if(null==e)return!s;for(e=Oe(e);o--;){var c=r[o];if(a&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++o<s;){var u=(c=r[o])[0],l=e[u],h=c[1];if(a&&c[2]){if(l===i&&!(u in e))return!1}else{var f=new Yr;if(n)var d=n(l,h,u,e,t,f);if(!(d===i?An(h,l,3,n,f):d))return!1}}return!0}function Rn(e){return!(!Xs(e)||(t=e,Ce&&Ce in t))&&(Gs(e)?qe:me).test(Mo(e));var t}function Pn(e){return"function"==typeof e?e:null==e?rc:"object"==typeof e?Us(e)?Fn(e[0],e[1]):Mn(e):hc(e)}function jn(e){if(!wo(e))return pr(e);var t=[];for(var r in Oe(e))Pe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Cn(e,t){return e<t}function $n(e,t){var r=-1,i=zs(e)?n(e.length):[];return ln(e,(function(e,n,o){i[++r]=t(e,n,o)})),i}function Mn(e){var t=ao(e);return 1==t.length&&t[0][2]?So(t[0][0],t[0][1]):function(r){return r===e||xn(r,e,t)}}function Fn(e,t){return go(e)&&Eo(t)?So($o(e),t):function(r){var n=Ia(r,e);return n===i&&n===t?Ta(r,e):An(t,n,3)}}function qn(e,t,r,n,o){e!==t&&yn(t,(function(s,a){if(o||(o=new Yr),Xs(s))!function(e,t,r,n,o,s,a){var c=To(e,r),u=To(t,r),l=a.get(u);if(l)Jr(e,r,l);else{var h=s?s(c,u,r+"",e,t,a):i,f=h===i;if(f){var d=Us(u),p=!d&&Ws(u),m=!d&&!p&&ca(u);h=u,d||p||m?Us(c)?h=c:Ys(c)?h=Ti(c):p?(f=!1,h=_i(u,!0)):m?(f=!1,h=Ei(u,!0)):h=[]:na(u)||Qs(u)?(h=c,Qs(c)?h=ya(c):Xs(c)&&!Gs(c)||(h=po(u))):f=!1}f&&(a.set(u,h),o(h,u,n,s,a),a.delete(u)),Jr(e,r,h)}}(e,t,a,r,qn,n,o);else{var c=n?n(To(e,a),s,a+"",e,t,o):i;c===i&&(c=s),Jr(e,a,c)}}),xa)}function Ln(e,t){var r=e.length;if(r)return yo(t+=t<0?r:0,r)?e[t]:i}function Vn(e,t,r){t=t.length?xt(t,(function(e){return Us(e)?function(t){return wn(t,1===e.length?e[0]:e)}:e})):[rc];var n=-1;t=xt(t,Ht(oo()));var i=$n(e,(function(e,r,i){var o=xt(t,(function(t){return t(e)}));return{criteria:o,index:++n,value:e}}));return function(e,t){var n=e.length;for(e.sort((function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var c=Si(i[n],o[n]);if(c)return n>=a?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}));n--;)e[n]=e[n].value;return e}(i)}function Qn(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var s=t[n],a=wn(e,s);r(a,s)&&Gn(o,yi(s,e),a)}return o}function Un(e,t,r,n){var i=n?Lt:qt,o=-1,s=t.length,a=e;for(e===t&&(t=Ti(t)),r&&(a=xt(e,Ht(r)));++o<s;)for(var c=0,u=t[o],l=r?r(u):u;(c=i(a,l,c,n))>-1;)a!==e&&We.call(a,c,1),We.call(e,c,1);return e}function Bn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;yo(i)?We.call(e,i,1):ci(e,i)}}return e}function zn(e,t){return e+dt(br()*(t-e+1))}function Yn(e,t){var r="";if(!e||t<1||t>h)return r;do{t%2&&(r+=e),(t=dt(t/2))&&(e+=e)}while(t);return r}function Wn(e,t){return No(Oo(e,t,rc),e+"")}function Kn(e){return Kr(qa(e))}function Hn(e,t){var r=qa(e);return Ro(r,on(t,0,r.length))}function Gn(e,t,r,n){if(!Xs(e))return e;for(var o=-1,s=(t=yi(t,e)).length,a=s-1,c=e;null!=c&&++o<s;){var u=$o(t[o]),l=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(o!=a){var h=c[u];(l=n?n(h,u,c):i)===i&&(l=Xs(h)?h:yo(t[o+1])?[]:{})}Zr(c,u,l),c=c[u]}return e}var Jn=kr?function(e,t){return kr.set(e,t),e}:rc,Zn=et?function(e,t){return et(e,"toString",{configurable:!0,enumerable:!1,value:Xa(t),writable:!0})}:rc;function Xn(e){return Ro(qa(e))}function ei(e,t,r){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var s=n(o);++i<o;)s[i]=e[i+t];return s}function ti(e,t){var r;return ln(e,(function(e,n,i){return!(r=t(e,n,i))})),!!r}function ri(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var o=n+i>>>1,s=e[o];null!==s&&!aa(s)&&(r?s<=t:s<t)?n=o+1:i=o}return i}return ni(e,t,rc,r)}function ni(e,t,r,n){var o=0,s=null==e?0:e.length;if(0===s)return 0;for(var a=(t=r(t))!=t,c=null===t,u=aa(t),l=t===i;o<s;){var h=dt((o+s)/2),f=r(e[h]),d=f!==i,p=null===f,m=f==f,y=aa(f);if(a)var v=n||m;else v=l?m&&(n||d):c?m&&d&&(n||!p):u?m&&d&&!p&&(n||!y):!p&&!y&&(n?f<=t:f<t);v?o=h+1:s=h}return yr(s,4294967294)}function ii(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r],a=t?t(s):s;if(!r||!qs(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function oi(e){return"number"==typeof e?e:aa(e)?f:+e}function si(e){if("string"==typeof e)return e;if(Us(e))return xt(e,si)+"";if(aa(e))return $r?$r.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ai(e,t,r){var n=-1,i=Nt,o=e.length,s=!0,a=[],c=a;if(r)s=!1,i=At;else if(o>=200){var u=t?null:Yi(e);if(u)return ar(u);s=!1,i=Jt,c=new zr}else c=t?[]:a;e:for(;++n<o;){var l=e[n],h=t?t(l):l;if(l=r||0!==l?l:0,s&&h==h){for(var f=c.length;f--;)if(c[f]===h)continue e;t&&c.push(h),a.push(l)}else i(c,h,r)||(c!==a&&c.push(h),a.push(l))}return a}function ci(e,t){return null==(e=Io(e,t=yi(t,e)))||delete e[$o(Ho(t))]}function ui(e,t,r,n){return Gn(e,t,r(wn(e,t)),n)}function li(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?ei(e,n?0:o,n?o+1:i):ei(e,n?o+1:0,n?i:o)}function hi(e,t){var r=e;return r instanceof Vr&&(r=r.value()),Pt(t,(function(e,t){return t.func.apply(t.thisArg,Rt([e],t.args))}),r)}function fi(e,t,r){var i=e.length;if(i<2)return i?ai(e[0]):[];for(var o=-1,s=n(i);++o<i;)for(var a=e[o],c=-1;++c<i;)c!=o&&(s[o]=un(s[o]||a,e[c],t,r));return ai(mn(s,1),t,r)}function di(e,t,r){for(var n=-1,o=e.length,s=t.length,a={};++n<o;){var c=n<s?t[n]:i;r(a,e[n],c)}return a}function pi(e){return Ys(e)?e:[]}function mi(e){return"function"==typeof e?e:rc}function yi(e,t){return Us(e)?e:go(e,t)?[e]:Co(va(e))}var vi=Wn;function gi(e,t,r){var n=e.length;return r=r===i?n:r,!t&&r>=n?e:ei(e,t,r)}var bi=st||function(e){return ht.clearTimeout(e)};function _i(e,t){if(t)return e.slice();var r=e.length,n=Ue?Ue(r):new e.constructor(r);return e.copy(n),n}function wi(e){var t=new e.constructor(e.byteLength);return new Qe(t).set(new Qe(e)),t}function Ei(e,t){var r=t?wi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Si(e,t){if(e!==t){var r=e!==i,n=null===e,o=e==e,s=aa(e),a=t!==i,c=null===t,u=t==t,l=aa(t);if(!c&&!l&&!s&&e>t||s&&a&&u&&!c&&!l||n&&a&&u||!r&&u||!o)return 1;if(!n&&!s&&!l&&e<t||l&&r&&o&&!n&&!s||c&&r&&o||!a&&o||!u)return-1}return 0}function Oi(e,t,r,i){for(var o=-1,s=e.length,a=r.length,c=-1,u=t.length,l=mr(s-a,0),h=n(u+l),f=!i;++c<u;)h[c]=t[c];for(;++o<a;)(f||o<s)&&(h[r[o]]=e[o]);for(;l--;)h[c++]=e[o++];return h}function Ii(e,t,r,i){for(var o=-1,s=e.length,a=-1,c=r.length,u=-1,l=t.length,h=mr(s-c,0),f=n(h+l),d=!i;++o<h;)f[o]=e[o];for(var p=o;++u<l;)f[p+u]=t[u];for(;++a<c;)(d||o<s)&&(f[p+r[a]]=e[o++]);return f}function Ti(e,t){var r=-1,i=e.length;for(t||(t=n(i));++r<i;)t[r]=e[r];return t}function ki(e,t,r,n){var o=!r;r||(r={});for(var s=-1,a=t.length;++s<a;){var c=t[s],u=n?n(r[c],e[c],c,r,e):i;u===i&&(u=e[c]),o?rn(r,c,u):Zr(r,c,u)}return r}function Di(e,t){return function(r,n){var i=Us(r)?Ot:en,o=t?t():{};return i(r,e,oo(n,2),o)}}function Ni(e){return Wn((function(t,r){var n=-1,o=r.length,s=o>1?r[o-1]:i,a=o>2?r[2]:i;for(s=e.length>3&&"function"==typeof s?(o--,s):i,a&&vo(r[0],r[1],a)&&(s=o<3?i:s,o=1),t=Oe(t);++n<o;){var c=r[n];c&&e(t,c,n,s)}return t}))}function Ai(e,t){return function(r,n){if(null==r)return r;if(!zs(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Oe(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function xi(e){return function(t,r,n){for(var i=-1,o=Oe(t),s=n(t),a=s.length;a--;){var c=s[e?a:++i];if(!1===r(o[c],c,o))break}return t}}function Ri(e){return function(t){var r=nr(t=va(t))?lr(t):i,n=r?r[0]:t.charAt(0),o=r?gi(r,1).join(""):t.slice(1);return n[e]()+o}}function Pi(e){return function(t){return Pt(Ga(Qa(t).replace(Ge,"")),e,"")}}function ji(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Fr(e.prototype),n=e.apply(r,t);return Xs(n)?n:r}}function Ci(e){return function(t,r,n){var o=Oe(t);if(!zs(t)){var s=oo(r,3);t=Aa(t),r=function(e){return s(o[e],e,o)}}var a=e(t,r,n);return a>-1?o[s?t[a]:a]:i}}function $i(e){return Xi((function(t){var r=t.length,n=r,s=Lr.prototype.thru;for(e&&t.reverse();n--;){var a=t[n];if("function"!=typeof a)throw new ke(o);if(s&&!c&&"wrapper"==no(a))var c=new Lr([],!0)}for(n=c?n:r;++n<r;){var u=no(a=t[n]),l="wrapper"==u?ro(a):i;c=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[no(l[0])].apply(c,l[3]):1==a.length&&bo(a)?c[u]():c.thru(a)}return function(){var e=arguments,n=e[0];if(c&&1==e.length&&Us(n))return c.plant(n).value();for(var i=0,o=r?t[i].apply(this,e):n;++i<r;)o=t[i].call(this,o);return o}}))}function Mi(e,t,r,o,s,a,c,l,h,f){var d=t&u,p=1&t,m=2&t,y=24&t,v=512&t,g=m?i:ji(e);return function u(){for(var b=arguments.length,_=n(b),w=b;w--;)_[w]=arguments[w];if(y)var E=io(u),S=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(_,E);if(o&&(_=Oi(_,o,s,y)),a&&(_=Ii(_,a,c,y)),b-=S,y&&b<f){var O=sr(_,E);return Bi(e,t,Mi,u.placeholder,r,_,O,l,h,f-b)}var I=p?r:this,T=m?I[e]:e;return b=_.length,l?_=function(e,t){for(var r=e.length,n=yr(t.length,r),o=Ti(e);n--;){var s=t[n];e[n]=yo(s,r)?o[s]:i}return e}(_,l):v&&b>1&&_.reverse(),d&&h<b&&(_.length=h),this&&this!==ht&&this instanceof u&&(T=g||ji(T)),T.apply(I,_)}}function Fi(e,t){return function(r,n){return function(e,t,r,n){return gn(e,(function(e,i,o){t(n,r(e),i,o)})),n}(r,e,t(n),{})}}function qi(e,t){return function(r,n){var o;if(r===i&&n===i)return t;if(r!==i&&(o=r),n!==i){if(o===i)return n;"string"==typeof r||"string"==typeof n?(r=si(r),n=si(n)):(r=oi(r),n=oi(n)),o=e(r,n)}return o}}function Li(e){return Xi((function(t){return t=xt(t,Ht(oo())),Wn((function(r){var n=this;return e(t,(function(e){return St(e,n,r)}))}))}))}function Vi(e,t){var r=(t=t===i?" ":si(t)).length;if(r<2)return r?Yn(t,e):t;var n=Yn(t,ft(e/ur(t)));return nr(t)?gi(lr(n),0,e).join(""):n.slice(0,e)}function Qi(e){return function(t,r,o){return o&&"number"!=typeof o&&vo(t,r,o)&&(r=o=i),t=fa(t),r===i?(r=t,t=0):r=fa(r),function(e,t,r,i){for(var o=-1,s=mr(ft((t-e)/(r||1)),0),a=n(s);s--;)a[i?s:++o]=e,e+=r;return a}(t,r,o=o===i?t<r?1:-1:fa(o),e)}}function Ui(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=ma(t),r=ma(r)),e(t,r)}}function Bi(e,t,r,n,o,s,a,u,l,h){var f=8&t;t|=f?c:64,4&(t&=~(f?64:c))||(t&=-4);var d=[e,t,o,f?s:i,f?a:i,f?i:s,f?i:a,u,l,h],p=r.apply(i,d);return bo(e)&&ko(p,d),p.placeholder=n,Ao(p,e,t)}function zi(e){var t=Se[e];return function(e,r){if(e=ma(e),(r=null==r?0:yr(da(r),292))&&$t(e)){var n=(va(e)+"e").split("e");return+((n=(va(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Yi=Or&&1/ar(new Or([,-0]))[1]==l?function(e){return new Or(e)}:ac;function Wi(e){return function(t){var r=ho(t);return r==E?ir(t):r==k?cr(t):function(e,t){return xt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Ki(e,t,r,s,l,h,f,d){var p=2&t;if(!p&&"function"!=typeof e)throw new ke(o);var m=s?s.length:0;if(m||(t&=-97,s=l=i),f=f===i?f:mr(da(f),0),d=d===i?d:da(d),m-=l?l.length:0,64&t){var y=s,v=l;s=l=i}var g=p?i:ro(e),b=[e,t,r,s,l,y,v,h,f,d];if(g&&function(e,t){var r=e[1],n=t[1],i=r|n,o=i<131,s=n==u&&8==r||n==u&&256==r&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!o&&!s)return e;1&n&&(e[2]=t[2],i|=1&r?0:4);var c=t[3];if(c){var l=e[3];e[3]=l?Oi(l,c,t[4]):c,e[4]=l?sr(e[3],a):t[4]}(c=t[5])&&(l=e[5],e[5]=l?Ii(l,c,t[6]):c,e[6]=l?sr(e[5],a):t[6]),(c=t[7])&&(e[7]=c),n&u&&(e[8]=null==e[8]?t[8]:yr(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(b,g),e=b[0],t=b[1],r=b[2],s=b[3],l=b[4],!(d=b[9]=b[9]===i?p?0:e.length:mr(b[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,r){var o=ji(e);return function s(){for(var a=arguments.length,c=n(a),u=a,l=io(s);u--;)c[u]=arguments[u];var h=a<3&&c[0]!==l&&c[a-1]!==l?[]:sr(c,l);return(a-=h.length)<r?Bi(e,t,Mi,s.placeholder,i,c,h,i,i,r-a):St(this&&this!==ht&&this instanceof s?o:e,this,c)}}(e,t,d):t!=c&&33!=t||l.length?Mi.apply(i,b):function(e,t,r,i){var o=1&t,s=ji(e);return function t(){for(var a=-1,c=arguments.length,u=-1,l=i.length,h=n(l+c),f=this&&this!==ht&&this instanceof t?s:e;++u<l;)h[u]=i[u];for(;c--;)h[u++]=arguments[++a];return St(f,o?r:this,h)}}(e,t,r,s);else var _=function(e,t,r){var n=1&t,i=ji(e);return function t(){return(this&&this!==ht&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,r);return Ao((g?Jn:ko)(_,b),e,t)}function Hi(e,t,r,n){return e===i||qs(e,Ae[r])&&!Pe.call(n,r)?t:e}function Gi(e,t,r,n,o,s){return Xs(e)&&Xs(t)&&(s.set(t,e),qn(e,t,i,Gi,s),s.delete(t)),e}function Ji(e){return na(e)?i:e}function Zi(e,t,r,n,o,s){var a=1&r,c=e.length,u=t.length;if(c!=u&&!(a&&u>c))return!1;var l=s.get(e),h=s.get(t);if(l&&h)return l==t&&h==e;var f=-1,d=!0,p=2&r?new zr:i;for(s.set(e,t),s.set(t,e);++f<c;){var m=e[f],y=t[f];if(n)var v=a?n(y,m,f,t,e,s):n(m,y,f,e,t,s);if(v!==i){if(v)continue;d=!1;break}if(p){if(!Ct(t,(function(e,t){if(!Jt(p,t)&&(m===e||o(m,e,r,n,s)))return p.push(t)}))){d=!1;break}}else if(m!==y&&!o(m,y,r,n,s)){d=!1;break}}return s.delete(e),s.delete(t),d}function Xi(e){return No(Oo(e,i,Bo),e+"")}function eo(e){return En(e,Aa,uo)}function to(e){return En(e,xa,lo)}var ro=kr?function(e){return kr.get(e)}:ac;function no(e){for(var t=e.name+"",r=Dr[t],n=Pe.call(Dr,t)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function io(e){return(Pe.call(Mr,"placeholder")?Mr:e).placeholder}function oo(){var e=Mr.iteratee||nc;return e=e===nc?Pn:e,arguments.length?e(arguments[0],arguments[1]):e}function so(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function ao(e){for(var t=Aa(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Eo(i)]}return t}function co(e,t){var r=function(e,t){return null==e?i:e[t]}(e,t);return Rn(r)?r:i}var uo=mt?function(e){return null==e?[]:(e=Oe(e),Dt(mt(e),(function(t){return Ye.call(e,t)})))}:pc,lo=mt?function(e){for(var t=[];e;)Rt(t,uo(e)),e=Be(e);return t}:pc,ho=Sn;function fo(e,t,r){for(var n=-1,i=(t=yi(t,e)).length,o=!1;++n<i;){var s=$o(t[n]);if(!(o=null!=e&&r(e,s)))break;e=e[s]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&Zs(i)&&yo(s,i)&&(Us(e)||Qs(e))}function po(e){return"function"!=typeof e.constructor||wo(e)?{}:Fr(Be(e))}function mo(e){return Us(e)||Qs(e)||!!(Ke&&e&&e[Ke])}function yo(e,t){var r=typeof e;return!!(t=null==t?h:t)&&("number"==r||"symbol"!=r&&ve.test(e))&&e>-1&&e%1==0&&e<t}function vo(e,t,r){if(!Xs(r))return!1;var n=typeof t;return!!("number"==n?zs(r)&&yo(t,r.length):"string"==n&&t in r)&&qs(r[t],e)}function go(e,t){if(Us(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!aa(e))||X.test(e)||!Z.test(e)||null!=t&&e in Oe(t)}function bo(e){var t=no(e),r=Mr[t];if("function"!=typeof r||!(t in Vr.prototype))return!1;if(e===r)return!0;var n=ro(r);return!!n&&e===n[0]}(wr&&ho(new wr(new ArrayBuffer(1)))!=R||Er&&ho(new Er)!=E||Sr&&ho(Sr.resolve())!=I||Or&&ho(new Or)!=k||Ir&&ho(new Ir)!=A)&&(ho=function(e){var t=Sn(e),r=t==O?e.constructor:i,n=r?Mo(r):"";if(n)switch(n){case Nr:return R;case Ar:return E;case xr:return I;case Rr:return k;case Pr:return A}return t});var _o=xe?Gs:mc;function wo(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ae)}function Eo(e){return e==e&&!Xs(e)}function So(e,t){return function(r){return null!=r&&r[e]===t&&(t!==i||e in Oe(r))}}function Oo(e,t,r){return t=mr(t===i?e.length-1:t,0),function(){for(var i=arguments,o=-1,s=mr(i.length-t,0),a=n(s);++o<s;)a[o]=i[t+o];o=-1;for(var c=n(t+1);++o<t;)c[o]=i[o];return c[t]=r(a),St(e,this,c)}}function Io(e,t){return t.length<2?e:wn(e,ei(t,0,-1))}function To(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var ko=xo(Jn),Do=lt||function(e,t){return ht.setTimeout(e,t)},No=xo(Zn);function Ao(e,t,r){var n=t+"";return No(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return It(p,(function(r){var n="_."+r[0];t&r[1]&&!Nt(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(ae):[]}(n),r)))}function xo(e){var t=0,r=0;return function(){var n=vr(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Ro(e,t){var r=-1,n=e.length,o=n-1;for(t=t===i?n:t;++r<t;){var s=zn(r,o),a=e[s];e[s]=e[r],e[r]=a}return e.length=t,e}var Po,jo,Co=(Po=Ps((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,r,n,i){t.push(n?i.replace(le,"$1"):r||e)})),t}),(function(e){return 500===jo.size&&jo.clear(),e})),jo=Po.cache,Po);function $o(e){if("string"==typeof e||aa(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Mo(e){if(null!=e){try{return Re.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Fo(e){if(e instanceof Vr)return e.clone();var t=new Lr(e.__wrapped__,e.__chain__);return t.__actions__=Ti(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var qo=Wn((function(e,t){return Ys(e)?un(e,mn(t,1,Ys,!0)):[]})),Lo=Wn((function(e,t){var r=Ho(t);return Ys(r)&&(r=i),Ys(e)?un(e,mn(t,1,Ys,!0),oo(r,2)):[]})),Vo=Wn((function(e,t){var r=Ho(t);return Ys(r)&&(r=i),Ys(e)?un(e,mn(t,1,Ys,!0),i,r):[]}));function Qo(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:da(r);return i<0&&(i=mr(n+i,0)),Ft(e,oo(t,3),i)}function Uo(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=n-1;return r!==i&&(o=da(r),o=r<0?mr(n+o,0):yr(o,n-1)),Ft(e,oo(t,3),o,!0)}function Bo(e){return null!=e&&e.length?mn(e,1):[]}function zo(e){return e&&e.length?e[0]:i}var Yo=Wn((function(e){var t=xt(e,pi);return t.length&&t[0]===e[0]?kn(t):[]})),Wo=Wn((function(e){var t=Ho(e),r=xt(e,pi);return t===Ho(r)?t=i:r.pop(),r.length&&r[0]===e[0]?kn(r,oo(t,2)):[]})),Ko=Wn((function(e){var t=Ho(e),r=xt(e,pi);return(t="function"==typeof t?t:i)&&r.pop(),r.length&&r[0]===e[0]?kn(r,i,t):[]}));function Ho(e){var t=null==e?0:e.length;return t?e[t-1]:i}var Go=Wn(Jo);function Jo(e,t){return e&&e.length&&t&&t.length?Un(e,t):e}var Zo=Xi((function(e,t){var r=null==e?0:e.length,n=nn(e,t);return Bn(e,xt(t,(function(e){return yo(e,r)?+e:e})).sort(Si)),n}));function Xo(e){return null==e?e:_r.call(e)}var es=Wn((function(e){return ai(mn(e,1,Ys,!0))})),ts=Wn((function(e){var t=Ho(e);return Ys(t)&&(t=i),ai(mn(e,1,Ys,!0),oo(t,2))})),rs=Wn((function(e){var t=Ho(e);return t="function"==typeof t?t:i,ai(mn(e,1,Ys,!0),i,t)}));function ns(e){if(!e||!e.length)return[];var t=0;return e=Dt(e,(function(e){if(Ys(e))return t=mr(e.length,t),!0})),Wt(t,(function(t){return xt(e,Ut(t))}))}function is(e,t){if(!e||!e.length)return[];var r=ns(e);return null==t?r:xt(r,(function(e){return St(t,i,e)}))}var os=Wn((function(e,t){return Ys(e)?un(e,t):[]})),ss=Wn((function(e){return fi(Dt(e,Ys))})),as=Wn((function(e){var t=Ho(e);return Ys(t)&&(t=i),fi(Dt(e,Ys),oo(t,2))})),cs=Wn((function(e){var t=Ho(e);return t="function"==typeof t?t:i,fi(Dt(e,Ys),i,t)})),us=Wn(ns),ls=Wn((function(e){var t=e.length,r=t>1?e[t-1]:i;return r="function"==typeof r?(e.pop(),r):i,is(e,r)}));function hs(e){var t=Mr(e);return t.__chain__=!0,t}function fs(e,t){return t(e)}var ds=Xi((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,o=function(t){return nn(t,e)};return!(t>1||this.__actions__.length)&&n instanceof Vr&&yo(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new Lr(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ps=Di((function(e,t,r){Pe.call(e,r)?++e[r]:rn(e,r,1)})),ms=Ci(Qo),ys=Ci(Uo);function vs(e,t){return(Us(e)?It:ln)(e,oo(t,3))}function gs(e,t){return(Us(e)?Tt:hn)(e,oo(t,3))}var bs=Di((function(e,t,r){Pe.call(e,r)?e[r].push(t):rn(e,r,[t])})),_s=Wn((function(e,t,r){var i=-1,o="function"==typeof t,s=zs(e)?n(e.length):[];return ln(e,(function(e){s[++i]=o?St(t,e,r):Dn(e,t,r)})),s})),ws=Di((function(e,t,r){rn(e,r,t)}));function Es(e,t){return(Us(e)?xt:$n)(e,oo(t,3))}var Ss=Di((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),Os=Wn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&vo(e,t[0],t[1])?t=[]:r>2&&vo(t[0],t[1],t[2])&&(t=[t[0]]),Vn(e,mn(t,1),[])})),Is=ut||function(){return ht.Date.now()};function Ts(e,t,r){return t=r?i:t,t=e&&null==t?e.length:t,Ki(e,u,i,i,i,i,t)}function ks(e,t){var r;if("function"!=typeof t)throw new ke(o);return e=da(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=i),r}}var Ds=Wn((function(e,t,r){var n=1;if(r.length){var i=sr(r,io(Ds));n|=c}return Ki(e,n,t,r,i)})),Ns=Wn((function(e,t,r){var n=3;if(r.length){var i=sr(r,io(Ns));n|=c}return Ki(t,n,e,r,i)}));function As(e,t,r){var n,s,a,c,u,l,h=0,f=!1,d=!1,p=!0;if("function"!=typeof e)throw new ke(o);function m(t){var r=n,o=s;return n=s=i,h=t,c=e.apply(o,r)}function y(e){var r=e-l;return l===i||r>=t||r<0||d&&e-h>=a}function v(){var e=Is();if(y(e))return g(e);u=Do(v,function(e){var r=t-(e-l);return d?yr(r,a-(e-h)):r}(e))}function g(e){return u=i,p&&n?m(e):(n=s=i,c)}function b(){var e=Is(),r=y(e);if(n=arguments,s=this,l=e,r){if(u===i)return function(e){return h=e,u=Do(v,t),f?m(e):c}(l);if(d)return bi(u),u=Do(v,t),m(l)}return u===i&&(u=Do(v,t)),c}return t=ma(t)||0,Xs(r)&&(f=!!r.leading,a=(d="maxWait"in r)?mr(ma(r.maxWait)||0,t):a,p="trailing"in r?!!r.trailing:p),b.cancel=function(){u!==i&&bi(u),h=0,n=l=s=u=i},b.flush=function(){return u===i?c:g(Is())},b}var xs=Wn((function(e,t){return cn(e,1,t)})),Rs=Wn((function(e,t,r){return cn(e,ma(t)||0,r)}));function Ps(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ke(o);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Ps.Cache||Br),r}function js(e){if("function"!=typeof e)throw new ke(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ps.Cache=Br;var Cs=vi((function(e,t){var r=(t=1==t.length&&Us(t[0])?xt(t[0],Ht(oo())):xt(mn(t,1),Ht(oo()))).length;return Wn((function(n){for(var i=-1,o=yr(n.length,r);++i<o;)n[i]=t[i].call(this,n[i]);return St(e,this,n)}))})),$s=Wn((function(e,t){var r=sr(t,io($s));return Ki(e,c,i,t,r)})),Ms=Wn((function(e,t){var r=sr(t,io(Ms));return Ki(e,64,i,t,r)})),Fs=Xi((function(e,t){return Ki(e,256,i,i,i,t)}));function qs(e,t){return e===t||e!=e&&t!=t}var Ls=Ui(On),Vs=Ui((function(e,t){return e>=t})),Qs=Nn(function(){return arguments}())?Nn:function(e){return ea(e)&&Pe.call(e,"callee")&&!Ye.call(e,"callee")},Us=n.isArray,Bs=vt?Ht(vt):function(e){return ea(e)&&Sn(e)==x};function zs(e){return null!=e&&Zs(e.length)&&!Gs(e)}function Ys(e){return ea(e)&&zs(e)}var Ws=yt||mc,Ks=gt?Ht(gt):function(e){return ea(e)&&Sn(e)==g};function Hs(e){if(!ea(e))return!1;var t=Sn(e);return t==b||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!na(e)}function Gs(e){if(!Xs(e))return!1;var t=Sn(e);return t==_||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Js(e){return"number"==typeof e&&e==da(e)}function Zs(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function Xs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ea(e){return null!=e&&"object"==typeof e}var ta=bt?Ht(bt):function(e){return ea(e)&&ho(e)==E};function ra(e){return"number"==typeof e||ea(e)&&Sn(e)==S}function na(e){if(!ea(e)||Sn(e)!=O)return!1;var t=Be(e);if(null===t)return!0;var r=Pe.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Re.call(r)==Me}var ia=_t?Ht(_t):function(e){return ea(e)&&Sn(e)==T},oa=wt?Ht(wt):function(e){return ea(e)&&ho(e)==k};function sa(e){return"string"==typeof e||!Us(e)&&ea(e)&&Sn(e)==D}function aa(e){return"symbol"==typeof e||ea(e)&&Sn(e)==N}var ca=Et?Ht(Et):function(e){return ea(e)&&Zs(e.length)&&!!it[Sn(e)]},ua=Ui(Cn),la=Ui((function(e,t){return e<=t}));function ha(e){if(!e)return[];if(zs(e))return sa(e)?lr(e):Ti(e);if(He&&e[He])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[He]());var t=ho(e);return(t==E?ir:t==k?ar:qa)(e)}function fa(e){return e?(e=ma(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function da(e){var t=fa(e),r=t%1;return t==t?r?t-r:t:0}function pa(e){return e?on(da(e),0,d):0}function ma(e){if("number"==typeof e)return e;if(aa(e))return f;if(Xs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var r=pe.test(e);return r||ye.test(e)?ct(e.slice(2),r?2:8):de.test(e)?f:+e}function ya(e){return ki(e,xa(e))}function va(e){return null==e?"":si(e)}var ga=Ni((function(e,t){if(wo(t)||zs(t))ki(t,Aa(t),e);else for(var r in t)Pe.call(t,r)&&Zr(e,r,t[r])})),ba=Ni((function(e,t){ki(t,xa(t),e)})),_a=Ni((function(e,t,r,n){ki(t,xa(t),e,n)})),wa=Ni((function(e,t,r,n){ki(t,Aa(t),e,n)})),Ea=Xi(nn),Sa=Wn((function(e,t){e=Oe(e);var r=-1,n=t.length,o=n>2?t[2]:i;for(o&&vo(t[0],t[1],o)&&(n=1);++r<n;)for(var s=t[r],a=xa(s),c=-1,u=a.length;++c<u;){var l=a[c],h=e[l];(h===i||qs(h,Ae[l])&&!Pe.call(e,l))&&(e[l]=s[l])}return e})),Oa=Wn((function(e){return e.push(i,Gi),St(Pa,i,e)}));function Ia(e,t,r){var n=null==e?i:wn(e,t);return n===i?r:n}function Ta(e,t){return null!=e&&fo(e,t,Tn)}var ka=Fi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=$e.call(t)),e[t]=r}),Xa(rc)),Da=Fi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=$e.call(t)),Pe.call(e,t)?e[t].push(r):e[t]=[r]}),oo),Na=Wn(Dn);function Aa(e){return zs(e)?Wr(e):jn(e)}function xa(e){return zs(e)?Wr(e,!0):function(e){if(!Xs(e))return function(e){var t=[];if(null!=e)for(var r in Oe(e))t.push(r);return t}(e);var t=wo(e),r=[];for(var n in e)("constructor"!=n||!t&&Pe.call(e,n))&&r.push(n);return r}(e)}var Ra=Ni((function(e,t,r){qn(e,t,r)})),Pa=Ni((function(e,t,r,n){qn(e,t,r,n)})),ja=Xi((function(e,t){var r={};if(null==e)return r;var n=!1;t=xt(t,(function(t){return t=yi(t,e),n||(n=t.length>1),t})),ki(e,to(e),r),n&&(r=sn(r,7,Ji));for(var i=t.length;i--;)ci(r,t[i]);return r})),Ca=Xi((function(e,t){return null==e?{}:function(e,t){return Qn(e,t,(function(t,r){return Ta(e,r)}))}(e,t)}));function $a(e,t){if(null==e)return{};var r=xt(to(e),(function(e){return[e]}));return t=oo(t),Qn(e,r,(function(e,r){return t(e,r[0])}))}var Ma=Wi(Aa),Fa=Wi(xa);function qa(e){return null==e?[]:Gt(e,Aa(e))}var La=Pi((function(e,t,r){return t=t.toLowerCase(),e+(r?Va(t):t)}));function Va(e){return Ha(va(e).toLowerCase())}function Qa(e){return(e=va(e))&&e.replace(ge,er).replace(Je,"")}var Ua=Pi((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Ba=Pi((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),za=Ri("toLowerCase"),Ya=Pi((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),Wa=Pi((function(e,t,r){return e+(r?" ":"")+Ha(t)})),Ka=Pi((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Ha=Ri("toUpperCase");function Ga(e,t,r){return e=va(e),(t=r?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.match(ce)||[]}(e):e.match(t)||[]}var Ja=Wn((function(e,t){try{return St(e,i,t)}catch(e){return Hs(e)?e:new we(e)}})),Za=Xi((function(e,t){return It(t,(function(t){t=$o(t),rn(e,t,Ds(e[t],e))})),e}));function Xa(e){return function(){return e}}var ec=$i(),tc=$i(!0);function rc(e){return e}function nc(e){return Pn("function"==typeof e?e:sn(e,1))}var ic=Wn((function(e,t){return function(r){return Dn(r,e,t)}})),oc=Wn((function(e,t){return function(r){return Dn(e,r,t)}}));function sc(e,t,r){var n=Aa(t),i=_n(t,n);null!=r||Xs(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=_n(t,Aa(t)));var o=!(Xs(r)&&"chain"in r&&!r.chain),s=Gs(e);return It(i,(function(r){var n=t[r];e[r]=n,s&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ti(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Rt([this.value()],arguments))})})),e}function ac(){}var cc=Li(xt),uc=Li(kt),lc=Li(Ct);function hc(e){return go(e)?Ut($o(e)):function(e){return function(t){return wn(t,e)}}(e)}var fc=Qi(),dc=Qi(!0);function pc(){return[]}function mc(){return!1}var yc,vc=qi((function(e,t){return e+t}),0),gc=zi("ceil"),bc=qi((function(e,t){return e/t}),1),_c=zi("floor"),wc=qi((function(e,t){return e*t}),1),Ec=zi("round"),Sc=qi((function(e,t){return e-t}),0);return Mr.after=function(e,t){if("function"!=typeof t)throw new ke(o);return e=da(e),function(){if(--e<1)return t.apply(this,arguments)}},Mr.ary=Ts,Mr.assign=ga,Mr.assignIn=ba,Mr.assignInWith=_a,Mr.assignWith=wa,Mr.at=Ea,Mr.before=ks,Mr.bind=Ds,Mr.bindAll=Za,Mr.bindKey=Ns,Mr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Us(e)?e:[e]},Mr.chain=hs,Mr.chunk=function(e,t,r){t=(r?vo(e,t,r):t===i)?1:mr(da(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,a=0,c=n(ft(o/t));s<o;)c[a++]=ei(e,s,s+=t);return c},Mr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var o=e[t];o&&(i[n++]=o)}return i},Mr.concat=function(){var e=arguments.length;if(!e)return[];for(var t=n(e-1),r=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Rt(Us(r)?Ti(r):[r],mn(t,1))},Mr.cond=function(e){var t=null==e?0:e.length,r=oo();return e=t?xt(e,(function(e){if("function"!=typeof e[1])throw new ke(o);return[r(e[0]),e[1]]})):[],Wn((function(r){for(var n=-1;++n<t;){var i=e[n];if(St(i[0],this,r))return St(i[1],this,r)}}))},Mr.conforms=function(e){return function(e){var t=Aa(e);return function(r){return an(r,e,t)}}(sn(e,1))},Mr.constant=Xa,Mr.countBy=ps,Mr.create=function(e,t){var r=Fr(e);return null==t?r:tn(r,t)},Mr.curry=function e(t,r,n){var o=Ki(t,8,i,i,i,i,i,r=n?i:r);return o.placeholder=e.placeholder,o},Mr.curryRight=function e(t,r,n){var o=Ki(t,16,i,i,i,i,i,r=n?i:r);return o.placeholder=e.placeholder,o},Mr.debounce=As,Mr.defaults=Sa,Mr.defaultsDeep=Oa,Mr.defer=xs,Mr.delay=Rs,Mr.difference=qo,Mr.differenceBy=Lo,Mr.differenceWith=Vo,Mr.drop=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,(t=r||t===i?1:da(t))<0?0:t,n):[]},Mr.dropRight=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,0,(t=n-(t=r||t===i?1:da(t)))<0?0:t):[]},Mr.dropRightWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!0,!0):[]},Mr.dropWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!0):[]},Mr.fill=function(e,t,r,n){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&vo(e,t,r)&&(r=0,n=o),function(e,t,r,n){var o=e.length;for((r=da(r))<0&&(r=-r>o?0:o+r),(n=n===i||n>o?o:da(n))<0&&(n+=o),n=r>n?0:pa(n);r<n;)e[r++]=t;return e}(e,t,r,n)):[]},Mr.filter=function(e,t){return(Us(e)?Dt:pn)(e,oo(t,3))},Mr.flatMap=function(e,t){return mn(Es(e,t),1)},Mr.flatMapDeep=function(e,t){return mn(Es(e,t),l)},Mr.flatMapDepth=function(e,t,r){return r=r===i?1:da(r),mn(Es(e,t),r)},Mr.flatten=Bo,Mr.flattenDeep=function(e){return null!=e&&e.length?mn(e,l):[]},Mr.flattenDepth=function(e,t){return null!=e&&e.length?mn(e,t=t===i?1:da(t)):[]},Mr.flip=function(e){return Ki(e,512)},Mr.flow=ec,Mr.flowRight=tc,Mr.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},Mr.functions=function(e){return null==e?[]:_n(e,Aa(e))},Mr.functionsIn=function(e){return null==e?[]:_n(e,xa(e))},Mr.groupBy=bs,Mr.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Mr.intersection=Yo,Mr.intersectionBy=Wo,Mr.intersectionWith=Ko,Mr.invert=ka,Mr.invertBy=Da,Mr.invokeMap=_s,Mr.iteratee=nc,Mr.keyBy=ws,Mr.keys=Aa,Mr.keysIn=xa,Mr.map=Es,Mr.mapKeys=function(e,t){var r={};return t=oo(t,3),gn(e,(function(e,n,i){rn(r,t(e,n,i),e)})),r},Mr.mapValues=function(e,t){var r={};return t=oo(t,3),gn(e,(function(e,n,i){rn(r,n,t(e,n,i))})),r},Mr.matches=function(e){return Mn(sn(e,1))},Mr.matchesProperty=function(e,t){return Fn(e,sn(t,1))},Mr.memoize=Ps,Mr.merge=Ra,Mr.mergeWith=Pa,Mr.method=ic,Mr.methodOf=oc,Mr.mixin=sc,Mr.negate=js,Mr.nthArg=function(e){return e=da(e),Wn((function(t){return Ln(t,e)}))},Mr.omit=ja,Mr.omitBy=function(e,t){return $a(e,js(oo(t)))},Mr.once=function(e){return ks(2,e)},Mr.orderBy=function(e,t,r,n){return null==e?[]:(Us(t)||(t=null==t?[]:[t]),Us(r=n?i:r)||(r=null==r?[]:[r]),Vn(e,t,r))},Mr.over=cc,Mr.overArgs=Cs,Mr.overEvery=uc,Mr.overSome=lc,Mr.partial=$s,Mr.partialRight=Ms,Mr.partition=Ss,Mr.pick=Ca,Mr.pickBy=$a,Mr.property=hc,Mr.propertyOf=function(e){return function(t){return null==e?i:wn(e,t)}},Mr.pull=Go,Mr.pullAll=Jo,Mr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?Un(e,t,oo(r,2)):e},Mr.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Un(e,t,i,r):e},Mr.pullAt=Zo,Mr.range=fc,Mr.rangeRight=dc,Mr.rearg=Fs,Mr.reject=function(e,t){return(Us(e)?Dt:pn)(e,js(oo(t,3)))},Mr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],o=e.length;for(t=oo(t,3);++n<o;){var s=e[n];t(s,n,e)&&(r.push(s),i.push(n))}return Bn(e,i),r},Mr.rest=function(e,t){if("function"!=typeof e)throw new ke(o);return Wn(e,t=t===i?t:da(t))},Mr.reverse=Xo,Mr.sampleSize=function(e,t,r){return t=(r?vo(e,t,r):t===i)?1:da(t),(Us(e)?Hr:Hn)(e,t)},Mr.set=function(e,t,r){return null==e?e:Gn(e,t,r)},Mr.setWith=function(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:Gn(e,t,r,n)},Mr.shuffle=function(e){return(Us(e)?Gr:Xn)(e)},Mr.slice=function(e,t,r){var n=null==e?0:e.length;return n?(r&&"number"!=typeof r&&vo(e,t,r)?(t=0,r=n):(t=null==t?0:da(t),r=r===i?n:da(r)),ei(e,t,r)):[]},Mr.sortBy=Os,Mr.sortedUniq=function(e){return e&&e.length?ii(e):[]},Mr.sortedUniqBy=function(e,t){return e&&e.length?ii(e,oo(t,2)):[]},Mr.split=function(e,t,r){return r&&"number"!=typeof r&&vo(e,t,r)&&(t=r=i),(r=r===i?d:r>>>0)?(e=va(e))&&("string"==typeof t||null!=t&&!ia(t))&&!(t=si(t))&&nr(e)?gi(lr(e),0,r):e.split(t,r):[]},Mr.spread=function(e,t){if("function"!=typeof e)throw new ke(o);return t=null==t?0:mr(da(t),0),Wn((function(r){var n=r[t],i=gi(r,0,t);return n&&Rt(i,n),St(e,this,i)}))},Mr.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Mr.take=function(e,t,r){return e&&e.length?ei(e,0,(t=r||t===i?1:da(t))<0?0:t):[]},Mr.takeRight=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,(t=n-(t=r||t===i?1:da(t)))<0?0:t,n):[]},Mr.takeRightWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!1,!0):[]},Mr.takeWhile=function(e,t){return e&&e.length?li(e,oo(t,3)):[]},Mr.tap=function(e,t){return t(e),e},Mr.throttle=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new ke(o);return Xs(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),As(e,t,{leading:n,maxWait:t,trailing:i})},Mr.thru=fs,Mr.toArray=ha,Mr.toPairs=Ma,Mr.toPairsIn=Fa,Mr.toPath=function(e){return Us(e)?xt(e,$o):aa(e)?[e]:Ti(Co(va(e)))},Mr.toPlainObject=ya,Mr.transform=function(e,t,r){var n=Us(e),i=n||Ws(e)||ca(e);if(t=oo(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:Xs(e)&&Gs(o)?Fr(Be(e)):{}}return(i?It:gn)(e,(function(e,n,i){return t(r,e,n,i)})),r},Mr.unary=function(e){return Ts(e,1)},Mr.union=es,Mr.unionBy=ts,Mr.unionWith=rs,Mr.uniq=function(e){return e&&e.length?ai(e):[]},Mr.uniqBy=function(e,t){return e&&e.length?ai(e,oo(t,2)):[]},Mr.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ai(e,i,t):[]},Mr.unset=function(e,t){return null==e||ci(e,t)},Mr.unzip=ns,Mr.unzipWith=is,Mr.update=function(e,t,r){return null==e?e:ui(e,t,mi(r))},Mr.updateWith=function(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:ui(e,t,mi(r),n)},Mr.values=qa,Mr.valuesIn=function(e){return null==e?[]:Gt(e,xa(e))},Mr.without=os,Mr.words=Ga,Mr.wrap=function(e,t){return $s(mi(t),e)},Mr.xor=ss,Mr.xorBy=as,Mr.xorWith=cs,Mr.zip=us,Mr.zipObject=function(e,t){return di(e||[],t||[],Zr)},Mr.zipObjectDeep=function(e,t){return di(e||[],t||[],Gn)},Mr.zipWith=ls,Mr.entries=Ma,Mr.entriesIn=Fa,Mr.extend=ba,Mr.extendWith=_a,sc(Mr,Mr),Mr.add=vc,Mr.attempt=Ja,Mr.camelCase=La,Mr.capitalize=Va,Mr.ceil=gc,Mr.clamp=function(e,t,r){return r===i&&(r=t,t=i),r!==i&&(r=(r=ma(r))==r?r:0),t!==i&&(t=(t=ma(t))==t?t:0),on(ma(e),t,r)},Mr.clone=function(e){return sn(e,4)},Mr.cloneDeep=function(e){return sn(e,5)},Mr.cloneDeepWith=function(e,t){return sn(e,5,t="function"==typeof t?t:i)},Mr.cloneWith=function(e,t){return sn(e,4,t="function"==typeof t?t:i)},Mr.conformsTo=function(e,t){return null==t||an(e,t,Aa(t))},Mr.deburr=Qa,Mr.defaultTo=function(e,t){return null==e||e!=e?t:e},Mr.divide=bc,Mr.endsWith=function(e,t,r){e=va(e),t=si(t);var n=e.length,o=r=r===i?n:on(da(r),0,n);return(r-=t.length)>=0&&e.slice(r,o)==t},Mr.eq=qs,Mr.escape=function(e){return(e=va(e))&&K.test(e)?e.replace(Y,tr):e},Mr.escapeRegExp=function(e){return(e=va(e))&&re.test(e)?e.replace(te,"\\$&"):e},Mr.every=function(e,t,r){var n=Us(e)?kt:fn;return r&&vo(e,t,r)&&(t=i),n(e,oo(t,3))},Mr.find=ms,Mr.findIndex=Qo,Mr.findKey=function(e,t){return Mt(e,oo(t,3),gn)},Mr.findLast=ys,Mr.findLastIndex=Uo,Mr.findLastKey=function(e,t){return Mt(e,oo(t,3),bn)},Mr.floor=_c,Mr.forEach=vs,Mr.forEachRight=gs,Mr.forIn=function(e,t){return null==e?e:yn(e,oo(t,3),xa)},Mr.forInRight=function(e,t){return null==e?e:vn(e,oo(t,3),xa)},Mr.forOwn=function(e,t){return e&&gn(e,oo(t,3))},Mr.forOwnRight=function(e,t){return e&&bn(e,oo(t,3))},Mr.get=Ia,Mr.gt=Ls,Mr.gte=Vs,Mr.has=function(e,t){return null!=e&&fo(e,t,In)},Mr.hasIn=Ta,Mr.head=zo,Mr.identity=rc,Mr.includes=function(e,t,r,n){e=zs(e)?e:qa(e),r=r&&!n?da(r):0;var i=e.length;return r<0&&(r=mr(i+r,0)),sa(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&qt(e,t,r)>-1},Mr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:da(r);return i<0&&(i=mr(n+i,0)),qt(e,t,i)},Mr.inRange=function(e,t,r){return t=fa(t),r===i?(r=t,t=0):r=fa(r),function(e,t,r){return e>=yr(t,r)&&e<mr(t,r)}(e=ma(e),t,r)},Mr.invoke=Na,Mr.isArguments=Qs,Mr.isArray=Us,Mr.isArrayBuffer=Bs,Mr.isArrayLike=zs,Mr.isArrayLikeObject=Ys,Mr.isBoolean=function(e){return!0===e||!1===e||ea(e)&&Sn(e)==v},Mr.isBuffer=Ws,Mr.isDate=Ks,Mr.isElement=function(e){return ea(e)&&1===e.nodeType&&!na(e)},Mr.isEmpty=function(e){if(null==e)return!0;if(zs(e)&&(Us(e)||"string"==typeof e||"function"==typeof e.splice||Ws(e)||ca(e)||Qs(e)))return!e.length;var t=ho(e);if(t==E||t==k)return!e.size;if(wo(e))return!jn(e).length;for(var r in e)if(Pe.call(e,r))return!1;return!0},Mr.isEqual=function(e,t){return An(e,t)},Mr.isEqualWith=function(e,t,r){var n=(r="function"==typeof r?r:i)?r(e,t):i;return n===i?An(e,t,i,r):!!n},Mr.isError=Hs,Mr.isFinite=function(e){return"number"==typeof e&&$t(e)},Mr.isFunction=Gs,Mr.isInteger=Js,Mr.isLength=Zs,Mr.isMap=ta,Mr.isMatch=function(e,t){return e===t||xn(e,t,ao(t))},Mr.isMatchWith=function(e,t,r){return r="function"==typeof r?r:i,xn(e,t,ao(t),r)},Mr.isNaN=function(e){return ra(e)&&e!=+e},Mr.isNative=function(e){if(_o(e))throw new we("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Rn(e)},Mr.isNil=function(e){return null==e},Mr.isNull=function(e){return null===e},Mr.isNumber=ra,Mr.isObject=Xs,Mr.isObjectLike=ea,Mr.isPlainObject=na,Mr.isRegExp=ia,Mr.isSafeInteger=function(e){return Js(e)&&e>=-9007199254740991&&e<=h},Mr.isSet=oa,Mr.isString=sa,Mr.isSymbol=aa,Mr.isTypedArray=ca,Mr.isUndefined=function(e){return e===i},Mr.isWeakMap=function(e){return ea(e)&&ho(e)==A},Mr.isWeakSet=function(e){return ea(e)&&"[object WeakSet]"==Sn(e)},Mr.join=function(e,t){return null==e?"":Bt.call(e,t)},Mr.kebabCase=Ua,Mr.last=Ho,Mr.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=n;return r!==i&&(o=(o=da(r))<0?mr(n+o,0):yr(o,n-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):Ft(e,Vt,o,!0)},Mr.lowerCase=Ba,Mr.lowerFirst=za,Mr.lt=ua,Mr.lte=la,Mr.max=function(e){return e&&e.length?dn(e,rc,On):i},Mr.maxBy=function(e,t){return e&&e.length?dn(e,oo(t,2),On):i},Mr.mean=function(e){return Qt(e,rc)},Mr.meanBy=function(e,t){return Qt(e,oo(t,2))},Mr.min=function(e){return e&&e.length?dn(e,rc,Cn):i},Mr.minBy=function(e,t){return e&&e.length?dn(e,oo(t,2),Cn):i},Mr.stubArray=pc,Mr.stubFalse=mc,Mr.stubObject=function(){return{}},Mr.stubString=function(){return""},Mr.stubTrue=function(){return!0},Mr.multiply=wc,Mr.nth=function(e,t){return e&&e.length?Ln(e,da(t)):i},Mr.noConflict=function(){return ht._===this&&(ht._=Fe),this},Mr.noop=ac,Mr.now=Is,Mr.pad=function(e,t,r){e=va(e);var n=(t=da(t))?ur(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Vi(dt(i),r)+e+Vi(ft(i),r)},Mr.padEnd=function(e,t,r){e=va(e);var n=(t=da(t))?ur(e):0;return t&&n<t?e+Vi(t-n,r):e},Mr.padStart=function(e,t,r){e=va(e);var n=(t=da(t))?ur(e):0;return t&&n<t?Vi(t-n,r)+e:e},Mr.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),gr(va(e).replace(ne,""),t||0)},Mr.random=function(e,t,r){if(r&&"boolean"!=typeof r&&vo(e,t,r)&&(t=r=i),r===i&&("boolean"==typeof t?(r=t,t=i):"boolean"==typeof e&&(r=e,e=i)),e===i&&t===i?(e=0,t=1):(e=fa(e),t===i?(t=e,e=0):t=fa(t)),e>t){var n=e;e=t,t=n}if(r||e%1||t%1){var o=br();return yr(e+o*(t-e+at("1e-"+((o+"").length-1))),t)}return zn(e,t)},Mr.reduce=function(e,t,r){var n=Us(e)?Pt:zt,i=arguments.length<3;return n(e,oo(t,4),r,i,ln)},Mr.reduceRight=function(e,t,r){var n=Us(e)?jt:zt,i=arguments.length<3;return n(e,oo(t,4),r,i,hn)},Mr.repeat=function(e,t,r){return t=(r?vo(e,t,r):t===i)?1:da(t),Yn(va(e),t)},Mr.replace=function(){var e=arguments,t=va(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Mr.result=function(e,t,r){var n=-1,o=(t=yi(t,e)).length;for(o||(o=1,e=i);++n<o;){var s=null==e?i:e[$o(t[n])];s===i&&(n=o,s=r),e=Gs(s)?s.call(e):s}return e},Mr.round=Ec,Mr.runInContext=e,Mr.sample=function(e){return(Us(e)?Kr:Kn)(e)},Mr.size=function(e){if(null==e)return 0;if(zs(e))return sa(e)?ur(e):e.length;var t=ho(e);return t==E||t==k?e.size:jn(e).length},Mr.snakeCase=Ya,Mr.some=function(e,t,r){var n=Us(e)?Ct:ti;return r&&vo(e,t,r)&&(t=i),n(e,oo(t,3))},Mr.sortedIndex=function(e,t){return ri(e,t)},Mr.sortedIndexBy=function(e,t,r){return ni(e,t,oo(r,2))},Mr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ri(e,t);if(n<r&&qs(e[n],t))return n}return-1},Mr.sortedLastIndex=function(e,t){return ri(e,t,!0)},Mr.sortedLastIndexBy=function(e,t,r){return ni(e,t,oo(r,2),!0)},Mr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ri(e,t,!0)-1;if(qs(e[r],t))return r}return-1},Mr.startCase=Wa,Mr.startsWith=function(e,t,r){return e=va(e),r=null==r?0:on(da(r),0,e.length),t=si(t),e.slice(r,r+t.length)==t},Mr.subtract=Sc,Mr.sum=function(e){return e&&e.length?Yt(e,rc):0},Mr.sumBy=function(e,t){return e&&e.length?Yt(e,oo(t,2)):0},Mr.template=function(e,t,r){var n=Mr.templateSettings;r&&vo(e,t,r)&&(t=i),e=va(e),t=_a({},t,n,Hi);var o,s,a=_a({},t.imports,n.imports,Hi),c=Aa(a),u=Gt(a,c),l=0,h=t.interpolate||be,f="__p += '",d=Ie((t.escape||be).source+"|"+h.source+"|"+(h===J?he:be).source+"|"+(t.evaluate||be).source+"|$","g"),p="//# sourceURL="+(Pe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++nt+"]")+"\n";e.replace(d,(function(t,r,n,i,a,c){return n||(n=i),f+=e.slice(l,c).replace(_e,rr),r&&(o=!0,f+="' +\n__e("+r+") +\n'"),a&&(s=!0,f+="';\n"+a+";\n__p += '"),n&&(f+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),f+="';\n";var m=Pe.call(t,"variable")&&t.variable;if(m){if(ue.test(m))throw new we("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(s?f.replace(Q,""):f).replace(U,"$1").replace(B,"$1;"),f="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var y=Ja((function(){return Ee(c,p+"return "+f).apply(i,u)}));if(y.source=f,Hs(y))throw y;return y},Mr.times=function(e,t){if((e=da(e))<1||e>h)return[];var r=d,n=yr(e,d);t=oo(t),e-=d;for(var i=Wt(n,t);++r<e;)t(r);return i},Mr.toFinite=fa,Mr.toInteger=da,Mr.toLength=pa,Mr.toLower=function(e){return va(e).toLowerCase()},Mr.toNumber=ma,Mr.toSafeInteger=function(e){return e?on(da(e),-9007199254740991,h):0===e?e:0},Mr.toString=va,Mr.toUpper=function(e){return va(e).toUpperCase()},Mr.trim=function(e,t,r){if((e=va(e))&&(r||t===i))return Kt(e);if(!e||!(t=si(t)))return e;var n=lr(e),o=lr(t);return gi(n,Zt(n,o),Xt(n,o)+1).join("")},Mr.trimEnd=function(e,t,r){if((e=va(e))&&(r||t===i))return e.slice(0,hr(e)+1);if(!e||!(t=si(t)))return e;var n=lr(e);return gi(n,0,Xt(n,lr(t))+1).join("")},Mr.trimStart=function(e,t,r){if((e=va(e))&&(r||t===i))return e.replace(ne,"");if(!e||!(t=si(t)))return e;var n=lr(e);return gi(n,Zt(n,lr(t))).join("")},Mr.truncate=function(e,t){var r=30,n="...";if(Xs(t)){var o="separator"in t?t.separator:o;r="length"in t?da(t.length):r,n="omission"in t?si(t.omission):n}var s=(e=va(e)).length;if(nr(e)){var a=lr(e);s=a.length}if(r>=s)return e;var c=r-ur(n);if(c<1)return n;var u=a?gi(a,0,c).join(""):e.slice(0,c);if(o===i)return u+n;if(a&&(c+=u.length-c),ia(o)){if(e.slice(c).search(o)){var l,h=u;for(o.global||(o=Ie(o.source,va(fe.exec(o))+"g")),o.lastIndex=0;l=o.exec(h);)var f=l.index;u=u.slice(0,f===i?c:f)}}else if(e.indexOf(si(o),c)!=c){var d=u.lastIndexOf(o);d>-1&&(u=u.slice(0,d))}return u+n},Mr.unescape=function(e){return(e=va(e))&&W.test(e)?e.replace(z,fr):e},Mr.uniqueId=function(e){var t=++je;return va(e)+t},Mr.upperCase=Ka,Mr.upperFirst=Ha,Mr.each=vs,Mr.eachRight=gs,Mr.first=zo,sc(Mr,(yc={},gn(Mr,(function(e,t){Pe.call(Mr.prototype,t)||(yc[t]=e)})),yc),{chain:!1}),Mr.VERSION="4.17.21",It(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Mr[e].placeholder=Mr})),It(["drop","take"],(function(e,t){Vr.prototype[e]=function(r){r=r===i?1:mr(da(r),0);var n=this.__filtered__&&!t?new Vr(this):this.clone();return n.__filtered__?n.__takeCount__=yr(r,n.__takeCount__):n.__views__.push({size:yr(r,d),type:e+(n.__dir__<0?"Right":"")}),n},Vr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),It(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;Vr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),It(["head","last"],(function(e,t){var r="take"+(t?"Right":"");Vr.prototype[e]=function(){return this[r](1).value()[0]}})),It(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");Vr.prototype[e]=function(){return this.__filtered__?new Vr(this):this[r](1)}})),Vr.prototype.compact=function(){return this.filter(rc)},Vr.prototype.find=function(e){return this.filter(e).head()},Vr.prototype.findLast=function(e){return this.reverse().find(e)},Vr.prototype.invokeMap=Wn((function(e,t){return"function"==typeof e?new Vr(this):this.map((function(r){return Dn(r,e,t)}))})),Vr.prototype.reject=function(e){return this.filter(js(oo(e)))},Vr.prototype.slice=function(e,t){e=da(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Vr(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==i&&(r=(t=da(t))<0?r.dropRight(-t):r.take(t-e)),r)},Vr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vr.prototype.toArray=function(){return this.take(d)},gn(Vr.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),o=Mr[n?"take"+("last"==t?"Right":""):t],s=n||/^find/.test(t);o&&(Mr.prototype[t]=function(){var t=this.__wrapped__,a=n?[1]:arguments,c=t instanceof Vr,u=a[0],l=c||Us(t),h=function(e){var t=o.apply(Mr,Rt([e],a));return n&&f?t[0]:t};l&&r&&"function"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,d=!!this.__actions__.length,p=s&&!f,m=c&&!d;if(!s&&l){t=m?t:new Vr(this);var y=e.apply(t,a);return y.__actions__.push({func:fs,args:[h],thisArg:i}),new Lr(y,f)}return p&&m?e.apply(this,a):(y=this.thru(h),p?n?y.value()[0]:y.value():y)})})),It(["pop","push","shift","sort","splice","unshift"],(function(e){var t=De[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Mr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Us(i)?i:[],e)}return this[r]((function(r){return t.apply(Us(r)?r:[],e)}))}})),gn(Vr.prototype,(function(e,t){var r=Mr[t];if(r){var n=r.name+"";Pe.call(Dr,n)||(Dr[n]=[]),Dr[n].push({name:t,func:r})}})),Dr[Mi(i,2).name]=[{name:"wrapper",func:i}],Vr.prototype.clone=function(){var e=new Vr(this.__wrapped__);return e.__actions__=Ti(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ti(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ti(this.__views__),e},Vr.prototype.reverse=function(){if(this.__filtered__){var e=new Vr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Us(e),n=t<0,i=r?e.length:0,o=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],s=o.size;switch(o.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=yr(t,e+s);break;case"takeRight":e=mr(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,u=n?a:s-1,l=this.__iteratees__,h=l.length,f=0,d=yr(c,this.__takeCount__);if(!r||!n&&i==c&&d==c)return hi(e,this.__actions__);var p=[];e:for(;c--&&f<d;){for(var m=-1,y=e[u+=t];++m<h;){var v=l[m],g=v.iteratee,b=v.type,_=g(y);if(2==b)y=_;else if(!_){if(1==b)continue e;break e}}p[f++]=y}return p},Mr.prototype.at=ds,Mr.prototype.chain=function(){return hs(this)},Mr.prototype.commit=function(){return new Lr(this.value(),this.__chain__)},Mr.prototype.next=function(){this.__values__===i&&(this.__values__=ha(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Mr.prototype.plant=function(e){for(var t,r=this;r instanceof qr;){var n=Fo(r);n.__index__=0,n.__values__=i,t?o.__wrapped__=n:t=n;var o=n;r=r.__wrapped__}return o.__wrapped__=e,t},Mr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vr){var t=e;return this.__actions__.length&&(t=new Vr(this)),(t=t.reverse()).__actions__.push({func:fs,args:[Xo],thisArg:i}),new Lr(t,this.__chain__)}return this.thru(Xo)},Mr.prototype.toJSON=Mr.prototype.valueOf=Mr.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Mr.prototype.first=Mr.prototype.head,He&&(Mr.prototype[He]=function(){return this}),Mr}();ht._=dr,(n=function(){return dr}.call(t,r,t,e))===i||(e.exports=n)}.call(this)},2371:function(e,t){!function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length>1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,i=1;i<n;++i)t[i]=t[i].slice(1,-1);return t[n]=t[n].slice(1),t.join("")}return t[0]}function r(e){return"(?:"+e+")"}function n(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function i(e){return e.toUpperCase()}function o(e){var n="[A-Za-z]",i="[0-9]",o=t(i,"[A-Fa-f]"),s=r(r("%[EFef]"+o+"%"+o+o+"%"+o+o)+"|"+r("%[89A-Fa-f]"+o+"%"+o+o)+"|"+r("%"+o+o)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",c=t("[\\:\\/\\?\\#\\[\\]\\@]",a),u=e?"[\\uE000-\\uF8FF]":"[]",l=t(n,i,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),h=r(n+t(n,i,"[\\+\\-\\.]")+"*"),f=r(r(s+"|"+t(l,a,"[\\:]"))+"*"),d=(r(r("25[0-5]")+"|"+r("2[0-4]"+i)+"|"+r("1"+i+i)+"|"+r("[1-9]"+i)+"|"+i),r(r("25[0-5]")+"|"+r("2[0-4]"+i)+"|"+r("1"+i+i)+"|"+r("0?[1-9]"+i)+"|0?0?"+i)),p=r(d+"\\."+d+"\\."+d+"\\."+d),m=r(o+"{1,4}"),y=r(r(m+"\\:"+m)+"|"+p),v=r(r(m+"\\:")+"{6}"+y),g=r("\\:\\:"+r(m+"\\:")+"{5}"+y),b=r(r(m)+"?\\:\\:"+r(m+"\\:")+"{4}"+y),_=r(r(r(m+"\\:")+"{0,1}"+m)+"?\\:\\:"+r(m+"\\:")+"{3}"+y),w=r(r(r(m+"\\:")+"{0,2}"+m)+"?\\:\\:"+r(m+"\\:")+"{2}"+y),E=r(r(r(m+"\\:")+"{0,3}"+m)+"?\\:\\:"+m+"\\:"+y),S=r(r(r(m+"\\:")+"{0,4}"+m)+"?\\:\\:"+y),O=r(r(r(m+"\\:")+"{0,5}"+m)+"?\\:\\:"+m),I=r(r(r(m+"\\:")+"{0,6}"+m)+"?\\:\\:"),T=r([v,g,b,_,w,E,S,O,I].join("|")),k=r(r(l+"|"+s)+"+"),D=(r(T+"\\%25"+k),r(T+r("\\%25|\\%(?!"+o+"{2})")+k)),N=r("[vV]"+o+"+\\."+t(l,a,"[\\:]")+"+"),A=r("\\["+r(D+"|"+T+"|"+N)+"\\]"),x=r(r(s+"|"+t(l,a))+"*"),R=r(A+"|"+p+"(?!"+x+")|"+x),P=r(i+"*"),j=r(r(f+"@")+"?"+R+r("\\:"+P)+"?"),C=r(s+"|"+t(l,a,"[\\:\\@]")),$=r(C+"*"),M=r(C+"+"),F=r(r(s+"|"+t(l,a,"[\\@]"))+"+"),q=r(r("\\/"+$)+"*"),L=r("\\/"+r(M+q)+"?"),V=r(F+q),Q=r(M+q),U="(?!"+C+")",B=(r(q+"|"+L+"|"+V+"|"+Q+"|"+U),r(r(C+"|"+t("[\\/\\?]",u))+"*")),z=r(r(C+"|[\\/\\?]")+"*"),Y=r(r("\\/\\/"+j+q)+"|"+L+"|"+Q+"|"+U),W=r(h+"\\:"+Y+r("\\?"+B)+"?"+r("\\#"+z)+"?"),K=r(r("\\/\\/"+j+q)+"|"+L+"|"+V+"|"+U),H=r(K+r("\\?"+B)+"?"+r("\\#"+z)+"?");return r(W+"|"+H),r(h+"\\:"+Y+r("\\?"+B)+"?"),r(r("\\/\\/("+r("("+f+")@")+"?("+R+")"+r("\\:("+P+")")+"?)")+"?("+q+"|"+L+"|"+Q+"|"+U+")"),r("\\?("+B+")"),r("\\#("+z+")"),r(r("\\/\\/("+r("("+f+")@")+"?("+R+")"+r("\\:("+P+")")+"?)")+"?("+q+"|"+L+"|"+V+"|"+U+")"),r("\\?("+B+")"),r("\\#("+z+")"),r(r("\\/\\/("+r("("+f+")@")+"?("+R+")"+r("\\:("+P+")")+"?)")+"?("+q+"|"+L+"|"+Q+"|"+U+")"),r("\\?("+B+")"),r("\\#("+z+")"),r("("+f+")@"),r("\\:("+P+")"),{NOT_SCHEME:new RegExp(t("[^]",n,i,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",l,a),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",l,a),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",l,a),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",l,a),"g"),NOT_QUERY:new RegExp(t("[^\\%]",l,a,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",l,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",l,a),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",l,c),"g"),PCT_ENCODED:new RegExp(s,"g"),IPV4ADDRESS:new RegExp("^("+p+")$"),IPV6ADDRESS:new RegExp("^\\[?("+T+")"+r(r("\\%25|\\%(?!"+o+"{2})")+"("+k+")")+"?\\]?$")}}var s=o(!1),a=o(!0),c=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},u=2147483647,l=36,h=/^xn--/,f=/[^\0-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=Math.floor,y=String.fromCharCode;function v(e){throw new RangeError(p[e])}function g(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+function(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}((e=e.replace(d,".")).split("."),t).join(".")}function b(e){for(var t=[],r=0,n=e.length;r<n;){var i=e.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){var o=e.charCodeAt(r++);56320==(64512&o)?t.push(((1023&i)<<10)+(1023&o)+65536):(t.push(i),r--)}else t.push(i)}return t}var _=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},w=function(e,t,r){var n=0;for(e=r?m(e/700):e>>1,e+=m(e/t);e>455;n+=l)e=m(e/35);return m(n+36*e/(e+38))},E=function(e){var t,r=[],n=e.length,i=0,o=128,s=72,a=e.lastIndexOf("-");a<0&&(a=0);for(var c=0;c<a;++c)e.charCodeAt(c)>=128&&v("not-basic"),r.push(e.charCodeAt(c));for(var h=a>0?a+1:0;h<n;){for(var f=i,d=1,p=l;;p+=l){h>=n&&v("invalid-input");var y=(t=e.charCodeAt(h++))-48<10?t-22:t-65<26?t-65:t-97<26?t-97:l;(y>=l||y>m((u-i)/d))&&v("overflow"),i+=y*d;var g=p<=s?1:p>=s+26?26:p-s;if(y<g)break;var b=l-g;d>m(u/b)&&v("overflow"),d*=b}var _=r.length+1;s=w(i-f,_,0==f),m(i/_)>u-o&&v("overflow"),o+=m(i/_),i%=_,r.splice(i++,0,o)}return String.fromCodePoint.apply(String,r)},S=function(e){var t=[],r=(e=b(e)).length,n=128,i=0,o=72,s=!0,a=!1,c=void 0;try{for(var h,f=e[Symbol.iterator]();!(s=(h=f.next()).done);s=!0){var d=h.value;d<128&&t.push(y(d))}}catch(e){a=!0,c=e}finally{try{!s&&f.return&&f.return()}finally{if(a)throw c}}var p=t.length,g=p;for(p&&t.push("-");g<r;){var E=u,S=!0,O=!1,I=void 0;try{for(var T,k=e[Symbol.iterator]();!(S=(T=k.next()).done);S=!0){var D=T.value;D>=n&&D<E&&(E=D)}}catch(e){O=!0,I=e}finally{try{!S&&k.return&&k.return()}finally{if(O)throw I}}var N=g+1;E-n>m((u-i)/N)&&v("overflow"),i+=(E-n)*N,n=E;var A=!0,x=!1,R=void 0;try{for(var P,j=e[Symbol.iterator]();!(A=(P=j.next()).done);A=!0){var C=P.value;if(C<n&&++i>u&&v("overflow"),C==n){for(var $=i,M=l;;M+=l){var F=M<=o?1:M>=o+26?26:M-o;if($<F)break;var q=$-F,L=l-F;t.push(y(_(F+q%L,0))),$=m(q/L)}t.push(y(_($,0))),o=w(i,N,g==p),i=0,++g}}}catch(e){x=!0,R=e}finally{try{!A&&j.return&&j.return()}finally{if(x)throw R}}++i,++n}return t.join("")},O={version:"2.1.0",ucs2:{decode:b,encode:function(e){return String.fromCodePoint.apply(String,function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(e))}},decode:E,encode:S,toASCII:function(e){return g(e,(function(e){return f.test(e)?"xn--"+S(e):e}))},toUnicode:function(e){return g(e,(function(e){return h.test(e)?E(e.slice(4).toLowerCase()):e}))}},I={};function T(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function k(e){for(var t="",r=0,n=e.length;r<n;){var i=parseInt(e.substr(r+1,2),16);if(i<128)t+=String.fromCharCode(i),r+=3;else if(i>=194&&i<224){if(n-r>=6){var o=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&i)<<6|63&o)}else t+=e.substr(r,6);r+=6}else if(i>=224){if(n-r>=9){var s=parseInt(e.substr(r+4,2),16),a=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&i)<<12|(63&s)<<6|63&a)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function D(e,t){function r(e){var r=k(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,T).replace(t.PCT_ENCODED,i)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,T).replace(t.PCT_ENCODED,i)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,T).replace(t.PCT_ENCODED,i)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,T).replace(t.PCT_ENCODED,i)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,T).replace(t.PCT_ENCODED,i)),e}function N(e){return e.replace(/^0*(.*)/,"$1")||"0"}function A(e,t){var r=e.match(t.IPV4ADDRESS)||[],n=c(r,2)[1];return n?n.split(".").map(N).join("."):e}function x(e,t){var r=e.match(t.IPV6ADDRESS)||[],n=c(r,3),i=n[1],o=n[2];if(i){for(var s=i.toLowerCase().split("::").reverse(),a=c(s,2),u=a[0],l=a[1],h=l?l.split(":").map(N):[],f=u.split(":").map(N),d=t.IPV4ADDRESS.test(f[f.length-1]),p=d?7:8,m=f.length-p,y=Array(p),v=0;v<p;++v)y[v]=h[v]||f[m+v]||"";d&&(y[p-1]=A(y[p-1],t));var g=y.reduce((function(e,t,r){if(!t||"0"===t){var n=e[e.length-1];n&&n.index+n.length===r?n.length++:e.push({index:r,length:1})}return e}),[]).sort((function(e,t){return t.length-e.length}))[0],b=void 0;if(g&&g.length>1){var _=y.slice(0,g.index),w=y.slice(g.index+g.length);b=_.join(":")+"::"+w.join(":")}else b=y.join(":");return o&&(b+="%"+o),b}return e}var R=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,P=void 0==="".match(/(){0}/)[1];function j(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},n=!1!==t.iri?a:s;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var i=e.match(R);if(i){P?(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port)&&(r.port=i[5])):(r.scheme=i[1]||void 0,r.userinfo=-1!==e.indexOf("@")?i[3]:void 0,r.host=-1!==e.indexOf("//")?i[4]:void 0,r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=-1!==e.indexOf("?")?i[7]:void 0,r.fragment=-1!==e.indexOf("#")?i[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?i[4]:void 0)),r.host&&(r.host=x(A(r.host,n),n)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var o=I[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||o&&o.unicodeSupport)D(r,n);else{if(r.host&&(t.domainHost||o&&o.domainHost))try{r.host=O.toASCII(r.host.replace(n.PCT_ENCODED,k).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}D(r,s)}o&&o.parse&&o.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}var C=/^\.\.?\//,$=/^\/\.(\/|$)/,M=/^\/\.\.(\/|$)/,F=/^\/?(?:.|\n)*?(?=\/|$)/;function q(e){for(var t=[];e.length;)if(e.match(C))e=e.replace(C,"");else if(e.match($))e=e.replace($,"/");else if(e.match(M))e=e.replace(M,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(F);if(!r)throw new Error("Unexpected dot segment condition");var n=r[0];e=e.slice(n.length),t.push(n)}return t.join("")}function L(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?a:s,n=[],i=I[(t.scheme||e.scheme||"").toLowerCase()];if(i&&i.serialize&&i.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||i&&i.domainHost)try{e.host=t.iri?O.toUnicode(e.host):O.toASCII(e.host.replace(r.PCT_ENCODED,k).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}D(e,r),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var o=function(e,t){var r=!1!==t.iri?a:s,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(x(A(String(e.host),r),r).replace(r.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}(e,t);if(void 0!==o&&("suffix"!==t.reference&&n.push("//"),n.push(o),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var c=e.path;t.absolutePath||i&&i.absolutePath||(c=q(c)),void 0===o&&(c=c.replace(/^\/\//,"/%2F")),n.push(c)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function V(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=j(L(e,r),r),t=j(L(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=q(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=q(t.path||""),n.query=t.query):(t.path?("/"===t.path.charAt(0)?n.path=q(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=q(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function Q(e,t){return e&&e.toString().replace(t&&t.iri?a.PCT_ENCODED:s.PCT_ENCODED,k)}var U={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return e.port!==(r?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},B={scheme:"https",domainHost:U.domainHost,parse:U.parse,serialize:U.serialize};function z(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var Y={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=z(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if(e.port!==(z(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),n=c(r,2),i=n[0],o=n[1];e.path=i&&"/"!==i?i:void 0,e.query=o,e.resourceName=void 0}return e.fragment=void 0,e}},W={scheme:"wss",domainHost:Y.domainHost,parse:Y.parse,serialize:Y.serialize},K={},H="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",G="[0-9A-Fa-f]",J=r(r("%[EFef]"+G+"%"+G+G+"%"+G+G)+"|"+r("%[89A-Fa-f]"+G+"%"+G+G)+"|"+r("%"+G+G)),Z=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),X=new RegExp(H,"g"),ee=new RegExp(J,"g"),te=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',Z),"g"),re=new RegExp(t("[^]",H,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ne=re;function ie(e){var t=k(e);return t.match(X)?t:e}var oe={scheme:"mailto",parse:function(e,t){var r=e,n=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var i=!1,o={},s=r.query.split("&"),a=0,c=s.length;a<c;++a){var u=s[a].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),h=0,f=l.length;h<f;++h)n.push(l[h]);break;case"subject":r.subject=Q(u[1],t);break;case"body":r.body=Q(u[1],t);break;default:i=!0,o[Q(u[0],t)]=Q(u[1],t)}}i&&(r.headers=o)}r.query=void 0;for(var d=0,p=n.length;d<p;++d){var m=n[d].split("@");if(m[0]=Q(m[0]),t.unicodeSupport)m[1]=Q(m[1],t).toLowerCase();else try{m[1]=O.toASCII(Q(m[1],t).toLowerCase())}catch(e){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}n[d]=m.join("@")}return r},serialize:function(e,t){var r,n=e,o=null!=(r=e.to)?r instanceof Array?r:"number"!=typeof r.length||r.split||r.setInterval||r.call?[r]:Array.prototype.slice.call(r):[];if(o){for(var s=0,a=o.length;s<a;++s){var c=String(o[s]),u=c.lastIndexOf("@"),l=c.slice(0,u).replace(ee,ie).replace(ee,i).replace(te,T),h=c.slice(u+1);try{h=t.iri?O.toUnicode(h):O.toASCII(Q(h,t).toLowerCase())}catch(e){n.error=n.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}o[s]=l+"@"+h}n.path=o.join(",")}var f=e.headers=e.headers||{};e.subject&&(f.subject=e.subject),e.body&&(f.body=e.body);var d=[];for(var p in f)f[p]!==K[p]&&d.push(p.replace(ee,ie).replace(ee,i).replace(re,T)+"="+f[p].replace(ee,ie).replace(ee,i).replace(ne,T));return d.length&&(n.query=d.join("&")),n}},se=/^([^\:]+)\:(.*)/,ae={scheme:"urn",parse:function(e,t){var r=e.path&&e.path.match(se),n=e;if(r){var i=t.scheme||n.scheme||"urn",o=r[1].toLowerCase(),s=r[2],a=i+":"+(t.nid||o),c=I[a];n.nid=o,n.nss=s,n.path=void 0,c&&(n=c.parse(n,t))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(e,t){var r=t.scheme||e.scheme||"urn",n=e.nid,i=r+":"+(t.nid||n),o=I[i];o&&(e=o.serialize(e,t));var s=e,a=e.nss;return s.path=(n||t.nid)+":"+a,s}},ce=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,ue={scheme:"urn:uuid",parse:function(e,t){var r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&r.uuid.match(ce)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e,t){var r=e;return r.nss=(e.uuid||"").toLowerCase(),r}};I[U.scheme]=U,I[B.scheme]=B,I[Y.scheme]=Y,I[W.scheme]=W,I[oe.scheme]=oe,I[ae.scheme]=ae,I[ue.scheme]=ue,e.SCHEMES=I,e.pctEncChar=T,e.pctDecChars=k,e.parse=j,e.removeDotSegments=q,e.serialize=L,e.resolveComponents=V,e.resolve=function(e,t,r){var n=function(e,t){var r=e;if(t)for(var n in t)r[n]=t[n];return r}({scheme:"null"},r);return L(V(j(e,n),j(t,n),n,!0),n)},e.normalize=function(e,t){return"string"==typeof e?e=L(j(e,t),t):"object"===n(e)&&(e=j(L(e,t),t)),e},e.equal=function(e,t,r){return"string"==typeof e?e=L(j(e,r),r):"object"===n(e)&&(e=L(e,r)),"string"==typeof t?t=L(j(t,r),r):"object"===n(t)&&(t=L(t,r)),e===t},e.escapeComponent=function(e,t){return e&&e.toString().replace(t&&t.iri?a.ESCAPE:s.ESCAPE,T)},e.unescapeComponent=Q,Object.defineProperty(e,"__esModule",{value:!0})}(t)},1143:e=>{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},1512:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},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})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{"use strict";var e,t;r.r(n),r.d(n,{Changes:()=>Ge,CollectionReference:()=>Be,DocumentReference:()=>Ye,GraphQLClient:()=>Aa,JoinQueryBuilder:()=>Le,QueryBuilder:()=>He,Squid:()=>sc,deserializeQuery:()=>Je}),function(e){e.database="database",e.api="api",e.observability="observability",e.crm="crm",e.auth="auth",e.ai="ai"}(e||(e={})),function(e){e.built_in_db="built_in_db",e.mongo="mongo",e.mysql="mysql",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_assistant="ai_assistant",e.cognito="cognito",e.okta="okta",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.clickhouse="clickhouse",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"}(t||(t={})),t.built_in_db,t.mongo,t.mysql,t.mssql,t.postgres,t.cockroach,t.snowflake,t.oracledb,t.api,t.graphql,t.datadog,t.newrelic,t.auth0,t.jwt_rsa,t.jwt_hmac,t.cognito,t.okta;var i;t.built_in_db,t.mysql,t.oracledb,t.mssql,t.postgres,t.cockroach,t.mongo,t.api,t.graphql,t.snowflake,t.datadog,Object.keys({us1:"US1 - East",us3:"US3 - West",us5:"US5 - Central",eu1:"EU1 - Europe",ap1:"AP1 - Asia","us1-fed":"US1-FED (FedRamp)"}),t.newrelic,Object.keys({worldwide:"Worldwide",eu:"Europe"}),t.auth0,t.jwt_rsa,t.jwt_hmac,t.ai_assistant,t.cognito,t.okta,t.mysql,t.oracledb,t.mssql,t.postgres,t.cockroach,t.mongo,t.snowflake,t.graphql,t.mysql,t.oracledb,t.mssql,t.snowflake,t.postgres,t.cockroach,t.mongo,t.built_in_db,t.graphql,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 * * 0",e.EVERY_WEEKDAY="0 0 * * 1-5",e.EVERY_WEEKEND="0 0 * * 6,0",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 0 *",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"}(i||(i={}));var o=r(8784),s=r.n(o);function a(e){if(Array.isArray(e))return e.map((e=>a(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]=a(e[t])})),r}function c(e){return u(a(e))}function u(e){if(void 0===e)return null;const t=o.cloneDeepWith(e,(e=>o.isDate(e)?{$date:e.toISOString()}:void 0));return JSON.stringify(t)}function l(e){const t=JSON.parse(e);return o.cloneDeepWith(t,(e=>o.isObject(e)&&o.has(e,"$date")&&1===Object.keys(e).length?new Date(e.$date):void 0))}function h(e){if(void 0===e)throw new Error("INVALID_ENCODE_VALUE");const t=u(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)}}function f(e){return"fieldName"in e}function d(e){return c(e)}function p(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 s().isEqual(e,t);if("!="===r)return!s().isEqual(e,t);if(null===e||null===t)return!1;switch(r){case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"like":return"string"==typeof t&&"string"==typeof e&&m(t,e,!1);case"not like":return!("string"==typeof t&&"string"==typeof e&&m(t,e,!1));case"like_cs":return"string"==typeof t&&"string"==typeof e&&m(t,e,!0);case"not like_cs":return!("string"==typeof t&&"string"==typeof e&&m(t,e,!0));default:throw new Error(`Unsupported operator comparison: ${r}`)}}function m(e,t,r){r||(e=e.toLowerCase(),t=t.toLowerCase());const n=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&").replace(/%/g,".*");return new RegExp(`^${n}$`).test(e)}function y(e,t){return`${e}_${t}`}d({fields:[{fieldName:"name",operator:">",value:"Yossi"},{fieldName:"age",operator:"<",value:10}]}),d({fieldName:"age",operator:"==",value:10}),d({fieldName:"age",operator:"==",value:11}),d({fieldName:"age",operator:"==",value:12}),d({fieldName:"age",operator:">",value:20}),d({fieldName:"age",operator:"<",value:20}),d({fieldName:"name",operator:"!=",value:"Yossi"}),d({fieldName:"name",operator:"!=",value:"Nir"});const v={"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))};class g{constructor(e){this.query=e,this.query=e,this.parsedConditions=this.parseConditions(this.query.conditions.filter(f))}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!(0,o.isEqual)(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(f),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=o.get(e,r);if("in"===n){if(t.value.includes(i))continue;return!1}if("not in"!==n){if(!p(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=v[`${r}:${i}`];return!!s&&s(n,o)}evaluateIncludes(e,t){const{operator:r,value:n}=e,{operator:i,value:s}=this.parseConditions([t])[0],a=Array.isArray(n)?n.sort():n,c=Array.isArray(s)?s.sort():s;return i===r&&(0,o.isEqual)(c,a)}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}}const b=require("rxjs");var _,w;(w=_||(_={}))[w.CONTINUE=100]="CONTINUE",w[w.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",w[w.PROCESSING=102]="PROCESSING",w[w.EARLYHINTS=103]="EARLYHINTS",w[w.OK=200]="OK",w[w.CREATED=201]="CREATED",w[w.ACCEPTED=202]="ACCEPTED",w[w.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",w[w.NO_CONTENT=204]="NO_CONTENT",w[w.RESET_CONTENT=205]="RESET_CONTENT",w[w.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",w[w.AMBIGUOUS=300]="AMBIGUOUS",w[w.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",w[w.FOUND=302]="FOUND",w[w.SEE_OTHER=303]="SEE_OTHER",w[w.NOT_MODIFIED=304]="NOT_MODIFIED",w[w.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",w[w.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",w[w.BAD_REQUEST=400]="BAD_REQUEST",w[w.UNAUTHORIZED=401]="UNAUTHORIZED",w[w.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",w[w.FORBIDDEN=403]="FORBIDDEN",w[w.NOT_FOUND=404]="NOT_FOUND",w[w.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",w[w.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",w[w.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",w[w.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",w[w.CONFLICT=409]="CONFLICT",w[w.GONE=410]="GONE",w[w.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",w[w.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",w[w.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",w[w.URI_TOO_LONG=414]="URI_TOO_LONG",w[w.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",w[w.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",w[w.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",w[w.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",w[w.MISDIRECTED=421]="MISDIRECTED",w[w.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",w[w.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",w[w.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",w[w.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",w[w.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",w[w.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",w[w.BAD_GATEWAY=502]="BAD_GATEWAY",w[w.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",w[w.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",w[w.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED";class E extends Error{constructor(e,t,r){super(e),this.statusCode=t,this.details=r}}function S(e){if(!(e instanceof Object))throw new Error("Field sort has to be an object");var t,r;I((t=e,r=["fieldName","asc"],!Array.isArray(t)&&[...Object.keys(t)].every((e=>r.includes(e)))),"Field sort should only contain a fieldName and asc"),I(O(e.asc,"boolean"),"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)}(e.fieldName)}function O(e,t){return Array.isArray(e)?e.every((e=>typeof e===t)):typeof e===t}function I(e,t){if(e)return;const r="function"==typeof t?t():t;throw r instanceof Error?r:new Error(null!=r?r:"Assertion error")}function T(e,t){return I(e,t),e}function k(e,t,r="."){const n=t.split(r);let i,o=e;for(;o&&n.length;){const e=T(n.shift());if(!(o instanceof Object&&e in o))return;i=o[e],o=i}return i}function D(e){return"object"==typeof e&&Reflect.getPrototypeOf(e)===Object.prototype}function N(e,t,r,n="."){var i;const s=t.split(n);let a=e;for(;s.length;){const e=T(s.shift());if(s.length){const t=D(a[e])&&null!==(i=o.clone(a[e]))&&void 0!==i?i:{};a[e]=t,a=t}else a[e]=r}}function A(e,t,r="."){var n;const i=t.split(r);let s=e;for(;i.length;){const e=T(i.shift());if(i.length){const t=D(s[e])&&null!==(n=o.clone(s[e]))&&void 0!==n?n:{};s[e]=t,s=t}else delete s[e]}}function x(e,t,r){if(e.has(t)){const n=e.get(t);e.delete(t),e.set(r,n)}}class R{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.where(e,r?"like_cs":"like",t)}notLike(e,t,r){return this.where(e,r?"not like_cs":"not like",t)}}class P{constructor(e,t,r){this.options=t,this.forward=r,this.destroySubject=new b.Subject,this.data=new b.BehaviorSubject(void 0),e.snapshots(this.options.subscribe).pipe((0,b.takeUntil)(this.destroySubject)).subscribe((e=>this.data.next(r?e:this.reverse(e)))),this.destroySubject.subscribe((()=>this.data.complete()))}reverse(e){return[...e.slice(0,this.options.pageSize).reverse(),...e.slice(this.options.pageSize)]}destroy(){this.destroySubject.next(),this.destroySubject.complete()}}class j{constructor(e,t={}){if(this.isDestroyed=new b.BehaviorSubject(!1),this.destroyedObs=this.isDestroyed.pipe((0,b.filter)(Boolean),(0,b.take)(1)),this._observeState=new b.BehaviorSubject({data:[],hasNext:!1,hasPrev:!1,isLoading:!0}),this.currentPageSnapshotEmitterWrapperSubject=new b.BehaviorSubject(void 0),this.options=Object.assign({pageSize:100,subscribe:!0},t),this.templateSnapshotEmitter=e.clone(),this.options.subscribe)this.firstPageSnapshotEmitterWrapper=new P(this.templateSnapshotEmitter.clone().limit(Math.min(3*this.options.pageSize,2e3)),this.options,!0),this.firstPageDataAvailable=(0,b.firstValueFrom)(this.firstPageSnapshotEmitterWrapper.data.pipe((0,b.filter)(Boolean),(0,b.raceWith)(this.isDestroyed))),this.firstPageSnapshotEmitterWrapper.data.pipe((0,b.filter)(Boolean)).subscribe((e=>{e.length?this.currentPageSnapshotEmitterWrapperSubject.value?this._observeState.value.hasPrev||this.templateSnapshotEmitter.extractData(e[0])===this.templateSnapshotEmitter.extractData(this._observeState.value.data[0])||this._observeState.next(Object.assign(Object.assign({},this._observeState.value),{hasPrev:!0})):this._observeState.next({data:e.slice(0,this.options.pageSize),hasNext:e.length>this.options.pageSize,hasPrev:!1,isLoading:!1}):this.resetToFirstPageData()}));else{const e=this.templateSnapshotEmitter.clone().limit(this.options.pageSize+1);this.currentPageSnapshotEmitterWrapperSubject.next(new P(e,this.options,!0))}this.currentPageSnapshotEmitterWrapperSubject.pipe((0,b.takeUntil)(this.destroyedObs),(0,b.startWith)(void 0),(0,b.pairwise)()).subscribe((([e,t])=>{e&&e.destroy(),t&&t.data.pipe((0,b.filter)(Boolean)).subscribe((e=>{var r,n,i;if(t.forward){let t=!0;if(this.options.subscribe){const t=T(null===(r=this.firstPageSnapshotEmitterWrapper)||void 0===r?void 0:r.data.value,"NO_FIRST_PAGE_DATA");if(!t.length||!e.length)return void this.resetToFirstPageData();if(this.templateSnapshotEmitter.extractData(t[0])===this.templateSnapshotEmitter.extractData(e[0]))return void this.resetToFirstPageData()}else if(t=this._observeState.value.hasNext,t&&!e.length)return void this.resetToFirstPageData();this._observeState.next({data:e.slice(0,this.options.pageSize),hasNext:e.length>this.options.pageSize,hasPrev:t,isLoading:!1})}else{let t=!0;if(this.options.subscribe){if(e.length<this.options.pageSize)return void this.resetToFirstPageData();const r=T(null===(n=this.firstPageSnapshotEmitterWrapper)||void 0===n?void 0:n.data.value,"NO_FIRST_PAGE_DATA");if(!r||!e.length||this.templateSnapshotEmitter.extractData(r[0])===this.templateSnapshotEmitter.extractData(e[0]))return void this.resetToFirstPageData();const o=T(null===(i=this.lastPageSnapshotEmitterWrapper)||void 0===i?void 0:i.data.value,"NO_LAST_PAGE_DATA");this.templateSnapshotEmitter.extractData(o[o.length-1])===this.templateSnapshotEmitter.extractData(e[Math.min(e.length,this.options.pageSize)-1])&&(t=!1)}const r=this.options.subscribe||e.length>this.options.pageSize;if(!e.length&&this._observeState.value.hasPrev)return void this.resetToFirstPageData();this._observeState.next({data:e.slice(0,this.options.pageSize),hasNext:t,hasPrev:r,isLoading:!1})}}))}))}async next(){if(this.isDestroyed.value)return this._observeState.value;if(await this.firstPageDataAvailable,this.isDestroyed.value)return this._observeState.value;const e=this._observeState.value;if(e.isLoading||!e.hasNext)return this._observeState.value;const t=e.data,r=this.templateSnapshotEmitter.extractData(T(t[this.options.pageSize-1],"NO_LAST_ITEM")),n=this.templateSnapshotEmitter.clone().limit(Math.min(3*this.options.pageSize,2e3)).addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((e=>({fieldName:e.fieldName,operator:e.asc?">":"<",value:k(r,e.fieldName)}))));return this._observeState.next(Object.assign(Object.assign({},e),{isLoading:!0})),this.currentPageSnapshotEmitterWrapperSubject.next(new P(n,this.options,!0)),await this.waitForData()}async prev(){if(this.isDestroyed.value)return this._observeState.value;if(await this.firstPageDataAvailable,this.options.subscribe&&(this.createLastPageSnapshotEmitterWrapper(),await this.lastPageDataAvailable),this.isDestroyed.value)return this._observeState.value;const e=this._observeState.value;if(e.isLoading||!e.hasPrev)return this._observeState.value;const t=e.data,r=this.templateSnapshotEmitter.extractData(T(t[0],"NO_FIRST_ITEM")),n=this.templateSnapshotEmitter.clone().flipSortOrder().limit(Math.min(3*this.options.pageSize,2e3));return n.addCompositeCondition(n.getSortOrders().map((e=>({fieldName:e.fieldName,operator:e.asc?">":"<",value:k(r,e.fieldName)})))),this._observeState.next(Object.assign(Object.assign({},e),{isLoading:!0})),this.currentPageSnapshotEmitterWrapperSubject.next(new P(n,this.options,!1)),await this.waitForData()}unsubscribe(){this.isDestroyed.next(!0),this.isDestroyed.complete(),this.firstPageSnapshotEmitterWrapper&&this.firstPageSnapshotEmitterWrapper.destroy(),this.currentPageSnapshotEmitterWrapperSubject.value&&this.currentPageSnapshotEmitterWrapperSubject.value.destroy(),this.lastPageSnapshotEmitterWrapper&&this.lastPageSnapshotEmitterWrapper.destroy(),this.currentPageSnapshotEmitterWrapperSubject.complete(),this._observeState.complete()}observeState(){return this._observeState.asObservable()}async waitForData(){return this._observeState.value.isLoading?(await(0,b.firstValueFrom)(this._observeState.pipe((0,b.filter)((e=>!e.isLoading)),(0,b.take)(1),(0,b.raceWith)(this.destroyedObs))),this._observeState.value):this._observeState.value}createLastPageSnapshotEmitterWrapper(){if(this.lastPageSnapshotEmitterWrapper)return;const e=this.templateSnapshotEmitter.clone().flipSortOrder().limit(Math.min(3*this.options.pageSize,2e3));this.lastPageSnapshotEmitterWrapper=new P(e,this.options,!1),this.lastPageDataAvailable=(0,b.firstValueFrom)(this.lastPageSnapshotEmitterWrapper.data.pipe((0,b.filter)(Boolean),(0,b.raceWith)(this.destroyedObs))),this.lastPageSnapshotEmitterWrapper.data.pipe((0,b.filter)(Boolean)).subscribe((e=>{this.currentPageSnapshotEmitterWrapperSubject&&e.length&&(this._observeState.value.hasNext||this.templateSnapshotEmitter.extractData(e[e.length-1])===this.templateSnapshotEmitter.extractData(this._observeState.value.data[this._observeState.value.data.length-1])||this._observeState.next(Object.assign(Object.assign({},this._observeState.value),{hasNext:!0})))}))}resetToFirstPageData(){var e,t,r,n;if(this.currentPageSnapshotEmitterWrapperSubject.next(void 0),this.options.subscribe)this._observeState.next({data:null!==(r=null===(t=null===(e=this.firstPageSnapshotEmitterWrapper)||void 0===e?void 0:e.data.value)||void 0===t?void 0:t.slice(0,this.options.pageSize))&&void 0!==r?r:[],hasNext:T(null===(n=this.firstPageSnapshotEmitterWrapper)||void 0===n?void 0:n.data.value,"NO_FIRST_PAGE_DATA").length>this.options.pageSize,hasPrev:!1,isLoading:!1});else{const e=this._observeState.value;this._observeState.next(Object.assign(Object.assign({},e),{hasNext:!1,hasPrev:!1,isLoading:!0}));const t=this.templateSnapshotEmitter.clone().limit(this.options.pageSize+1);this.currentPageSnapshotEmitterWrapperSubject.next(new P(t,this.options,!0))}}}function C(e,t){return`${function(e){const[t,r,n,i]=e.split(/[_-]/);return I(!i,"Invalid appId: "+e),{appId:t,environmentId:null!=r?r:"prod",squidDeveloperId:n}}(e).appId}${t&&"prod"!==t?`-${t}`:""}`}r(2091);const $="__squidId";function M(e){return l(e)}function F(...e){const[t,r,n]=e,i="object"==typeof t?t:{docId:t,collectionName:r,integrationId:n};return i.integrationId||(i.integrationId=void 0),c(i)}var q;function L(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?o.cloneDeep(t.value):t.value;case"removeProperty":return;default:throw new Error("Unknown property mutation type: "+JSON.stringify(t))}}function V(e){return Object.entries(e.properties).sort((([e],[t])=>e.split(".").length-t.split(".").length))}function Q(e){let t=[];return(0,b.from)(e).pipe((0,b.groupBy)((e=>`${e.squidDocIdObj.integrationId}${e.squidDocIdObj.collectionName}/${e.squidDocIdObj.docId}`)),(0,b.mergeMap)((e=>e.pipe((0,b.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(I("update"===t.type,"Invalid mutation type"),"update"===e.type)return function(e,t){const r=o.cloneDeep(e);t=o.cloneDeep(t);for(const[e]of V(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 V(t))r.properties[e]=[...r.properties[e]||[],...n];return r}(e,t);const r=o.cloneDeep(e);for(const[e,n]of V(t)){const t=n;for(const n of t){const t=L(k(r.properties,e),n);void 0===t?A(r.properties,e):N(r.properties,e,t)}}return r}(e,t)))))),(0,b.toArray)()).subscribe((e=>{t=e})),t}!function(e){e.TRACE="trace",e.DEBUG="debug",e.INFO="info",e.WARN="warn",e.ERROR="error"}(q||(q={}));var U=r(6236),B=r.n(U),z=r(8414),Y=r.n(z);const W=new(B())({allErrors:!0,allowUnionTypes:!1,useDefaults:!1});function K(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?K(e,t,r,o+1,i):K(e,t,r,n,o-1)}function H(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){if(-1!==K(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 G(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){const n=K(e,t,r);n>-1&&e.splice(n,1)}Y()(W),W.addKeyword({keyword:"isDate",type:"object",validate:(e,t)=>e===t instanceof Date}),W.addKeyword({keyword:"isJSON",type:"object",validate:(e,t)=>{try{const e=JSON.stringify(t);return JSON.parse(e),!0}catch(e){return!1}}}),W.addKeyword({keyword:"isComputed",validate:(e,t)=>!e||null!==t}),W.addKeyword({keyword:"isDefaultComputed",validate:(e,t)=>!e||null!==t}),W.addKeyword({keyword:"primaryKey",validate:(e,t)=>!e||null!==t}),W.addKeyword({keyword:"insertable",validate:(e,t)=>!e||null!==t}),W.addKeyword({keyword:"deletable",validate:(e,t)=>!e||null!==t}),W.addKeyword({keyword:"applyDefaultValueOn",validate:(e,t)=>!e||["always","empty","updateOrEmpty"].includes(e)}),W.addKeyword({keyword:"dataType",validate:(e,t)=>!0});class J extends Error{constructor(e,t){super(e),this.details=t}}const Z=["query","aiData","api","backend-function","webhooks"];function X(e,t,r){const n=new URL("https://squid.cloud");n.host=`${t}.${e}.${n.host}`;const i=r.split("/")[0]||"";ee(e)&&(n.protocol="http",n.port=Z.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();return(o.endsWith("/")?o:o+"/")+r}function ee(e){return/^local/.test(e)}function te(){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)}))}class re{constructor(){this.locks={}}async lock(...e){if(this.canGetLock(...e))return void this.lockSync(...e);const t=Object.entries(this.locks).filter((([t])=>e.includes(t))).map((([e,t])=>t));await(0,b.lastValueFrom)((0,b.combineLatest)(t).pipe((0,b.filter)((e=>!e.includes(!0))),(0,b.take)(1))),await this.lock(...e)}release(...e){for(const t of e){const e=T(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){I(this.canGetLock(...e),"Cannot acquire lock sync");for(const t of e)this.locks[t]=new b.BehaviorSubject(!0)}}function ne(e){return null!=e}function ie(e){return"function"==typeof e}function oe(e){return function(t){if(function(e){return ie(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 se=function(e,t){return se=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])},se(e,t)};function ae(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}se(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var ce=function(){return ce=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},ce.apply(this,arguments)};function ue(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 le(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))}function he(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(c){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,c])}}}function fe(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 de(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 pe(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;var me,ye,ve=(me=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}},(ye=me((function(e){Error.call(e),e.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),ye.prototype.constructor=ye,ye);function ge(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var be=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=fe(o),a=s.next();!a.done;a=s.next())a.value.remove(this)}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(ie(c))try{c()}catch(e){i=e instanceof ve?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=fe(u),h=l.next();!h.done;h=l.next()){var f=h.value;try{_e(f)}catch(e){i=null!=i?i:[],e instanceof ve?i=pe(pe([],de(i)),de(e.errors)):i.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(i)throw new ve(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)_e(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)&&ge(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&ge(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function _e(e){ie(e)?e():e.unsubscribe()}be.EMPTY;var we=null,Ee=null,Se=!1,Oe=!1,Ie={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=Ie.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,pe([e,t],de(r))):setTimeout.apply(void 0,pe([e,t],de(r)))},clearTimeout:function(e){var t=Ie.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Te(){}var ke=De("C",void 0,void 0);function De(e,t,r){return{kind:e,value:t,error:r}}var Ne=function(e){function t(t){var r,n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,((r=t)instanceof be||r&&"closed"in r&&ie(r.remove)&&ie(r.add)&&ie(r.unsubscribe))&&t.add(n)):n.destination=$e,n}return ae(t,e),t.create=function(e,t,r){return new Pe(e,t,r)},t.prototype.next=function(e){this.isStopped?Ce(function(e){return De("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?Ce(De("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?Ce(ke,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}(be),Ae=Function.prototype.bind;function xe(e,t){return Ae.call(e,t)}var Re=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){je(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){je(e)}else je(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){je(e)}},e}(),Pe=function(e){function t(t,r,n){var i,o,s=e.call(this)||this;return ie(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&Oe?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&xe(t.next,o),error:t.error&&xe(t.error,o),complete:t.complete&&xe(t.complete,o)}):i=t,s.destination=new Re(i),s}return ae(t,e),t}(Ne);function je(e){Se||function(e){Ie.setTimeout((function(){if(!we)throw e;we(e)}))}(e)}function Ce(e,t){var r=Ee;r&&Ie.setTimeout((function(){return r(e,t)}))}var $e={closed:!0,next:Te,error:function(e){throw e},complete:Te};function Me(e,t,r,n,i){return new Fe(e,t,r,n,i)}var Fe=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 ae(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}(Ne);function qe(e,t){return oe((function(r,n){var i=0;r.subscribe(Me(n,(function(r){n.next(e.call(t,r,i++))})))}))}class Le extends R{constructor(e,t,r,n,i,o,s,a,c,u,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=c,this.joinConditions=u,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}),c=Object.assign(Object.assign({},this.leftToRight),{[t]:[]});return c[s].push(t),new Le(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,this.rootAlias,t,c,Object.assign(Object.assign({},this.joins),{[t]:e.build()}),Object.assign(Object.assign({},this.joinConditions),{[t]:a}),this.queryBuilder)}snapshot(){return(0,b.firstValueFrom)(this.snapshots(!1))}snapshots(e=!0){return this.querySubscriptionManager.processQuery(this.build(),this.rootAlias,o.cloneDeep(this.joins),o.cloneDeep(this.joinConditions),e,!1).pipe(qe((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?F(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 Ue(this)}dereference(){return new Ve(this)}build(){return this.queryBuilder.build()}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){return new Le(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,this.rootAlias,this.latestAlias,o.cloneDeep(this.leftToRight),o.cloneDeep(this.joins),o.cloneDeep(this.joinConditions),this.queryBuilder.clone())}addCompositeCondition(e){return this.queryBuilder.addCompositeCondition(e),this}flipSortOrder(){return this.queryBuilder.flipSortOrder(),this}extractData(e){return e[this.rootAlias].data}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 j(this,e)}}class Ve{constructor(e){this.joinQueryBuilder=e}grouped(){return this.joinQueryBuilder.grouped().dereference()}snapshot(){return(0,b.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(qe((e=>e.map((e=>o.mapValues(e,(e=>null==e?void 0:e.data)))))))}peek(){throw new Error("peek is not currently supported for join queries")}getSortOrders(){return this.joinQueryBuilder.getSortOrders()}clone(){return new Ve(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 j(this,e)}serialize(){return Object.assign(Object.assign({},this.joinQueryBuilder.serialize()),{dereference:!0})}getLimit(){return this.joinQueryBuilder.getLimit()}}class Qe{constructor(e){this.groupedJoin=e}snapshot(){return(0,b.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.groupedJoin.snapshots(e).pipe(qe((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 Qe(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 j(this,e)}}class Ue{constructor(e){this.joinQueryBuilder=e}snapshot(){return(0,b.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(qe((e=>this.groupData(e,this.joinQueryBuilder.rootAlias))))}peek(){throw new Error("peek is not currently supported for join queries")}dereference(){return new Qe(this)}groupData(e,t){const r=o.groupBy(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 Ue(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].data:e.data}serialize(){return Object.assign(Object.assign({},this.joinQueryBuilder.serialize()),{grouped:!0})}paginate(e){return new j(this,e)}}class Be{constructor(e,t,r,n,i){this.collectionName=e,this.integrationId=t,this.documentReferenceFactory=r,this.queryBuilderFactory=n,this.querySubscriptionManager=i,this.refId=te()}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!==t.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={[$]:te()};else e=e&&"string"!=typeof e?{__id:c(e)}:{__id:e||te()};const r=F(c(e),this.collectionName,this.integrationId);return this.documentReferenceFactory.create(r,this.queryBuilderFactory)}query(){return this.queryBuilderFactory.get(this.collectionName,this.integrationId)}joinQuery(e){return new Le(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,e,e,{[e]:[]},{},{},this.query())}or(...e){return new ze(...e)}}class ze{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,b.firstValueFrom)(this.snapshots(!1))}snapshots(e=!0){const t=this.snapshotEmitters.map((t=>t.snapshots(e)));return this.or(this.snapshotEmitters[0].getSortOrders(),...t)}peek(){throw new Error("peek is not currently supported for merged queries")}or(e,...t){return(0,b.combineLatest)([...t]).pipe((0,b.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=k(this.extractData(t),n),o=k(this.extractData(r),n);return p(e,o,"==")?0:p(o,e,"<")?i?-1:1:i?1:-1}return 0})).slice(0,this.getLimit())})))}clone(){return new ze(...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 j(this,e)}}class Ye{constructor(e,t,r){this._squidDocId=e,this.dataManager=t,this.queryBuilderFactory=r,this.refId=te()}get squidDocId(){return this._squidDocId}get data(){return T(this.dataManager.getProperties(this.squidDocId),(()=>{const{collectionName:e,integrationId:t,docId:r}=M(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.isTracked()&&this.hasData)return this.data;const e=await this.queryBuilderFactory.getForDocument(this.squidDocId).dereference().snapshot();return T(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,b.map)((e=>(T(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:M(this.squidDocId),properties:r};return this.dataManager.applyOutgoingMutation(n,t)}async setInPath(e,t,r){return this.update({[e]:o.cloneDeep(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:M(this.squidDocId),properties:{[e]:[n]}};return this.dataManager.applyOutgoingMutation(i,r)}decrementInPath(e,t,r){return this.incrementInPath(e,-t,r)}async insert(e,r){const n=M(this.squidDocId),i=n.integrationId;let o=l(n.docId);if(o[$]&&(o={}),i===t.built_in_db&&o.__id)try{const e=l(o.__id);o=Object.assign(Object.assign({},o),e)}catch(e){}const s={type:"insert",squidDocIdObj:n,properties:Object.assign(Object.assign(Object.assign({},e),{__docId__:n.docId}),o)};return this.dataManager.applyOutgoingMutation(s,r)}async delete(e){const t={type:"delete",squidDocIdObj:M(this.squidDocId)};return this.dataManager.applyOutgoingMutation(t,e)}migrateDocIds(e){const t=e[this.squidDocId];t&&(this._squidDocId=t)}}class We{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}=M(e),i=l(n),o=this.get(t,r);return Object.entries(i).forEach((([e,t])=>{o.where(e,"==",t)})),o}get(e,t){return new He(e,t,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this,this.documentIdentityService)}}class Ke{constructor(e){this.queryBuilder=e}peek(){return this.queryBuilder.peek().map((e=>e.data))}snapshot(){return(0,b.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.queryBuilder.snapshots(e).pipe(qe((e=>e.map((e=>e.data)))))}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){return new Ke(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 j(this,e)}}class He extends R{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=r instanceof Array?[...r]:[r];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){I(O(e,"number"),"Limit needs to be a number"),-1!==e&&(I(e>0,"query limit has to be greater than 0"),I(Math.floor(e)===e,"query limit has to be an integer"),I(e<=2e4,"Limit can be maximum 20000"))}(e),this.query.limit=e,this}getLimit(){return this.query.limit}sortBy(e,t=!0){const r={asc:t,fieldName:e};return S(r),I(!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=this.query.conditions.filter(f),t=[],r=o.groupBy(e||[],(e=>e.fieldName));for(const e of Object.values(r)){const r=o.groupBy(e,(e=>e.operator));for(const[e,n]of Object.entries(r)){if("=="===e||"!="===e){t.push(...n);continue}const r=o.sortBy(n,(e=>e.value));">"===e||">="===e?t.push(r[r.length-1]):t.push(r[0])}}return[...this.query.conditions.filter((e=>!f(e))),...t]}getSortOrder(){return this.query.sortOrder}snapshot(){return(0,b.firstValueFrom)(this.snapshots(!1))}setForceFetchFromServer(){return this.forceFetchFromServer=!0,this}peek(){return this.localQueryManager.peek(this.build())}snapshots(e=!0){return this.querySubscriptionManager.processQuery(this.build(),this.collectionName,{},{},e,this.forceFetchFromServer).pipe(qe((e=>e.map((e=>{I(1===Object.keys(e).length);const t=F(T(e[this.collectionName]).__docId__,this.collectionName,this.integrationId);return this.documentReferenceFactory.create(t,this.queryBuilderFactory)})))))}changes(){let e,t=new Set;return this.snapshots().pipe((0,b.combineLatestWith)(this.documentIdentityService.observeChanges().pipe((0,b.switchMap)((t=>(Object.entries(t).forEach((([t,r])=>{!function(e,t,r){const n=e[t];void 0!==n&&(e[r]=n,delete e[t])}(e||{},t,r)})),b.NEVER))),(0,b.startWith)({}))),qe((([r])=>{let n=[];const i=[],o=[];if(e){for(const o of r){const r=o.squidDocId,s=o.data;if(t.has(s))delete e[r],t.delete(s);else if(e[r]){i.push(o);const n=e[r];delete e[r],t.delete(n)}else n.push(o)}for(const e of t)o.push(e)}else n=r;e={},t=new Set;for(const n of r){const r=n.data;e[n.squidDocId]=r,t.add(r)}return new Ge(n,i,o)})))}get hash(){return h(this.build())}dereference(){return new Ke(this)}getSortOrders(){return this.query.sortOrder}clone(){const e=new He(this.collectionName,this.integrationId,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.queryBuilderFactory,this.documentIdentityService);return e.query=o.cloneDeep(this.query),e}addCompositeCondition(e){return this.query.conditions.push({fields:e}),this}flipSortOrder(){return this.query.sortOrder=this.query.sortOrder.map((e=>Object.assign(Object.assign({},e),{asc:!e.asc}))),this}serialize(){return{type:"simple",dereference:!1,query:this.build()}}extractData(e){return e.data}paginate(e){return new j(this,e)}}class Ge{constructor(e,t,r){this.inserts=e,this.updates=t,this.deletes=r}}function Je(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=Ze(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:c}=r.query;let u=e.collection(a,c).joinQuery(r.alias);return u=Ze(u,r.query),Object.entries(n).map((([t,r])=>{const{collectionName:n,integrationId:o}=r,{left:s,right:a,leftAlias:c}=i[t];let l=e.collection(n,o).query();l=Ze(l,r),u=u.join(l,t,{left:s,right:a},{leftAlias:c})})),o&&s?u.grouped().dereference():o?u.dereference():s?u.grouped():u}(e,t);case"merged":return function(e,t){const{queries:r}=t,{collectionName:n,integrationId:i}=Xe(r[0]),o=r.map((t=>Je(e,t)));return e.collection(n,i).or(...o)}(e,t)}}function Ze(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 Xe(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 Xe(e.queries[0])}}class et{constructor(e,t,r){this.rpcManager=e,this.socketManager=t,this.integrationId=r,this.ongoingChatRequests={},this.socketManager.observeNotifications().pipe((0,b.filter)((e=>"aiAssistant"===e.type)),qe((e=>e))).subscribe((e=>{this.handleChatResponse(e)}))}profile(e){return new tt(this,this.integrationId,e)}async mutate(e){await this.rpcManager.post("ai/assistant/mutate",e)}chat(e,t){const r=te(),n=new b.BehaviorSubject("");this.ongoingChatRequests[r]=n;const i={profileId:e,prompt:t,integrationId:this.integrationId,clientRequestId:r};return this.rpcManager.post("ai/assistant/chat",i).catch((e=>{n.error(e),n.complete()})),n.pipe((0,b.finalize)((()=>{delete this.ongoingChatRequests[r]})),(0,b.share)())}handleChatResponse(e){const t=this.ongoingChatRequests[e.clientRequestId];t&&(e.payload.complete?t.complete():t.next(t.value+e.payload.token))}}class tt{constructor(e,t,r){this.client=e,this.integrationId=t,this.profileId=r}chat(e){return this.client.chat(this.profileId,e)}context(e){return new rt(this.client,this.integrationId,this.profileId,e)}instruction(e){return new nt(this.client,this.integrationId,this.profileId,e)}insert(e){const{modelName:t}=e,r={type:"insert",resource:"profile",profileId:this.profileId,payload:{modelName:t,strictContext:!1},integrationId:this.integrationId};return this.client.mutate(r)}update(e){const{modelName:t}=e,r={type:"update",resource:"profile",profileId:this.profileId,payload:{modelName:t,strictContext:!1},integrationId:this.integrationId};return this.client.mutate(r)}delete(){const e={type:"delete",resource:"profile",profileId:this.profileId,integrationId:this.integrationId,payload:{}};return this.client.mutate(e)}}class rt{constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||te()}insert(e){const{title:t,context:r}=e,n={type:"insert",resource:"context",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id,title:t,context:r}};return this.client.mutate(n)}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 nt{constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||te()}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 it{constructor(e,t){this.rpcManager=e,this.socketManager=t,this.assistantsMap=new Map}getAssistant(e){let t=this.assistantsMap.get(e);return t||(t=new et(this.rpcManager,this.socketManager,e),this.assistantsMap.set(e,t),t)}}class ot{constructor(e,t,r,n={}){this.clientIdService=e,this.rpcManager=t,this.socketManager=r,this.apiServerUrlOverrideMapping=n,this.ongoingApiExecutions={},r.observeNotifications().pipe((0,b.filter)((e=>"api"===e.type)),qe((e=>e))).subscribe((e=>{this.handleApiResponse(e.clientRequestId,e).then()}))}callApiAndSubscribe(e,t,r){const n=te(),i=new b.Subject;this.ongoingApiExecutions[n]=i;const o={integrationId:e,endpointId:t,request:r,clientRequestId:n,serverUrlOverride:this.apiServerUrlOverrideMapping[e]};return this.rpcManager.post("api/call",o).catch((n=>{console.error("Got error while calling API",e,t,r,n),i.error(n),i.complete()})),(0,b.race)(i.pipe((0,b.finalize)((()=>{delete this.ongoingApiExecutions[n]})),(0,b.share)()),this.clientIdService.observeClientTooOld().pipe(qe((()=>{throw new Error("CLIENT_NOT_CONNECTED")}))))}async handleApiResponse(e,t){const r=this.ongoingApiExecutions[e];r&&(t.success?r.next(l(t.payload)):r.error((0,o.pick)(t,"httpStatus","payload")),r.complete())}}class st{constructor(e,t){this.destructManager=e,this.apiKey=t,this.authIdTokenSet=new b.BehaviorSubject(!1),this.authIdTokenObservableSubject=new b.Subject,this.shouldWaitForAuth=!1,this.observeAuthIdToken().subscribe((e=>{this.idToken=e.token,this.integrationId=e.integrationId,this.authIdTokenSet.next(!0)}))}setAuthIdToken(e,t){this.shouldWaitForAuth=!0,this.authIdTokenSet.next(!1);const r=e&&"string"!=typeof e?(0,b.from)(e).pipe((0,b.map)((e=>({token:e,integrationId:t})))):(0,b.of)({token:e,integrationId:t});this.authIdTokenObservableSubject.next(r)}observeAuthIdToken(){return this.authIdTokenObservableSubject.pipe((0,b.switchMap)((e=>e)),(0,b.takeUntil)(this.destructManager.observeIsDestructing()))}async waitForReadyState(){this.shouldWaitForAuth&&!this.destructManager.isDestructing&&await(0,b.firstValueFrom)((0,b.race)(this.authIdTokenSet.asObservable().pipe((0,b.filter)(Boolean)),this.destructManager.observeIsDestructing()))}getApiKey(){return this.apiKey}getAuthToken(){return this.apiKey?{type:"ApiKey",token:this.apiKey}:this.idToken?{type:"Bearer",token:this.idToken,integrationId:this.integrationId}:void 0}}class at{constructor(e,t,r){this.clientIdService=e,this.rpcManager=t,this.socketManager=r,this.ongoingFunctionExecutions={},r.observeNotifications().pipe((0,b.filter)((e=>"backendFunction"===e.type)),qe((e=>e))).subscribe((e=>{this.handleFunctionResponse(e.clientRequestId,e.payload)}))}executeFunctionAndSubscribe(e,...t){const r=te(),n=new b.Subject;this.ongoingFunctionExecutions[r]=n;const i={functionName:e,paramsArrayStr:u(t),clientRequestId:r};return this.rpcManager.post("backend-function/execute",i).catch((t=>{console.error("Got error while executing function",e,t),n.error(t),n.complete()})),(0,b.race)(n.pipe((0,b.finalize)((()=>{delete this.ongoingFunctionExecutions[r]})),(0,b.share)()),this.clientIdService.observeClientTooOld().pipe(qe((()=>{throw new Error("CLIENT_NOT_CONNECTED")}))))}handleFunctionResponse(e,t){const r=this.ongoingFunctionExecutions[e];if(!r)return;const n=l(t);n.success?r.next(n.response):(r.error(new Error(n.response)),r.complete())}}class ct{constructor(e){this.destructManager=e,this.clientTooOldSubject=new b.BehaviorSubject(!1),this.clientIdSubject=new b.BehaviorSubject(te()),this.destructManager.onDestruct((()=>{this.clientTooOldSubject.complete(),this.clientIdSubject.complete()}))}observeClientId(){return this.clientIdSubject}observeClientTooOld(){return this.clientTooOldSubject.pipe((0,b.filter)((e=>e)),(0,b.map)((e=>{})))}notifyClientTooOld(){this.clientTooOldSubject.next(!0),this.clientIdSubject.next(te())}notifyClientReadyToBeRegenerated(){this.clientTooOldSubject.next(!1)}observeClientReadyToBeRegenerated(){return this.clientTooOldSubject.pipe((0,b.skip)(1),(0,b.filter)((e=>!e)),(0,b.map)((e=>{})))}getClientId(){return this.clientIdSubject.value}isClientTooOld(){return this.clientTooOldSubject.value}}class ut{constructor(e,t,r){this.documentReferenceFactory=e,this.queryBuilderFactory=t,this.querySubscriptionManager=r,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 Be(e,t,this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager),r.set(e,n),n)}}class lt{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 ht=r(3910);const ft="dataManager_runInTransaction";class dt{constructor(e,t,r,n,i,o,s,a){this.documentStore=e,this.mutationSender=t,this.socketManager=r,this.querySubscriptionManager=n,this.queryBuilderFactory=i,this.lockManager=o,this.destructManager=s,this.documentIdentityService=a,this.docIdToLocalTimestamp=new Map,this.batchClientRequestIds=new Set,this.docIdToServerTimestamp=new Map,this.pendingIncomingUpdates=new Map,this.pendingOutgoingMutations=new Map,this.pendingOutgoingMutationsChanged=new b.Subject,this.outgoingMutationsEmpty=new b.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.querySubscriptionManager.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){return t?(I(t===this.currentTransactionId,"Transaction already ended."),e(t).then((e=>Promise.resolve()))):(this.lockManager.canGetLock(ft)?this.lockManager.lockSync(ft):await this.lockManager.lock(ft),new Promise((async(t,r)=>{try{this.currentTransactionId=te();try{return await e(this.currentTransactionId)}catch(e){console.error("error while executing callback function in transaction",e)}finally{this.finishTransaction({resolve:t,reject:r})}}catch(e){console.error("error while executing transaction",e)}finally{this.lockManager.release(ft)}})))}async applyOutgoingMutation(e,t){var r;const n=F(e.squidDocIdObj);this.knownDirtyDocs.add(n),t||this.lockManager.canGetLock(ft)||(await this.lockManager.lock(ft),this.lockManager.release(ft)),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=Q([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=V(t);for(const[e,t]of n){const n=t;for(const t of n){const n=L(k(r,e),t);void 0===n?A(r,e):N(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 I(t===this.currentTransactionId,"Transaction already ended."),void e(t);await this.lockManager.lock(ft);try{this.currentTransactionId=te();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(ft)}}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,b.filter)((e=>"mutations"===e.type)),qe((e=>e))).subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,b.filter)(Boolean),(0,b.take)(1)).subscribe((()=>{this.handleIncomingMutations(e.payload)}))})),this.socketManager.observeNotifications().pipe((0,b.filter)((e=>"query"===e.type)),qe((e=>e))).subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,b.filter)(Boolean),(0,b.take)(1)).subscribe((()=>{this.handleIncomingQuerySnapshots(e.payload)}))}))}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=F(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;for(const[t,i]of Object.entries(e))this.addPendingIncomingUpdate(t,i),this.pendingIncomingUpdates.get(t)||(r=!0),n.add(t);return this.runInTransactionSync((()=>{for(const e of n)this.maybeApplyIncomingUpdate(e)}),t).then(),r}addPendingIncomingUpdate(e,t){const r=this.pendingIncomingUpdates.get(e),n=this.docIdToServerTimestamp.get(e);r&&r.timestamp>t.timestamp||n&&n.timestamp>t.timestamp||this.pendingIncomingUpdates.set(e,t)}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.querySubscriptionManager.setClientRequestIdsForLocalDoc(e,t.properties).forEach((e=>{this.batchClientRequestIds.add(e)})),t.properties&&(this.querySubscriptionManager.findQueriesForDocument(t.properties,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||c(Object.assign(Object.assign({},t),{__ts__:void 0}))!==c(r))&&(this.documentStore.saveDocument(e,t),!0))}finishTransaction(e){this.currentTransactionId=void 0;const t=[...this.batchClientRequestIds.values()];this.batchClientRequestIds.clear(),this.querySubscriptionManager.notifyAllSubscriptions(t),this.sendAllUnsentOutgoingMutations(e).then()}async sendAllUnsentOutgoingMutations(e){const t=this.groupOutgoingMutationsByIntegrationId();try{await ht.PromisePool.for(t).withConcurrency(t.length||1).handleError((e=>{throw e})).process((async([e,t])=>{await this.sendMutationsForIntegration([...t],e)})),this.pendingOutgoingMutations.size||this.outgoingMutationsEmpty.next(!0),await this.refreshUpdatedDocuments(),this.hasPendingSentMutations()?(await(0,b.firstValueFrom)(this.pendingOutgoingMutationsChanged.pipe((0,b.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);await 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=F(e.mutation.squidDocIdObj),r=T(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){this.setExpiration(t,!0);try{const e=await this.queryBuilderFactory.getForDocument(t).setForceFetchFromServer().snapshot();if(T(e.length<=1,"Got more than one doc for the same id:"+t),!e.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,r]of[...this.pendingOutgoingMutations.entries()]){const t=r[r.length-1];if(t&&!t.sentToServer){const r=t.mutation.squidDocIdObj.integrationId;(e[r]||(e[r]=[])).push(t),t.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=F(t.mutation.squidDocIdObj),n=e[r];n&&(t.mutation.squidDocIdObj=M(n))}))})),Object.entries(e).forEach((([e,t])=>{x(this.pendingOutgoingMutations,e,t),x(this.docIdToLocalTimestamp,e,t),x(this.docIdToServerTimestamp,e,t)}))}hasPendingSentMutations(){for(const e of this.pendingOutgoingMutations.values())for(const t of e)if(t.sentToServer)return!0;return!1}}class pt{constructor(){this.predestructors=[],this.destructors=[],this.isDestructedSubject=new b.BehaviorSubject(!1)}get isDestructing(){return this.isDestructedSubject.value}observeIsDestructing(){return this.isDestructedSubject.asObservable().pipe((0,b.filter)(Boolean),qe((()=>{})))}onPreDestruct(e){this.predestructors.push(e)}onDestruct(e){this.destructors.push(e)}async destruct(){if(this.isDestructing)return;this.isDestructedSubject.next(!0);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()}}}class mt{constructor(e,t){this.socketManager=e,this.destructManager=t,this.ongoingLocks={},this.acquireLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,b.filter)((e=>"lockAcquired"===e.type))),this.releaseLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,b.filter)((e=>"lockReleased"===e.type))),this.lockWaitForConnectionThreshold=2e3,t.onPreDestruct((()=>{this.releaseAllLocks()})),this.socketManager.observeConnectionReady().subscribe((e=>{e||this.releaseAllLocks()})),this.releaseLockMessagesFromServer.subscribe((e=>{const t=this.ongoingLocks[e.payload.clientRequestId];void 0!==t&&t.release().then()}))}async lock(e,t){if(!await(0,b.firstValueFrom)((0,b.race)((0,b.timer)(this.lockWaitForConnectionThreshold).pipe(qe((()=>!1))),this.socketManager.observeConnectionReady().pipe((0,b.filter)(Boolean)),this.destructManager.observeIsDestructing())))return Promise.reject("CLIENT_NOT_CONNECTED");const r=te(),n={type:"acquireLock",payload:{mutex:e,exclusive:t,clientRequestId:r}};this.socketManager.sendMessage(n);const i=await(0,b.firstValueFrom)((0,b.race)((0,b.timer)(5e3).pipe((0,b.take)(1),qe((()=>({payload:{error:"TIMEOUT_GETTING_LOCK",lockId:void 0}})))),this.acquireLockMessagesFromServer.pipe((0,b.filter)((e=>e.payload.clientRequestId===r)))));if(!i.payload.lockId)throw new Error(`Failed to acquire lock: ${i.payload.error}`);const o=i.payload.lockId,s=new yt(o,r,this.ongoingLocks,this.socketManager);return this.ongoingLocks[o]=s,s}releaseAllLocks(){for(const[e,t]of Object.entries(this.ongoingLocks))t.release().then(),delete this.ongoingLocks[e]}}class yt{constructor(e,t,r,n){this.lockId=e,this.clientRequestId=t,this.ongoingLocks=r,this.socketManager=n,this.released=!1,this.onReleaseSubject=new b.Subject}async 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 vt{constructor(e,t){this.documentStore=e,this.destructManager=t,this.changeNotifier=new b.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 gt{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 Ye(e,T(this.dataManager,"dataManager not found"),t);const{integrationId:n,collectionName:i}=M(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,r]of this.documents)r.migrateDocIds(e);Object.entries(e).forEach((([e,t])=>{const r=M(e),n=M(t);x(this.documents,r.docId,n.docId)}))}getCollectionKey(e,t){return`${e}_${t}`}}class bt{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=(0,o.cloneDeep)(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 T(this.getDocumentOrUndefined(e))}getDocumentOrUndefined(e){return this.squidDocIdToDoc.get(e)}sortAndLimitDocs(e,t){if(0===e.size)return[];const r=[...e].map((e=>this.squidDocIdToDoc.get(e))).filter(ne),{sortOrder:n,limit:i}=t,s=n.map((e=>e.fieldName)),a=n.map((e=>e.asc?"asc":"desc")),c=(0,o.orderBy)(r,s,a);return i<0?c:c.slice(0,i)}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;x(this.squidDocIdToDoc,e,t);const n=M(t),i=l(n.docId);this.saveDocument(t,Object.assign(Object.assign(Object.assign({},r),i),{__docId__:n.docId}))}}var _t="Invariant Violation",wt=Object.setPrototypeOf,Et=void 0===wt?function(e,t){return e.__proto__=t,e}:wt,St=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,Et(n,t.prototype),n}return ae(t,e),t}(Error);function Ot(e,t){if(!e)throw new St(t)}var It=["debug","log","warn","error","silent"],Tt=It.indexOf("log");function kt(e){return function(){if(It.indexOf(e)>=Tt)return(console[e]||console.log).apply(console,arguments)}}function Dt(e){try{return e()}catch(e){}}!function(e){e.debug=kt("debug"),e.log=kt("log"),e.warn=kt("warn"),e.error=kt("error")}(Ot||(Ot={}));const Nt=Dt((function(){return globalThis}))||Dt((function(){return window}))||Dt((function(){return self}))||Dt((function(){return global}))||Dt((function(){return Dt.constructor("return this")()}));var At="__",xt=[At,At].join("DEV");const Rt=function(){try{return Boolean(__DEV__)}catch(e){return Object.defineProperty(Nt,xt,{value:"production"!==Dt((function(){return"production"})),enumerable:!1,configurable:!0,writable:!0}),Nt[xt]}}();function Pt(e){try{return e()}catch(e){}}var jt=Pt((function(){return globalThis}))||Pt((function(){return window}))||Pt((function(){return self}))||Pt((function(){return global}))||Pt((function(){return Pt.constructor("return this")()})),Ct=!1;function $t(e,t){if(!Boolean(e))throw new Error(t)}!jt||Pt((function(){return"production"}))||Pt((function(){return process}))||(Object.defineProperty(jt,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Ct=!0);const Mt=10,Ft=2;function qt(e){return Lt(e,[])}function Lt(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:Lt(t,r)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Ft)return"[Array]";const r=Math.min(Mt,e.length),n=e.length-r,i=[];for(let n=0;n<r;++n)i.push(Lt(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>Ft)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+": "+Lt(r,t)));return"{ "+n.join(", ")+" }"}(e,r)}(e,t);default:return String(e)}}class Vt{constructor(e,t="GraphQL request",r={line:1,column:1}){"string"==typeof e||$t(!1,`Body must be a string. Received: ${qt(e)}.`),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||$t(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||$t(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}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 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 Bt(e,t,r){return t&&Ut(e.prototype,t),r&&Ut(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}Ct&&(delete jt.process,Ct=!1),__DEV__?Ot("boolean"==typeof Rt,Rt):Ot("boolean"==typeof Rt,39);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 Kt=Wt("iterator"),Ht=Wt("observable"),Gt=Wt("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 Zt(e){var t=e.constructor;return void 0!==t&&null===(t=t[Gt])&&(t=void 0),void 0!==t?t:cr}function Xt(e){return e instanceof cr}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))},Bt(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")},Bt(e,[{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),cr=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(Zt(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(Zt(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=Zt(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=Zt(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=Zt(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 Xt(i)&&i.constructor===r?i:new r((function(e){return i.subscribe(e)}))}if(Yt("iterator")&&(n=Jt(t,Kt)))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 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){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()}}))}))},Bt(e,null,[{key:Gt,get:function(){return this}}]),e}();function ur(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 __DEV__?new St("Found a ".concat(e.operation," operation").concat(e.name?" named '".concat(e.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new St(44);"FragmentDefinition"===e.kind&&n.push(e)})),void 0===r&&(__DEV__?Ot(1===n.length,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):Ot(1===n.length,45),r=n[0].name.value),ce(ce({},e),{definitions:pe([{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 fr(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 __DEV__?Ot(n,"No fragment named ".concat(r)):Ot(n,46),n||null;default:return null}}function dr(e){return{__ref:String(e)}}function pr(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function mr(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 mr(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 mr(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 __DEV__?new St('The inline argument "'.concat(t.value,'" of kind "').concat(r.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new St(55);e[t.value]=null}}zt()&&Object.defineProperty(cr,Symbol("extensions"),{value:{symbol:Ht,hostReportError:er},configurable:!0});var yr=["connection","include","skip","client","rest","export"],vr=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(gr(i),")")}return r.connection.key}var o=e;if(t){var s=gr(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(gr(r[e]),")"):o+="@".concat(e))})),o}),{setStringify:function(e){var t=gr;return gr=e,t}}),gr=function(e){return JSON.stringify(e,br)};function br(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 _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 mr(r,n,i,t)})),r}return null}function wr(e){return e.alias?e.alias.value:e.name.value}function Er(e,t,r){if("string"==typeof e.__typename)return e.__typename;for(var n=0,i=t.selections;n<i.length;n++){var o=i[n];if(Sr(o)){if("__typename"===o.name.value)return e[wr(o)]}else{var s=Er(e,fr(o,r).selectionSet,r);if("string"==typeof s)return s}}}function Sr(e){return"Field"===e.kind}function Or(e){__DEV__?Ot(e&&"Document"===e.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):Ot(e&&"Document"===e.kind,47);var t=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw __DEV__?new St('Schema type definitions not allowed in queries. Found: "'.concat(e.kind,'"')):new St(48);return e}));return __DEV__?Ot(t.length<=1,"Ambiguous GraphQL document: contains ".concat(t.length," operations")):Ot(t.length<=1,49),e}function Ir(e){return Or(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 kr(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function Dr(e){var t=Ir(e);return __DEV__?Ot(t&&"query"===t.operation,"Must contain a query definition."):Ot(t&&"query"===t.operation,50),t}function Nr(e){var t;Or(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 __DEV__?new St("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new St(54)}function Ar(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&mr(t,e.variable.name,e.defaultValue)})),t}function xr(e,t){return t?t(e):cr.of()}function Rr(e){return"function"==typeof e?new Cr(e):e}function Pr(e){return e.request.length<=1}var jr=function(e){function t(t,r){var n=e.call(this,t)||this;return n.link=r,n}return ae(t,e),t}(Error),Cr=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return cr.of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(Rr).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,r,n){var i=Rr(r),o=Rr(n||new e(xr));return Pr(i)&&Pr(o)?new e((function(e){return t(e)?i.request(e)||cr.of():o.request(e)||cr.of()})):new e((function(e,r){return t(e)?i.request(e,r)||cr.of():o.request(e,r)||cr.of()}))},e.execute=function(e,t){return e.request(function(e,t){var r=ce({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){r=ce(ce({},r),"function"==typeof e?e(r):e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return ce({},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 __DEV__?new St("illegal argument: ".concat(i)):new St(27)}return e}(t))))||cr.of()},e.concat=function(t,r){var n=Rr(t);if(Pr(n))return __DEV__&&Ot.warn(new jr("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Rr(r);return Pr(i)?new e((function(e){return n.request(e,(function(e){return i.request(e)||cr.of()}))||cr.of()})):new e((function(e,t){return n.request(e,(function(e){return i.request(e,t)||cr.of()}))||cr.of()}))},e.prototype.split=function(t,r,n){return this.concat(e.split(t,r,n||new e(xr)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw __DEV__?new St("request is not implemented"):new St(22)},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}(),$r=Cr.execute;class Mr{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 Fr{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 qr={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"]},Lr=new Set(Object.keys(qr));function Vr(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&Lr.has(t)}var Qr,Ur,Br;!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(Qr||(Qr={})),(Br=Ur||(Ur={})).NAME="Name",Br.DOCUMENT="Document",Br.OPERATION_DEFINITION="OperationDefinition",Br.VARIABLE_DEFINITION="VariableDefinition",Br.SELECTION_SET="SelectionSet",Br.FIELD="Field",Br.ARGUMENT="Argument",Br.FRAGMENT_SPREAD="FragmentSpread",Br.INLINE_FRAGMENT="InlineFragment",Br.FRAGMENT_DEFINITION="FragmentDefinition",Br.VARIABLE="Variable",Br.INT="IntValue",Br.FLOAT="FloatValue",Br.STRING="StringValue",Br.BOOLEAN="BooleanValue",Br.NULL="NullValue",Br.ENUM="EnumValue",Br.LIST="ListValue",Br.OBJECT="ObjectValue",Br.OBJECT_FIELD="ObjectField",Br.DIRECTIVE="Directive",Br.NAMED_TYPE="NamedType",Br.LIST_TYPE="ListType",Br.NON_NULL_TYPE="NonNullType",Br.SCHEMA_DEFINITION="SchemaDefinition",Br.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",Br.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",Br.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",Br.FIELD_DEFINITION="FieldDefinition",Br.INPUT_VALUE_DEFINITION="InputValueDefinition",Br.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",Br.UNION_TYPE_DEFINITION="UnionTypeDefinition",Br.ENUM_TYPE_DEFINITION="EnumTypeDefinition",Br.ENUM_VALUE_DEFINITION="EnumValueDefinition",Br.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",Br.DIRECTIVE_DEFINITION="DirectiveDefinition",Br.SCHEMA_EXTENSION="SchemaExtension",Br.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",Br.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",Br.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",Br.UNION_TYPE_EXTENSION="UnionTypeExtension",Br.ENUM_TYPE_EXTENSION="EnumTypeExtension",Br.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension";const zr=Object.freeze({});function Yr(e,t,r=qr){const n=new Map;for(const e of Object.values(Ur))n.set(e,Wr(t,e));let i,o,s,a=Array.isArray(e),c=[e],u=-1,l=[],h=e;const f=[],d=[];do{u++;const e=u===c.length,v=e&&0!==l.length;if(e){if(o=0===d.length?void 0:f[f.length-1],h=s,s=d.pop(),v)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}u=i.index,c=i.keys,l=i.edits,a=i.inArray,i=i.prev}else if(s){if(o=a?u:c[u],h=s[o],null==h)continue;f.push(o)}let g;if(!Array.isArray(h)){var p,m;Vr(h)||$t(!1,`Invalid AST Node: ${qt(h)}.`);const r=e?null===(p=n.get(h.kind))||void 0===p?void 0:p.leave:null===(m=n.get(h.kind))||void 0===m?void 0:m.enter;if(g=null==r?void 0:r.call(t,h,o,s,f,d),g===zr)break;if(!1===g){if(!e){f.pop();continue}}else if(void 0!==g&&(l.push([o,g]),!e)){if(!Vr(g)){f.pop();continue}h=g}}var y;void 0===g&&v&&l.push([o,h]),e?f.pop():(i={inArray:a,index:u,keys:c,edits:l,prev:i},a=Array.isArray(h),c=a?h:null!==(y=r[h.kind])&&void 0!==y?y:[],u=-1,l=[],s&&d.push(s),s=h)}while(void 0!==i);return 0!==l.length?l[l.length-1][1]:e}function Wr(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 Kr(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;__DEV__?Ot(r&&1===r.length,"Incorrect number of arguments for the @".concat(n," directive.")):Ot(r&&1===r.length,41);var i=r[0];__DEV__?Ot(i.name&&"if"===i.name.value,"Invalid argument for the @".concat(n," directive.")):Ot(i.name&&"if"===i.name.value,42);var o=i.value;__DEV__?Ot(o&&("Variable"===o.kind||"BooleanValue"===o.kind),"Argument for the @".concat(n," directive must be a variable or a boolean value.")):Ot(o&&("Variable"===o.kind||"BooleanValue"===o.kind),43),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],__DEV__?Ot(void 0!==i,"Invalid variable referenced in @".concat(r.name.value," directive.")):Ot(void 0!==i,40)):i=n.value.value,"skip"===r.name.value?!i:i}))}function Hr(e,t,r){var n=new Set(e),i=n.size;return Yr(t,{Directive:function(e){if(n.delete(e.name.value)&&(!r||!n.size))return zr}}),r?!n.size:n.size<i}function Gr(e){return e&&Hr(["client","export"],e,!0)}var Jr=function(e,t){var r;try{r=JSON.stringify(e)}catch(e){var n=__DEV__?new St("Network request failed. ".concat(t," is not serializable: ").concat(e.message)):new St(24);throw n.parseError=e,n}return r},Zr="function"==typeof WeakMap&&"ReactNative"!==Dt((function(){return navigator.product})),Xr="function"==typeof WeakSet,en="function"==typeof Symbol&&"function"==typeof Symbol.for,tn=en&&Symbol.asyncIterator;function rn(e){var t={next:function(){return e.read()}};return tn&&(t[Symbol.asyncIterator]=function(){return this}),t}function nn(e){var t,r,n,i,o=e;if(e.body&&(o=e.body),i=o,tn&&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 rn(o.getReader());if(function(e){return!!e.stream}(o))return rn(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)})))}},tn&&(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 c(){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",c),e.removeListener("finish",c),e.removeListener("close",c)},e.on("data",s),e.on("error",a),e.on("end",c),e.on("finish",c),e.on("close",c);var u={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 tn&&(u[Symbol.asyncIterator]=function(){return this}),u}(o);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}Dt((function(){return window.document.createElement})),Dt((function(){return navigator.userAgent.indexOf("jsdom")>=0}));var on=function(e,t,r){var n=new Error(r);throw n.name="ServerError",n.response=e,n.statusCode=e.status,n.result=t,n},sn=Object.prototype.hasOwnProperty;function an(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 cn(e,t){e.status>=300&&on(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 un(e,t){var r,n;"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&(null===(r=t.next)||void 0===r||r.call(t,e.result)),null===(n=t.error)||void 0===n||n.call(t,e))}function ln(e){return 9===e||32===e}function hn(e){return e>=48&&e<=57}function fn(e){return e>=97&&e<=122||e>=65&&e<=90}function dn(e){return fn(e)||95===e}function pn(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&&ln(e.charCodeAt(t));)++t;return t}const yn=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function vn(e){return gn[e.charCodeAt(0)]}const gn=["\\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"];function bn(e){return Yr(e,_n)}const _n={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>wn(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Sn("(",wn(e.variableDefinitions,", "),")"),r=wn([e.operation,wn([e.name,t]),wn(e.directives," ")]," ");return("query"===r?"":r+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:r,directives:n})=>e+": "+t+Sn(" = ",r)+Sn(" ",wn(n," "))},SelectionSet:{leave:({selections:e})=>En(e)},Field:{leave({alias:e,name:t,arguments:r,directives:n,selectionSet:i}){const o=Sn("",e,": ")+t;let s=o+Sn("(",wn(r,", "),")");return s.length>80&&(s=o+Sn("(\n",On(wn(r,"\n")),"\n)")),wn([s,wn(n," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Sn(" ",wn(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:r})=>wn(["...",Sn("on ",e),wn(t," "),r]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:r,directives:n,selectionSet:i})=>`fragment ${e}${Sn("(",wn(r,", "),")")} on ${t} ${Sn("",wn(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||ln(e.charCodeAt(0)))),s=r.endsWith('\\"""'),a=e.endsWith('"')&&!s,c=e.endsWith("\\"),u=a||c,l=!i||e.length>70||u||o||s;let h="";const f=i&&ln(e.charCodeAt(0));return(l&&!f||o)&&(h+="\n"),h+=r,(l||u)&&(h+="\n"),'"""'+h+'"""'}(e):`"${e.replace(yn,vn)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+wn(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+wn(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Sn("(",wn(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:r})=>Sn("",e,"\n")+wn(["schema",wn(t," "),En(r)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:r})=>Sn("",e,"\n")+wn(["scalar",t,wn(r," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Sn("",e,"\n")+wn(["type",t,Sn("implements ",wn(r," & ")),wn(n," "),En(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:r,type:n,directives:i})=>Sn("",e,"\n")+t+(In(r)?Sn("(\n",On(wn(r,"\n")),"\n)"):Sn("(",wn(r,", "),")"))+": "+n+Sn(" ",wn(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:r,defaultValue:n,directives:i})=>Sn("",e,"\n")+wn([t+": "+r,Sn("= ",n),wn(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Sn("",e,"\n")+wn(["interface",t,Sn("implements ",wn(r," & ")),wn(n," "),En(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:r,types:n})=>Sn("",e,"\n")+wn(["union",t,wn(r," "),Sn("= ",wn(n," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:r,values:n})=>Sn("",e,"\n")+wn(["enum",t,wn(r," "),En(n)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:r})=>Sn("",e,"\n")+wn([t,wn(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:r,fields:n})=>Sn("",e,"\n")+wn(["input",t,wn(r," "),En(n)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:r,repeatable:n,locations:i})=>Sn("",e,"\n")+"directive @"+t+(In(r)?Sn("(\n",On(wn(r,"\n")),"\n)"):Sn("(",wn(r,", "),")"))+(n?" repeatable":"")+" on "+wn(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>wn(["extend schema",wn(e," "),En(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>wn(["extend scalar",e,wn(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>wn(["extend type",e,Sn("implements ",wn(t," & ")),wn(r," "),En(n)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>wn(["extend interface",e,Sn("implements ",wn(t," & ")),wn(r," "),En(n)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:r})=>wn(["extend union",e,wn(t," "),Sn("= ",wn(r," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:r})=>wn(["extend enum",e,wn(t," "),En(r)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:r})=>wn(["extend input",e,wn(t," "),En(r)]," ")}};function wn(e,t=""){var r;return null!==(r=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==r?r:""}function En(e){return Sn("{\n",On(wn(e,"\n")),"\n}")}function Sn(e,t,r=""){return null!=t&&""!==t?e+t+r:""}function On(e){return Sn(" ",e.replace(/\n/g,"\n "))}function In(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}var Tn={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},kn=function(e,t){return t(e)};function Dn(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},o={};r.forEach((function(e){i=ce(ce(ce({},i),e.options),{headers:ce(ce({},i.headers),e.headers)}),e.credentials&&(i.credentials=e.credentials),o=ce(ce({},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,u=e.query,l={operationName:s,variables:c};return o.includeExtensions&&(l.extensions=a),o.includeQuery&&(l.query=t(u,bn)),{options:i,body:l}}function Nn(e){return new cr((function(t){t.error(e)}))}var An=Dt((function(){return fetch})),xn=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?kn:i,s=e.includeExtensions,a=e.preserveHeaderCase,c=e.useGETForQueries,u=e.includeUnusedVariables,l=void 0!==u&&u,h=ue(e,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&function(e){if(!e&&"undefined"==typeof fetch)throw __DEV__?new St("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n "):new St(23)}(n||An);var f={http:{includeExtensions:s,preserveHeaderCase:a},options:h.fetchOptions,credentials:h.credentials,headers:h.headers};return new Cr((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,u=a.name,h=a.version;u&&(s["apollographql-client-name"]=u),h&&(s["apollographql-client-version"]=h)}var d,p=ce(ce({},s),i.headers),m={http:i.http,options:i.fetchOptions,credentials:i.credentials,headers:p},y=Dn(e,o,Tn,f,m),v=y.options,g=y.body;if(g.variables&&!l){var b=new Set(Object.keys(g.variables));Yr(e.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&b.delete(e.name.value)}}),b.size&&(g.variables=ce({},g.variables),b.forEach((function(e){delete g.variables[e]})))}if(!v.signal){var _=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController;return{controller:e,signal:e.signal}}(),w=_.controller,E=_.signal;(d=w)&&(v.signal=E)}if(c&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(v.method="GET"),Hr(["defer"],e.query)&&(v.headers=v.headers||{},v.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),"GET"===v.method){var S=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=Jr(t.variables,"Variables map")}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=Jr(t.extensions,"Extensions map")}catch(e){return{parseError:e}}n("extensions",o)}var s="",a=e,c=e.indexOf("#");-1!==c&&(s=e.substr(c),a=e.substr(0,c));var u=-1===a.indexOf("?")?"?":"&";return{newURI:a+u+r.join("&")+s}}(t,g),O=S.newURI,I=S.parseError;if(I)return Nn(I);t=O}else try{v.body=Jr(g,"Payload")}catch(I){return Nn(I)}return new cr((function(r){return(n||Dt((function(){return fetch}))||An)(t,v).then((function(t){var n;e.setContext({response:t});var i=null===(n=t.headers)||void 0===n?void 0:n.get("content-type");return null!==i&&/^multipart\/mixed/i.test(i)?function(e,t){var r,n,i;return le(this,void 0,void 0,(function(){var o,s,a,c,u,l,h,f,d,p,m,y,v,g,b,_,w,E,S,O;return he(this,(function(I){switch(I.label){case 0:if(void 0===TextDecoder)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");o=new TextDecoder("utf-8"),s=null===(r=e.headers)||void 0===r?void 0:r.get("content-type"),a="boundary=",c=(null==s?void 0:s.includes(a))?null==s?void 0:s.substring((null==s?void 0:s.indexOf(a))+9).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",h=nn(e),f=!0,I.label=1;case 1:return f?[4,h.next()]:[3,3];case 2:for(d=I.sent(),p=d.value,m=d.done,y="string"==typeof p?p:o.decode(p),f=!m,v=(l+=y).indexOf(u);v>-1;){if(g=void 0,O=[l.slice(0,v),l.slice(v+u.length)],l=O[1],(g=O[0]).trim()){if(b=g.indexOf("\r\n\r\n"),_=an(g.slice(0,b)),(w=_["content-type"])&&-1===w.toLowerCase().indexOf("application/json"))throw new Error("Unsupported patch content type: application/json is required.");E=g.slice(b);try{S=cn(e,E.replace("\r\n","")),(Object.keys(S).length>1||"data"in S||"incremental"in S||"errors"in S)&&(null===(n=t.next)||void 0===n||n.call(t,S))}catch(e){un(e,t)}}v=l.indexOf(u)}return[3,1];case 3:return null===(i=t.complete)||void 0===i||i.call(t),[2]}}))}))}(t,r):function(e,t,r){var n;(n=t,function(e){return e.text().then((function(t){return cn(e,t)})).then((function(t){return e.status>=300&&on(e,t,"Response not successful: Received status code ".concat(e.status)),Array.isArray(t)||sn.call(t,"data")||sn.call(t,"errors")||on(e,t,"Server response was missing for query '".concat(Array.isArray(n)?n.map((function(e){return e.operationName})):n.operationName,"'.")),t}))})(e).then((function(e){var t,n;null===(t=r.next)||void 0===t||t.call(r,e),null===(n=r.complete)||void 0===n||n.call(r)})).catch((function(e){return un(e,r)}))}(t,e,r)})).catch((function(e){return un(e,r)})),function(){d&&d.abort()}}))}))},Rn=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,xn(t).request)||this;return r.options=t,r}return ae(t,e),t}(Cr),Pn=Object.prototype,jn=Pn.toString,Cn=Pn.hasOwnProperty,$n=Function.prototype.toString,Mn=new Map;function Fn(e,t){try{return qn(e,t)}finally{Mn.clear()}}function qn(e,t){if(e===t)return!0;var r,n,i,o=jn.call(e);if(o!==jn.call(t))return!1;switch(o){case"[object Array]":if(e.length!==t.length)return!1;case"[object Object]":if(Un(e,t))return!0;var s=Ln(e),a=Ln(t),c=s.length;if(c!==a.length)return!1;for(var u=0;u<c;++u)if(!Cn.call(t,s[u]))return!1;for(u=0;u<c;++u){var l=s[u];if(!qn(e[l],t[l]))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=="".concat(t);case"[object Map]":case"[object Set]":if(e.size!==t.size)return!1;if(Un(e,t))return!0;for(var h=e.entries(),f="[object Map]"===o;;){var d=h.next();if(d.done)break;var p=d.value,m=p[0],y=p[1];if(!t.has(m))return!1;if(f&&!qn(y,t.get(m)))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]":var v=e.byteLength;if(v===t.byteLength)for(;v--&&e[v]===t[v];);return-1===v;case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":var g=$n.call(e);return g===$n.call(t)&&(n=Qn,!((i=(r=g).length-n.length)>=0&&r.indexOf(n,i)===i))}return!1}function Ln(e){return Object.keys(e).filter(Vn,e)}function Vn(e){return void 0!==this[e]}var Qn="{ [native code] }";function Un(e,t){var r=Mn.get(e);if(r){if(r.has(t))return!0}else Mn.set(e,r=new Set);return r.add(t),!1}var Bn=Array.isArray;function zn(e){return Array.isArray(e)&&e.length>0}var Yn=Object.prototype.hasOwnProperty;function Wn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Kn(e)}function Kn(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new Gn,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var Hn=function(e,t,r){return this.merge(e[r],t[r])},Gn=function(){function e(e){void 0===e&&(e=Hn),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(Yn.call(e,i)){var o=e[i];if(t[i]!==o){var s=r.reconciler.apply(r,pe([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):ce({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},e}();function Jn(e){return"incremental"in e}function Zn(e,t){var r=e,n=new Gn;return Jn(t)&&zn(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 Xn,ei,ti=function(){return Object.create(null)},ri=Array.prototype,ni=ri.forEach,ii=ri.slice,oi=function(){function e(e,t){void 0===e&&(e=!0),void 0===t&&(t=ti),this.weakness=e,this.makeData=t}return e.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},e.prototype.lookupArray=function(e){var t=this;return ni.call(e,(function(e){return t=t.getChildTrie(e)})),t.data||(t.data=this.makeData(ii.call(e)))},e.prototype.getChildTrie=function(t){var r=this.weakness&&function(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}(t)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),n=r.get(t);return n||r.set(t,n=new e(this.weakness,this.makeData)),n},e}(),si=function(){function e(){this.known=new(Xr?WeakSet:Set),this.pool=new oi(Zr),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)?Bn(e)?e.slice(0):ce({__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),__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,c=o.length;if(s.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(a=this.pool.lookupArray(o)).object){var u=a.object=Object.create(i);this.known.add(u),s.sorted.forEach((function(e,t){u[e]=o[c+t]})),__DEV__&&Object.freeze(u)}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}(),ai=Object.assign((function(e){if(ur(e)){void 0===Xn&&ci();var t=Xn.admit(e),r=ei.get(t);return void 0===r&&ei.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:ci});function ci(){Xn=new si,ei=new(Zr?WeakMap:Map)}function ui(e,t,r){return new cr((function(n){var i=n.next,o=n.error,s=n.complete,a=0,c=!1,u={then:function(e){return new Promise((function(t){return t(e())}))}};function l(e,t){return e?function(t){++a;var r=function(){return e(t)};u=u.then(r,r).then((function(e){--a,i&&i.call(n,e),c&&h.complete()}),(function(e){throw--a,e})).catch((function(e){o&&o.call(n,e)}))}:function(e){return t&&t.call(n,e)}}var h={next:l(t,i),error:l(r,o),complete:function(){c=!0,a||s&&s.call(n)}},f=e.subscribe(h);return function(){return f.unsubscribe()}}))}function li(e){return zn(hi(e))}function hi(e){var t=zn(e.errors)?e.errors.slice(0):[];return Jn(e)&&zn(e.incremental)&&e.incremental.forEach((function(e){e.errors&&t.push.apply(t,e.errors)})),t}var fi={kind:Ur.FIELD,name:{kind:Ur.NAME,value:"__typename"}};function di(e,t){return!e||e.selectionSet.selections.every((function(e){return e.kind===Ur.FRAGMENT_SPREAD&&di(t[e.name.value],t)}))}function pi(e){return di(Ir(e)||function(e){__DEV__?Ot("Document"===e.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):Ot("Document"===e.kind,51),__DEV__?Ot(e.definitions.length<=1,"Fragment must have exactly one definition."):Ot(e.definitions.length<=1,52);var t=e.definitions[0];return __DEV__?Ot("FragmentDefinition"===t.kind,"Must be a fragment definition."):Ot("FragmentDefinition"===t.kind,53),t}(e),hr(kr(e)))?null:e}function mi(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 yi(e,t){for(var r=mi(""),n=mi(""),i=function(e){for(var t=0,i=void 0;t<e.length&&(i=e[t]);++t)if(!Bn(i)){if(i.kind===Ur.OPERATION_DEFINITION)return r(i.name&&i.name.value);if(i.kind===Ur.FRAGMENT_DEFINITION)return n(i.name.value)}return __DEV__&&Ot.error("Could not find operation or fragment"),null},o=0,s=t.definitions.length-1;s>=0;--s)t.definitions[s].kind===Ur.OPERATION_DEFINITION&&++o;var a=function(e){var t=new Set,r=[];return e.forEach((function(e){e.name?t.add(e.name):e.test&&r.push(e.test)})),function(e){return t.has(e.name.value)||r.some((function(t){return t(e)}))}}(e),c=e.some((function(e){return e.remove})),u=function(e){return c&&e&&e.some(a)},l=new Map,h=!1,f={enter:function(e){if(u(e.directives))return h=!0,null}},d=Yr(t,{Field:f,InlineFragment:f,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(u(e.directives))return h=!0,null;var s=i(o);s&&s.fragmentSpreads.add(e.name.value)}},FragmentDefinition:{enter:function(e,t,r,n){l.set(JSON.stringify(n),e)},leave:function(e,t,r,i){return e===l.get(JSON.stringify(i))?e:o>0&&e.selectionSet.selections.every((function(e){return e.kind===Ur.FIELD&&"__typename"===e.name.value}))?(n(e.name.value).removed=!0,h=!0,null):void 0}},Directive:{leave:function(e){if(a(e))return h=!0,null}}});if(!h)return t;var p=function(e){return e.transitiveVars||(e.transitiveVars=new Set(e.variables),e.removed||e.fragmentSpreads.forEach((function(t){p(n(t)).transitiveVars.forEach((function(t){e.transitiveVars.add(t)}))}))),e},m=new Set;d.definitions.forEach((function(e){e.kind===Ur.OPERATION_DEFINITION?p(r(e.name&&e.name.value)).fragmentSpreads.forEach((function(e){m.add(e)})):e.kind!==Ur.FRAGMENT_DEFINITION||0!==o||n(e.name.value).removed||m.add(e.name.value)})),m.forEach((function(e){p(n(e)).fragmentSpreads.forEach((function(e){m.add(e)}))}));var y={enter:function(e){if(t=e.name.value,!m.has(t)||n(t).removed)return null;var t}};return pi(Yr(d,{FragmentSpread:y,FragmentDefinition:y,OperationDefinition:{leave:function(e){if(e.variableDefinitions){var t=p(r(e.name&&e.name.value)).transitiveVars;if(t.size<e.variableDefinitions.length)return ce(ce({},e),{variableDefinitions:e.variableDefinitions.filter((function(e){return t.has(e.variable.name.value)}))})}}}}))}var vi=Object.assign((function(e){return Yr(e,{SelectionSet:{enter:function(e,t,r){if(!r||r.kind!==Ur.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 ce(ce({},e),{selections:pe(pe([],n,!0),[fi],!1)})}}}}})}),{added:function(e){return e===fi}}),gi={test:function(e){var t="connection"===e.name.value;return t&&(e.arguments&&e.arguments.some((function(e){return"key"===e.name.value}))||__DEV__&&Ot.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key.")),t}};function bi(e){return"query"===Nr(e).operation?e:Yr(e,{OperationDefinition:{enter:function(e){return ce(ce({},e),{operation:"query"})}}})}var _i=new Map;function wi(e){var t=_i.get(e)||1;return _i.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function Ei(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function Si(e){function t(t){Object.defineProperty(e,t,{value:cr})}return en&&Symbol.species&&t(Symbol.species),t("@@species"),e}function Oi(e){return e&&"function"==typeof e.then}var Ii=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),Ei(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),Ei(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?Oi(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"),Ei(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 cr(t)]),Oi(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return ae(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}(cr);Si(Ii);var Ti,ki=function(e){function t(r){var n,i,o=r.graphQLErrors,s=r.clientErrors,a=r.networkError,c=r.errorMessage,u=r.extraInfo,l=e.call(this,c)||this;return l.name="ApolloError",l.graphQLErrors=o||[],l.clientErrors=s||[],l.networkError=a||null,l.message=c||(i="",(zn((n=l).graphQLErrors)||zn(n.clientErrors))&&(n.graphQLErrors||[]).concat(n.clientErrors||[]).forEach((function(e){var t=e?e.message:"Error message not found.";i+="".concat(t,"\n")})),n.networkError&&(i+="".concat(n.networkError.message,"\n")),i=i.replace(/\n$/,"")),l.extraInfo=u,l.__proto__=t.prototype,l}return ae(t,e),t}(Error);function Di(e){return!!e&&e<7}!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"}(Ti||(Ti={}));var Ni=Object.prototype.toString;function Ai(e){return xi(e)}function xi(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]=xi(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]=xi(e[r],t)})),n;default:return e}}function Ri(){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}var Pi=Object.assign,ji=Object.hasOwnProperty,Ci=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=Mi)}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.isTornDown=!1;var s=r.defaultOptions.watchQuery,a=(void 0===s?{}:s).fetchPolicy,c=void 0===a?"cache-first":a,u=i.fetchPolicy,l=void 0===u?c:u,h=i.initialFetchPolicy,f=void 0===h?"standby"===l?c:l:h;o.options=ce(ce({},i),{initialFetchPolicy:f,fetchPolicy:l}),o.queryId=n.queryId||r.generateQueryId();var d=Ir(o.query);return o.queryName=d&&d.name&&d.name.value,o}return ae(t,e),Object.defineProperty(t.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},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||Ti.ready,n=ce(ce({},t),{loading:Di(r),networkStatus:r}),i=this.options.fetchPolicy,o=void 0===i?"cache-first":i;if("network-only"===o||"no-cache"===o||"standby"===o||this.queryManager.transform(this.options.query).hasForcedResolvers);else{var s=this.queryInfo.getDiff();(s.complete||this.options.returnPartialData)&&(n.data=s.result),Fn(n.data,{})&&(n.data=void 0),s.complete?(delete n.partial,!s.complete||n.networkStatus!==Ti.loading||"cache-first"!==o&&"cache-only"!==o||(n.networkStatus=Ti.ready,n.loading=!1)):n.partial=!0,!__DEV__||s.complete||this.options.partialRefetch||n.loading||n.data||n.error||Fi(s.missing)}return e&&this.updateLastResult(n),n},t.prototype.isDifferentFromLastResult=function(e,t){return!this.last||!Fn(this.last.result,e)||t&&!Fn(this.last.variables,t)},t.prototype.getLast=function(e,t){var r=this.last;if(r&&r[e]&&(!t||Fn(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",__DEV__&&e&&ji.call(e,"variables")){var i=Dr(this.query),o=i.variableDefinitions;o&&o.some((function(e){return"variables"===e.variable.name.value}))||__DEV__&&Ot.warn("Called refetch(".concat(JSON.stringify(e),") for query ").concat((null===(t=i.name)||void 0===t?void 0:t.value)||JSON.stringify(i),", which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?"))}return e&&!Fn(this.options.variables,e)&&(r.variables=this.options.variables=ce(ce({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(r,Ti.refetch)},t.prototype.fetchMore=function(e){var t=this,r=ce(ce({},e.query?e:ce(ce(ce(ce({},this.options),{query:this.query}),e),{variables:ce(ce({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"}),n=this.queryManager.generateQueryId(),i=this.queryInfo,o=i.networkStatus;i.networkStatus=Ti.fetchMore,r.notifyOnNetworkStatusChange&&this.observe();var s=new Set;return this.queryManager.fetchQuery(n,r,Ti.fetchMore).then((function(a){return t.queryManager.removeQuery(n),i.networkStatus===Ti.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)||$i(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):__DEV__&&Ot.error("Unhandled GraphQL subscription error",t)}});return this.subscriptions.add(r),function(){t.subscriptions.delete(r)&&r.unsubscribe()}},t.prototype.setOptions=function(e){return this.reobserve(e)},t.prototype.setVariables=function(e){return Fn(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},Ti.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){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,e,t)},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){__DEV__?Ot(r,"Attempted to start a polling query without a polling interval."):Ot(r,13),(t||(this.pollingInfo={})).interval=r;var n=function(){e.pollingInfo&&(Di(e.queryInfo.networkStatus)?i():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"network-only"},Ti.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){return void 0===t&&(t=this.variables),this.last=ce(ce({},this.last),{result:this.queryManager.assumeImmutableResults?e:Ai(e),variables:t}),zn(e.errors)||delete this.last.error,this.last},t.prototype.reobserve=function(e,t){var r=this;this.isTornDown=!1;var n=t===Ti.refetch||t===Ti.fetchMore||t===Ti.poll,i=this.options.variables,o=this.options.fetchPolicy,s=Ri(this.options,e||{}),a=n?s:Pi(this.options,s);n||(this.updatePolling(),e&&e.variables&&!Fn(e.variables,i)&&"standby"!==a.fetchPolicy&&a.fetchPolicy===o&&(this.applyNextFetchPolicy("variables-changed",a),void 0===t&&(t=Ti.setVariables)));var c=a.variables&&ce({},a.variables),u=this.fetch(a,t),l={next:function(e){r.reportResult(e,c)},error:function(e){r.reportError(e,c)}};return n||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=u,this.observer=l),u.addObserver(l),u.promise},t.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},t.prototype.reportResult=function(e,t){var r=this.getLastError();(r||this.isDifferentFromLastResult(e,t))&&((r||!e.partial||this.options.returnPartialData)&&this.updateLastResult(e,t),Ei(this.observers,"next",e))},t.prototype.reportError=function(e,t){var r=ce(ce({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:Ti.error,loading:!1});this.updateLastResult(r,t),Ei(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}(cr);function $i(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(){return this.nextFetchPolicy=n,"function"==typeof n?n.apply(this,arguments):r}}):e.reobserve()}function Mi(e){__DEV__&&Ot.error("Unhandled error",e.message,e.stack)}function Fi(e){__DEV__&&e&&__DEV__&&Ot.debug("Missing cache result fields: ".concat(JSON.stringify(e)),e)}function qi(e){return e.kind===Ur.FIELD||e.kind===Ur.FRAGMENT_SPREAD||e.kind===Ur.INLINE_FRAGMENT}Si(Ci);var Li=null,Vi={},Qi=1;function Ui(e){try{return e()}catch(e){}}var Bi="@wry/context:Slot",zi=Ui((function(){return globalThis}))||Ui((function(){return r.g}))||Object.create(null),Yi=zi[Bi]||Array[Bi]||function(e){try{Object.defineProperty(zi,Bi,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}}(function(){function e(){this.id=["slot",Qi++,Date.now(),Math.random().toString(36).slice(2)].join(":")}return e.prototype.hasValue=function(){for(var e=Li;e;e=e.parent)if(this.id in e.slots){var t=e.slots[this.id];if(t===Vi)break;return e!==Li&&(Li.slots[this.id]=t),!0}return Li&&(Li.slots[this.id]=Vi),!1},e.prototype.getValue=function(){if(this.hasValue())return Li.slots[this.id]},e.prototype.withValue=function(e,t,r,n){var i,o=((i={__proto__:null})[this.id]=e,i),s=Li;Li={parent:s,slots:o};try{return t.apply(n,r)}finally{Li=s}},e.bind=function(e){var t=Li;return function(){var r=Li;try{return Li=t,e.apply(this,arguments)}finally{Li=r}}},e.noContext=function(e,t,r){if(!Li)return e.apply(r,t);var n=Li;try{return Li=null,e.apply(r,t)}finally{Li=n}},e}());function Wi(){}Yi.bind,Yi.noContext;var Ki,Hi=function(){function e(e,t){void 0===e&&(e=1/0),void 0===t&&(t=Wi),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},e.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var r=t.older,n=t.newer;n&&(n.older=r),r&&(r.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t},e.prototype.set=function(e,t){var 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)},e.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},e.prototype.delete=function(e){var 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)},e}(),Gi=new Yi,Ji=Object.prototype.hasOwnProperty,Zi=void 0===(Ki=Array.from)?function(e){var t=[];return e.forEach((function(e){return t.push(e)})),t}:Ki;function Xi(e){var t=e.unsubscribe;"function"==typeof t&&(e.unsubscribe=void 0,t())}var eo=[],to=100;function ro(e,t){if(!e)throw new Error(t||"assertion failure")}function no(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}var io=function(){function e(t){this.fn=t,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++e.count}return e.prototype.peek=function(){if(1===this.value.length&&!ao(this))return oo(this),this.value[0]},e.prototype.recompute=function(e){return ro(!this.recomputing,"already recomputing"),oo(this),ao(this)?function(e,t){return mo(e),Gi.withValue(e,so,[e,t]),function(e,t){if("function"==typeof e.subscribe)try{Xi(e),e.unsubscribe=e.subscribe.apply(null,t)}catch(t){return e.setDirty(),!1}return!0}(e,t)&&function(e){e.dirty=!1,ao(e)||uo(e)}(e),no(e.value)}(this,e):no(this.value)},e.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,co(this),Xi(this))},e.prototype.dispose=function(){var e=this;this.setDirty(),mo(this),lo(this,(function(t,r){t.setDirty(),yo(t,e)}))},e.prototype.forget=function(){this.dispose()},e.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=eo.pop()||new Set),this.deps.add(e)},e.prototype.forgetDeps=function(){var e=this;this.deps&&(Zi(this.deps).forEach((function(t){return t.delete(e)})),this.deps.clear(),eo.push(this.deps),this.deps=null)},e.count=0,e}();function oo(e){var t=Gi.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),ao(e)?ho(t,e):fo(t,e),t}function so(e,t){e.recomputing=!0,e.value.length=0;try{e.value[0]=e.fn.apply(null,t)}catch(t){e.value[1]=t}e.recomputing=!1}function ao(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function co(e){lo(e,ho)}function uo(e){lo(e,fo)}function lo(e,t){var r=e.parents.size;if(r)for(var n=Zi(e.parents),i=0;i<r;++i)t(n[i],e)}function ho(e,t){ro(e.childValues.has(t)),ro(ao(t));var r=!ao(e);if(e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=eo.pop()||new Set;e.dirtyChildren.add(t),r&&co(e)}function fo(e,t){ro(e.childValues.has(t)),ro(!ao(t));var r,n,i,o=e.childValues.get(t);0===o.length?e.childValues.set(t,t.value.slice(0)):(r=o,n=t.value,(i=r.length)>0&&i===n.length&&r[i-1]===n[i-1]||e.setDirty()),po(e,t),ao(e)||uo(e)}function po(e,t){var r=e.dirtyChildren;r&&(r.delete(t),0===r.size&&(eo.length<to&&eo.push(r),e.dirtyChildren=null))}function mo(e){e.childValues.size>0&&e.childValues.forEach((function(t,r){yo(e,r)})),e.forgetDeps(),ro(null===e.dirtyChildren)}function yo(e,t){t.parents.delete(e),e.childValues.delete(t),po(e,t)}var vo={setDirty:!0,dispose:!0,forget:!0};function go(e){var t=new Map,r=e&&e.subscribe;function n(e){var n=Gi.getValue();if(n){var i=t.get(e);i||t.set(e,i=new Set),n.dependOn(i),"function"==typeof r&&(Xi(i),i.unsubscribe=r(e))}}return n.dirty=function(e,r){var n=t.get(e);if(n){var i=r&&Ji.call(vo,r)?r:"setDirty";Zi(n).forEach((function(e){return e[i]()})),t.delete(e),Xi(n)}},n}function bo(){var e=new oi("function"==typeof WeakMap);return function(){return e.lookupArray(arguments)}}bo();var _o=new Set;function wo(e,t){void 0===t&&(t=Object.create(null));var r=new Hi(t.max||Math.pow(2,16),(function(e){return e.dispose()})),n=t.keyArgs,i=t.makeCacheKey||bo(),o=function(){var o=i.apply(null,n?n.apply(null,arguments):arguments);if(void 0===o)return e.apply(null,arguments);var s=r.get(o);s||(r.set(o,s=new io(e)),s.subscribe=t.subscribe,s.forget=function(){return r.delete(o)});var a=s.recompute(Array.prototype.slice.call(arguments));return r.set(o,s),_o.add(r),Gi.hasValue()||(_o.forEach((function(e){return e.clean()})),_o.clear()),a};function s(e){var t=r.get(e);t&&t.setDirty()}function a(e){var t=r.get(e);if(t)return t.peek()}function c(e){return r.delete(e)}return Object.defineProperty(o,"size",{get:function(){return r.map.size},configurable:!1,enumerable:!1}),o.dirtyKey=s,o.dirty=function(){s(i.apply(null,arguments))},o.peekKey=a,o.peek=function(){return a(i.apply(null,arguments))},o.forgetKey=c,o.forget=function(){return c(i.apply(null,arguments))},o.makeCacheKey=i,o.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(o)}var Eo=new Yi,So=new WeakMap;function Oo(e){var t=So.get(e);return t||So.set(e,t={vars:new Set,dep:go()}),t}function Io(e){Oo(e).vars.forEach((function(t){return t.forgetCache(e)}))}function To(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){Oo(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=Eo.getValue();a&&(i(a),Oo(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),Oo(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}var ko=function(){function e(e){var t=e.cache,r=e.client,n=e.resolvers,i=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,r&&(this.client=r),n&&this.addResolvers(n),i&&this.setFragmentMatcher(i)}return e.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=Wn(t.resolvers,e)})):this.resolvers=Wn(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers||{}},e.prototype.runResolvers=function(e){var t=e.document,r=e.remoteResult,n=e.context,i=e.variables,o=e.onlyRunForcedResolvers,s=void 0!==o&&o;return le(this,void 0,void 0,(function(){return he(this,(function(e){return t?[2,this.resolveDocument(t,r.data,n,i,this.fragmentMatcher,s).then((function(e){return ce(ce({},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 Hr(["client"],e)&&this.resolvers?e:null},e.prototype.serverQuery=function(e){return function(e){return Or(e),yi([{test:function(e){return"client"===e.name.value},remove:!0}],e)}(e)},e.prototype.prepareContext=function(e){var t=this.cache;return ce(ce({},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={}),le(this,void 0,void 0,(function(){return he(this,(function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(r),t).then((function(e){return ce(ce({},t),e.exportedVariables)}))]:[2,ce({},t)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return Yr(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 zr}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:bi(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),le(this,void 0,void 0,(function(){var s,a,c,u,l,h,f,d,p,m;return he(this,(function(y){return s=Nr(e),a=kr(e),c=hr(a),u=this.collectSelectionsToResolve(s,c),l=s.operation,h=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",d=(f=this).cache,p=f.client,m={fragmentMap:c,context:ce(ce({},r),{cache:d,client:p}),variables:n,fragmentMatcher:i,defaultOperationType:h,exportedVariables:{},selectionsToResolve:u,onlyRunForcedResolvers:o},[2,this.resolveSelectionSet(s.selectionSet,!1,t,m).then((function(e){return{result:e,exportedVariables:m.exportedVariables}}))]}))}))},e.prototype.resolveSelectionSet=function(e,t,r,n){return le(this,void 0,void 0,(function(){var i,o,s,a,c,u=this;return he(this,(function(l){return i=n.fragmentMap,o=n.context,s=n.variables,a=[r],c=function(e){return le(u,void 0,void 0,(function(){var c,u;return he(this,(function(l){return(t||n.selectionsToResolve.has(e))&&Kr(e,s)?Sr(e)?[2,this.resolveField(e,t,r,n).then((function(t){var r;void 0!==t&&a.push(((r={})[wr(e)]=t,r))}))]:(function(e){return"InlineFragment"===e.kind}(e)?c=e:(c=i[e.name.value],__DEV__?Ot(c,"No fragment named ".concat(e.name.value)):Ot(c,11)),c&&c.typeCondition&&(u=c.typeCondition.name.value,n.fragmentMatcher(r,u,o))?[2,this.resolveSelectionSet(c.selectionSet,t,r,n).then((function(e){a.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(e.selections.map(c)).then((function(){return Kn(a)}))]}))}))},e.prototype.resolveField=function(e,t,r,n){return le(this,void 0,void 0,(function(){var i,o,s,a,c,u,l,h,f,d=this;return he(this,(function(p){return r?(i=n.variables,o=e.name.value,s=wr(e),a=o!==s,c=r[s]||r[o],u=Promise.resolve(c),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=r.__typename||n.defaultOperationType,(h=this.resolvers&&this.resolvers[l])&&(f=h[a?o:s])&&(u=Promise.resolve(Eo.withValue(this.cache,f,[r,_r(e,i),n.context,{field:e,fragmentMap:n.fragmentMap}])))),[2,u.then((function(r){var i,o;if(void 0===r&&(r=c),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)?d.resolveSubSelectedArray(e,t||s,r,n):e.selectionSet?d.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),Yr(i,{Directive:function(e,t,n,i,s){"client"===e.name.value&&s.forEach((function(e){r(e)&&qi(e)&&o.add(e)}))},FragmentSpread:function(n,i,s,a,c){var u=t[n.name.value];__DEV__?Ot(u,"No fragment named ".concat(n.name.value)):Ot(u,12);var l=e(u);l.size>0&&(c.forEach((function(e){r(e)&&qi(e)&&o.add(e)})),o.add(n),l.forEach((function(e){o.add(e)})))}})}return n.get(i)}(e)},e}(),Do=new(Zr?WeakMap:Map);function No(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return Do.set(e,(Do.get(e)+1)%1e15),r.apply(this,arguments)})}function Ao(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var xo=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.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var r=this.cache=e.cache;Do.has(r)||(Do.set(r,0),No(r,"evict"),No(r,"modify"),No(r,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||Ti.loading;return this.variables&&this.networkStatus!==Ti.loading&&!Fn(this.variables,e.variables)&&(t=Ti.setVariables),Fn(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(){Ao(this),this.dirty=!1},e.prototype.getDiff=function(e){void 0===e&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Fn(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var r=this.observableQuery;if(r&&"no-cache"===r.options.fetchPolicy)return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},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||Fn(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():$i(e)})):delete this.oqListener)},e.prototype.notify=function(){var e=this;Ao(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(Di(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,this.subscriptions.forEach((function(e){return e.unsubscribe()}));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=ce(ce({},this.getDiffOptions(e)),{watcher:this,callback:function(e){return t.setDiff(e)}});this.lastWatch&&Fn(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===Do.get(this.cache)&&Fn(t,r.variables)&&Fn(e.data,r.result.data))},e.prototype.markResult=function(e,t,r,n){var i=this,o=new Gn,s=zn(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&zn(e.incremental)){var a=Zn(this.getDiff().result,e);e.data=a}else if("hasNext"in e&&e.hasNext){var c=this.getDiff();e.data=o.merge(c.result,e.data)}this.graphQLErrors=s,"no-cache"===r.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(r.variables)):0!==n&&(Ro(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:Do.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||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=Ti.ready},e.prototype.markError=function(e){return this.networkStatus=Ti.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function Ro(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!li(e);return!n&&r&&e.data&&(n=!0),n}var Po=Object.prototype.hasOwnProperty,jo=function(){function e(e){var t=e.cache,r=e.link,n=e.defaultOptions,i=e.queryDeduplication,o=void 0!==i&&i,s=e.onBroadcast,a=e.ssrMode,c=void 0!==a&&a,u=e.clientAwareness,l=void 0===u?{}:u,h=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Zr?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=l,this.localState=h||new ko({cache:t}),this.ssrMode=c,this.assumeImmutableResults=!!f,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return e.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(__DEV__?new St("QueryManager stopped while query was in flight"):new St(14))},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,u=e.awaitRefetchQueries,l=void 0!==u&&u,h=e.update,f=e.onQueryUpdated,d=e.fetchPolicy,p=void 0===d?(null===(t=this.defaultOptions.mutate)||void 0===t?void 0:t.fetchPolicy)||"network-only":d,m=e.errorPolicy,y=void 0===m?(null===(r=this.defaultOptions.mutate)||void 0===r?void 0:r.errorPolicy)||"none":m,v=e.keepRootFields,g=e.context;return le(this,void 0,void 0,(function(){var e,t,r,a,u,d;return he(this,(function(m){switch(m.label){case 0:return __DEV__?Ot(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):Ot(n,15),__DEV__?Ot("network-only"===p||"no-cache"===p,"Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):Ot("network-only"===p||"no-cache"===p,16),e=this.generateMutationId(),t=this.transform(n),r=t.document,a=t.hasClientExports,n=this.cache.transformForLink(r),i=this.getVariables(n,i),a?[4,this.localState.addExportedVariables(n,i,g)]:[3,2];case 1:i=m.sent(),m.label=2;case 2:return u=this.mutationStore&&(this.mutationStore[e]={mutation:n,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:e,document:n,variables:i,fetchPolicy:p,errorPolicy:y,context:g,updateQueries:s,update:h,keepRootFields:v}),this.broadcastQueries(),d=this,[2,new Promise((function(t,r){return ui(d.getObservableFromLink(n,ce(ce({},g),{optimisticResponse:o}),i,!1),(function(t){if(li(t)&&"none"===y)throw new ki({graphQLErrors:hi(t)});u&&(u.loading=!1,u.error=null);var r=ce({},t);return"function"==typeof c&&(c=c(r)),"ignore"===y&&li(r)&&delete r.errors,d.markMutationResult({mutationId:e,result:r,document:n,variables:i,fetchPolicy:p,errorPolicy:y,context:g,update:h,updateQueries:s,awaitRefetchQueries:l,refetchQueries:c,removeOptimistic:o?e:void 0,onQueryUpdated:f,keepRootFields:v})})).subscribe({next:function(e){d.broadcastQueries(),"hasNext"in e&&!1!==e.hasNext||t(e)},error:function(t){u&&(u.loading=!1,u.error=t),o&&d.cache.removeOptimistic(e),d.broadcastQueries(),r(t instanceof ki?t:new ki({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&&Ro(n,e.errorPolicy)){if(Jn(n)||i.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Jn(n)&&zn(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),a=void 0;s.result&&(a=Zn(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&&Po.call(c,a)){var u=c[a],l=r.queries.get(o),h=l.document,f=l.variables,d=t.diff({query:h,variables:f,returnPartialData:!0,optimistic:!1}),p=d.result;if(d.complete&&p){var m=u(p,{mutationResult:n,queryName:h&&Tr(h)||void 0,queryVariables:f});m&&i.push({result:m,dataId:"ROOT_QUERY",query:h,variables:f})}}}))}if(i.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(t){o||i.forEach((function(e){return t.write(e)}));var s,a=e.update,c=!(Jn(s=n)||function(e){return"hasNext"in e&&"data"in e}(s))||Jn(n)&&!n.hasNext;if(a){if(!o){var u=t.diff({id:"ROOT_MUTATION",query:r.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});u.complete&&("incremental"in(n=ce(ce({},n),{data:u.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 u.push(e)})),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(u).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(ce(ce({},t),{result:{data:n}}),e)}catch(e){__DEV__&&Ot.error(e)}}),t.mutationId)},e.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).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){var t=this.transformCache;if(!t.has(e)){var r=this.cache.transformDocument(e),n=yi([gi],Or(r)),i=this.localState.clientQuery(r),o=n&&this.localState.serverQuery(n),s={document:r,hasClientExports:Gr(r),hasForcedResolvers:this.localState.shouldForceResolvers(r),clientQuery:i,serverQuery:o,defaultVars:Ar(Ir(r)),asQuery:ce(ce({},r),{definitions:r.definitions.map((function(e){return"OperationDefinition"===e.kind&&"query"!==e.operation?ce(ce({},e),{operation:"query"}):e}))})},a=function(e){e&&!t.has(e)&&t.set(e,s)};a(e),a(r),a(i),a(o)}return t.get(e)},e.prototype.getVariables=function(e,t){return ce(ce({},this.transform(e).defaultVars),t)},e.prototype.watchQuery=function(e){void 0===(e=ce(ce({},e),{variables:this.getVariables(e.query,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var t=new xo(this),r=new Ci({queryManager:this,queryInfo:t,options:e});return this.queries.set(r.queryId,t),t.init({document:r.query,observableQuery:r,variables:r.variables}),r},e.prototype.query=function(e,t){var r=this;return void 0===t&&(t=this.generateQueryId()),__DEV__?Ot(e.query,"query option is required. You must specify your GraphQL document in the query option."):Ot(e.query,17),__DEV__?Ot("Document"===e.query.kind,'You must wrap the query string in a "gql" tag.'):Ot("Document"===e.query.kind,18),__DEV__?Ot(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):Ot(!e.returnPartialData,19),__DEV__?Ot(!e.pollInterval,"pollInterval option only supported on watchQuery."):Ot(!e.pollInterval,20),this.fetchQuery(t,e).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(__DEV__?new St("Store reset while query was in flight (not completed in link chain)"):new St(21)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=Ti.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).document,!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=wi("legacyOneTimeQuery"),i=t.getQuery(n).init({document:e.query,variables:e.variables}),o=new Ci({queryManager:t,queryInfo:i,options:ce(ce({},e),{fetchPolicy:"network-only"})});Ot(o.queryId===n),i.setObservableQuery(o),r.set(n,o)})),__DEV__&&n.size&&n.forEach((function(e,t){e||__DEV__&&Ot.warn("Unknown query ".concat("string"==typeof t?"named ":"").concat(JSON.stringify(t,null,2)," requested in refetchQueries options.include array"))})),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=e.variables,s=e.context,a=void 0===s?{}:s;r=this.transform(r).document,o=this.getVariables(r,o);var c=function(e){return t.getObservableFromLink(r,a,e).map((function(o){if("no-cache"!==n&&(Ro(o,i)&&t.cache.write({query:r,result:o.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),li(o))throw new ki({graphQLErrors:o.errors});return o}))};if(this.transform(r).hasClientExports){var u=this.localState.addExportedVariables(r,o,a).then(c);return new cr((function(e){var t=null;return u.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(o)},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.transform(e).serverQuery;if(a){var c=this.inFlightLinkObservables,u=this.link,l={query:a,variables:r,operationName:Tr(a)||void 0,context:this.prepareContext(ce(ce({},t),{forceFetch:!n}))};if(t=l.context,n){var h=c.get(a)||new Map;c.set(a,h);var f=ai(r);if(!(o=h.get(f))){var d=new Ii([$r(u,l)]);h.set(f,o=d),d.beforeNext((function(){h.delete(f)&&h.size<1&&c.delete(a)}))}}else o=new Ii([$r(u,l)])}else o=new Ii([cr.of({data:{}})]),t=this.prepareContext(t);var p=this.transform(e).clientQuery;return p&&(o=ui(o,(function(e){return s.localState.runResolvers({document:p,remoteResult:e,context:t,variables:r})}))),o},e.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId(),i=this.cache.transformForLink(this.transform(e.document).document);return ui(this.getObservableFromLink(i,r.context,r.variables),(function(o){var s=hi(o),a=s.length>0;if(n>=e.lastRequestId){if(a&&"none"===r.errorPolicy)throw e.markError(new ki({graphQLErrors:s}));e.markResult(o,i,r,t),e.markReady()}var c={data:o.data,loading:!1,networkStatus:Ti.ready};return a&&"ignore"!==r.errorPolicy&&(c.errors=s,c.networkStatus=Ti.error),c}),(function(t){var r=t.hasOwnProperty("graphQLErrors")?t:new ki({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},e.prototype.fetchQueryObservable=function(e,t,r){var n=this;void 0===r&&(r=Ti.loading);var i=this.transform(t.query).document,o=this.getVariables(i,t.variables),s=this.getQuery(e),a=this.defaultOptions.watchQuery,c=t.fetchPolicy,u=void 0===c?a&&a.fetchPolicy||"cache-first":c,l=t.errorPolicy,h=void 0===l?a&&a.errorPolicy||"none":l,f=t.returnPartialData,d=void 0!==f&&f,p=t.notifyOnNetworkStatusChange,m=void 0!==p&&p,y=t.context,v=void 0===y?{}:y,g=Object.assign({},t,{query:i,variables:o,fetchPolicy:u,errorPolicy:h,returnPartialData:d,notifyOnNetworkStatusChange:m,context:v}),b=function(e){g.variables=e;var i=n.fetchQueryByPolicy(s,g,r);return"standby"!==g.fetchPolicy&&i.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),i},_=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,(function(e){_(),setTimeout((function(){return w.cancel(e)}))}));var w=new Ii(this.transform(g.query).hasClientExports?this.localState.addExportedVariables(g.query,g.variables,g.context).then(b):b(g.variables));return w.promise.then(_,_),w},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?wi("refetchQueries"):void 0:s,c=e.onQueryUpdated,u=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){u.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 xo&&e.watcher.observableQuery;if(n){if(c){u.delete(n.queryId);var i=c(n,t,r);return!0===i&&(i=n.refetch()),!1!==i&&l.set(n,i),i}null!==c&&u.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),u.size&&u.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,s=e.diff;if(c){if(!s){var a=i.queryInfo;a.reset(),s=a.getDiff()}n=c(i,s,o)}c&&!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,u=t.returnPartialData,l=t.context,h=t.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(i).document,variables:o,networkStatus:r});var d=function(){return e.getDiff(o)},p=function(t,r){void 0===r&&(r=e.networkStatus||Ti.loading);var s=t.result;!__DEV__||u||Fn(s,{})||Fi(t.missing);var a=function(e){return cr.of(ce({data:e,loading:Di(r),networkStatus:r},t.complete?null:{partial:!0}))};return s&&n.transform(i).hasForcedResolvers?n.localState.runResolvers({document:i,remoteResult:{data:s},context:l,variables:o,onlyRunForcedResolvers:!0}).then((function(e){return a(e.data||void 0)})):"none"===c&&r===Ti.refetch&&Array.isArray(t.missing)?a(void 0):a(s)},m="no-cache"===s?0:r===Ti.refetch&&"merge"!==a?1:2,y=function(){return n.getResultsFromLink(e,m,{variables:o,context:l,fetchPolicy:s,errorPolicy:c})},v=h&&"number"==typeof f&&f!==r&&Di(r);switch(s){default:case"cache-first":return(g=d()).complete?[p(g,e.markReady())]:u||v?[p(g),y()]:[y()];case"cache-and-network":var g;return(g=d()).complete||u||v?[p(g),y()]:[y()];case"cache-only":return[p(d(),e.markReady())];case"network-only":return v?[p(d()),y()]:[y()];case"no-cache":return v?[p(e.getDiff()),y()]:[y()];case"standby":return[]}},e.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new xo(this,e)),this.queries.get(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return ce(ce({},t),{clientAwareness:this.clientAwareness})},e}();function Co(e,t){return Ri(e,t,t.variables&&{variables:ce(ce({},e&&e.variables),t.variables)})}var $o=!1,Mo=function(){function e(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var r=e.uri,n=e.credentials,i=e.headers,o=e.cache,s=e.ssrMode,a=void 0!==s&&s,c=e.ssrForceFetchDelay,u=void 0===c?0:c,l=e.connectToDevTools,h=void 0===l?"object"==typeof window&&!window.__APOLLO_CLIENT__&&__DEV__:l,f=e.queryDeduplication,d=void 0===f||f,p=e.defaultOptions,m=e.assumeImmutableResults,y=void 0!==m&&m,v=e.resolvers,g=e.typeDefs,b=e.fragmentMatcher,_=e.name,w=e.version,E=e.link;if(E||(E=r?new Rn({uri:r,credentials:n,headers:i}):Cr.empty()),!o)throw __DEV__?new St("To initialize Apollo Client, you must specify a 'cache' property in the options object. \nFor more information, please visit: https://go.apollo.dev/c/docs"):new St(9);if(this.link=E,this.cache=o,this.disableNetworkFetches=a||u>0,this.queryDeduplication=d,this.defaultOptions=p||Object.create(null),this.typeDefs=g,u&&setTimeout((function(){return t.disableNetworkFetches=!1}),u),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),h&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),!$o&&h&&__DEV__&&($o=!0,"undefined"!=typeof window&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var S=window.navigator,O=S&&S.userAgent,I=void 0;"string"==typeof O&&(O.indexOf("Chrome/")>-1?I="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":O.indexOf("Firefox/")>-1&&(I="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),I&&__DEV__&&Ot.log("Download the Apollo DevTools for a better development experience: "+I)}this.version="3.7.9",this.localState=new ko({cache:o,client:this,resolvers:v,fragmentMatcher:b}),this.queryManager=new jo({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:d,ssrMode:a,clientAwareness:{name:_,version:w},localState:this.localState,assumeImmutableResults:y,onBroadcast:h?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Co(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=ce(ce({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=Co(this.defaultOptions.query,e)),__DEV__?Ot("cache-and-network"!==e.fetchPolicy,"The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):Ot("cache-and-network"!==e.fetchPolicy,10),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=ce(ce({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Co(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){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},e.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return $r(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){__DEV__&&Ot.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(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}(),Fo=function(){function e(){this.getFragmentDoc=wo(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(ce(ce({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(ce(ce({},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=ue(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=ue(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(ce(ce({},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(ce(ce({},e),{data:i})),i)}})},e}(),qo=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 c=a.path.length-1;c>=0;--c)a.missing=((s={})[a.path[c]]=a.missing,s)}else a.missing=a.path;return a.__proto__=t.prototype,a}return ae(t,e),t}(Error);function Lo(e){return __DEV__&&(t=e,(r=new Set([t])).forEach((function(e){ur(e)&&function(e){if(__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 Vo=Object.prototype.hasOwnProperty;function Qo(e){return null==e}function Uo(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=Qo(n)?Qo(i)?void 0:{_id:i}:{id:n}),Qo(n)&&!Qo(i)&&(n=i),!Qo(n)))return"".concat(r,":").concat("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))}var Bo={dataIdFromObject:Uo,addTypename:!0,resultCaching:!0,canonizeResults:!1};function zo(e){var t=e.canonizeResults;return void 0===t?Bo.canonizeResults:t}var Yo=/^[_a-z][_0-9a-z]*/i;function Wo(e){var t=e.match(Yo);return t?t[0]:e}function Ko(e,t,r){return!!ur(t)&&(Bn(t)?t.every((function(t){return Ko(e,t,r)})):e.selections.every((function(e){if(Sr(e)&&Kr(e,r)){var n=wr(e);return Vo.call(t,n)&&(!e.selectionSet||Ko(e.selectionSet,t[n],r))}return!0})))}function Ho(e){return ur(e)&&!pr(e)&&!Bn(e)}function Go(e,t){var r=hr(kr(e));return{fragmentMap:r,lookupFragment:function(e){var n=r[e];return!n&&t&&(n=t.lookup(e)),n||null}}}var Jo=Object.create(null),Zo=function(){return Jo},Xo=Object.create(null),es=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 Lo(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 dr(e);if(pr(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 ce({},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),Vo.call(this.data,e)){var r=this.data[e];if(r&&Vo.call(r,t))return r[t]}return"__typename"===t&&Vo.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof is?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),Vo.call(this.data,e)?this.data[e]:this instanceof is?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){__DEV__?Ot("string"==typeof r,"store.merge expects a string ID"):Ot("string"==typeof r,1);var s=new Gn(ss).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=Wo(e);t===e||n.policies.hasKeyArgs(s.__typename,t)||(a[t]=1),void 0!==s[e]||n instanceof is||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:Jo,INVALIDATE:Xo,isReference:pr,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 u=Wo(c),l=n[c];if(void 0!==l){var h="function"==typeof t?t:t[c]||t[u];if(h){var f=h===Zo?Jo:h(Lo(l),ce(ce({},a),{fieldName:u,storeFieldName:c,storage:r.getStorage(e,c)}));f===Xo?r.group.dirty(e,c):(f===Jo&&(f=void 0),f!==l&&(i[c]=f,o=!0,l=f))}void 0!==l&&(s=!1)}})),o)return this.merge(e,i),s&&(this instanceof is?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]=Zo,n):Zo)}return!1},e.prototype.evict=function(e,t){var r=!1;return e.id&&(Vo.call(this.data,e.id)&&(r=this.delete(e.id,e.fieldName,e.args)),this instanceof is&&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){Vo.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&&Vo.call(e,r)||t.delete(r)})),e){var r=e.__META,n=ue(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 is?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){Vo.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 is;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},e.prototype.findChildRefIds=function(e){if(!Vo.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),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}(),ts=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?go():null,this.keyMaker=new oi(Zr)},e.prototype.depend=function(e,t){if(this.d){this.d(rs(e,t));var r=Wo(t);r!==t&&this.d(rs(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(rs(e,t),"__exists"===t?"forget":"setDirty")},e}();function rs(e,t){return t+"#"+e}function ns(e,t){as(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 ts(i))||this;return s.stump=new os(s),s.storageTrie=new oi(Zr),o&&s.replace(o),s}return ae(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}(es||(es={}));var is=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 ae(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){Fn(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 ce(ce({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var r=this.parent.findChildRefIds(t);return Vo.call(this.data,t)?ce(ce({},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}(es),os=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,(function(){}),new ts(t.group.caching,t.group))||this}return ae(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},t}(is);function ss(e,t,r){var n=e[r],i=t[r];return Fn(n,i)?n:i}function as(e){return!!(e instanceof es&&e.group.caching)}function cs(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var us=function(){function e(e){var t=this;this.knownResults=new(Zr?WeakMap:Map),this.config=Ri(e,{addTypename:!1!==e.addTypename,canonizeResults:zo(e)}),this.canon=e.canon||new si,this.executeSelectionSet=wo((function(e){var r,n=e.context.canonizeResults,i=cs(e);i[3]=!n;var o=(r=t.executeSelectionSet).peek.apply(r,i);return o?n?ce(ce({},o),{result:t.canon.admit(o.result)}):o:(ns(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))}),{max:this.config.resultCacheMaxSize,keyArgs:cs,makeCacheKey:function(e,t,r,n){if(as(r.store))return r.store.makeCacheKey(e,pr(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=wo((function(e){return ns(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(as(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return e.prototype.resetCanon=function(){this.canon=new si},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,u=void 0===c?this.config.canonizeResults:c,l=this.config.cache.policies;o=ce(ce({},Ar(Dr(r))),o);var h,f=dr(i),d=this.executeSelectionSet({selectionSet:Nr(r).selectionSet,objectOrReference:f,enclosingRef:f,context:ce({store:t,query:r,policies:l,variables:o,varString:ai(o),canonizeResults:u},Go(r,this.config.fragments))});if(d.missing&&(h=[new qo(ls(d.missing),d.missing,r,o)],!a))throw h[0];return{result:d.result,complete:!h,missing:h}},e.prototype.isFresh=function(e,t,r,n){if(as(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,c=o.policies,u=o.store.getFieldValue(n,"__typename"),l=[],h=new Gn;function f(e,t){var r;return e.missing&&(s=h.merge(s,((r={})[t]=e.missing,r))),e.result}this.config.addTypename&&"string"==typeof u&&!c.rootIdsByTypename[u]&&l.push({__typename:u});var d=new Set(r.selections);d.forEach((function(e){var r,p;if(Kr(e,a))if(Sr(e)){var m=c.readField({fieldName:e.name.value,field:e,variables:o.variables,from:n},o),y=wr(e);void 0===m?vi.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))):Bn(m)?m=f(t.executeSubSelectedArray({field:e,array:m,enclosingRef:i,context:o}),y):e.selectionSet?null!=m&&(m=f(t.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:m,enclosingRef:pr(m)?m:i,context:o}),y)):o.canonizeResults&&(m=t.canon.pass(m)),void 0!==m&&l.push(((p={})[y]=m,p))}else{var v=fr(e,o.lookupFragment);if(!v&&e.kind===Ur.FRAGMENT_SPREAD)throw __DEV__?new St("No fragment named ".concat(e.name.value)):new St(5);v&&c.fragmentMatches(v,u)&&v.selectionSet.selections.forEach(d.add,d)}}));var p={result:Kn(l),missing:s},m=o.canonizeResults?this.canon.admit(p):Lo(p);return m.result&&this.knownResults.set(m.result,r),m},e.prototype.execSubSelectedArrayImpl=function(e){var t,r=this,n=e.field,i=e.array,o=e.enclosingRef,s=e.context,a=new Gn;function c(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:Bn(e)?c(r.executeSubSelectedArray({field:n,array:e,enclosingRef:o,context:s}),t):n.selectionSet?c(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:e,enclosingRef:pr(e)?e:o,context:s}),t):(__DEV__&&function(e,t,r){if(!t.selectionSet){var n=new Set([r]);n.forEach((function(r){ur(r)&&(__DEV__?Ot(!pr(r),"Missing selection set for object of type ".concat(function(e,t){return pr(t)?e.get(t.__ref,"__typename"):t&&t.__typename}(e,r)," returned for query field ").concat(t.name.value)):Ot(!pr(r),6),Object.values(r).forEach(n.add,n))}))}}(s.store,n,e),e)})),{result:s.canonizeResults?this.canon.admit(i):i,missing:t}},e}();function ls(e){try{JSON.stringify(e,(function(e,t){if("string"==typeof t)throw t;return t}))}catch(e){return e}}var hs=Object.create(null);function fs(e){var t=JSON.stringify(e);return hs[t]||(hs[t]=Object.create(null))}function ds(e){var t=fs(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,r){var n=function(e,t){return r.readField(t,e)},i=r.keyObject=ms(e,(function(e){var i=gs(r.storeObject,e,n);return void 0===i&&t!==r.storeObject&&Vo.call(t,e[0])&&(i=gs(t,e,vs)),__DEV__?Ot(void 0!==i,"Missing field '".concat(e.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):Ot(void 0!==i,2),i}));return"".concat(r.typename,":").concat(JSON.stringify(i))})}function ps(e){var t=fs(e);return t.keyArgsFn||(t.keyArgsFn=function(t,r){var n=r.field,i=r.variables,o=r.fieldName,s=ms(e,(function(e){var r=e[0],o=r.charAt(0);if("@"!==o)if("$"!==o){if(t)return gs(t,e)}else{var s=r.slice(1);if(i&&Vo.call(i,s)){var a=e.slice(0);return a[0]=s,gs(i,a)}}else if(n&&zn(n.directives)){var c=r.slice(1),u=n.directives.find((function(e){return e.name.value===c})),l=u&&_r(u,i);return l&&gs(l,e.slice(1))}})),a=JSON.stringify(s);return(t||"{}"!==a)&&(o+=":"+a),o})}function ms(e,t){var r=new Gn;return ys(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 ys(e){var t=fs(e);if(!t.paths){var r=t.paths=[],n=[];e.forEach((function(t,i){Bn(t)?(ys(t).forEach((function(e){return r.push(n.concat(e))})),n.length=0):(n.push(t),Bn(e[i+1])||(r.push(n.slice(0)),n.length=0))}))}return t.paths}function vs(e,t){return e[t]}function gs(e,t,r){return r=r||vs,bs(t.reduce((function e(t,n){return Bn(t)?t.map((function(t){return e(t,n)})):t&&r(t,n)}),e))}function bs(e){return ur(e)?Bn(e)?e.map(bs):ms(Object.keys(e).sort(),(function(t){return gs(e,t)})):e}function _s(e){return void 0!==e.args?e.args:e.field?_r(e.field,e.variables):null}vr.setStringify(ai);var ws=function(){},Es=function(e,t){return t.fieldName},Ss=function(e,t,r){return(0,r.mergeObjects)(e,t)},Os=function(e,t){return t},Is=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=ce({dataIdFromObject:Uo},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=ce(ce({},t),{typename:i,storeObject:s,readField:t&&t.readField||function(){var e=ks(arguments,s);return n.readField(e,{store:n.cache.data,variables:e.variables})}}),c=i&&this.getTypePolicy(i),u=c&&c.keyFn||this.config.dataIdFromObject;u;){var l=u(e,a);if(!Bn(l)){o=l;break}u=ds(l)}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=ue(n,["queryType","mutationType","subscriptionType"]);i&&t.setRootTypename("Query",r),o&&t.setRootTypename("Mutation",r),s&&t.setRootTypename("Subscription",r),Vo.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?Ss:!1===t?Os:e.merge}s(n,t.merge),n.keyFn=!1===i?ws:Bn(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,c=i.read,u=i.merge;n.keyFn=!1===a?Es:Bn(a)?ps(a):"function"==typeof a?a:n.keyFn,"function"==typeof c&&(n.read=c),s(n,u)}n.read&&n.merge&&(n.keyFn=n.keyFn||Es)}))},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var r="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[r];t!==n&&(__DEV__?Ot(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):Ot(!n||n===e,3),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(Yo);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},e.prototype.getTypePolicy=function(e){var t=this;if(!Vo.call(this.typePolicies,e)){var r=this.typePolicies[e]=Object.create(null);r.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach((function(e){var n=t.getTypePolicy(e),i=n.fields,o=ue(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],c=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&a.indexOf(t)<0&&a.push(t)},u=!(!r||!this.fuzzySubtypes.size),l=!1,h=0;h<a.length;++h){var f=a[h];if(f.has(o))return s.has(o)||(l&&__DEV__&&Ot.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;f.forEach(c),u&&h===a.length-1&&Ko(e.selectionSet,r,n)&&(u=!1,l=!0,this.fuzzySubtypes.forEach((function(e,r){var n=t.match(e);n&&n[0]===t&&c(r)})))}return!1},e.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},e.prototype.getStoreFieldName=function(e){var t,r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},a=_s(e);o;){var c=o(a,s);if(!Bn(c)){t=c||n;break}o=ps(c)}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 mr(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 mr(n,r,i,t)}))),vr(e.name.value,n,r)}(e.field,e.variables):vr(n,_s(e))),!1===t?n:n===Wo(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=Wo(i),s=t.store.getFieldValue(r,i),a=this.getFieldPolicy(e.typename,o,!1),c=a&&a.read;if(c){var u=Ts(this,r,e,t,t.store.getStorage(pr(r)?r.__ref:r,i));return Eo.withValue(this.cache,c,[s,u])}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===Ss?Ds(n.store)(e,t):a===Os?t:(n.overwrite&&(e=void 0),a(e,t,Ts(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},e}();function Ts(e,t,r,n,i){var o=e.getStoreFieldName(r),s=Wo(o),a=r.variables||n.variables,c=n.store,u=c.toReference,l=c.canRead;return{args:_s(r),field:r.field||null,fieldName:s,storeFieldName:o,variables:a,isReference:pr,toReference:u,storage:i,cache:e.cache,canRead:l,readField:function(){return e.readField(ks(arguments,t,a),n)},mergeObjects:Ds(n.store)}}function ks(e,t,r){var n,i,o,s=e[0],a=e[1],c=e.length;return"string"==typeof s?n={fieldName:s,from:c>1?a:t}:(n=ce({},s),Vo.call(n,"from")||(n.from=t)),__DEV__&&void 0===n.from&&__DEV__&&Ot.warn("Undefined 'from' passed to readField with arguments ".concat((i=Array.from(e),o=wi("stringifyForDisplay"),JSON.stringify(i,(function(e,t){return void 0===t?o:t})).split(JSON.stringify(o)).join("<undefined>")))),void 0===n.variables&&(n.variables=r),n}function Ds(e){return function(t,r){if(Bn(t)||Bn(r))throw __DEV__?new St("Cannot automatically merge arrays"):new St(4);if(ur(t)&&ur(r)){var n=e.getFieldValue(t,"__typename"),i=e.getFieldValue(r,"__typename");if(n&&i&&n!==i)return r;if(pr(t)&&Ho(r))return e.merge(t.__ref,r),t;if(Ho(t)&&pr(r))return e.merge(t,r.__ref),r;if(Ho(t)&&Ho(r))return ce(ce({},t),r)}return r}}function Ns(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:ce(ce({},e),{clientOnly:t,deferred:r})),i}var As=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=Ir(n),u=new Gn;s=ce(ce({},Ar(c)),s);var l=ce(ce({store:e,written:Object.create(null),merge:function(e,t){return u.merge(e,t)},variables:s,varString:ai(s)},Go(n,this.fragments)),{overwrite:!!a,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),h=this.processSelectionSet({result:i||Object.create(null),dataId:o,selectionSet:c.selectionSet,mergeTree:{map:new Map},context:l});if(!pr(h))throw __DEV__?new St("Could not identify object ".concat(JSON.stringify(i))):new St(7);return l.incomingById.forEach((function(t,n){var i=t.storeObject,o=t.mergeTree,s=t.fieldNodeSet,a=dr(n);if(o&&o.map.size){var c=r.applyMerges(o,a,i,l);if(pr(c))return;i=c}if(__DEV__&&!l.overwrite){var u=Object.create(null);s.forEach((function(e){e.selectionSet&&(u[e.name.value]=!0)})),Object.keys(i).forEach((function(e){(function(e){return!0===u[Wo(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)&&!Fn(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"),c=Wo(r),u="".concat(a,".").concat(c);if(!$s.has(u)){$s.add(u);var l=[];Bn(o)||Bn(s)||[o,s].forEach((function(e){var t=n.getFieldValue(e,"__typename");"string"!=typeof t||l.includes(t)||l.push(t)})),__DEV__&&Ot.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(a," object.\n\nTo address this problem (which is not a bug in Apollo Client), ").concat(l.length?"either ensure all objects of type "+l.join(" and ")+" have an ID or a custom merge function, or ":"","define a custom merge function for the ").concat(u," field, so InMemoryCache can safely merge these objects:\n\n existing: ").concat(JSON.stringify(o).slice(0,1e3),"\n incoming: ").concat(JSON.stringify(s).slice(0,1e3),"\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"))}}}}(a,i,e,l.store)}))}e.merge(n,i)})),e.retain(h.__ref),h},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),u=r&&a.rootTypenamesById[r]||Er(n,i,o.fragmentMap)||r&&o.store.get(r,"__typename");"string"==typeof u&&(c.__typename=u);var l=function(){var e=ks(arguments,c,o.variables);if(pr(e.from)){var t=o.incomingById.get(e.from.__ref);if(t){var r=a.readField(ce(ce({},e),{from:t.storeObject}),o);if(void 0!==r)return r}}return a.readField(e,o)},h=new Set;this.flattenFields(i,n,o,u).forEach((function(e,r){var i,o=wr(r),f=n[o];if(h.add(r),void 0!==f){var d=a.getStoreFieldName({typename:u,fieldName:r.name.value,field:r,variables:e.variables}),p=Rs(s,d),m=t.processFieldValue(f,r,r.selectionSet?Ns(e,!1,!1):e,p),y=void 0;r.selectionSet&&(pr(m)||Ho(m))&&(y=l("__typename",m));var v=a.getMergeFunction(u,r.name.value,y);v?p.info={field:r,typename:u,merge:v}:Cs(s,d),c=e.merge(c,((i={})[d]=m,i))}else!__DEV__||e.clientOnly||e.deferred||vi.added(r)||a.getReadFunction(u,r.name.value)||__DEV__&&Ot.error("Missing field '".concat(wr(r),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))}));try{var f=a.identify(n,{typename:u,selectionSet:i,fragmentMap:o.fragmentMap,storeObject:c,readField:l}),d=f[0],p=f[1];r=r||d,p&&(c=o.merge(c,p))}catch(e){if(!r)throw e}if("string"==typeof r){var m=dr(r),y=o.written[r]||(o.written[r]=[]);if(y.indexOf(i)>=0)return m;if(y.push(i),this.reader&&this.reader.isFresh(n,m,i,o))return m;var v=o.incomingById.get(r);return v?(v.storeObject=o.merge(v.storeObject,c),v.mergeTree=Ps(v.mergeTree,s),h.forEach((function(e){return v.fieldNodeSet.add(e)}))):o.incomingById.set(r,{storeObject:c,mergeTree:js(s)?void 0:s,fieldNodeSet:h}),m}return c},e.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?Bn(e)?e.map((function(e,o){var s=i.processFieldValue(e,t,r,Rs(n,o));return Cs(n,o),s})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):__DEV__?Ai(e):e},e.prototype.flattenFields=function(e,t,r,n){void 0===n&&(n=Er(t,e,r.fragmentMap));var i=new Map,o=this.cache.policies,s=new oi(!1);return function e(a,c){var u=s.lookup(a,c.clientOnly,c.deferred);u.visited||(u.visited=!0,a.selections.forEach((function(s){if(Kr(s,r.variables)){var a=c.clientOnly,u=c.deferred;if(a&&u||!zn(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||(u=!0)}})),Sr(s)){var l=i.get(s);l&&(a=a&&l.clientOnly,u=u&&l.deferred),i.set(s,Ns(r,a,u))}else{var h=fr(s,r.lookupFragment);if(!h&&s.kind===Ur.FRAGMENT_SPREAD)throw __DEV__?new St("No fragment named ".concat(s.name.value)):new St(8);h&&o.fragmentMatches(h,n,t,r.variables)&&e(h.selectionSet,Ns(r,a,u))}}})))}(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=Bn(r)||!pr(t)&&!Ho(t)?void 0:t,u=r;c&&!i&&(i=[pr(c)?c.__ref:c]);var l=function(e,t){return Bn(e)?"number"==typeof t?e[t]:void 0:n.store.getFieldValue(e,String(t))};e.map.forEach((function(e,t){var r=l(c,t),o=l(u,t);if(void 0!==o){i&&i.push(t);var h=s.applyMerges(e,r,o,n,i);h!==o&&(a=a||new Map).set(t,h),i&&Ot(i.pop()===t)}})),a&&(r=Bn(u)?u.slice(0):ce({},u),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}(),xs=[];function Rs(e,t){var r=e.map;return r.has(t)||r.set(t,xs.pop()||{map:new Map}),r.get(t)}function Ps(e,t){if(e===t||!t||js(t))return e;if(!e||js(e))return t;var r=e.info&&t.info?ce(ce({},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,Ps(e,t.map.get(r))),o.delete(r)})),o.forEach((function(r){i.map.set(r,Ps(t.map.get(r),e.map.get(r)))}))}return i}function js(e){return!e||!(e.info||e.map.size)}function Cs(e,t){var r=e.map,n=r.get(t);n&&js(n)&&(xs.push(n),r.delete(t))}var $s=new Set,Ms=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.watches=new Set,r.typenameDocumentCache=new Map,r.makeVar=To,r.txCount=0,r.config=function(e){return Ri(Bo,e)}(t),r.addTypename=!!r.config.addTypename,r.policies=new Is({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return ae(t,e),t.prototype.init=function(){var e=this.data=new es.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 As(this,this.storeReader=new us({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:zo(this.config),canon:e?void 0:r&&r.canon,fragments:n}),n),this.maybeBroadcastWatch=wo((function(e,r){return t.broadcastWatch(e,r)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var r=e.optimistic?t.optimisticData:t.data;if(as(r)){var n=e.optimistic,i=e.id,o=e.variables;return r.makeCacheKey(e.query,e.callback,ai({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(ce(ce({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:r})).result||null}catch(e){if(e instanceof qo)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(Vo.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(ce(ce({},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||Oo(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&&Io(r),r.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){ai.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){__DEV__&&Ot.warn(e)}},t.prototype.evict=function(e){if(!e.id){if(Vo.call(e,"id"))return!1;e=ce(ce({},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(),ai.reset(),e&&e.discardWatches?(this.watches.forEach((function(e){return t.maybeBroadcastWatch.forget(e)})),this.watches.clear(),Io(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}},u=new Set;return a&&!this.txCount&&this.broadcastWatches(ce(ce({},e),{onWatchUpdated:function(e){return u.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&&u.size?(this.broadcastWatches(ce(ce({},e),{onWatchUpdated:function(e,t){var r=a.call(this,e,t);return!1!==r&&u.delete(e),r}})),u.size&&u.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){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=vi(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},t.prototype.transformForLink=function(e){var t=this.config.fragments;return t?t.transform(e):e},t.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,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&&Fn(r.result,n.result)||e.callback(e.lastDiff=n,r)},t}(Fo);function Fs(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const qs=/\r\n|[\n\r]/g;function Ls(e,t){let r=0,n=1;for(const i of e.body.matchAll(qs)){if("number"==typeof i.index||Fs(!1),i.index>=t)break;r=i.index+i[0].length,n+=1}return{line:n,column:t+1-r}}function Vs(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,c=t.column+a,u=`${e.name}:${s}:${c}\n`,l=n.split(/\r\n|[\n\r]/g),h=l[i];if(h.length>120){const e=Math.floor(c/80),t=c%80,r=[];for(let e=0;e<h.length;e+=80)r.push(h.slice(e,e+80));return u+Qs([[`${s} |`,r[0]],...r.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",r[e+1]]])}return u+Qs([[s-1+" |",l[i-1]],[`${s} |`,h],["|","^".padStart(c)],[`${s+1} |`,l[i+1]]])}function Qs(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 Us extends Error{constructor(e,...t){var r,n,i;const{nodes:o,source:s,positions:a,path:c,originalError:u,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!=c?c:void 0,this.originalError=null!=u?u:void 0,this.nodes=Bs(Array.isArray(o)?o:o?[o]:void 0);const h=Bs(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=>Ls(s,e))):null==h?void 0:h.map((e=>Ls(e.source,e.start)));const f="object"==typeof(d=null==u?void 0:u.extensions)&&null!==d?null==u?void 0:u.extensions:void 0;var d;this.extensions=null!==(i=null!=l?l:f)&&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!=u&&u.stack?Object.defineProperty(this,"stack",{value:u.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Us):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"+Vs((t=r.loc).source,Ls(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+Vs(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 Bs(e){return void 0===e||0===e.length?void 0:e}function zs(e,t,r){return new Us(`Syntax Error: ${r}`,{source:e,positions:[t]})}var Ys,Ws,Ks;!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"}(Ys||(Ys={})),(Ks=Ws||(Ws={})).SOF="<SOF>",Ks.EOF="<EOF>",Ks.BANG="!",Ks.DOLLAR="$",Ks.AMP="&",Ks.PAREN_L="(",Ks.PAREN_R=")",Ks.SPREAD="...",Ks.COLON=":",Ks.EQUALS="=",Ks.AT="@",Ks.BRACKET_L="[",Ks.BRACKET_R="]",Ks.BRACE_L="{",Ks.PIPE="|",Ks.BRACE_R="}",Ks.NAME="Name",Ks.INT="Int",Ks.FLOAT="Float",Ks.STRING="String",Ks.BLOCK_STRING="BlockString",Ks.COMMENT="Comment";class Hs{constructor(e){const t=new Fr(Ws.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!==Ws.EOF)do{if(e.next)e=e.next;else{const t=ra(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===Ws.COMMENT);return e}}function Gs(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Js(e,t){return Zs(e.charCodeAt(t))&&Xs(e.charCodeAt(t+1))}function Zs(e){return e>=55296&&e<=56319}function Xs(e){return e>=56320&&e<=57343}function ea(e,t){const r=e.source.body.codePointAt(t);if(void 0===r)return Ws.EOF;if(r>=32&&r<=126){const e=String.fromCodePoint(r);return'"'===e?"'\"'":`"${e}"`}return"U+"+r.toString(16).toUpperCase().padStart(4,"0")}function ta(e,t,r,n,i){const o=e.line,s=1+r-e.lineStart;return new Fr(t,r,n,o,s,i)}function ra(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 na(e,i);case 33:return ta(e,Ws.BANG,i,i+1);case 36:return ta(e,Ws.DOLLAR,i,i+1);case 38:return ta(e,Ws.AMP,i,i+1);case 40:return ta(e,Ws.PAREN_L,i,i+1);case 41:return ta(e,Ws.PAREN_R,i,i+1);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return ta(e,Ws.SPREAD,i,i+3);break;case 58:return ta(e,Ws.COLON,i,i+1);case 61:return ta(e,Ws.EQUALS,i,i+1);case 64:return ta(e,Ws.AT,i,i+1);case 91:return ta(e,Ws.BRACKET_L,i,i+1);case 93:return ta(e,Ws.BRACKET_R,i,i+1);case 123:return ta(e,Ws.BRACE_L,i,i+1);case 124:return ta(e,Ws.PIPE,i,i+1);case 125:return ta(e,Ws.BRACE_R,i,i+1);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?fa(e,i):sa(e,i)}if(hn(t)||45===t)return ia(e,i,t);if(dn(t))return da(e,i);throw zs(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":Gs(t)||Js(r,i)?`Unexpected character: ${ea(e,i)}.`:`Invalid character: ${ea(e,i)}.`)}return ta(e,Ws.EOF,n,n)}function na(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(Gs(e))++i;else{if(!Js(r,i))break;i+=2}}return ta(e,Ws.COMMENT,t,i,r.slice(t+1,i))}function ia(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),hn(o))throw zs(e.source,i,`Invalid number, unexpected digit after 0: ${ea(e,i)}.`)}else i=oa(e,i,o),o=n.charCodeAt(i);if(46===o&&(s=!0,o=n.charCodeAt(++i),i=oa(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=oa(e,i,o),o=n.charCodeAt(i)),46===o||dn(o))throw zs(e.source,i,`Invalid number, expected digit but got: ${ea(e,i)}.`);return ta(e,s?Ws.FLOAT:Ws.INT,t,i,n.slice(t,i))}function oa(e,t,r){if(!hn(r))throw zs(e.source,t,`Invalid number, expected digit but got: ${ea(e,t)}.`);const n=e.source.body;let i=t+1;for(;hn(n.charCodeAt(i));)++i;return i}function sa(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),ta(e,Ws.STRING,t,i+1,s);if(92!==n){if(10===n||13===n)break;if(Gs(n))++i;else{if(!Js(r,i))throw zs(e.source,i,`Invalid character within String: ${ea(e,i)}.`);i+=2}}else{s+=r.slice(o,i);const t=117===r.charCodeAt(i+1)?123===r.charCodeAt(i+2)?aa(e,i):ca(e,i):ha(e,i);s+=t.value,i+=t.size,o=i}}throw zs(e.source,i,"Unterminated string.")}function aa(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||!Gs(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|la(e),n<0)break}throw zs(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+i)}".`)}function ca(e,t){const r=e.source.body,n=ua(r,t+2);if(Gs(n))return{value:String.fromCodePoint(n),size:6};if(Zs(n)&&92===r.charCodeAt(t+6)&&117===r.charCodeAt(t+7)){const e=ua(r,t+8);if(Xs(e))return{value:String.fromCodePoint(n,e),size:12}}throw zs(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+6)}".`)}function ua(e,t){return la(e.charCodeAt(t))<<12|la(e.charCodeAt(t+1))<<8|la(e.charCodeAt(t+2))<<4|la(e.charCodeAt(t+3))}function la(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function ha(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 zs(e.source,t,`Invalid character escape sequence: "${r.slice(t,t+2)}".`)}function fa(e,t){const r=e.source.body,n=r.length;let i=e.lineStart,o=t+3,s=o,a="";const c=[];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),c.push(a);const n=ta(e,Ws.BLOCK_STRING,t,o+3,pn(c).join("\n"));return e.line+=c.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(Gs(n))++o;else{if(!Js(r,o))throw zs(e.source,o,`Invalid character within String: ${ea(e,o)}.`);o+=2}else a+=r.slice(s,o),c.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 zs(e.source,o,"Unterminated string.")}function da(e,t){const r=e.source.body,n=r.length;let i=t+1;for(;i<n&&(fn(o=r.charCodeAt(i))||hn(o)||95===o);)++i;var o;return ta(e,Ws.NAME,t,i,r.slice(t,i))}class pa{constructor(e,t={}){const r=function(e){return e instanceof Vt}(e)?e:new Vt(e);this._lexer=new Hs(r),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(Ws.NAME);return this.node(e,{kind:Ur.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Ur.DOCUMENT,definitions:this.many(Ws.SOF,this.parseDefinition,Ws.EOF)})}parseDefinition(){if(this.peek(Ws.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===Ws.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 zs(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(Ws.BRACE_L))return this.node(e,{kind:Ur.OPERATION_DEFINITION,operation:Qr.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let r;return this.peek(Ws.NAME)&&(r=this.parseName()),this.node(e,{kind:Ur.OPERATION_DEFINITION,operation:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Ws.NAME);switch(e.value){case"query":return Qr.QUERY;case"mutation":return Qr.MUTATION;case"subscription":return Qr.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Ws.PAREN_L,this.parseVariableDefinition,Ws.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Ur.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Ws.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Ws.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Ws.DOLLAR),this.node(e,{kind:Ur.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Ur.SELECTION_SET,selections:this.many(Ws.BRACE_L,this.parseSelection,Ws.BRACE_R)})}parseSelection(){return this.peek(Ws.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let r,n;return this.expectOptionalToken(Ws.COLON)?(r=t,n=this.parseName()):n=t,this.node(e,{kind:Ur.FIELD,alias:r,name:n,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Ws.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Ws.PAREN_L,t,Ws.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,r=this.parseName();return this.expectToken(Ws.COLON),this.node(t,{kind:Ur.ARGUMENT,name:r,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Ws.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(Ws.NAME)?this.node(e,{kind:Ur.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Ur.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:Ur.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:Ur.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 Ws.BRACKET_L:return this.parseList(e);case Ws.BRACE_L:return this.parseObject(e);case Ws.INT:return this.advanceLexer(),this.node(t,{kind:Ur.INT,value:t.value});case Ws.FLOAT:return this.advanceLexer(),this.node(t,{kind:Ur.FLOAT,value:t.value});case Ws.STRING:case Ws.BLOCK_STRING:return this.parseStringLiteral();case Ws.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Ur.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Ur.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Ur.NULL});default:return this.node(t,{kind:Ur.ENUM,value:t.value})}case Ws.DOLLAR:if(e){if(this.expectToken(Ws.DOLLAR),this._lexer.token.kind===Ws.NAME){const e=this._lexer.token.value;throw zs(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:Ur.STRING,value:e.value,block:e.kind===Ws.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:Ur.LIST,values:this.any(Ws.BRACKET_L,(()=>this.parseValueLiteral(e)),Ws.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:Ur.OBJECT,fields:this.any(Ws.BRACE_L,(()=>this.parseObjectField(e)),Ws.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,r=this.parseName();return this.expectToken(Ws.COLON),this.node(t,{kind:Ur.OBJECT_FIELD,name:r,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(Ws.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(Ws.AT),this.node(t,{kind:Ur.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(Ws.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(Ws.BRACKET_R),t=this.node(e,{kind:Ur.LIST_TYPE,type:r})}else t=this.parseNamedType();return this.expectOptionalToken(Ws.BANG)?this.node(e,{kind:Ur.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Ur.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Ws.STRING)||this.peek(Ws.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(Ws.BRACE_L,this.parseOperationTypeDefinition,Ws.BRACE_R);return this.node(e,{kind:Ur.SCHEMA_DEFINITION,description:t,directives:r,operationTypes:n})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(Ws.COLON);const r=this.parseNamedType();return this.node(e,{kind:Ur.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:Ur.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:Ur.OBJECT_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:i,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Ws.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Ws.BRACE_L,this.parseFieldDefinition,Ws.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName(),n=this.parseArgumentDefs();this.expectToken(Ws.COLON);const i=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:Ur.FIELD_DEFINITION,description:t,name:r,arguments:n,type:i,directives:o})}parseArgumentDefs(){return this.optionalMany(Ws.PAREN_L,this.parseInputValueDef,Ws.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName();this.expectToken(Ws.COLON);const n=this.parseTypeReference();let i;this.expectOptionalToken(Ws.EQUALS)&&(i=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:Ur.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:Ur.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:Ur.UNION_TYPE_DEFINITION,description:t,name:r,directives:n,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(Ws.EQUALS)?this.delimitedMany(Ws.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:Ur.ENUM_TYPE_DEFINITION,description:t,name:r,directives:n,values:i})}parseEnumValuesDefinition(){return this.optionalMany(Ws.BRACE_L,this.parseEnumValueDefinition,Ws.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseEnumValueName(),n=this.parseConstDirectives();return this.node(e,{kind:Ur.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 zs(this._lexer.source,this._lexer.token.start,`${ma(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:Ur.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:r,directives:n,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(Ws.BRACE_L,this.parseInputValueDef,Ws.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Ws.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(Ws.BRACE_L,this.parseOperationTypeDefinition,Ws.BRACE_R);if(0===t.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:Ur.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:Ur.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:Ur.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:Ur.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:Ur.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:Ur.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:Ur.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:r,fields:n})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Ws.AT);const r=this.parseName(),n=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:Ur.DIRECTIVE_DEFINITION,description:t,name:r,arguments:n,repeatable:i,locations:o})}parseDirectiveLocations(){return this.delimitedMany(Ws.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(Ys,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new Mr(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 zs(this._lexer.source,t.start,`Expected ${ya(e)}, found ${ma(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==Ws.NAME||t.value!==e)throw zs(this._lexer.source,t.start,`Expected "${e}", found ${ma(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===Ws.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return zs(this._lexer.source,t.start,`Unexpected ${ma(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!==Ws.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw zs(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function ma(e){const t=e.value;return ya(e.kind)+(null!=t?` "${t}"`:"")}function ya(e){return function(e){return e===Ws.BANG||e===Ws.DOLLAR||e===Ws.AMP||e===Ws.PAREN_L||e===Ws.PAREN_R||e===Ws.SPREAD||e===Ws.COLON||e===Ws.EQUALS||e===Ws.AT||e===Ws.BRACKET_L||e===Ws.BRACKET_R||e===Ws.BRACE_L||e===Ws.PIPE||e===Ws.BRACE_R}(e)?`"${e}"`:e}var va=new Map,ga=new Map,ba=!0,_a=!1;function wa(e){return e.replace(/[\s,]+/g," ").trim()}function Ea(e){var t,r,n,i=wa(e);if(!va.has(i)){var o=function(e,t){return new pa(e,t).parseDocument()}(e,{experimentalFragmentVariables:_a,allowLegacyFragmentVariables:_a});if(!o||"Document"!==o.kind)throw new Error("Not a valid GraphQL document.");va.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=wa((s=e.loc).source.body.substring(s.start,s.end)),o=ga.get(t);o&&!o.has(i)?ba&&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||ga.set(t,o=new Set),o.add(i),r.has(i)||(r.add(i),n.push(e))}else n.push(e);var s})),ce(ce({},t),{definitions:n}))))}return va.get(i)}function Sa(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]})),Ea(n)}var Oa,Ia=Sa;(Oa=Sa||(Sa={})).gql=Ia,Oa.resetCaches=function(){va.clear(),ga.clear()},Oa.disableFragmentWarnings=function(){ba=!1},Oa.enableExperimentalFragmentVariables=function(){_a=!0},Oa.disableExperimentalFragmentVariables=function(){_a=!1},Sa.default=Sa;const Ta=require("cross-fetch");var ka,Da,Na=r.n(Ta);class Aa{constructor(e,t,r,n){this.rpcManager=e,this.region=r,this.appId=n;const i=X(this.region,this.appId,`${t}/graphql`);this.client=new Mo({link:new Rn({uri:i,headers:this.rpcManager.getStaticHeaders(),fetch:Na()}),cache:new Ms})}async query(e){return(await this.client.query({query:Sa`
|
|
8
|
+
deps: ${r}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e)"__proto__"!==n&&((Array.isArray(e[n])?t:r)[n]=e[n]);return[t,r]}(e);a(e,t),c(e,r)}};function a(e,t=e.schema){const{gen:r,data:i,it:s}=e;if(0===Object.keys(t).length)return;const a=r.let("missing");for(const c in t){const u=t[c];if(0===u.length)continue;const l=(0,o.propertyInData)(r,i,c,s.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")}),s.allErrors?r.if(l,(()=>{for(const t of u)(0,o.checkReportMissingProp)(e,t)})):(r.if(n._`${l} && (${(0,o.checkMissingProp)(e,u,a)})`),(0,o.reportMissingProp)(e,a),r.else())}}function c(e,t=e.schema){const{gen:r,data:n,keyword:s,it:a}=e,c=r.name("valid");for(const u in t)(0,i.alwaysValidSchema)(a,t[u])||(r.if((0,o.propertyInData)(r,n,u,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:s,schemaProp:u},c);e.mergeValidEvaluated(t,c)}),(()=>r.var(c,!0))),e.ok(c))}t.validatePropertyDeps=a,t.validateSchemaDeps=c,t.default=s},76:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>n.str`must match "${e.ifClause}" schema`,params:({params:e})=>n._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:r,it:o}=e;void 0===r.then&&void 0===r.else&&(0,i.checkStrictMode)(o,'"if" without "then" and "else" is ignored');const a=s(o,"then"),c=s(o,"else");if(!a&&!c)return;const u=t.let("valid",!0),l=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(t)}(),e.reset(),a&&c){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(l,h("then",r),h("else",r))}else a?t.if(l,h("then")):t.if((0,n.not)(l),h("else"));function h(r,i){return()=>{const o=e.subschema({keyword:r},l);t.assign(u,l),e.mergeValidEvaluated(o,u),i?t.assign(i,n._`${r}`):e.setParams({ifClause:r})}}e.pass(u,(()=>e.error(!0)))}};function s(e,t){const r=e.schema[t];return void 0!==r&&!(0,i.alwaysValidSchema)(e,r)}t.default=o},6951:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8891),i=r(1162),o=r(8634),s=r(5151),a=r(5609),c=r(5463),u=r(3021),l=r(4943),h=r(4243),f=r(8103),d=r(2869),p=r(4279),m=r(4880),y=r(2609),v=r(76),g=r(5316);t.default=function(e=!1){const t=[d.default,p.default,m.default,y.default,v.default,g.default,u.default,l.default,c.default,h.default,f.default];return e?t.push(i.default,s.default):t.push(n.default,o.default),t.push(a.default),t}},8634:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const n=r(5669),i=r(8936),o=r(3499),s={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return a(e,"additionalItems",t);r.items=!0,(0,i.alwaysValidSchema)(r,t)||e.ok((0,o.validateArray)(e))}};function a(e,t,r=e.schema){const{gen:o,parentSchema:s,data:a,keyword:c,it:u}=e;!function(e){const{opts:n,errSchemaPath:o}=u,s=r.length,a=s===e.minItems&&(s===e.maxItems||!1===e[t]);if(n.strictTuples&&!a){const e=`"${c}" is ${s}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,i.checkStrictMode)(u,e,n.strictTuples)}}(s),u.opts.unevaluated&&r.length&&!0!==u.items&&(u.items=i.mergeEvaluated.items(o,r.length,u.items));const l=o.name("valid"),h=o.const("len",n._`${a}.length`);r.forEach(((t,r)=>{(0,i.alwaysValidSchema)(u,t)||(o.if(n._`${h} > ${r}`,(()=>e.subschema({keyword:c,schemaProp:r,dataProp:r},l))),e.ok(l))}))}t.validateTuple=a,t.default=s},5151:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o=r(3499),s=r(8891),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:a}=r;n.items=!0,(0,i.alwaysValidSchema)(n,t)||(a?(0,s.validateAdditionalItems)(e,a):e.ok((0,o.validateArray)(e)))}};t.default=a},2869:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8936),i={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:i}=e;if((0,n.alwaysValidSchema)(i,r))return void e.fail();const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=i},4880:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>n._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:r,parentSchema:o,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&o.discriminator)return;const a=r,c=t.let("valid",!1),u=t.let("passing",null),l=t.name("_valid");e.setParams({passing:u}),t.block((function(){a.forEach(((r,o)=>{let a;(0,i.alwaysValidSchema)(s,r)?t.var(l,!0):a=e.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},l),o>0&&t.if(n._`${l} && ${c}`).assign(c,!1).assign(u,n._`[${u}, ${o}]`).else(),t.if(l,(()=>{t.assign(c,!0),t.assign(u,o),a&&e.mergeEvaluated(a,n.Name)}))}))})),e.result(c,(()=>e.reset()),(()=>e.error(!0)))}};t.default=o},8103:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3499),i=r(5669),o=r(8936),s=r(8936),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:a,parentSchema:c,it:u}=e,{opts:l}=u,h=(0,n.allSchemaProperties)(r),f=h.filter((e=>(0,o.alwaysValidSchema)(u,r[e])));if(0===h.length||f.length===h.length&&(!u.opts.unevaluated||!0===u.props))return;const d=l.strictSchema&&!l.allowMatchingProperties&&c.properties,p=t.name("valid");!0===u.props||u.props instanceof i.Name||(u.props=(0,s.evaluatedPropsToName)(t,u.props));const{props:m}=u;function y(e){for(const t in d)new RegExp(e).test(t)&&(0,o.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){t.forIn("key",a,(o=>{t.if(i._`${(0,n.usePattern)(e,r)}.test(${o})`,(()=>{const n=f.includes(r);n||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:o,dataPropType:s.Type.Str},p),u.opts.unevaluated&&!0!==m?t.assign(i._`${m}[${o}]`,!0):n||u.allErrors||t.if((0,i.not)(p),(()=>t.break()))}))}))}!function(){for(const e of h)d&&y(e),u.allErrors?v(e):(t.var(p,!0),v(e),t.if(p))}()}};t.default=a},1162:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8634),i={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,n.validateTuple)(e,"items")};t.default=i},4243:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1686),i=r(3499),o=r(8936),s=r(4943),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:a,data:c,it:u}=e;"all"===u.opts.removeAdditional&&void 0===a.additionalProperties&&s.default.code(new n.KeywordCxt(u,s.default,"additionalProperties"));const l=(0,i.allSchemaProperties)(r);for(const e of l)u.definedProperties.add(e);u.opts.unevaluated&&l.length&&!0!==u.props&&(u.props=o.mergeEvaluated.props(t,(0,o.toHash)(l),u.props));const h=l.filter((e=>!(0,o.alwaysValidSchema)(u,r[e])));if(0===h.length)return;const f=t.name("valid");for(const r of h)d(r)?p(r):(t.if((0,i.propertyInData)(t,c,r,u.opts.ownProperties)),p(r),u.allErrors||t.else().var(f,!0),t.endIf()),e.it.definedProperties.add(r),e.ok(f);function d(e){return u.opts.useDefaults&&!u.compositeRule&&void 0!==r[e].default}function p(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},f)}}};t.default=a},3021:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>n._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:r,data:o,it:s}=e;if((0,i.alwaysValidSchema)(s,r))return;const a=t.name("valid");t.forIn("key",o,(r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},a),t.if((0,n.not)(a),(()=>{e.error(!0),s.allErrors||t.break()}))})),e.ok(a)}};t.default=o},5316:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8936),i={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,n.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};t.default=i},3499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const n=r(5669),i=r(8936),o=r(7250),s=r(8936);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:n._`Object.prototype.hasOwnProperty`})}function c(e,t,r){return n._`${a(e)}.call(${t}, ${r})`}function u(e,t,r,i){const o=n._`${t}${(0,n.getProperty)(r)} === undefined`;return i?(0,n.or)(o,(0,n.not)(c(e,t,r))):o}function l(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:r,data:i,it:o}=e;r.if(u(r,i,t,o.opts.ownProperties),(()=>{e.setParams({missingProperty:n._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},i,o){return(0,n.or)(...i.map((i=>(0,n.and)(u(e,t,i,r.ownProperties),n._`${o} = ${i}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=c,t.propertyInData=function(e,t,r,i){const o=n._`${t}${(0,n.getProperty)(r)} !== undefined`;return i?n._`${o} && ${c(e,t,r)}`:o},t.noPropertyInData=u,t.allSchemaProperties=l,t.schemaProperties=function(e,t){return l(t).filter((r=>!(0,i.alwaysValidSchema)(e,t[r])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:s,errorPath:a},it:c},u,l,h){const f=h?n._`${e}, ${t}, ${i}${s}`:t,d=[[o.default.instancePath,(0,n.strConcat)(o.default.instancePath,a)],[o.default.parentData,c.parentData],[o.default.parentDataProperty,c.parentDataProperty],[o.default.rootData,o.default.rootData]];c.opts.dynamicRef&&d.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);const p=n._`${f}, ${r.object(...d)}`;return l!==n.nil?n._`${u}.call(${l}, ${p})`:n._`${u}(${p})`};const h=n._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){const i=t.unicodeRegExp?"u":"",{regExp:o}=t.code,a=o(r,i);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:n._`${"new RegExp"===o.code?h:(0,s.useFunc)(e,o)}(${r}, ${i})`})},t.validateArray=function(e){const{gen:t,data:r,keyword:o,it:s}=e,a=t.name("valid");if(s.allErrors){const e=t.let("valid",!0);return c((()=>t.assign(e,!1))),e}return t.var(a,!0),c((()=>t.break())),a;function c(s){const c=t.const("len",n._`${r}.length`);t.forRange("i",0,c,(r=>{e.subschema({keyword:o,dataProp:r,dataPropType:i.Type.Num},a),t.if((0,n.not)(a),s)}))}},t.validateUnion=function(e){const{gen:t,schema:r,keyword:o,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some((e=>(0,i.alwaysValidSchema)(s,e)))&&!s.opts.unevaluated)return;const a=t.let("valid",!1),c=t.name("_valid");t.block((()=>r.forEach(((r,i)=>{const s=e.subschema({keyword:o,schemaProp:i,compositeRule:!0},c);t.assign(a,n._`${a} || ${c}`),e.mergeValidEvaluated(s,c)||t.if((0,n.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},1018:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=r},2101:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1018),i=r(1939),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",n.default,i.default];t.default=o},1939:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const n=r(1578),i=r(3499),o=r(5669),s=r(7250),a=r(7382),c=r(8936),u={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:i}=e,{baseId:s,schemaEnv:c,validateName:u,opts:f,self:d}=i,{root:p}=c;if(("#"===r||"#/"===r)&&s===p.baseId)return function(){if(c===p)return h(e,u,c,c.$async);const r=t.scopeValue("root",{ref:p});return h(e,o._`${r}.validate`,p,p.$async)}();const m=a.resolveRef.call(d,p,s,r);if(void 0===m)throw new n.default(i.opts.uriResolver,s,r);return m instanceof a.SchemaEnv?function(t){const r=l(e,t);h(e,r,t,t.$async)}(m):function(n){const i=t.scopeValue("schema",!0===f.code.source?{ref:n,code:(0,o.stringify)(n)}:{ref:n}),s=t.name("valid"),a=e.subschema({schema:n,dataTypes:[],schemaPath:o.nil,topSchemaRef:i,errSchemaPath:r},s);e.mergeEvaluated(a),e.ok(s)}(m)}};function l(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):o._`${r.scopeValue("wrapper",{ref:t})}.validate`}function h(e,t,r,n){const{gen:a,it:u}=e,{allErrors:l,schemaEnv:h,opts:f}=u,d=f.passContext?s.default.this:o.nil;function p(e){const t=o._`${e}.errors`;a.assign(s.default.vErrors,o._`${s.default.vErrors} === null ? ${t} : ${s.default.vErrors}.concat(${t})`),a.assign(s.default.errors,o._`${s.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;const n=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==u.props)if(n&&!n.dynamicProps)void 0!==n.props&&(u.props=c.mergeEvaluated.props(a,n.props,u.props));else{const t=a.var("props",o._`${e}.evaluated.props`);u.props=c.mergeEvaluated.props(a,t,u.props,o.Name)}if(!0!==u.items)if(n&&!n.dynamicItems)void 0!==n.items&&(u.items=c.mergeEvaluated.items(a,n.items,u.items));else{const t=a.var("items",o._`${e}.evaluated.items`);u.items=c.mergeEvaluated.items(a,t,u.items,o.Name)}}n?function(){if(!h.$async)throw new Error("async schema referenced by sync schema");const r=a.let("valid");a.try((()=>{a.code(o._`await ${(0,i.callValidateCode)(e,t,d)}`),m(t),l||a.assign(r,!0)}),(e=>{a.if(o._`!(${e} instanceof ${u.ValidationError})`,(()=>a.throw(e))),p(e),l||a.assign(r,!1)})),e.ok(r)}():e.result((0,i.callValidateCode)(e,t,d),(()=>m(t)),(()=>p(t)))}t.getValidate=l,t.callRef=h,t.default=u},2:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(7421),o=r(7382),s=r(8936),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>n._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){const{gen:t,data:r,schema:a,parentSchema:c,it:u}=e,{oneOf:l}=c;if(!u.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=a.propertyName;if("string"!=typeof h)throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const f=t.let("valid",!1),d=t.const("tag",n._`${r}${(0,n.getProperty)(h)}`);function p(r){const i=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},i);return e.mergeEvaluated(o,n.Name),i}t.if(n._`typeof ${d} == "string"`,(()=>function(){const r=function(){var e;const t={},r=i(c);let n=!0;for(let t=0;t<l.length;t++){let c=l[t];(null==c?void 0:c.$ref)&&!(0,s.schemaHasRulesButRef)(c,u.self.RULES)&&(c=o.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,null==c?void 0:c.$ref),c instanceof o.SchemaEnv&&(c=c.schema));const f=null===(e=null==c?void 0:c.properties)||void 0===e?void 0:e[h];if("object"!=typeof f)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);n=n&&(r||i(c)),a(f,t)}if(!n)throw new Error(`discriminator: "${h}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(h)}function a(e,t){if(e.const)f(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`);for(const r of e.enum)f(r,t)}}function f(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${h}" values must be unique strings`);t[e]=r}}();t.if(!1);for(const e in r)t.elseIf(n._`${d} === ${e}`),t.assign(f,p(r[e]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:d,tagName:h}),t.endIf()}()),(()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:d,tagName:h}))),e.ok(f)}};t.default=a},7421:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(r=t.DiscrError||(t.DiscrError={})).Tag="tag",r.Mapping="mapping"},5671:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2101),i=r(7499),o=r(6951),s=r(4480),a=r(2480),c=[n.default,i.default,(0,o.default)(),s.default,a.metadataVocabulary,a.contentVocabulary];t.default=c},3599:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>n.str`must match format "${e}"`,params:({schemaCode:e})=>n._`{format: ${e}}`},code(e,t){const{gen:r,data:i,$data:o,schema:s,schemaCode:a,it:c}=e,{opts:u,errSchemaPath:l,schemaEnv:h,self:f}=c;u.validateFormats&&(o?function(){const o=r.scopeValue("formats",{ref:f.formats,code:u.code.formats}),s=r.const("fDef",n._`${o}[${a}]`),c=r.let("fType"),l=r.let("format");r.if(n._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,(()=>r.assign(c,n._`${s}.type || "string"`).assign(l,n._`${s}.validate`)),(()=>r.assign(c,n._`"string"`).assign(l,s))),e.fail$data((0,n.or)(!1===u.strictSchema?n.nil:n._`${a} && !${l}`,function(){const e=h.$async?n._`(${s}.async ? await ${l}(${i}) : ${l}(${i}))`:n._`${l}(${i})`,r=n._`(typeof ${l} == "function" ? ${e} : ${l}.test(${i}))`;return n._`${l} && ${l} !== true && ${c} === ${t} && !${r}`}()))}():function(){const o=f.formats[s];if(!o)return void function(){if(!1!==u.strictSchema)throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${l}"`}f.logger.warn(e())}();if(!0===o)return;const[a,c,d]=function(e){const t=e instanceof RegExp?(0,n.regexpCode)(e):u.code.formats?n._`${u.code.formats}${(0,n.getProperty)(s)}`:void 0,i=r.scopeValue("formats",{key:s,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,i]:[e.type||"string",e.validate,n._`${i}.validate`]}(o);a===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!h.$async)throw new Error("async format in sync schema");return n._`await ${d}(${i})`}return"function"==typeof c?n._`${d}(${i})`:n._`${d}.test(${i})`}())}())}};t.default=i},4480:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=[r(3599).default];t.default=n},2480:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},6577:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o=r(4285),s={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>n._`{allowedValue: ${e}}`},code(e){const{gen:t,data:r,$data:s,schemaCode:a,schema:c}=e;s||c&&"object"==typeof c?e.fail$data(n._`!${(0,i.useFunc)(t,o.default)}(${r}, ${a})`):e.fail(n._`${c} !== ${r}`)}};t.default=s},9450:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o=r(4285),s={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>n._`{allowedValues: ${e}}`},code(e){const{gen:t,data:r,$data:s,schema:a,schemaCode:c,it:u}=e;if(!s&&0===a.length)throw new Error("enum must have non-empty array");const l=a.length>=u.opts.loopEnum;let h;const f=()=>null!=h?h:h=(0,i.useFunc)(t,o.default);let d;if(l||s)d=t.let("valid"),e.block$data(d,(function(){t.assign(d,!1),t.forOf("v",c,(e=>t.if(n._`${f()}(${r}, ${e})`,(()=>t.assign(d,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",c);d=(0,n.or)(...a.map(((t,i)=>function(e,t){const i=a[t];return"object"==typeof i&&null!==i?n._`${f()}(${r}, ${e}[${t}])`:n._`${r} === ${i}`}(e,i))))}e.pass(d)}};t.default=s},7499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1337),i=r(9706),o=r(9507),s=r(1216),a=r(34),c=r(6962),u=r(1135),l=r(194),h=r(6577),f=r(9450),d=[n.default,i.default,o.default,s.default,a.default,c.default,u.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},h.default,f.default];t.default=d},1135:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxItems"===e?"more":"fewer";return n.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:i}=e,o="maxItems"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`${r}.length ${o} ${i}`)}};t.default=i},9507:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=r(8936),o=r(9161),s={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxLength"===e?"more":"fewer";return n.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:s,it:a}=e,c="maxLength"===t?n.operators.GT:n.operators.LT,u=!1===a.opts.unicode?n._`${r}.length`:n._`${(0,i.useFunc)(e.gen,o.default)}(${r})`;e.fail$data(n._`${u} ${c} ${s}`)}};t.default=s},1337:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i=n.operators,o={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},s={message:({keyword:e,schemaCode:t})=>n.str`must be ${o[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>n._`{comparison: ${o[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:s,code(e){const{keyword:t,data:r,schemaCode:i}=e;e.fail$data(n._`${r} ${o[t].fail} ${i} || isNaN(${r})`)}};t.default=a},34:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxProperties"===e?"more":"fewer";return n.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:i}=e,o="maxProperties"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`Object.keys(${r}).length ${o} ${i}`)}};t.default=i},9706:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5669),i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>n.str`must be multiple of ${e}`,params:({schemaCode:e})=>n._`{multipleOf: ${e}}`},code(e){const{gen:t,data:r,schemaCode:i,it:o}=e,s=o.opts.multipleOfPrecision,a=t.let("res"),c=s?n._`Math.abs(Math.round(${a}) - ${a}) > 1e-${s}`:n._`${a} !== parseInt(${a})`;e.fail$data(n._`(${i} === 0 || (${a} = ${r}/${i}, ${c}))`)}};t.default=i},1216:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3499),i=r(5669),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match pattern "${e}"`,params:({schemaCode:e})=>i._`{pattern: ${e}}`},code(e){const{data:t,$data:r,schema:o,schemaCode:s,it:a}=e,c=a.opts.unicodeRegExp?"u":"",u=r?i._`(new RegExp(${s}, ${c}))`:(0,n.usePattern)(e,o);e.fail$data(i._`!${u}.test(${t})`)}};t.default=o},6962:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3499),i=r(5669),o=r(8936),s={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>i.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>i._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:r,schemaCode:s,data:a,$data:c,it:u}=e,{opts:l}=u;if(!c&&0===r.length)return;const h=r.length>=l.loopRequired;if(u.allErrors?function(){if(h||c)e.block$data(i.nil,f);else for(const t of r)(0,n.checkReportMissingProp)(e,t)}():function(){const o=t.let("missing");if(h||c){const r=t.let("valid",!0);e.block$data(r,(()=>function(r,o){e.setParams({missingProperty:r}),t.forOf(r,s,(()=>{t.assign(o,(0,n.propertyInData)(t,a,r,l.ownProperties)),t.if((0,i.not)(o),(()=>{e.error(),t.break()}))}),i.nil)}(o,r))),e.ok(r)}else t.if((0,n.checkMissingProp)(e,r,o)),(0,n.reportMissingProp)(e,o),t.else()}(),l.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=`required property "${e}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(u,t,u.opts.strictRequired)}}function f(){t.forOf("prop",s,(r=>{e.setParams({missingProperty:r}),t.if((0,n.noPropertyInData)(t,a,r,l.ownProperties),(()=>e.error()))}))}}};t.default=s},194:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(7332),i=r(5669),o=r(8936),s=r(4285),a={message:({params:{i:e,j:t}})=>i.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>i._`{i: ${e}, j: ${t}}`},c={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:a,code(e){const{gen:t,data:r,$data:a,schema:c,parentSchema:u,schemaCode:l,it:h}=e;if(!a&&!c)return;const f=t.let("valid"),d=u.items?(0,n.getSchemaTypes)(u.items):[];function p(o,s){const a=t.name("item"),c=(0,n.checkDataTypes)(d,a,h.opts.strictNumbers,n.DataType.Wrong),u=t.const("indices",i._`{}`);t.for(i._`;${o}--;`,(()=>{t.let(a,i._`${r}[${o}]`),t.if(c,i._`continue`),d.length>1&&t.if(i._`typeof ${a} == "string"`,i._`${a} += "_"`),t.if(i._`typeof ${u}[${a}] == "number"`,(()=>{t.assign(s,i._`${u}[${a}]`),e.error(),t.assign(f,!1).break()})).code(i._`${u}[${a}] = ${o}`)}))}function m(n,a){const c=(0,o.useFunc)(t,s.default),u=t.name("outer");t.label(u).for(i._`;${n}--;`,(()=>t.for(i._`${a} = ${n}; ${a}--;`,(()=>t.if(i._`${c}(${r}[${n}], ${r}[${a}])`,(()=>{e.error(),t.assign(f,!1).break(u)}))))))}e.block$data(f,(function(){const n=t.let("i",i._`${r}.length`),o=t.let("j");e.setParams({i:n,j:o}),t.assign(f,!0),t.if(i._`${n} > 1`,(()=>(d.length>0&&!d.some((e=>"object"===e||"array"===e))?p:m)(n,o)))}),i._`${l} === false`),e.ok(f)}};t.default=c},2943:e=>{"use strict";var t=e.exports=function(e,t,n){"function"==typeof t&&(n=t,t={}),r(t,"function"==typeof(n=t.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function r(e,n,i,o,s,a,c,u,l,h){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var f in n(o,s,a,c,u,l,h),o){var d=o[f];if(Array.isArray(d)){if(f in t.arrayKeywords)for(var p=0;p<d.length;p++)r(e,n,i,d[p],s+"/"+f+"/"+p,a,s,f,o,p)}else if(f in t.propsKeywords){if(d&&"object"==typeof d)for(var m in d)r(e,n,i,d[m],s+"/"+f+"/"+m.replace(/~/g,"~0").replace(/\//g,"~1"),a,s,f,o,m)}else(f in t.keywords||e.allKeys&&!(f in t.skipKeywords))&&r(e,n,i,d,s+"/"+f,a,s,f,o)}i(o,s,a,c,u,l,h)}}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},2091:function(e,t,r){var n,i;i=function(e){var t=["N","E","A","D"];function r(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function n(e,t){Object.defineProperty(this,"kind",{value:e,enumerable:!0}),t&&t.length&&Object.defineProperty(this,"path",{value:t,enumerable:!0})}function i(e,t,r){i.super_.call(this,"E",e),Object.defineProperty(this,"lhs",{value:t,enumerable:!0}),Object.defineProperty(this,"rhs",{value:r,enumerable:!0})}function o(e,t){o.super_.call(this,"N",e),Object.defineProperty(this,"rhs",{value:t,enumerable:!0})}function s(e,t){s.super_.call(this,"D",e),Object.defineProperty(this,"lhs",{value:t,enumerable:!0})}function a(e,t,r){a.super_.call(this,"A",e),Object.defineProperty(this,"index",{value:t,enumerable:!0}),Object.defineProperty(this,"item",{value:r,enumerable:!0})}function c(e,t,r){var n=e.slice((r||t)+1||e.length);return e.length=t<0?e.length+t:t,e.push.apply(e,n),e}function u(e){var t=typeof e;return"object"!==t?t:e===Math?"math":null===e?"null":Array.isArray(e)?"array":"[object Date]"===Object.prototype.toString.call(e)?"date":"function"==typeof e.toString&&/^\/.*\//.test(e.toString())?"regexp":"object"}function l(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}function h(e){var t=0,r=u(e);if("array"===r)return e.forEach((function(e){t+=h(e)})),t+l("[type: array, hash: "+t+"]");if("object"===r){for(var n in e)if(e.hasOwnProperty(n)){var i="[ type: object, key: "+n+", value hash: "+h(e[n])+"]";t+=l(i)}return t}return t+l("[ type: "+r+" ; value: "+e+"]")}function f(e,t,r,n,c,l,d,p){r=r||[],d=d||[];var m=(c=c||[]).slice(0);if(null!=l){if(n){if("function"==typeof n&&n(m,l))return;if("object"==typeof n){if(n.prefilter&&n.prefilter(m,l))return;if(n.normalize){var y=n.normalize(m,l,e,t);y&&(e=y[0],t=y[1])}}}m.push(l)}"regexp"===u(e)&&"regexp"===u(t)&&(e=e.toString(),t=t.toString());var v,g,b,_,w=typeof e,E=typeof t,S="undefined"!==w||d&&d.length>0&&d[d.length-1].lhs&&Object.getOwnPropertyDescriptor(d[d.length-1].lhs,l),O="undefined"!==E||d&&d.length>0&&d[d.length-1].rhs&&Object.getOwnPropertyDescriptor(d[d.length-1].rhs,l);if(!S&&O)r.push(new o(m,t));else if(!O&&S)r.push(new s(m,e));else if(u(e)!==u(t))r.push(new i(m,e,t));else if("date"===u(e)&&e-t!=0)r.push(new i(m,e,t));else if("object"===w&&null!==e&&null!==t){for(v=d.length-1;v>-1;--v)if(d[v].lhs===e){_=!0;break}if(_)e!==t&&r.push(new i(m,e,t));else{if(d.push({lhs:e,rhs:t}),Array.isArray(e)){for(p&&(e.sort((function(e,t){return h(e)-h(t)})),t.sort((function(e,t){return h(e)-h(t)}))),v=t.length-1,g=e.length-1;v>g;)r.push(new a(m,v,new o(void 0,t[v--])));for(;g>v;)r.push(new a(m,g,new s(void 0,e[g--])));for(;v>=0;--v)f(e[v],t[v],r,n,m,v,d,p)}else{var I=Object.keys(e),T=Object.keys(t);for(v=0;v<I.length;++v)b=I[v],(_=T.indexOf(b))>=0?(f(e[b],t[b],r,n,m,b,d,p),T[_]=null):f(e[b],void 0,r,n,m,b,d,p);for(v=0;v<T.length;++v)(b=T[v])&&f(void 0,t[b],r,n,m,b,d,p)}d.length=d.length-1}}else e!==t&&("number"===w&&isNaN(e)&&isNaN(t)||r.push(new i(m,e,t)))}function d(e,t,r,n,i){var o=[];if(f(e,t,o,n,null,null,null,i),r)for(var s=0;s<o.length;++s)r(o[s]);return o}function p(e,t,r,n){var i=d(e,t,n?function(e){e&&n.push(e)}:void 0,r);return n||(i.length?i:void 0)}function m(e,t,r){if(r.path&&r.path.length){var n,i=e[t],o=r.path.length-1;for(n=0;n<o;n++)i=i[r.path[n]];switch(r.kind){case"A":m(i[r.path[n]],r.index,r.item);break;case"D":delete i[r.path[n]];break;case"E":case"N":i[r.path[n]]=r.rhs}}else switch(r.kind){case"A":m(e[t],r.index,r.item);break;case"D":e=c(e,t);break;case"E":case"N":e[t]=r.rhs}return e}function y(e,r,n){if(void 0===n&&r&&~t.indexOf(r.kind)&&(n=r),e&&n&&n.kind){for(var i=e,o=-1,s=n.path?n.path.length-1:0;++o<s;)void 0===i[n.path[o]]&&(i[n.path[o]]=void 0!==n.path[o+1]&&"number"==typeof n.path[o+1]?[]:{}),i=i[n.path[o]];switch(n.kind){case"A":n.path&&void 0===i[n.path[o]]&&(i[n.path[o]]=[]),m(n.path?i[n.path[o]]:i,n.index,n.item);break;case"D":delete i[n.path[o]];break;case"E":case"N":i[n.path[o]]=n.rhs}}}function v(e,t,r){if(r.path&&r.path.length){var n,i=e[t],o=r.path.length-1;for(n=0;n<o;n++)i=i[r.path[n]];switch(r.kind){case"A":v(i[r.path[n]],r.index,r.item);break;case"D":case"E":i[r.path[n]]=r.lhs;break;case"N":delete i[r.path[n]]}}else switch(r.kind){case"A":v(e[t],r.index,r.item);break;case"D":case"E":e[t]=r.lhs;break;case"N":e=c(e,t)}return e}return r(i,n),r(o,n),r(s,n),r(a,n),Object.defineProperties(p,{diff:{value:p,enumerable:!0},orderIndependentDiff:{value:function(e,t,r,n){var i=d(e,t,n?function(e){e&&n.push(e)}:void 0,r,!0);return n||(i.length?i:void 0)},enumerable:!0},observableDiff:{value:d,enumerable:!0},orderIndependentObservableDiff:{value:function(e,t,r,n,i,o,s){return f(e,t,r,n,i,o,s,!0)},enumerable:!0},orderIndepHash:{value:h,enumerable:!0},applyDiff:{value:function(e,t,r){e&&t&&d(e,t,(function(n){r&&!r(e,t,n)||y(e,t,n)}))},enumerable:!0},applyChange:{value:y,enumerable:!0},revertChange:{value:function(e,t,r){if(e&&t&&r&&r.kind){var n,i,o=e;for(i=r.path.length-1,n=0;n<i;n++)void 0===o[r.path[n]]&&(o[r.path[n]]={}),o=o[r.path[n]];switch(r.kind){case"A":v(o[r.path[n]],r.index,r.item);break;case"D":case"E":o[r.path[n]]=r.lhs;break;case"N":delete o[r.path[n]]}}},enumerable:!0},isConflict:{value:function(){return"undefined"!=typeof $conflict},enumerable:!0}}),p.DeepDiff=p,e&&(e.DeepDiff=p),p}(this),void 0===(n=function(){return i}.call(t,r,t,e))||(e.exports=n)},6471:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!=i--;){var s=o[i];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}},8784:function(e,t,r){var n;e=r.nmd(e),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",c=32,u=128,l=1/0,h=9007199254740991,f=NaN,d=4294967295,p=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",c],["partialRight",64],["rearg",256]],m="[object Arguments]",y="[object Array]",v="[object Boolean]",g="[object Date]",b="[object Error]",_="[object Function]",w="[object GeneratorFunction]",E="[object Map]",S="[object Number]",O="[object Object]",I="[object Promise]",T="[object RegExp]",k="[object Set]",N="[object String]",D="[object Symbol]",A="[object WeakMap]",x="[object ArrayBuffer]",R="[object DataView]",P="[object Float32Array]",C="[object Float64Array]",j="[object Int8Array]",$="[object Int16Array]",M="[object Int32Array]",F="[object Uint8Array]",q="[object Uint8ClampedArray]",L="[object Uint16Array]",V="[object Uint32Array]",Q=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,B=/(__e\(.*?\)|\b__t\)) \+\n'';/g,z=/&(?:amp|lt|gt|quot|#39);/g,Y=/[&<>"']/g,K=RegExp(z.source),H=RegExp(Y.source),G=/<%-([\s\S]+?)%>/g,W=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,re=RegExp(te.source),ne=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,ce=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,fe=/\w*$/,de=/^[-+]0x[0-9a-f]+$/i,pe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ve=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,be=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Ee="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Oe="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",Te="\\ufe0e\\ufe0f",ke="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ne="["+we+"]",De="["+ke+"]",Ae="["+Ee+"]",xe="\\d+",Re="["+Se+"]",Pe="["+Oe+"]",Ce="[^"+we+ke+xe+Se+Oe+Ie+"]",je="\\ud83c[\\udffb-\\udfff]",$e="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Fe="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+Ie+"]",Le="\\u200d",Ve="(?:"+Pe+"|"+Ce+")",Qe="(?:"+qe+"|"+Ce+")",Ue="(?:['’](?:d|ll|m|re|s|t|ve))?",Be="(?:['’](?:D|LL|M|RE|S|T|VE))?",ze="(?:"+Ae+"|"+je+")?",Ye="["+Te+"]?",Ke=Ye+ze+"(?:"+Le+"(?:"+[$e,Me,Fe].join("|")+")"+Ye+ze+")*",He="(?:"+[Re,Me,Fe].join("|")+")"+Ke,Ge="(?:"+[$e+Ae+"?",Ae,Me,Fe,Ne].join("|")+")",We=RegExp("['’]","g"),Je=RegExp(Ae,"g"),Ze=RegExp(je+"(?="+je+")|"+Ge+Ke,"g"),Xe=RegExp([qe+"?"+Pe+"+"+Ue+"(?="+[De,qe,"$"].join("|")+")",Qe+"+"+Be+"(?="+[De,qe+Ve,"$"].join("|")+")",qe+"?"+Ve+"+"+Ue,qe+"+"+Be,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xe,He].join("|"),"g"),et=RegExp("["+Le+we+Ee+Te+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],nt=-1,it={};it[P]=it[C]=it[j]=it[$]=it[M]=it[F]=it[q]=it[L]=it[V]=!0,it[m]=it[y]=it[x]=it[v]=it[R]=it[g]=it[b]=it[_]=it[E]=it[S]=it[O]=it[T]=it[k]=it[N]=it[A]=!1;var ot={};ot[m]=ot[y]=ot[x]=ot[R]=ot[v]=ot[g]=ot[P]=ot[C]=ot[j]=ot[$]=ot[M]=ot[E]=ot[S]=ot[O]=ot[T]=ot[k]=ot[N]=ot[D]=ot[F]=ot[q]=ot[L]=ot[V]=!0,ot[b]=ot[_]=ot[A]=!1;var st={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},at=parseFloat,ct=parseInt,ut="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,lt="object"==typeof self&&self&&self.Object===Object&&self,ht=ut||lt||Function("return this")(),ft=t&&!t.nodeType&&t,dt=ft&&e&&!e.nodeType&&e,pt=dt&&dt.exports===ft,mt=pt&&ut.process,yt=function(){try{return dt&&dt.require&&dt.require("util").types||mt&&mt.binding&&mt.binding("util")}catch(e){}}(),vt=yt&&yt.isArrayBuffer,gt=yt&&yt.isDate,bt=yt&&yt.isMap,_t=yt&&yt.isRegExp,wt=yt&&yt.isSet,Et=yt&&yt.isTypedArray;function St(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Ot(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(n,s,r(s),e)}return n}function It(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function Tt(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function kt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function Nt(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[i++]=s)}return o}function Dt(e,t){return!(null==e||!e.length)&&qt(e,t,0)>-1}function At(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function xt(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Rt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Pt(e,t,r,n){var i=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function Ct(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function jt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var $t=Ut("length");function Mt(e,t,r){var n;return r(e,(function(e,r,i){if(t(e,r,i))return n=r,!1})),n}function Ft(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function qt(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):Ft(e,Vt,r)}function Lt(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function Vt(e){return e!=e}function Qt(e,t){var r=null==e?0:e.length;return r?Yt(e,t)/r:f}function Ut(e){return function(t){return null==t?i:t[e]}}function Bt(e){return function(t){return null==e?i:e[t]}}function zt(e,t,r,n,i){return i(e,(function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)})),r}function Yt(e,t){for(var r,n=-1,o=e.length;++n<o;){var s=t(e[n]);s!==i&&(r=r===i?s:r+s)}return r}function Kt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Ht(e){return e?e.slice(0,hr(e)+1).replace(ne,""):e}function Gt(e){return function(t){return e(t)}}function Wt(e,t){return xt(t,(function(t){return e[t]}))}function Jt(e,t){return e.has(t)}function Zt(e,t){for(var r=-1,n=e.length;++r<n&&qt(t,e[r],0)>-1;);return r}function Xt(e,t){for(var r=e.length;r--&&qt(t,e[r],0)>-1;);return r}var er=Bt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tr=Bt({"&":"&","<":"<",">":">",'"':""","'":"'"});function rr(e){return"\\"+st[e]}function nr(e){return et.test(e)}function ir(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function or(e,t){return function(r){return e(t(r))}}function sr(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r];s!==t&&s!==a||(e[r]=a,o[i++]=r)}return o}function ar(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}function cr(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=[e,e]})),r}function ur(e){return nr(e)?function(e){for(var t=Ze.lastIndex=0;Ze.test(e);)++t;return t}(e):$t(e)}function lr(e){return nr(e)?function(e){return e.match(Ze)||[]}(e):function(e){return e.split("")}(e)}function hr(e){for(var t=e.length;t--&&ie.test(e.charAt(t)););return t}var fr=Bt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),dr=function e(t){var r,n=(t=null==t?ht:dr.defaults(ht.Object(),t,dr.pick(ht,rt))).Array,ie=t.Date,we=t.Error,Ee=t.Function,Se=t.Math,Oe=t.Object,Ie=t.RegExp,Te=t.String,ke=t.TypeError,Ne=n.prototype,De=Ee.prototype,Ae=Oe.prototype,xe=t["__core-js_shared__"],Re=De.toString,Pe=Ae.hasOwnProperty,Ce=0,je=(r=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",$e=Ae.toString,Me=Re.call(Oe),Fe=ht._,qe=Ie("^"+Re.call(Pe).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=pt?t.Buffer:i,Ve=t.Symbol,Qe=t.Uint8Array,Ue=Le?Le.allocUnsafe:i,Be=or(Oe.getPrototypeOf,Oe),ze=Oe.create,Ye=Ae.propertyIsEnumerable,Ke=Ne.splice,He=Ve?Ve.isConcatSpreadable:i,Ge=Ve?Ve.iterator:i,Ze=Ve?Ve.toStringTag:i,et=function(){try{var e=co(Oe,"defineProperty");return e({},"",{}),e}catch(e){}}(),st=t.clearTimeout!==ht.clearTimeout&&t.clearTimeout,ut=ie&&ie.now!==ht.Date.now&&ie.now,lt=t.setTimeout!==ht.setTimeout&&t.setTimeout,ft=Se.ceil,dt=Se.floor,mt=Oe.getOwnPropertySymbols,yt=Le?Le.isBuffer:i,$t=t.isFinite,Bt=Ne.join,pr=or(Oe.keys,Oe),mr=Se.max,yr=Se.min,vr=ie.now,gr=t.parseInt,br=Se.random,_r=Ne.reverse,wr=co(t,"DataView"),Er=co(t,"Map"),Sr=co(t,"Promise"),Or=co(t,"Set"),Ir=co(t,"WeakMap"),Tr=co(Oe,"create"),kr=Ir&&new Ir,Nr={},Dr=Mo(wr),Ar=Mo(Er),xr=Mo(Sr),Rr=Mo(Or),Pr=Mo(Ir),Cr=Ve?Ve.prototype:i,jr=Cr?Cr.valueOf:i,$r=Cr?Cr.toString:i;function Mr(e){if(ea(e)&&!Us(e)&&!(e instanceof Vr)){if(e instanceof Lr)return e;if(Pe.call(e,"__wrapped__"))return Fo(e)}return new Lr(e)}var Fr=function(){function e(){}return function(t){if(!Xs(t))return{};if(ze)return ze(t);e.prototype=t;var r=new e;return e.prototype=i,r}}();function qr(){}function Lr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Vr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Qr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ur(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Br(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function zr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Br;++t<r;)this.add(e[t])}function Yr(e){var t=this.__data__=new Ur(e);this.size=t.size}function Kr(e,t){var r=Us(e),n=!r&&Qs(e),i=!r&&!n&&Ks(e),o=!r&&!n&&!i&&ca(e),s=r||n||i||o,a=s?Kt(e.length,Te):[],c=a.length;for(var u in e)!t&&!Pe.call(e,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||yo(u,c))||a.push(u);return a}function Hr(e){var t=e.length;return t?e[zn(0,t-1)]:i}function Gr(e,t){return Ro(Ti(e),on(t,0,e.length))}function Wr(e){return Ro(Ti(e))}function Jr(e,t,r){(r!==i&&!qs(e[t],r)||r===i&&!(t in e))&&rn(e,t,r)}function Zr(e,t,r){var n=e[t];Pe.call(e,t)&&qs(n,r)&&(r!==i||t in e)||rn(e,t,r)}function Xr(e,t){for(var r=e.length;r--;)if(qs(e[r][0],t))return r;return-1}function en(e,t,r,n){return ln(e,(function(e,i,o){t(n,e,r(e),o)})),n}function tn(e,t){return e&&ki(t,Aa(t),e)}function rn(e,t,r){"__proto__"==t&&et?et(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function nn(e,t){for(var r=-1,o=t.length,s=n(o),a=null==e;++r<o;)s[r]=a?i:Ia(e,t[r]);return s}function on(e,t,r){return e==e&&(r!==i&&(e=e<=r?e:r),t!==i&&(e=e>=t?e:t)),e}function sn(e,t,r,n,o,s){var a,c=1&t,u=2&t,l=4&t;if(r&&(a=o?r(e,n,o,s):r(e)),a!==i)return a;if(!Xs(e))return e;var h=Us(e);if(h){if(a=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Pe.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!c)return Ti(e,a)}else{var f=ho(e),d=f==_||f==w;if(Ks(e))return _i(e,c);if(f==O||f==m||d&&!o){if(a=u||d?{}:po(e),!c)return u?function(e,t){return ki(e,lo(e),t)}(e,function(e,t){return e&&ki(t,xa(t),e)}(a,e)):function(e,t){return ki(e,uo(e),t)}(e,tn(a,e))}else{if(!ot[f])return o?e:{};a=function(e,t,r){var n,i=e.constructor;switch(t){case x:return wi(e);case v:case g:return new i(+e);case R:return function(e,t){var r=t?wi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case P:case C:case j:case $:case M:case F:case q:case L:case V:return Ei(e,r);case E:return new i;case S:case N:return new i(e);case T:return function(e){var t=new e.constructor(e.source,fe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case k:return new i;case D:return n=e,jr?Oe(jr.call(n)):{}}}(e,f,c)}}s||(s=new Yr);var p=s.get(e);if(p)return p;s.set(e,a),oa(e)?e.forEach((function(n){a.add(sn(n,t,r,n,e,s))})):ta(e)&&e.forEach((function(n,i){a.set(i,sn(n,t,r,i,e,s))}));var y=h?i:(l?u?to:eo:u?xa:Aa)(e);return It(y||e,(function(n,i){y&&(n=e[i=n]),Zr(a,i,sn(n,t,r,i,e,s))})),a}function an(e,t,r){var n=r.length;if(null==e)return!n;for(e=Oe(e);n--;){var o=r[n],s=t[o],a=e[o];if(a===i&&!(o in e)||!s(a))return!1}return!0}function cn(e,t,r){if("function"!=typeof e)throw new ke(o);return No((function(){e.apply(i,r)}),t)}function un(e,t,r,n){var i=-1,o=Dt,s=!0,a=e.length,c=[],u=t.length;if(!a)return c;r&&(t=xt(t,Gt(r))),n?(o=At,s=!1):t.length>=200&&(o=Jt,s=!1,t=new zr(t));e:for(;++i<a;){var l=e[i],h=null==r?l:r(l);if(l=n||0!==l?l:0,s&&h==h){for(var f=u;f--;)if(t[f]===h)continue e;c.push(l)}else o(t,h,n)||c.push(l)}return c}Mr.templateSettings={escape:G,evaluate:W,interpolate:J,variable:"",imports:{_:Mr}},Mr.prototype=qr.prototype,Mr.prototype.constructor=Mr,Lr.prototype=Fr(qr.prototype),Lr.prototype.constructor=Lr,Vr.prototype=Fr(qr.prototype),Vr.prototype.constructor=Vr,Qr.prototype.clear=function(){this.__data__=Tr?Tr(null):{},this.size=0},Qr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Qr.prototype.get=function(e){var t=this.__data__;if(Tr){var r=t[e];return r===s?i:r}return Pe.call(t,e)?t[e]:i},Qr.prototype.has=function(e){var t=this.__data__;return Tr?t[e]!==i:Pe.call(t,e)},Qr.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Tr&&t===i?s:t,this},Ur.prototype.clear=function(){this.__data__=[],this.size=0},Ur.prototype.delete=function(e){var t=this.__data__,r=Xr(t,e);return!(r<0||(r==t.length-1?t.pop():Ke.call(t,r,1),--this.size,0))},Ur.prototype.get=function(e){var t=this.__data__,r=Xr(t,e);return r<0?i:t[r][1]},Ur.prototype.has=function(e){return Xr(this.__data__,e)>-1},Ur.prototype.set=function(e,t){var r=this.__data__,n=Xr(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Br.prototype.clear=function(){this.size=0,this.__data__={hash:new Qr,map:new(Er||Ur),string:new Qr}},Br.prototype.delete=function(e){var t=so(this,e).delete(e);return this.size-=t?1:0,t},Br.prototype.get=function(e){return so(this,e).get(e)},Br.prototype.has=function(e){return so(this,e).has(e)},Br.prototype.set=function(e,t){var r=so(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},zr.prototype.add=zr.prototype.push=function(e){return this.__data__.set(e,s),this},zr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.clear=function(){this.__data__=new Ur,this.size=0},Yr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Yr.prototype.get=function(e){return this.__data__.get(e)},Yr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ur){var n=r.__data__;if(!Er||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Br(n)}return r.set(e,t),this.size=r.size,this};var ln=Ai(gn),hn=Ai(bn,!0);function fn(e,t){var r=!0;return ln(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function dn(e,t,r){for(var n=-1,o=e.length;++n<o;){var s=e[n],a=t(s);if(null!=a&&(c===i?a==a&&!aa(a):r(a,c)))var c=a,u=s}return u}function pn(e,t){var r=[];return ln(e,(function(e,n,i){t(e,n,i)&&r.push(e)})),r}function mn(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=mo),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?mn(a,t-1,r,n,i):Rt(i,a):n||(i[i.length]=a)}return i}var yn=xi(),vn=xi(!0);function gn(e,t){return e&&yn(e,t,Aa)}function bn(e,t){return e&&vn(e,t,Aa)}function _n(e,t){return Nt(t,(function(t){return Ws(e[t])}))}function wn(e,t){for(var r=0,n=(t=yi(t,e)).length;null!=e&&r<n;)e=e[$o(t[r++])];return r&&r==n?e:i}function En(e,t,r){var n=t(e);return Us(e)?n:Rt(n,r(e))}function Sn(e){return null==e?e===i?"[object Undefined]":"[object Null]":Ze&&Ze in Oe(e)?function(e){var t=Pe.call(e,Ze),r=e[Ze];try{e[Ze]=i;var n=!0}catch(e){}var o=$e.call(e);return n&&(t?e[Ze]=r:delete e[Ze]),o}(e):function(e){return $e.call(e)}(e)}function On(e,t){return e>t}function In(e,t){return null!=e&&Pe.call(e,t)}function Tn(e,t){return null!=e&&t in Oe(e)}function kn(e,t,r){for(var o=r?At:Dt,s=e[0].length,a=e.length,c=a,u=n(a),l=1/0,h=[];c--;){var f=e[c];c&&t&&(f=xt(f,Gt(t))),l=yr(f.length,l),u[c]=!r&&(t||s>=120&&f.length>=120)?new zr(c&&f):i}f=e[0];var d=-1,p=u[0];e:for(;++d<s&&h.length<l;){var m=f[d],y=t?t(m):m;if(m=r||0!==m?m:0,!(p?Jt(p,y):o(h,y,r))){for(c=a;--c;){var v=u[c];if(!(v?Jt(v,y):o(e[c],y,r)))continue e}p&&p.push(y),h.push(m)}}return h}function Nn(e,t,r){var n=null==(e=Io(e,t=yi(t,e)))?e:e[$o(Go(t))];return null==n?i:St(n,e,r)}function Dn(e){return ea(e)&&Sn(e)==m}function An(e,t,r,n,o){return e===t||(null==e||null==t||!ea(e)&&!ea(t)?e!=e&&t!=t:function(e,t,r,n,o,s){var a=Us(e),c=Us(t),u=a?y:ho(e),l=c?y:ho(t),h=(u=u==m?O:u)==O,f=(l=l==m?O:l)==O,d=u==l;if(d&&Ks(e)){if(!Ks(t))return!1;a=!0,h=!1}if(d&&!h)return s||(s=new Yr),a||ca(e)?Zi(e,t,r,n,o,s):function(e,t,r,n,i,o,s){switch(r){case R:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!o(new Qe(e),new Qe(t)));case v:case g:case S:return qs(+e,+t);case b:return e.name==t.name&&e.message==t.message;case T:case N:return e==t+"";case E:var a=ir;case k:var c=1&n;if(a||(a=ar),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;n|=2,s.set(e,t);var l=Zi(a(e),a(t),n,i,o,s);return s.delete(e),l;case D:if(jr)return jr.call(e)==jr.call(t)}return!1}(e,t,u,r,n,o,s);if(!(1&r)){var p=h&&Pe.call(e,"__wrapped__"),_=f&&Pe.call(t,"__wrapped__");if(p||_){var w=p?e.value():e,I=_?t.value():t;return s||(s=new Yr),o(w,I,r,n,s)}}return!!d&&(s||(s=new Yr),function(e,t,r,n,o,s){var a=1&r,c=eo(e),u=c.length;if(u!=eo(t).length&&!a)return!1;for(var l=u;l--;){var h=c[l];if(!(a?h in t:Pe.call(t,h)))return!1}var f=s.get(e),d=s.get(t);if(f&&d)return f==t&&d==e;var p=!0;s.set(e,t),s.set(t,e);for(var m=a;++l<u;){var y=e[h=c[l]],v=t[h];if(n)var g=a?n(v,y,h,t,e,s):n(y,v,h,e,t,s);if(!(g===i?y===v||o(y,v,r,n,s):g)){p=!1;break}m||(m="constructor"==h)}if(p&&!m){var b=e.constructor,_=t.constructor;b==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(p=!1)}return s.delete(e),s.delete(t),p}(e,t,r,n,o,s))}(e,t,r,n,An,o))}function xn(e,t,r,n){var o=r.length,s=o,a=!n;if(null==e)return!s;for(e=Oe(e);o--;){var c=r[o];if(a&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++o<s;){var u=(c=r[o])[0],l=e[u],h=c[1];if(a&&c[2]){if(l===i&&!(u in e))return!1}else{var f=new Yr;if(n)var d=n(l,h,u,e,t,f);if(!(d===i?An(h,l,3,n,f):d))return!1}}return!0}function Rn(e){return!(!Xs(e)||(t=e,je&&je in t))&&(Ws(e)?qe:me).test(Mo(e));var t}function Pn(e){return"function"==typeof e?e:null==e?rc:"object"==typeof e?Us(e)?Fn(e[0],e[1]):Mn(e):hc(e)}function Cn(e){if(!wo(e))return pr(e);var t=[];for(var r in Oe(e))Pe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function jn(e,t){return e<t}function $n(e,t){var r=-1,i=zs(e)?n(e.length):[];return ln(e,(function(e,n,o){i[++r]=t(e,n,o)})),i}function Mn(e){var t=ao(e);return 1==t.length&&t[0][2]?So(t[0][0],t[0][1]):function(r){return r===e||xn(r,e,t)}}function Fn(e,t){return go(e)&&Eo(t)?So($o(e),t):function(r){var n=Ia(r,e);return n===i&&n===t?Ta(r,e):An(t,n,3)}}function qn(e,t,r,n,o){e!==t&&yn(t,(function(s,a){if(o||(o=new Yr),Xs(s))!function(e,t,r,n,o,s,a){var c=To(e,r),u=To(t,r),l=a.get(u);if(l)Jr(e,r,l);else{var h=s?s(c,u,r+"",e,t,a):i,f=h===i;if(f){var d=Us(u),p=!d&&Ks(u),m=!d&&!p&&ca(u);h=u,d||p||m?Us(c)?h=c:Ys(c)?h=Ti(c):p?(f=!1,h=_i(u,!0)):m?(f=!1,h=Ei(u,!0)):h=[]:na(u)||Qs(u)?(h=c,Qs(c)?h=ya(c):Xs(c)&&!Ws(c)||(h=po(u))):f=!1}f&&(a.set(u,h),o(h,u,n,s,a),a.delete(u)),Jr(e,r,h)}}(e,t,a,r,qn,n,o);else{var c=n?n(To(e,a),s,a+"",e,t,o):i;c===i&&(c=s),Jr(e,a,c)}}),xa)}function Ln(e,t){var r=e.length;if(r)return yo(t+=t<0?r:0,r)?e[t]:i}function Vn(e,t,r){t=t.length?xt(t,(function(e){return Us(e)?function(t){return wn(t,1===e.length?e[0]:e)}:e})):[rc];var n=-1;t=xt(t,Gt(oo()));var i=$n(e,(function(e,r,i){var o=xt(t,(function(t){return t(e)}));return{criteria:o,index:++n,value:e}}));return function(e,t){var n=e.length;for(e.sort((function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var c=Si(i[n],o[n]);if(c)return n>=a?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}));n--;)e[n]=e[n].value;return e}(i)}function Qn(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var s=t[n],a=wn(e,s);r(a,s)&&Wn(o,yi(s,e),a)}return o}function Un(e,t,r,n){var i=n?Lt:qt,o=-1,s=t.length,a=e;for(e===t&&(t=Ti(t)),r&&(a=xt(e,Gt(r)));++o<s;)for(var c=0,u=t[o],l=r?r(u):u;(c=i(a,l,c,n))>-1;)a!==e&&Ke.call(a,c,1),Ke.call(e,c,1);return e}function Bn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;yo(i)?Ke.call(e,i,1):ci(e,i)}}return e}function zn(e,t){return e+dt(br()*(t-e+1))}function Yn(e,t){var r="";if(!e||t<1||t>h)return r;do{t%2&&(r+=e),(t=dt(t/2))&&(e+=e)}while(t);return r}function Kn(e,t){return Do(Oo(e,t,rc),e+"")}function Hn(e){return Hr(qa(e))}function Gn(e,t){var r=qa(e);return Ro(r,on(t,0,r.length))}function Wn(e,t,r,n){if(!Xs(e))return e;for(var o=-1,s=(t=yi(t,e)).length,a=s-1,c=e;null!=c&&++o<s;){var u=$o(t[o]),l=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(o!=a){var h=c[u];(l=n?n(h,u,c):i)===i&&(l=Xs(h)?h:yo(t[o+1])?[]:{})}Zr(c,u,l),c=c[u]}return e}var Jn=kr?function(e,t){return kr.set(e,t),e}:rc,Zn=et?function(e,t){return et(e,"toString",{configurable:!0,enumerable:!1,value:Xa(t),writable:!0})}:rc;function Xn(e){return Ro(qa(e))}function ei(e,t,r){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var s=n(o);++i<o;)s[i]=e[i+t];return s}function ti(e,t){var r;return ln(e,(function(e,n,i){return!(r=t(e,n,i))})),!!r}function ri(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var o=n+i>>>1,s=e[o];null!==s&&!aa(s)&&(r?s<=t:s<t)?n=o+1:i=o}return i}return ni(e,t,rc,r)}function ni(e,t,r,n){var o=0,s=null==e?0:e.length;if(0===s)return 0;for(var a=(t=r(t))!=t,c=null===t,u=aa(t),l=t===i;o<s;){var h=dt((o+s)/2),f=r(e[h]),d=f!==i,p=null===f,m=f==f,y=aa(f);if(a)var v=n||m;else v=l?m&&(n||d):c?m&&d&&(n||!p):u?m&&d&&!p&&(n||!y):!p&&!y&&(n?f<=t:f<t);v?o=h+1:s=h}return yr(s,4294967294)}function ii(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r],a=t?t(s):s;if(!r||!qs(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function oi(e){return"number"==typeof e?e:aa(e)?f:+e}function si(e){if("string"==typeof e)return e;if(Us(e))return xt(e,si)+"";if(aa(e))return $r?$r.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ai(e,t,r){var n=-1,i=Dt,o=e.length,s=!0,a=[],c=a;if(r)s=!1,i=At;else if(o>=200){var u=t?null:Yi(e);if(u)return ar(u);s=!1,i=Jt,c=new zr}else c=t?[]:a;e:for(;++n<o;){var l=e[n],h=t?t(l):l;if(l=r||0!==l?l:0,s&&h==h){for(var f=c.length;f--;)if(c[f]===h)continue e;t&&c.push(h),a.push(l)}else i(c,h,r)||(c!==a&&c.push(h),a.push(l))}return a}function ci(e,t){return null==(e=Io(e,t=yi(t,e)))||delete e[$o(Go(t))]}function ui(e,t,r,n){return Wn(e,t,r(wn(e,t)),n)}function li(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?ei(e,n?0:o,n?o+1:i):ei(e,n?o+1:0,n?i:o)}function hi(e,t){var r=e;return r instanceof Vr&&(r=r.value()),Pt(t,(function(e,t){return t.func.apply(t.thisArg,Rt([e],t.args))}),r)}function fi(e,t,r){var i=e.length;if(i<2)return i?ai(e[0]):[];for(var o=-1,s=n(i);++o<i;)for(var a=e[o],c=-1;++c<i;)c!=o&&(s[o]=un(s[o]||a,e[c],t,r));return ai(mn(s,1),t,r)}function di(e,t,r){for(var n=-1,o=e.length,s=t.length,a={};++n<o;){var c=n<s?t[n]:i;r(a,e[n],c)}return a}function pi(e){return Ys(e)?e:[]}function mi(e){return"function"==typeof e?e:rc}function yi(e,t){return Us(e)?e:go(e,t)?[e]:jo(va(e))}var vi=Kn;function gi(e,t,r){var n=e.length;return r=r===i?n:r,!t&&r>=n?e:ei(e,t,r)}var bi=st||function(e){return ht.clearTimeout(e)};function _i(e,t){if(t)return e.slice();var r=e.length,n=Ue?Ue(r):new e.constructor(r);return e.copy(n),n}function wi(e){var t=new e.constructor(e.byteLength);return new Qe(t).set(new Qe(e)),t}function Ei(e,t){var r=t?wi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Si(e,t){if(e!==t){var r=e!==i,n=null===e,o=e==e,s=aa(e),a=t!==i,c=null===t,u=t==t,l=aa(t);if(!c&&!l&&!s&&e>t||s&&a&&u&&!c&&!l||n&&a&&u||!r&&u||!o)return 1;if(!n&&!s&&!l&&e<t||l&&r&&o&&!n&&!s||c&&r&&o||!a&&o||!u)return-1}return 0}function Oi(e,t,r,i){for(var o=-1,s=e.length,a=r.length,c=-1,u=t.length,l=mr(s-a,0),h=n(u+l),f=!i;++c<u;)h[c]=t[c];for(;++o<a;)(f||o<s)&&(h[r[o]]=e[o]);for(;l--;)h[c++]=e[o++];return h}function Ii(e,t,r,i){for(var o=-1,s=e.length,a=-1,c=r.length,u=-1,l=t.length,h=mr(s-c,0),f=n(h+l),d=!i;++o<h;)f[o]=e[o];for(var p=o;++u<l;)f[p+u]=t[u];for(;++a<c;)(d||o<s)&&(f[p+r[a]]=e[o++]);return f}function Ti(e,t){var r=-1,i=e.length;for(t||(t=n(i));++r<i;)t[r]=e[r];return t}function ki(e,t,r,n){var o=!r;r||(r={});for(var s=-1,a=t.length;++s<a;){var c=t[s],u=n?n(r[c],e[c],c,r,e):i;u===i&&(u=e[c]),o?rn(r,c,u):Zr(r,c,u)}return r}function Ni(e,t){return function(r,n){var i=Us(r)?Ot:en,o=t?t():{};return i(r,e,oo(n,2),o)}}function Di(e){return Kn((function(t,r){var n=-1,o=r.length,s=o>1?r[o-1]:i,a=o>2?r[2]:i;for(s=e.length>3&&"function"==typeof s?(o--,s):i,a&&vo(r[0],r[1],a)&&(s=o<3?i:s,o=1),t=Oe(t);++n<o;){var c=r[n];c&&e(t,c,n,s)}return t}))}function Ai(e,t){return function(r,n){if(null==r)return r;if(!zs(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Oe(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function xi(e){return function(t,r,n){for(var i=-1,o=Oe(t),s=n(t),a=s.length;a--;){var c=s[e?a:++i];if(!1===r(o[c],c,o))break}return t}}function Ri(e){return function(t){var r=nr(t=va(t))?lr(t):i,n=r?r[0]:t.charAt(0),o=r?gi(r,1).join(""):t.slice(1);return n[e]()+o}}function Pi(e){return function(t){return Pt(Wa(Qa(t).replace(We,"")),e,"")}}function Ci(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Fr(e.prototype),n=e.apply(r,t);return Xs(n)?n:r}}function ji(e){return function(t,r,n){var o=Oe(t);if(!zs(t)){var s=oo(r,3);t=Aa(t),r=function(e){return s(o[e],e,o)}}var a=e(t,r,n);return a>-1?o[s?t[a]:a]:i}}function $i(e){return Xi((function(t){var r=t.length,n=r,s=Lr.prototype.thru;for(e&&t.reverse();n--;){var a=t[n];if("function"!=typeof a)throw new ke(o);if(s&&!c&&"wrapper"==no(a))var c=new Lr([],!0)}for(n=c?n:r;++n<r;){var u=no(a=t[n]),l="wrapper"==u?ro(a):i;c=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[no(l[0])].apply(c,l[3]):1==a.length&&bo(a)?c[u]():c.thru(a)}return function(){var e=arguments,n=e[0];if(c&&1==e.length&&Us(n))return c.plant(n).value();for(var i=0,o=r?t[i].apply(this,e):n;++i<r;)o=t[i].call(this,o);return o}}))}function Mi(e,t,r,o,s,a,c,l,h,f){var d=t&u,p=1&t,m=2&t,y=24&t,v=512&t,g=m?i:Ci(e);return function u(){for(var b=arguments.length,_=n(b),w=b;w--;)_[w]=arguments[w];if(y)var E=io(u),S=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(_,E);if(o&&(_=Oi(_,o,s,y)),a&&(_=Ii(_,a,c,y)),b-=S,y&&b<f){var O=sr(_,E);return Bi(e,t,Mi,u.placeholder,r,_,O,l,h,f-b)}var I=p?r:this,T=m?I[e]:e;return b=_.length,l?_=function(e,t){for(var r=e.length,n=yr(t.length,r),o=Ti(e);n--;){var s=t[n];e[n]=yo(s,r)?o[s]:i}return e}(_,l):v&&b>1&&_.reverse(),d&&h<b&&(_.length=h),this&&this!==ht&&this instanceof u&&(T=g||Ci(T)),T.apply(I,_)}}function Fi(e,t){return function(r,n){return function(e,t,r,n){return gn(e,(function(e,i,o){t(n,r(e),i,o)})),n}(r,e,t(n),{})}}function qi(e,t){return function(r,n){var o;if(r===i&&n===i)return t;if(r!==i&&(o=r),n!==i){if(o===i)return n;"string"==typeof r||"string"==typeof n?(r=si(r),n=si(n)):(r=oi(r),n=oi(n)),o=e(r,n)}return o}}function Li(e){return Xi((function(t){return t=xt(t,Gt(oo())),Kn((function(r){var n=this;return e(t,(function(e){return St(e,n,r)}))}))}))}function Vi(e,t){var r=(t=t===i?" ":si(t)).length;if(r<2)return r?Yn(t,e):t;var n=Yn(t,ft(e/ur(t)));return nr(t)?gi(lr(n),0,e).join(""):n.slice(0,e)}function Qi(e){return function(t,r,o){return o&&"number"!=typeof o&&vo(t,r,o)&&(r=o=i),t=fa(t),r===i?(r=t,t=0):r=fa(r),function(e,t,r,i){for(var o=-1,s=mr(ft((t-e)/(r||1)),0),a=n(s);s--;)a[i?s:++o]=e,e+=r;return a}(t,r,o=o===i?t<r?1:-1:fa(o),e)}}function Ui(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=ma(t),r=ma(r)),e(t,r)}}function Bi(e,t,r,n,o,s,a,u,l,h){var f=8&t;t|=f?c:64,4&(t&=~(f?64:c))||(t&=-4);var d=[e,t,o,f?s:i,f?a:i,f?i:s,f?i:a,u,l,h],p=r.apply(i,d);return bo(e)&&ko(p,d),p.placeholder=n,Ao(p,e,t)}function zi(e){var t=Se[e];return function(e,r){if(e=ma(e),(r=null==r?0:yr(da(r),292))&&$t(e)){var n=(va(e)+"e").split("e");return+((n=(va(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Yi=Or&&1/ar(new Or([,-0]))[1]==l?function(e){return new Or(e)}:ac;function Ki(e){return function(t){var r=ho(t);return r==E?ir(t):r==k?cr(t):function(e,t){return xt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Hi(e,t,r,s,l,h,f,d){var p=2&t;if(!p&&"function"!=typeof e)throw new ke(o);var m=s?s.length:0;if(m||(t&=-97,s=l=i),f=f===i?f:mr(da(f),0),d=d===i?d:da(d),m-=l?l.length:0,64&t){var y=s,v=l;s=l=i}var g=p?i:ro(e),b=[e,t,r,s,l,y,v,h,f,d];if(g&&function(e,t){var r=e[1],n=t[1],i=r|n,o=i<131,s=n==u&&8==r||n==u&&256==r&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!o&&!s)return e;1&n&&(e[2]=t[2],i|=1&r?0:4);var c=t[3];if(c){var l=e[3];e[3]=l?Oi(l,c,t[4]):c,e[4]=l?sr(e[3],a):t[4]}(c=t[5])&&(l=e[5],e[5]=l?Ii(l,c,t[6]):c,e[6]=l?sr(e[5],a):t[6]),(c=t[7])&&(e[7]=c),n&u&&(e[8]=null==e[8]?t[8]:yr(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(b,g),e=b[0],t=b[1],r=b[2],s=b[3],l=b[4],!(d=b[9]=b[9]===i?p?0:e.length:mr(b[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,r){var o=Ci(e);return function s(){for(var a=arguments.length,c=n(a),u=a,l=io(s);u--;)c[u]=arguments[u];var h=a<3&&c[0]!==l&&c[a-1]!==l?[]:sr(c,l);return(a-=h.length)<r?Bi(e,t,Mi,s.placeholder,i,c,h,i,i,r-a):St(this&&this!==ht&&this instanceof s?o:e,this,c)}}(e,t,d):t!=c&&33!=t||l.length?Mi.apply(i,b):function(e,t,r,i){var o=1&t,s=Ci(e);return function t(){for(var a=-1,c=arguments.length,u=-1,l=i.length,h=n(l+c),f=this&&this!==ht&&this instanceof t?s:e;++u<l;)h[u]=i[u];for(;c--;)h[u++]=arguments[++a];return St(f,o?r:this,h)}}(e,t,r,s);else var _=function(e,t,r){var n=1&t,i=Ci(e);return function t(){return(this&&this!==ht&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,r);return Ao((g?Jn:ko)(_,b),e,t)}function Gi(e,t,r,n){return e===i||qs(e,Ae[r])&&!Pe.call(n,r)?t:e}function Wi(e,t,r,n,o,s){return Xs(e)&&Xs(t)&&(s.set(t,e),qn(e,t,i,Wi,s),s.delete(t)),e}function Ji(e){return na(e)?i:e}function Zi(e,t,r,n,o,s){var a=1&r,c=e.length,u=t.length;if(c!=u&&!(a&&u>c))return!1;var l=s.get(e),h=s.get(t);if(l&&h)return l==t&&h==e;var f=-1,d=!0,p=2&r?new zr:i;for(s.set(e,t),s.set(t,e);++f<c;){var m=e[f],y=t[f];if(n)var v=a?n(y,m,f,t,e,s):n(m,y,f,e,t,s);if(v!==i){if(v)continue;d=!1;break}if(p){if(!jt(t,(function(e,t){if(!Jt(p,t)&&(m===e||o(m,e,r,n,s)))return p.push(t)}))){d=!1;break}}else if(m!==y&&!o(m,y,r,n,s)){d=!1;break}}return s.delete(e),s.delete(t),d}function Xi(e){return Do(Oo(e,i,Bo),e+"")}function eo(e){return En(e,Aa,uo)}function to(e){return En(e,xa,lo)}var ro=kr?function(e){return kr.get(e)}:ac;function no(e){for(var t=e.name+"",r=Nr[t],n=Pe.call(Nr,t)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function io(e){return(Pe.call(Mr,"placeholder")?Mr:e).placeholder}function oo(){var e=Mr.iteratee||nc;return e=e===nc?Pn:e,arguments.length?e(arguments[0],arguments[1]):e}function so(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function ao(e){for(var t=Aa(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Eo(i)]}return t}function co(e,t){var r=function(e,t){return null==e?i:e[t]}(e,t);return Rn(r)?r:i}var uo=mt?function(e){return null==e?[]:(e=Oe(e),Nt(mt(e),(function(t){return Ye.call(e,t)})))}:pc,lo=mt?function(e){for(var t=[];e;)Rt(t,uo(e)),e=Be(e);return t}:pc,ho=Sn;function fo(e,t,r){for(var n=-1,i=(t=yi(t,e)).length,o=!1;++n<i;){var s=$o(t[n]);if(!(o=null!=e&&r(e,s)))break;e=e[s]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&Zs(i)&&yo(s,i)&&(Us(e)||Qs(e))}function po(e){return"function"!=typeof e.constructor||wo(e)?{}:Fr(Be(e))}function mo(e){return Us(e)||Qs(e)||!!(He&&e&&e[He])}function yo(e,t){var r=typeof e;return!!(t=null==t?h:t)&&("number"==r||"symbol"!=r&&ve.test(e))&&e>-1&&e%1==0&&e<t}function vo(e,t,r){if(!Xs(r))return!1;var n=typeof t;return!!("number"==n?zs(r)&&yo(t,r.length):"string"==n&&t in r)&&qs(r[t],e)}function go(e,t){if(Us(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!aa(e))||X.test(e)||!Z.test(e)||null!=t&&e in Oe(t)}function bo(e){var t=no(e),r=Mr[t];if("function"!=typeof r||!(t in Vr.prototype))return!1;if(e===r)return!0;var n=ro(r);return!!n&&e===n[0]}(wr&&ho(new wr(new ArrayBuffer(1)))!=R||Er&&ho(new Er)!=E||Sr&&ho(Sr.resolve())!=I||Or&&ho(new Or)!=k||Ir&&ho(new Ir)!=A)&&(ho=function(e){var t=Sn(e),r=t==O?e.constructor:i,n=r?Mo(r):"";if(n)switch(n){case Dr:return R;case Ar:return E;case xr:return I;case Rr:return k;case Pr:return A}return t});var _o=xe?Ws:mc;function wo(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ae)}function Eo(e){return e==e&&!Xs(e)}function So(e,t){return function(r){return null!=r&&r[e]===t&&(t!==i||e in Oe(r))}}function Oo(e,t,r){return t=mr(t===i?e.length-1:t,0),function(){for(var i=arguments,o=-1,s=mr(i.length-t,0),a=n(s);++o<s;)a[o]=i[t+o];o=-1;for(var c=n(t+1);++o<t;)c[o]=i[o];return c[t]=r(a),St(e,this,c)}}function Io(e,t){return t.length<2?e:wn(e,ei(t,0,-1))}function To(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var ko=xo(Jn),No=lt||function(e,t){return ht.setTimeout(e,t)},Do=xo(Zn);function Ao(e,t,r){var n=t+"";return Do(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return It(p,(function(r){var n="_."+r[0];t&r[1]&&!Dt(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(ae):[]}(n),r)))}function xo(e){var t=0,r=0;return function(){var n=vr(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Ro(e,t){var r=-1,n=e.length,o=n-1;for(t=t===i?n:t;++r<t;){var s=zn(r,o),a=e[s];e[s]=e[r],e[r]=a}return e.length=t,e}var Po,Co,jo=(Po=Ps((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,r,n,i){t.push(n?i.replace(le,"$1"):r||e)})),t}),(function(e){return 500===Co.size&&Co.clear(),e})),Co=Po.cache,Po);function $o(e){if("string"==typeof e||aa(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Mo(e){if(null!=e){try{return Re.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Fo(e){if(e instanceof Vr)return e.clone();var t=new Lr(e.__wrapped__,e.__chain__);return t.__actions__=Ti(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var qo=Kn((function(e,t){return Ys(e)?un(e,mn(t,1,Ys,!0)):[]})),Lo=Kn((function(e,t){var r=Go(t);return Ys(r)&&(r=i),Ys(e)?un(e,mn(t,1,Ys,!0),oo(r,2)):[]})),Vo=Kn((function(e,t){var r=Go(t);return Ys(r)&&(r=i),Ys(e)?un(e,mn(t,1,Ys,!0),i,r):[]}));function Qo(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:da(r);return i<0&&(i=mr(n+i,0)),Ft(e,oo(t,3),i)}function Uo(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=n-1;return r!==i&&(o=da(r),o=r<0?mr(n+o,0):yr(o,n-1)),Ft(e,oo(t,3),o,!0)}function Bo(e){return null!=e&&e.length?mn(e,1):[]}function zo(e){return e&&e.length?e[0]:i}var Yo=Kn((function(e){var t=xt(e,pi);return t.length&&t[0]===e[0]?kn(t):[]})),Ko=Kn((function(e){var t=Go(e),r=xt(e,pi);return t===Go(r)?t=i:r.pop(),r.length&&r[0]===e[0]?kn(r,oo(t,2)):[]})),Ho=Kn((function(e){var t=Go(e),r=xt(e,pi);return(t="function"==typeof t?t:i)&&r.pop(),r.length&&r[0]===e[0]?kn(r,i,t):[]}));function Go(e){var t=null==e?0:e.length;return t?e[t-1]:i}var Wo=Kn(Jo);function Jo(e,t){return e&&e.length&&t&&t.length?Un(e,t):e}var Zo=Xi((function(e,t){var r=null==e?0:e.length,n=nn(e,t);return Bn(e,xt(t,(function(e){return yo(e,r)?+e:e})).sort(Si)),n}));function Xo(e){return null==e?e:_r.call(e)}var es=Kn((function(e){return ai(mn(e,1,Ys,!0))})),ts=Kn((function(e){var t=Go(e);return Ys(t)&&(t=i),ai(mn(e,1,Ys,!0),oo(t,2))})),rs=Kn((function(e){var t=Go(e);return t="function"==typeof t?t:i,ai(mn(e,1,Ys,!0),i,t)}));function ns(e){if(!e||!e.length)return[];var t=0;return e=Nt(e,(function(e){if(Ys(e))return t=mr(e.length,t),!0})),Kt(t,(function(t){return xt(e,Ut(t))}))}function is(e,t){if(!e||!e.length)return[];var r=ns(e);return null==t?r:xt(r,(function(e){return St(t,i,e)}))}var os=Kn((function(e,t){return Ys(e)?un(e,t):[]})),ss=Kn((function(e){return fi(Nt(e,Ys))})),as=Kn((function(e){var t=Go(e);return Ys(t)&&(t=i),fi(Nt(e,Ys),oo(t,2))})),cs=Kn((function(e){var t=Go(e);return t="function"==typeof t?t:i,fi(Nt(e,Ys),i,t)})),us=Kn(ns),ls=Kn((function(e){var t=e.length,r=t>1?e[t-1]:i;return r="function"==typeof r?(e.pop(),r):i,is(e,r)}));function hs(e){var t=Mr(e);return t.__chain__=!0,t}function fs(e,t){return t(e)}var ds=Xi((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,o=function(t){return nn(t,e)};return!(t>1||this.__actions__.length)&&n instanceof Vr&&yo(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new Lr(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ps=Ni((function(e,t,r){Pe.call(e,r)?++e[r]:rn(e,r,1)})),ms=ji(Qo),ys=ji(Uo);function vs(e,t){return(Us(e)?It:ln)(e,oo(t,3))}function gs(e,t){return(Us(e)?Tt:hn)(e,oo(t,3))}var bs=Ni((function(e,t,r){Pe.call(e,r)?e[r].push(t):rn(e,r,[t])})),_s=Kn((function(e,t,r){var i=-1,o="function"==typeof t,s=zs(e)?n(e.length):[];return ln(e,(function(e){s[++i]=o?St(t,e,r):Nn(e,t,r)})),s})),ws=Ni((function(e,t,r){rn(e,r,t)}));function Es(e,t){return(Us(e)?xt:$n)(e,oo(t,3))}var Ss=Ni((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),Os=Kn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&vo(e,t[0],t[1])?t=[]:r>2&&vo(t[0],t[1],t[2])&&(t=[t[0]]),Vn(e,mn(t,1),[])})),Is=ut||function(){return ht.Date.now()};function Ts(e,t,r){return t=r?i:t,t=e&&null==t?e.length:t,Hi(e,u,i,i,i,i,t)}function ks(e,t){var r;if("function"!=typeof t)throw new ke(o);return e=da(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=i),r}}var Ns=Kn((function(e,t,r){var n=1;if(r.length){var i=sr(r,io(Ns));n|=c}return Hi(e,n,t,r,i)})),Ds=Kn((function(e,t,r){var n=3;if(r.length){var i=sr(r,io(Ds));n|=c}return Hi(t,n,e,r,i)}));function As(e,t,r){var n,s,a,c,u,l,h=0,f=!1,d=!1,p=!0;if("function"!=typeof e)throw new ke(o);function m(t){var r=n,o=s;return n=s=i,h=t,c=e.apply(o,r)}function y(e){var r=e-l;return l===i||r>=t||r<0||d&&e-h>=a}function v(){var e=Is();if(y(e))return g(e);u=No(v,function(e){var r=t-(e-l);return d?yr(r,a-(e-h)):r}(e))}function g(e){return u=i,p&&n?m(e):(n=s=i,c)}function b(){var e=Is(),r=y(e);if(n=arguments,s=this,l=e,r){if(u===i)return function(e){return h=e,u=No(v,t),f?m(e):c}(l);if(d)return bi(u),u=No(v,t),m(l)}return u===i&&(u=No(v,t)),c}return t=ma(t)||0,Xs(r)&&(f=!!r.leading,a=(d="maxWait"in r)?mr(ma(r.maxWait)||0,t):a,p="trailing"in r?!!r.trailing:p),b.cancel=function(){u!==i&&bi(u),h=0,n=l=s=u=i},b.flush=function(){return u===i?c:g(Is())},b}var xs=Kn((function(e,t){return cn(e,1,t)})),Rs=Kn((function(e,t,r){return cn(e,ma(t)||0,r)}));function Ps(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ke(o);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Ps.Cache||Br),r}function Cs(e){if("function"!=typeof e)throw new ke(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ps.Cache=Br;var js=vi((function(e,t){var r=(t=1==t.length&&Us(t[0])?xt(t[0],Gt(oo())):xt(mn(t,1),Gt(oo()))).length;return Kn((function(n){for(var i=-1,o=yr(n.length,r);++i<o;)n[i]=t[i].call(this,n[i]);return St(e,this,n)}))})),$s=Kn((function(e,t){var r=sr(t,io($s));return Hi(e,c,i,t,r)})),Ms=Kn((function(e,t){var r=sr(t,io(Ms));return Hi(e,64,i,t,r)})),Fs=Xi((function(e,t){return Hi(e,256,i,i,i,t)}));function qs(e,t){return e===t||e!=e&&t!=t}var Ls=Ui(On),Vs=Ui((function(e,t){return e>=t})),Qs=Dn(function(){return arguments}())?Dn:function(e){return ea(e)&&Pe.call(e,"callee")&&!Ye.call(e,"callee")},Us=n.isArray,Bs=vt?Gt(vt):function(e){return ea(e)&&Sn(e)==x};function zs(e){return null!=e&&Zs(e.length)&&!Ws(e)}function Ys(e){return ea(e)&&zs(e)}var Ks=yt||mc,Hs=gt?Gt(gt):function(e){return ea(e)&&Sn(e)==g};function Gs(e){if(!ea(e))return!1;var t=Sn(e);return t==b||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!na(e)}function Ws(e){if(!Xs(e))return!1;var t=Sn(e);return t==_||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Js(e){return"number"==typeof e&&e==da(e)}function Zs(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function Xs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ea(e){return null!=e&&"object"==typeof e}var ta=bt?Gt(bt):function(e){return ea(e)&&ho(e)==E};function ra(e){return"number"==typeof e||ea(e)&&Sn(e)==S}function na(e){if(!ea(e)||Sn(e)!=O)return!1;var t=Be(e);if(null===t)return!0;var r=Pe.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Re.call(r)==Me}var ia=_t?Gt(_t):function(e){return ea(e)&&Sn(e)==T},oa=wt?Gt(wt):function(e){return ea(e)&&ho(e)==k};function sa(e){return"string"==typeof e||!Us(e)&&ea(e)&&Sn(e)==N}function aa(e){return"symbol"==typeof e||ea(e)&&Sn(e)==D}var ca=Et?Gt(Et):function(e){return ea(e)&&Zs(e.length)&&!!it[Sn(e)]},ua=Ui(jn),la=Ui((function(e,t){return e<=t}));function ha(e){if(!e)return[];if(zs(e))return sa(e)?lr(e):Ti(e);if(Ge&&e[Ge])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Ge]());var t=ho(e);return(t==E?ir:t==k?ar:qa)(e)}function fa(e){return e?(e=ma(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function da(e){var t=fa(e),r=t%1;return t==t?r?t-r:t:0}function pa(e){return e?on(da(e),0,d):0}function ma(e){if("number"==typeof e)return e;if(aa(e))return f;if(Xs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ht(e);var r=pe.test(e);return r||ye.test(e)?ct(e.slice(2),r?2:8):de.test(e)?f:+e}function ya(e){return ki(e,xa(e))}function va(e){return null==e?"":si(e)}var ga=Di((function(e,t){if(wo(t)||zs(t))ki(t,Aa(t),e);else for(var r in t)Pe.call(t,r)&&Zr(e,r,t[r])})),ba=Di((function(e,t){ki(t,xa(t),e)})),_a=Di((function(e,t,r,n){ki(t,xa(t),e,n)})),wa=Di((function(e,t,r,n){ki(t,Aa(t),e,n)})),Ea=Xi(nn),Sa=Kn((function(e,t){e=Oe(e);var r=-1,n=t.length,o=n>2?t[2]:i;for(o&&vo(t[0],t[1],o)&&(n=1);++r<n;)for(var s=t[r],a=xa(s),c=-1,u=a.length;++c<u;){var l=a[c],h=e[l];(h===i||qs(h,Ae[l])&&!Pe.call(e,l))&&(e[l]=s[l])}return e})),Oa=Kn((function(e){return e.push(i,Wi),St(Pa,i,e)}));function Ia(e,t,r){var n=null==e?i:wn(e,t);return n===i?r:n}function Ta(e,t){return null!=e&&fo(e,t,Tn)}var ka=Fi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=$e.call(t)),e[t]=r}),Xa(rc)),Na=Fi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=$e.call(t)),Pe.call(e,t)?e[t].push(r):e[t]=[r]}),oo),Da=Kn(Nn);function Aa(e){return zs(e)?Kr(e):Cn(e)}function xa(e){return zs(e)?Kr(e,!0):function(e){if(!Xs(e))return function(e){var t=[];if(null!=e)for(var r in Oe(e))t.push(r);return t}(e);var t=wo(e),r=[];for(var n in e)("constructor"!=n||!t&&Pe.call(e,n))&&r.push(n);return r}(e)}var Ra=Di((function(e,t,r){qn(e,t,r)})),Pa=Di((function(e,t,r,n){qn(e,t,r,n)})),Ca=Xi((function(e,t){var r={};if(null==e)return r;var n=!1;t=xt(t,(function(t){return t=yi(t,e),n||(n=t.length>1),t})),ki(e,to(e),r),n&&(r=sn(r,7,Ji));for(var i=t.length;i--;)ci(r,t[i]);return r})),ja=Xi((function(e,t){return null==e?{}:function(e,t){return Qn(e,t,(function(t,r){return Ta(e,r)}))}(e,t)}));function $a(e,t){if(null==e)return{};var r=xt(to(e),(function(e){return[e]}));return t=oo(t),Qn(e,r,(function(e,r){return t(e,r[0])}))}var Ma=Ki(Aa),Fa=Ki(xa);function qa(e){return null==e?[]:Wt(e,Aa(e))}var La=Pi((function(e,t,r){return t=t.toLowerCase(),e+(r?Va(t):t)}));function Va(e){return Ga(va(e).toLowerCase())}function Qa(e){return(e=va(e))&&e.replace(ge,er).replace(Je,"")}var Ua=Pi((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Ba=Pi((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),za=Ri("toLowerCase"),Ya=Pi((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),Ka=Pi((function(e,t,r){return e+(r?" ":"")+Ga(t)})),Ha=Pi((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Ga=Ri("toUpperCase");function Wa(e,t,r){return e=va(e),(t=r?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.match(ce)||[]}(e):e.match(t)||[]}var Ja=Kn((function(e,t){try{return St(e,i,t)}catch(e){return Gs(e)?e:new we(e)}})),Za=Xi((function(e,t){return It(t,(function(t){t=$o(t),rn(e,t,Ns(e[t],e))})),e}));function Xa(e){return function(){return e}}var ec=$i(),tc=$i(!0);function rc(e){return e}function nc(e){return Pn("function"==typeof e?e:sn(e,1))}var ic=Kn((function(e,t){return function(r){return Nn(r,e,t)}})),oc=Kn((function(e,t){return function(r){return Nn(e,r,t)}}));function sc(e,t,r){var n=Aa(t),i=_n(t,n);null!=r||Xs(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=_n(t,Aa(t)));var o=!(Xs(r)&&"chain"in r&&!r.chain),s=Ws(e);return It(i,(function(r){var n=t[r];e[r]=n,s&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ti(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Rt([this.value()],arguments))})})),e}function ac(){}var cc=Li(xt),uc=Li(kt),lc=Li(jt);function hc(e){return go(e)?Ut($o(e)):function(e){return function(t){return wn(t,e)}}(e)}var fc=Qi(),dc=Qi(!0);function pc(){return[]}function mc(){return!1}var yc,vc=qi((function(e,t){return e+t}),0),gc=zi("ceil"),bc=qi((function(e,t){return e/t}),1),_c=zi("floor"),wc=qi((function(e,t){return e*t}),1),Ec=zi("round"),Sc=qi((function(e,t){return e-t}),0);return Mr.after=function(e,t){if("function"!=typeof t)throw new ke(o);return e=da(e),function(){if(--e<1)return t.apply(this,arguments)}},Mr.ary=Ts,Mr.assign=ga,Mr.assignIn=ba,Mr.assignInWith=_a,Mr.assignWith=wa,Mr.at=Ea,Mr.before=ks,Mr.bind=Ns,Mr.bindAll=Za,Mr.bindKey=Ds,Mr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Us(e)?e:[e]},Mr.chain=hs,Mr.chunk=function(e,t,r){t=(r?vo(e,t,r):t===i)?1:mr(da(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,a=0,c=n(ft(o/t));s<o;)c[a++]=ei(e,s,s+=t);return c},Mr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var o=e[t];o&&(i[n++]=o)}return i},Mr.concat=function(){var e=arguments.length;if(!e)return[];for(var t=n(e-1),r=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Rt(Us(r)?Ti(r):[r],mn(t,1))},Mr.cond=function(e){var t=null==e?0:e.length,r=oo();return e=t?xt(e,(function(e){if("function"!=typeof e[1])throw new ke(o);return[r(e[0]),e[1]]})):[],Kn((function(r){for(var n=-1;++n<t;){var i=e[n];if(St(i[0],this,r))return St(i[1],this,r)}}))},Mr.conforms=function(e){return function(e){var t=Aa(e);return function(r){return an(r,e,t)}}(sn(e,1))},Mr.constant=Xa,Mr.countBy=ps,Mr.create=function(e,t){var r=Fr(e);return null==t?r:tn(r,t)},Mr.curry=function e(t,r,n){var o=Hi(t,8,i,i,i,i,i,r=n?i:r);return o.placeholder=e.placeholder,o},Mr.curryRight=function e(t,r,n){var o=Hi(t,16,i,i,i,i,i,r=n?i:r);return o.placeholder=e.placeholder,o},Mr.debounce=As,Mr.defaults=Sa,Mr.defaultsDeep=Oa,Mr.defer=xs,Mr.delay=Rs,Mr.difference=qo,Mr.differenceBy=Lo,Mr.differenceWith=Vo,Mr.drop=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,(t=r||t===i?1:da(t))<0?0:t,n):[]},Mr.dropRight=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,0,(t=n-(t=r||t===i?1:da(t)))<0?0:t):[]},Mr.dropRightWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!0,!0):[]},Mr.dropWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!0):[]},Mr.fill=function(e,t,r,n){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&vo(e,t,r)&&(r=0,n=o),function(e,t,r,n){var o=e.length;for((r=da(r))<0&&(r=-r>o?0:o+r),(n=n===i||n>o?o:da(n))<0&&(n+=o),n=r>n?0:pa(n);r<n;)e[r++]=t;return e}(e,t,r,n)):[]},Mr.filter=function(e,t){return(Us(e)?Nt:pn)(e,oo(t,3))},Mr.flatMap=function(e,t){return mn(Es(e,t),1)},Mr.flatMapDeep=function(e,t){return mn(Es(e,t),l)},Mr.flatMapDepth=function(e,t,r){return r=r===i?1:da(r),mn(Es(e,t),r)},Mr.flatten=Bo,Mr.flattenDeep=function(e){return null!=e&&e.length?mn(e,l):[]},Mr.flattenDepth=function(e,t){return null!=e&&e.length?mn(e,t=t===i?1:da(t)):[]},Mr.flip=function(e){return Hi(e,512)},Mr.flow=ec,Mr.flowRight=tc,Mr.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},Mr.functions=function(e){return null==e?[]:_n(e,Aa(e))},Mr.functionsIn=function(e){return null==e?[]:_n(e,xa(e))},Mr.groupBy=bs,Mr.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Mr.intersection=Yo,Mr.intersectionBy=Ko,Mr.intersectionWith=Ho,Mr.invert=ka,Mr.invertBy=Na,Mr.invokeMap=_s,Mr.iteratee=nc,Mr.keyBy=ws,Mr.keys=Aa,Mr.keysIn=xa,Mr.map=Es,Mr.mapKeys=function(e,t){var r={};return t=oo(t,3),gn(e,(function(e,n,i){rn(r,t(e,n,i),e)})),r},Mr.mapValues=function(e,t){var r={};return t=oo(t,3),gn(e,(function(e,n,i){rn(r,n,t(e,n,i))})),r},Mr.matches=function(e){return Mn(sn(e,1))},Mr.matchesProperty=function(e,t){return Fn(e,sn(t,1))},Mr.memoize=Ps,Mr.merge=Ra,Mr.mergeWith=Pa,Mr.method=ic,Mr.methodOf=oc,Mr.mixin=sc,Mr.negate=Cs,Mr.nthArg=function(e){return e=da(e),Kn((function(t){return Ln(t,e)}))},Mr.omit=Ca,Mr.omitBy=function(e,t){return $a(e,Cs(oo(t)))},Mr.once=function(e){return ks(2,e)},Mr.orderBy=function(e,t,r,n){return null==e?[]:(Us(t)||(t=null==t?[]:[t]),Us(r=n?i:r)||(r=null==r?[]:[r]),Vn(e,t,r))},Mr.over=cc,Mr.overArgs=js,Mr.overEvery=uc,Mr.overSome=lc,Mr.partial=$s,Mr.partialRight=Ms,Mr.partition=Ss,Mr.pick=ja,Mr.pickBy=$a,Mr.property=hc,Mr.propertyOf=function(e){return function(t){return null==e?i:wn(e,t)}},Mr.pull=Wo,Mr.pullAll=Jo,Mr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?Un(e,t,oo(r,2)):e},Mr.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Un(e,t,i,r):e},Mr.pullAt=Zo,Mr.range=fc,Mr.rangeRight=dc,Mr.rearg=Fs,Mr.reject=function(e,t){return(Us(e)?Nt:pn)(e,Cs(oo(t,3)))},Mr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],o=e.length;for(t=oo(t,3);++n<o;){var s=e[n];t(s,n,e)&&(r.push(s),i.push(n))}return Bn(e,i),r},Mr.rest=function(e,t){if("function"!=typeof e)throw new ke(o);return Kn(e,t=t===i?t:da(t))},Mr.reverse=Xo,Mr.sampleSize=function(e,t,r){return t=(r?vo(e,t,r):t===i)?1:da(t),(Us(e)?Gr:Gn)(e,t)},Mr.set=function(e,t,r){return null==e?e:Wn(e,t,r)},Mr.setWith=function(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:Wn(e,t,r,n)},Mr.shuffle=function(e){return(Us(e)?Wr:Xn)(e)},Mr.slice=function(e,t,r){var n=null==e?0:e.length;return n?(r&&"number"!=typeof r&&vo(e,t,r)?(t=0,r=n):(t=null==t?0:da(t),r=r===i?n:da(r)),ei(e,t,r)):[]},Mr.sortBy=Os,Mr.sortedUniq=function(e){return e&&e.length?ii(e):[]},Mr.sortedUniqBy=function(e,t){return e&&e.length?ii(e,oo(t,2)):[]},Mr.split=function(e,t,r){return r&&"number"!=typeof r&&vo(e,t,r)&&(t=r=i),(r=r===i?d:r>>>0)?(e=va(e))&&("string"==typeof t||null!=t&&!ia(t))&&!(t=si(t))&&nr(e)?gi(lr(e),0,r):e.split(t,r):[]},Mr.spread=function(e,t){if("function"!=typeof e)throw new ke(o);return t=null==t?0:mr(da(t),0),Kn((function(r){var n=r[t],i=gi(r,0,t);return n&&Rt(i,n),St(e,this,i)}))},Mr.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Mr.take=function(e,t,r){return e&&e.length?ei(e,0,(t=r||t===i?1:da(t))<0?0:t):[]},Mr.takeRight=function(e,t,r){var n=null==e?0:e.length;return n?ei(e,(t=n-(t=r||t===i?1:da(t)))<0?0:t,n):[]},Mr.takeRightWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!1,!0):[]},Mr.takeWhile=function(e,t){return e&&e.length?li(e,oo(t,3)):[]},Mr.tap=function(e,t){return t(e),e},Mr.throttle=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new ke(o);return Xs(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),As(e,t,{leading:n,maxWait:t,trailing:i})},Mr.thru=fs,Mr.toArray=ha,Mr.toPairs=Ma,Mr.toPairsIn=Fa,Mr.toPath=function(e){return Us(e)?xt(e,$o):aa(e)?[e]:Ti(jo(va(e)))},Mr.toPlainObject=ya,Mr.transform=function(e,t,r){var n=Us(e),i=n||Ks(e)||ca(e);if(t=oo(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:Xs(e)&&Ws(o)?Fr(Be(e)):{}}return(i?It:gn)(e,(function(e,n,i){return t(r,e,n,i)})),r},Mr.unary=function(e){return Ts(e,1)},Mr.union=es,Mr.unionBy=ts,Mr.unionWith=rs,Mr.uniq=function(e){return e&&e.length?ai(e):[]},Mr.uniqBy=function(e,t){return e&&e.length?ai(e,oo(t,2)):[]},Mr.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ai(e,i,t):[]},Mr.unset=function(e,t){return null==e||ci(e,t)},Mr.unzip=ns,Mr.unzipWith=is,Mr.update=function(e,t,r){return null==e?e:ui(e,t,mi(r))},Mr.updateWith=function(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:ui(e,t,mi(r),n)},Mr.values=qa,Mr.valuesIn=function(e){return null==e?[]:Wt(e,xa(e))},Mr.without=os,Mr.words=Wa,Mr.wrap=function(e,t){return $s(mi(t),e)},Mr.xor=ss,Mr.xorBy=as,Mr.xorWith=cs,Mr.zip=us,Mr.zipObject=function(e,t){return di(e||[],t||[],Zr)},Mr.zipObjectDeep=function(e,t){return di(e||[],t||[],Wn)},Mr.zipWith=ls,Mr.entries=Ma,Mr.entriesIn=Fa,Mr.extend=ba,Mr.extendWith=_a,sc(Mr,Mr),Mr.add=vc,Mr.attempt=Ja,Mr.camelCase=La,Mr.capitalize=Va,Mr.ceil=gc,Mr.clamp=function(e,t,r){return r===i&&(r=t,t=i),r!==i&&(r=(r=ma(r))==r?r:0),t!==i&&(t=(t=ma(t))==t?t:0),on(ma(e),t,r)},Mr.clone=function(e){return sn(e,4)},Mr.cloneDeep=function(e){return sn(e,5)},Mr.cloneDeepWith=function(e,t){return sn(e,5,t="function"==typeof t?t:i)},Mr.cloneWith=function(e,t){return sn(e,4,t="function"==typeof t?t:i)},Mr.conformsTo=function(e,t){return null==t||an(e,t,Aa(t))},Mr.deburr=Qa,Mr.defaultTo=function(e,t){return null==e||e!=e?t:e},Mr.divide=bc,Mr.endsWith=function(e,t,r){e=va(e),t=si(t);var n=e.length,o=r=r===i?n:on(da(r),0,n);return(r-=t.length)>=0&&e.slice(r,o)==t},Mr.eq=qs,Mr.escape=function(e){return(e=va(e))&&H.test(e)?e.replace(Y,tr):e},Mr.escapeRegExp=function(e){return(e=va(e))&&re.test(e)?e.replace(te,"\\$&"):e},Mr.every=function(e,t,r){var n=Us(e)?kt:fn;return r&&vo(e,t,r)&&(t=i),n(e,oo(t,3))},Mr.find=ms,Mr.findIndex=Qo,Mr.findKey=function(e,t){return Mt(e,oo(t,3),gn)},Mr.findLast=ys,Mr.findLastIndex=Uo,Mr.findLastKey=function(e,t){return Mt(e,oo(t,3),bn)},Mr.floor=_c,Mr.forEach=vs,Mr.forEachRight=gs,Mr.forIn=function(e,t){return null==e?e:yn(e,oo(t,3),xa)},Mr.forInRight=function(e,t){return null==e?e:vn(e,oo(t,3),xa)},Mr.forOwn=function(e,t){return e&&gn(e,oo(t,3))},Mr.forOwnRight=function(e,t){return e&&bn(e,oo(t,3))},Mr.get=Ia,Mr.gt=Ls,Mr.gte=Vs,Mr.has=function(e,t){return null!=e&&fo(e,t,In)},Mr.hasIn=Ta,Mr.head=zo,Mr.identity=rc,Mr.includes=function(e,t,r,n){e=zs(e)?e:qa(e),r=r&&!n?da(r):0;var i=e.length;return r<0&&(r=mr(i+r,0)),sa(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&qt(e,t,r)>-1},Mr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:da(r);return i<0&&(i=mr(n+i,0)),qt(e,t,i)},Mr.inRange=function(e,t,r){return t=fa(t),r===i?(r=t,t=0):r=fa(r),function(e,t,r){return e>=yr(t,r)&&e<mr(t,r)}(e=ma(e),t,r)},Mr.invoke=Da,Mr.isArguments=Qs,Mr.isArray=Us,Mr.isArrayBuffer=Bs,Mr.isArrayLike=zs,Mr.isArrayLikeObject=Ys,Mr.isBoolean=function(e){return!0===e||!1===e||ea(e)&&Sn(e)==v},Mr.isBuffer=Ks,Mr.isDate=Hs,Mr.isElement=function(e){return ea(e)&&1===e.nodeType&&!na(e)},Mr.isEmpty=function(e){if(null==e)return!0;if(zs(e)&&(Us(e)||"string"==typeof e||"function"==typeof e.splice||Ks(e)||ca(e)||Qs(e)))return!e.length;var t=ho(e);if(t==E||t==k)return!e.size;if(wo(e))return!Cn(e).length;for(var r in e)if(Pe.call(e,r))return!1;return!0},Mr.isEqual=function(e,t){return An(e,t)},Mr.isEqualWith=function(e,t,r){var n=(r="function"==typeof r?r:i)?r(e,t):i;return n===i?An(e,t,i,r):!!n},Mr.isError=Gs,Mr.isFinite=function(e){return"number"==typeof e&&$t(e)},Mr.isFunction=Ws,Mr.isInteger=Js,Mr.isLength=Zs,Mr.isMap=ta,Mr.isMatch=function(e,t){return e===t||xn(e,t,ao(t))},Mr.isMatchWith=function(e,t,r){return r="function"==typeof r?r:i,xn(e,t,ao(t),r)},Mr.isNaN=function(e){return ra(e)&&e!=+e},Mr.isNative=function(e){if(_o(e))throw new we("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Rn(e)},Mr.isNil=function(e){return null==e},Mr.isNull=function(e){return null===e},Mr.isNumber=ra,Mr.isObject=Xs,Mr.isObjectLike=ea,Mr.isPlainObject=na,Mr.isRegExp=ia,Mr.isSafeInteger=function(e){return Js(e)&&e>=-9007199254740991&&e<=h},Mr.isSet=oa,Mr.isString=sa,Mr.isSymbol=aa,Mr.isTypedArray=ca,Mr.isUndefined=function(e){return e===i},Mr.isWeakMap=function(e){return ea(e)&&ho(e)==A},Mr.isWeakSet=function(e){return ea(e)&&"[object WeakSet]"==Sn(e)},Mr.join=function(e,t){return null==e?"":Bt.call(e,t)},Mr.kebabCase=Ua,Mr.last=Go,Mr.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=n;return r!==i&&(o=(o=da(r))<0?mr(n+o,0):yr(o,n-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):Ft(e,Vt,o,!0)},Mr.lowerCase=Ba,Mr.lowerFirst=za,Mr.lt=ua,Mr.lte=la,Mr.max=function(e){return e&&e.length?dn(e,rc,On):i},Mr.maxBy=function(e,t){return e&&e.length?dn(e,oo(t,2),On):i},Mr.mean=function(e){return Qt(e,rc)},Mr.meanBy=function(e,t){return Qt(e,oo(t,2))},Mr.min=function(e){return e&&e.length?dn(e,rc,jn):i},Mr.minBy=function(e,t){return e&&e.length?dn(e,oo(t,2),jn):i},Mr.stubArray=pc,Mr.stubFalse=mc,Mr.stubObject=function(){return{}},Mr.stubString=function(){return""},Mr.stubTrue=function(){return!0},Mr.multiply=wc,Mr.nth=function(e,t){return e&&e.length?Ln(e,da(t)):i},Mr.noConflict=function(){return ht._===this&&(ht._=Fe),this},Mr.noop=ac,Mr.now=Is,Mr.pad=function(e,t,r){e=va(e);var n=(t=da(t))?ur(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Vi(dt(i),r)+e+Vi(ft(i),r)},Mr.padEnd=function(e,t,r){e=va(e);var n=(t=da(t))?ur(e):0;return t&&n<t?e+Vi(t-n,r):e},Mr.padStart=function(e,t,r){e=va(e);var n=(t=da(t))?ur(e):0;return t&&n<t?Vi(t-n,r)+e:e},Mr.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),gr(va(e).replace(ne,""),t||0)},Mr.random=function(e,t,r){if(r&&"boolean"!=typeof r&&vo(e,t,r)&&(t=r=i),r===i&&("boolean"==typeof t?(r=t,t=i):"boolean"==typeof e&&(r=e,e=i)),e===i&&t===i?(e=0,t=1):(e=fa(e),t===i?(t=e,e=0):t=fa(t)),e>t){var n=e;e=t,t=n}if(r||e%1||t%1){var o=br();return yr(e+o*(t-e+at("1e-"+((o+"").length-1))),t)}return zn(e,t)},Mr.reduce=function(e,t,r){var n=Us(e)?Pt:zt,i=arguments.length<3;return n(e,oo(t,4),r,i,ln)},Mr.reduceRight=function(e,t,r){var n=Us(e)?Ct:zt,i=arguments.length<3;return n(e,oo(t,4),r,i,hn)},Mr.repeat=function(e,t,r){return t=(r?vo(e,t,r):t===i)?1:da(t),Yn(va(e),t)},Mr.replace=function(){var e=arguments,t=va(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Mr.result=function(e,t,r){var n=-1,o=(t=yi(t,e)).length;for(o||(o=1,e=i);++n<o;){var s=null==e?i:e[$o(t[n])];s===i&&(n=o,s=r),e=Ws(s)?s.call(e):s}return e},Mr.round=Ec,Mr.runInContext=e,Mr.sample=function(e){return(Us(e)?Hr:Hn)(e)},Mr.size=function(e){if(null==e)return 0;if(zs(e))return sa(e)?ur(e):e.length;var t=ho(e);return t==E||t==k?e.size:Cn(e).length},Mr.snakeCase=Ya,Mr.some=function(e,t,r){var n=Us(e)?jt:ti;return r&&vo(e,t,r)&&(t=i),n(e,oo(t,3))},Mr.sortedIndex=function(e,t){return ri(e,t)},Mr.sortedIndexBy=function(e,t,r){return ni(e,t,oo(r,2))},Mr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ri(e,t);if(n<r&&qs(e[n],t))return n}return-1},Mr.sortedLastIndex=function(e,t){return ri(e,t,!0)},Mr.sortedLastIndexBy=function(e,t,r){return ni(e,t,oo(r,2),!0)},Mr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ri(e,t,!0)-1;if(qs(e[r],t))return r}return-1},Mr.startCase=Ka,Mr.startsWith=function(e,t,r){return e=va(e),r=null==r?0:on(da(r),0,e.length),t=si(t),e.slice(r,r+t.length)==t},Mr.subtract=Sc,Mr.sum=function(e){return e&&e.length?Yt(e,rc):0},Mr.sumBy=function(e,t){return e&&e.length?Yt(e,oo(t,2)):0},Mr.template=function(e,t,r){var n=Mr.templateSettings;r&&vo(e,t,r)&&(t=i),e=va(e),t=_a({},t,n,Gi);var o,s,a=_a({},t.imports,n.imports,Gi),c=Aa(a),u=Wt(a,c),l=0,h=t.interpolate||be,f="__p += '",d=Ie((t.escape||be).source+"|"+h.source+"|"+(h===J?he:be).source+"|"+(t.evaluate||be).source+"|$","g"),p="//# sourceURL="+(Pe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++nt+"]")+"\n";e.replace(d,(function(t,r,n,i,a,c){return n||(n=i),f+=e.slice(l,c).replace(_e,rr),r&&(o=!0,f+="' +\n__e("+r+") +\n'"),a&&(s=!0,f+="';\n"+a+";\n__p += '"),n&&(f+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),f+="';\n";var m=Pe.call(t,"variable")&&t.variable;if(m){if(ue.test(m))throw new we("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(s?f.replace(Q,""):f).replace(U,"$1").replace(B,"$1;"),f="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var y=Ja((function(){return Ee(c,p+"return "+f).apply(i,u)}));if(y.source=f,Gs(y))throw y;return y},Mr.times=function(e,t){if((e=da(e))<1||e>h)return[];var r=d,n=yr(e,d);t=oo(t),e-=d;for(var i=Kt(n,t);++r<e;)t(r);return i},Mr.toFinite=fa,Mr.toInteger=da,Mr.toLength=pa,Mr.toLower=function(e){return va(e).toLowerCase()},Mr.toNumber=ma,Mr.toSafeInteger=function(e){return e?on(da(e),-9007199254740991,h):0===e?e:0},Mr.toString=va,Mr.toUpper=function(e){return va(e).toUpperCase()},Mr.trim=function(e,t,r){if((e=va(e))&&(r||t===i))return Ht(e);if(!e||!(t=si(t)))return e;var n=lr(e),o=lr(t);return gi(n,Zt(n,o),Xt(n,o)+1).join("")},Mr.trimEnd=function(e,t,r){if((e=va(e))&&(r||t===i))return e.slice(0,hr(e)+1);if(!e||!(t=si(t)))return e;var n=lr(e);return gi(n,0,Xt(n,lr(t))+1).join("")},Mr.trimStart=function(e,t,r){if((e=va(e))&&(r||t===i))return e.replace(ne,"");if(!e||!(t=si(t)))return e;var n=lr(e);return gi(n,Zt(n,lr(t))).join("")},Mr.truncate=function(e,t){var r=30,n="...";if(Xs(t)){var o="separator"in t?t.separator:o;r="length"in t?da(t.length):r,n="omission"in t?si(t.omission):n}var s=(e=va(e)).length;if(nr(e)){var a=lr(e);s=a.length}if(r>=s)return e;var c=r-ur(n);if(c<1)return n;var u=a?gi(a,0,c).join(""):e.slice(0,c);if(o===i)return u+n;if(a&&(c+=u.length-c),ia(o)){if(e.slice(c).search(o)){var l,h=u;for(o.global||(o=Ie(o.source,va(fe.exec(o))+"g")),o.lastIndex=0;l=o.exec(h);)var f=l.index;u=u.slice(0,f===i?c:f)}}else if(e.indexOf(si(o),c)!=c){var d=u.lastIndexOf(o);d>-1&&(u=u.slice(0,d))}return u+n},Mr.unescape=function(e){return(e=va(e))&&K.test(e)?e.replace(z,fr):e},Mr.uniqueId=function(e){var t=++Ce;return va(e)+t},Mr.upperCase=Ha,Mr.upperFirst=Ga,Mr.each=vs,Mr.eachRight=gs,Mr.first=zo,sc(Mr,(yc={},gn(Mr,(function(e,t){Pe.call(Mr.prototype,t)||(yc[t]=e)})),yc),{chain:!1}),Mr.VERSION="4.17.21",It(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Mr[e].placeholder=Mr})),It(["drop","take"],(function(e,t){Vr.prototype[e]=function(r){r=r===i?1:mr(da(r),0);var n=this.__filtered__&&!t?new Vr(this):this.clone();return n.__filtered__?n.__takeCount__=yr(r,n.__takeCount__):n.__views__.push({size:yr(r,d),type:e+(n.__dir__<0?"Right":"")}),n},Vr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),It(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;Vr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),It(["head","last"],(function(e,t){var r="take"+(t?"Right":"");Vr.prototype[e]=function(){return this[r](1).value()[0]}})),It(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");Vr.prototype[e]=function(){return this.__filtered__?new Vr(this):this[r](1)}})),Vr.prototype.compact=function(){return this.filter(rc)},Vr.prototype.find=function(e){return this.filter(e).head()},Vr.prototype.findLast=function(e){return this.reverse().find(e)},Vr.prototype.invokeMap=Kn((function(e,t){return"function"==typeof e?new Vr(this):this.map((function(r){return Nn(r,e,t)}))})),Vr.prototype.reject=function(e){return this.filter(Cs(oo(e)))},Vr.prototype.slice=function(e,t){e=da(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Vr(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==i&&(r=(t=da(t))<0?r.dropRight(-t):r.take(t-e)),r)},Vr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vr.prototype.toArray=function(){return this.take(d)},gn(Vr.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),o=Mr[n?"take"+("last"==t?"Right":""):t],s=n||/^find/.test(t);o&&(Mr.prototype[t]=function(){var t=this.__wrapped__,a=n?[1]:arguments,c=t instanceof Vr,u=a[0],l=c||Us(t),h=function(e){var t=o.apply(Mr,Rt([e],a));return n&&f?t[0]:t};l&&r&&"function"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,d=!!this.__actions__.length,p=s&&!f,m=c&&!d;if(!s&&l){t=m?t:new Vr(this);var y=e.apply(t,a);return y.__actions__.push({func:fs,args:[h],thisArg:i}),new Lr(y,f)}return p&&m?e.apply(this,a):(y=this.thru(h),p?n?y.value()[0]:y.value():y)})})),It(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ne[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Mr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Us(i)?i:[],e)}return this[r]((function(r){return t.apply(Us(r)?r:[],e)}))}})),gn(Vr.prototype,(function(e,t){var r=Mr[t];if(r){var n=r.name+"";Pe.call(Nr,n)||(Nr[n]=[]),Nr[n].push({name:t,func:r})}})),Nr[Mi(i,2).name]=[{name:"wrapper",func:i}],Vr.prototype.clone=function(){var e=new Vr(this.__wrapped__);return e.__actions__=Ti(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ti(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ti(this.__views__),e},Vr.prototype.reverse=function(){if(this.__filtered__){var e=new Vr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Us(e),n=t<0,i=r?e.length:0,o=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],s=o.size;switch(o.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=yr(t,e+s);break;case"takeRight":e=mr(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,u=n?a:s-1,l=this.__iteratees__,h=l.length,f=0,d=yr(c,this.__takeCount__);if(!r||!n&&i==c&&d==c)return hi(e,this.__actions__);var p=[];e:for(;c--&&f<d;){for(var m=-1,y=e[u+=t];++m<h;){var v=l[m],g=v.iteratee,b=v.type,_=g(y);if(2==b)y=_;else if(!_){if(1==b)continue e;break e}}p[f++]=y}return p},Mr.prototype.at=ds,Mr.prototype.chain=function(){return hs(this)},Mr.prototype.commit=function(){return new Lr(this.value(),this.__chain__)},Mr.prototype.next=function(){this.__values__===i&&(this.__values__=ha(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Mr.prototype.plant=function(e){for(var t,r=this;r instanceof qr;){var n=Fo(r);n.__index__=0,n.__values__=i,t?o.__wrapped__=n:t=n;var o=n;r=r.__wrapped__}return o.__wrapped__=e,t},Mr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vr){var t=e;return this.__actions__.length&&(t=new Vr(this)),(t=t.reverse()).__actions__.push({func:fs,args:[Xo],thisArg:i}),new Lr(t,this.__chain__)}return this.thru(Xo)},Mr.prototype.toJSON=Mr.prototype.valueOf=Mr.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Mr.prototype.first=Mr.prototype.head,Ge&&(Mr.prototype[Ge]=function(){return this}),Mr}();ht._=dr,(n=function(){return dr}.call(t,r,t,e))===i||(e.exports=n)}.call(this)},2371:function(e,t){!function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length>1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,i=1;i<n;++i)t[i]=t[i].slice(1,-1);return t[n]=t[n].slice(1),t.join("")}return t[0]}function r(e){return"(?:"+e+")"}function n(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function i(e){return e.toUpperCase()}function o(e){var n="[A-Za-z]",i="[0-9]",o=t(i,"[A-Fa-f]"),s=r(r("%[EFef]"+o+"%"+o+o+"%"+o+o)+"|"+r("%[89A-Fa-f]"+o+"%"+o+o)+"|"+r("%"+o+o)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",c=t("[\\:\\/\\?\\#\\[\\]\\@]",a),u=e?"[\\uE000-\\uF8FF]":"[]",l=t(n,i,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),h=r(n+t(n,i,"[\\+\\-\\.]")+"*"),f=r(r(s+"|"+t(l,a,"[\\:]"))+"*"),d=(r(r("25[0-5]")+"|"+r("2[0-4]"+i)+"|"+r("1"+i+i)+"|"+r("[1-9]"+i)+"|"+i),r(r("25[0-5]")+"|"+r("2[0-4]"+i)+"|"+r("1"+i+i)+"|"+r("0?[1-9]"+i)+"|0?0?"+i)),p=r(d+"\\."+d+"\\."+d+"\\."+d),m=r(o+"{1,4}"),y=r(r(m+"\\:"+m)+"|"+p),v=r(r(m+"\\:")+"{6}"+y),g=r("\\:\\:"+r(m+"\\:")+"{5}"+y),b=r(r(m)+"?\\:\\:"+r(m+"\\:")+"{4}"+y),_=r(r(r(m+"\\:")+"{0,1}"+m)+"?\\:\\:"+r(m+"\\:")+"{3}"+y),w=r(r(r(m+"\\:")+"{0,2}"+m)+"?\\:\\:"+r(m+"\\:")+"{2}"+y),E=r(r(r(m+"\\:")+"{0,3}"+m)+"?\\:\\:"+m+"\\:"+y),S=r(r(r(m+"\\:")+"{0,4}"+m)+"?\\:\\:"+y),O=r(r(r(m+"\\:")+"{0,5}"+m)+"?\\:\\:"+m),I=r(r(r(m+"\\:")+"{0,6}"+m)+"?\\:\\:"),T=r([v,g,b,_,w,E,S,O,I].join("|")),k=r(r(l+"|"+s)+"+"),N=(r(T+"\\%25"+k),r(T+r("\\%25|\\%(?!"+o+"{2})")+k)),D=r("[vV]"+o+"+\\."+t(l,a,"[\\:]")+"+"),A=r("\\["+r(N+"|"+T+"|"+D)+"\\]"),x=r(r(s+"|"+t(l,a))+"*"),R=r(A+"|"+p+"(?!"+x+")|"+x),P=r(i+"*"),C=r(r(f+"@")+"?"+R+r("\\:"+P)+"?"),j=r(s+"|"+t(l,a,"[\\:\\@]")),$=r(j+"*"),M=r(j+"+"),F=r(r(s+"|"+t(l,a,"[\\@]"))+"+"),q=r(r("\\/"+$)+"*"),L=r("\\/"+r(M+q)+"?"),V=r(F+q),Q=r(M+q),U="(?!"+j+")",B=(r(q+"|"+L+"|"+V+"|"+Q+"|"+U),r(r(j+"|"+t("[\\/\\?]",u))+"*")),z=r(r(j+"|[\\/\\?]")+"*"),Y=r(r("\\/\\/"+C+q)+"|"+L+"|"+Q+"|"+U),K=r(h+"\\:"+Y+r("\\?"+B)+"?"+r("\\#"+z)+"?"),H=r(r("\\/\\/"+C+q)+"|"+L+"|"+V+"|"+U),G=r(H+r("\\?"+B)+"?"+r("\\#"+z)+"?");return r(K+"|"+G),r(h+"\\:"+Y+r("\\?"+B)+"?"),r(r("\\/\\/("+r("("+f+")@")+"?("+R+")"+r("\\:("+P+")")+"?)")+"?("+q+"|"+L+"|"+Q+"|"+U+")"),r("\\?("+B+")"),r("\\#("+z+")"),r(r("\\/\\/("+r("("+f+")@")+"?("+R+")"+r("\\:("+P+")")+"?)")+"?("+q+"|"+L+"|"+V+"|"+U+")"),r("\\?("+B+")"),r("\\#("+z+")"),r(r("\\/\\/("+r("("+f+")@")+"?("+R+")"+r("\\:("+P+")")+"?)")+"?("+q+"|"+L+"|"+Q+"|"+U+")"),r("\\?("+B+")"),r("\\#("+z+")"),r("("+f+")@"),r("\\:("+P+")"),{NOT_SCHEME:new RegExp(t("[^]",n,i,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",l,a),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",l,a),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",l,a),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",l,a),"g"),NOT_QUERY:new RegExp(t("[^\\%]",l,a,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",l,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",l,a),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",l,c),"g"),PCT_ENCODED:new RegExp(s,"g"),IPV4ADDRESS:new RegExp("^("+p+")$"),IPV6ADDRESS:new RegExp("^\\[?("+T+")"+r(r("\\%25|\\%(?!"+o+"{2})")+"("+k+")")+"?\\]?$")}}var s=o(!1),a=o(!0),c=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},u=2147483647,l=36,h=/^xn--/,f=/[^\0-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=Math.floor,y=String.fromCharCode;function v(e){throw new RangeError(p[e])}function g(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+function(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}((e=e.replace(d,".")).split("."),t).join(".")}function b(e){for(var t=[],r=0,n=e.length;r<n;){var i=e.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){var o=e.charCodeAt(r++);56320==(64512&o)?t.push(((1023&i)<<10)+(1023&o)+65536):(t.push(i),r--)}else t.push(i)}return t}var _=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},w=function(e,t,r){var n=0;for(e=r?m(e/700):e>>1,e+=m(e/t);e>455;n+=l)e=m(e/35);return m(n+36*e/(e+38))},E=function(e){var t,r=[],n=e.length,i=0,o=128,s=72,a=e.lastIndexOf("-");a<0&&(a=0);for(var c=0;c<a;++c)e.charCodeAt(c)>=128&&v("not-basic"),r.push(e.charCodeAt(c));for(var h=a>0?a+1:0;h<n;){for(var f=i,d=1,p=l;;p+=l){h>=n&&v("invalid-input");var y=(t=e.charCodeAt(h++))-48<10?t-22:t-65<26?t-65:t-97<26?t-97:l;(y>=l||y>m((u-i)/d))&&v("overflow"),i+=y*d;var g=p<=s?1:p>=s+26?26:p-s;if(y<g)break;var b=l-g;d>m(u/b)&&v("overflow"),d*=b}var _=r.length+1;s=w(i-f,_,0==f),m(i/_)>u-o&&v("overflow"),o+=m(i/_),i%=_,r.splice(i++,0,o)}return String.fromCodePoint.apply(String,r)},S=function(e){var t=[],r=(e=b(e)).length,n=128,i=0,o=72,s=!0,a=!1,c=void 0;try{for(var h,f=e[Symbol.iterator]();!(s=(h=f.next()).done);s=!0){var d=h.value;d<128&&t.push(y(d))}}catch(e){a=!0,c=e}finally{try{!s&&f.return&&f.return()}finally{if(a)throw c}}var p=t.length,g=p;for(p&&t.push("-");g<r;){var E=u,S=!0,O=!1,I=void 0;try{for(var T,k=e[Symbol.iterator]();!(S=(T=k.next()).done);S=!0){var N=T.value;N>=n&&N<E&&(E=N)}}catch(e){O=!0,I=e}finally{try{!S&&k.return&&k.return()}finally{if(O)throw I}}var D=g+1;E-n>m((u-i)/D)&&v("overflow"),i+=(E-n)*D,n=E;var A=!0,x=!1,R=void 0;try{for(var P,C=e[Symbol.iterator]();!(A=(P=C.next()).done);A=!0){var j=P.value;if(j<n&&++i>u&&v("overflow"),j==n){for(var $=i,M=l;;M+=l){var F=M<=o?1:M>=o+26?26:M-o;if($<F)break;var q=$-F,L=l-F;t.push(y(_(F+q%L,0))),$=m(q/L)}t.push(y(_($,0))),o=w(i,D,g==p),i=0,++g}}}catch(e){x=!0,R=e}finally{try{!A&&C.return&&C.return()}finally{if(x)throw R}}++i,++n}return t.join("")},O={version:"2.1.0",ucs2:{decode:b,encode:function(e){return String.fromCodePoint.apply(String,function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(e))}},decode:E,encode:S,toASCII:function(e){return g(e,(function(e){return f.test(e)?"xn--"+S(e):e}))},toUnicode:function(e){return g(e,(function(e){return h.test(e)?E(e.slice(4).toLowerCase()):e}))}},I={};function T(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function k(e){for(var t="",r=0,n=e.length;r<n;){var i=parseInt(e.substr(r+1,2),16);if(i<128)t+=String.fromCharCode(i),r+=3;else if(i>=194&&i<224){if(n-r>=6){var o=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&i)<<6|63&o)}else t+=e.substr(r,6);r+=6}else if(i>=224){if(n-r>=9){var s=parseInt(e.substr(r+4,2),16),a=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&i)<<12|(63&s)<<6|63&a)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function N(e,t){function r(e){var r=k(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,T).replace(t.PCT_ENCODED,i)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,T).replace(t.PCT_ENCODED,i)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,T).replace(t.PCT_ENCODED,i)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,T).replace(t.PCT_ENCODED,i)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,T).replace(t.PCT_ENCODED,i)),e}function D(e){return e.replace(/^0*(.*)/,"$1")||"0"}function A(e,t){var r=e.match(t.IPV4ADDRESS)||[],n=c(r,2)[1];return n?n.split(".").map(D).join("."):e}function x(e,t){var r=e.match(t.IPV6ADDRESS)||[],n=c(r,3),i=n[1],o=n[2];if(i){for(var s=i.toLowerCase().split("::").reverse(),a=c(s,2),u=a[0],l=a[1],h=l?l.split(":").map(D):[],f=u.split(":").map(D),d=t.IPV4ADDRESS.test(f[f.length-1]),p=d?7:8,m=f.length-p,y=Array(p),v=0;v<p;++v)y[v]=h[v]||f[m+v]||"";d&&(y[p-1]=A(y[p-1],t));var g=y.reduce((function(e,t,r){if(!t||"0"===t){var n=e[e.length-1];n&&n.index+n.length===r?n.length++:e.push({index:r,length:1})}return e}),[]).sort((function(e,t){return t.length-e.length}))[0],b=void 0;if(g&&g.length>1){var _=y.slice(0,g.index),w=y.slice(g.index+g.length);b=_.join(":")+"::"+w.join(":")}else b=y.join(":");return o&&(b+="%"+o),b}return e}var R=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,P=void 0==="".match(/(){0}/)[1];function C(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},n=!1!==t.iri?a:s;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var i=e.match(R);if(i){P?(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port)&&(r.port=i[5])):(r.scheme=i[1]||void 0,r.userinfo=-1!==e.indexOf("@")?i[3]:void 0,r.host=-1!==e.indexOf("//")?i[4]:void 0,r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=-1!==e.indexOf("?")?i[7]:void 0,r.fragment=-1!==e.indexOf("#")?i[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?i[4]:void 0)),r.host&&(r.host=x(A(r.host,n),n)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var o=I[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||o&&o.unicodeSupport)N(r,n);else{if(r.host&&(t.domainHost||o&&o.domainHost))try{r.host=O.toASCII(r.host.replace(n.PCT_ENCODED,k).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}N(r,s)}o&&o.parse&&o.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}var j=/^\.\.?\//,$=/^\/\.(\/|$)/,M=/^\/\.\.(\/|$)/,F=/^\/?(?:.|\n)*?(?=\/|$)/;function q(e){for(var t=[];e.length;)if(e.match(j))e=e.replace(j,"");else if(e.match($))e=e.replace($,"/");else if(e.match(M))e=e.replace(M,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(F);if(!r)throw new Error("Unexpected dot segment condition");var n=r[0];e=e.slice(n.length),t.push(n)}return t.join("")}function L(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?a:s,n=[],i=I[(t.scheme||e.scheme||"").toLowerCase()];if(i&&i.serialize&&i.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||i&&i.domainHost)try{e.host=t.iri?O.toUnicode(e.host):O.toASCII(e.host.replace(r.PCT_ENCODED,k).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}N(e,r),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var o=function(e,t){var r=!1!==t.iri?a:s,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(x(A(String(e.host),r),r).replace(r.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}(e,t);if(void 0!==o&&("suffix"!==t.reference&&n.push("//"),n.push(o),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var c=e.path;t.absolutePath||i&&i.absolutePath||(c=q(c)),void 0===o&&(c=c.replace(/^\/\//,"/%2F")),n.push(c)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function V(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=C(L(e,r),r),t=C(L(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=q(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=q(t.path||""),n.query=t.query):(t.path?("/"===t.path.charAt(0)?n.path=q(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=q(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function Q(e,t){return e&&e.toString().replace(t&&t.iri?a.PCT_ENCODED:s.PCT_ENCODED,k)}var U={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return e.port!==(r?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},B={scheme:"https",domainHost:U.domainHost,parse:U.parse,serialize:U.serialize};function z(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var Y={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=z(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if(e.port!==(z(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),n=c(r,2),i=n[0],o=n[1];e.path=i&&"/"!==i?i:void 0,e.query=o,e.resourceName=void 0}return e.fragment=void 0,e}},K={scheme:"wss",domainHost:Y.domainHost,parse:Y.parse,serialize:Y.serialize},H={},G="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",W="[0-9A-Fa-f]",J=r(r("%[EFef]"+W+"%"+W+W+"%"+W+W)+"|"+r("%[89A-Fa-f]"+W+"%"+W+W)+"|"+r("%"+W+W)),Z=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),X=new RegExp(G,"g"),ee=new RegExp(J,"g"),te=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',Z),"g"),re=new RegExp(t("[^]",G,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ne=re;function ie(e){var t=k(e);return t.match(X)?t:e}var oe={scheme:"mailto",parse:function(e,t){var r=e,n=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var i=!1,o={},s=r.query.split("&"),a=0,c=s.length;a<c;++a){var u=s[a].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),h=0,f=l.length;h<f;++h)n.push(l[h]);break;case"subject":r.subject=Q(u[1],t);break;case"body":r.body=Q(u[1],t);break;default:i=!0,o[Q(u[0],t)]=Q(u[1],t)}}i&&(r.headers=o)}r.query=void 0;for(var d=0,p=n.length;d<p;++d){var m=n[d].split("@");if(m[0]=Q(m[0]),t.unicodeSupport)m[1]=Q(m[1],t).toLowerCase();else try{m[1]=O.toASCII(Q(m[1],t).toLowerCase())}catch(e){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}n[d]=m.join("@")}return r},serialize:function(e,t){var r,n=e,o=null!=(r=e.to)?r instanceof Array?r:"number"!=typeof r.length||r.split||r.setInterval||r.call?[r]:Array.prototype.slice.call(r):[];if(o){for(var s=0,a=o.length;s<a;++s){var c=String(o[s]),u=c.lastIndexOf("@"),l=c.slice(0,u).replace(ee,ie).replace(ee,i).replace(te,T),h=c.slice(u+1);try{h=t.iri?O.toUnicode(h):O.toASCII(Q(h,t).toLowerCase())}catch(e){n.error=n.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}o[s]=l+"@"+h}n.path=o.join(",")}var f=e.headers=e.headers||{};e.subject&&(f.subject=e.subject),e.body&&(f.body=e.body);var d=[];for(var p in f)f[p]!==H[p]&&d.push(p.replace(ee,ie).replace(ee,i).replace(re,T)+"="+f[p].replace(ee,ie).replace(ee,i).replace(ne,T));return d.length&&(n.query=d.join("&")),n}},se=/^([^\:]+)\:(.*)/,ae={scheme:"urn",parse:function(e,t){var r=e.path&&e.path.match(se),n=e;if(r){var i=t.scheme||n.scheme||"urn",o=r[1].toLowerCase(),s=r[2],a=i+":"+(t.nid||o),c=I[a];n.nid=o,n.nss=s,n.path=void 0,c&&(n=c.parse(n,t))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(e,t){var r=t.scheme||e.scheme||"urn",n=e.nid,i=r+":"+(t.nid||n),o=I[i];o&&(e=o.serialize(e,t));var s=e,a=e.nss;return s.path=(n||t.nid)+":"+a,s}},ce=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,ue={scheme:"urn:uuid",parse:function(e,t){var r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&r.uuid.match(ce)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e,t){var r=e;return r.nss=(e.uuid||"").toLowerCase(),r}};I[U.scheme]=U,I[B.scheme]=B,I[Y.scheme]=Y,I[K.scheme]=K,I[oe.scheme]=oe,I[ae.scheme]=ae,I[ue.scheme]=ue,e.SCHEMES=I,e.pctEncChar=T,e.pctDecChars=k,e.parse=C,e.removeDotSegments=q,e.serialize=L,e.resolveComponents=V,e.resolve=function(e,t,r){var n=function(e,t){var r=e;if(t)for(var n in t)r[n]=t[n];return r}({scheme:"null"},r);return L(V(C(e,n),C(t,n),n,!0),n)},e.normalize=function(e,t){return"string"==typeof e?e=L(C(e,t),t):"object"===n(e)&&(e=C(L(e,t),t)),e},e.equal=function(e,t,r){return"string"==typeof e?e=L(C(e,r),r):"object"===n(e)&&(e=L(e,r)),"string"==typeof t?t=L(C(t,r),r):"object"===n(t)&&(t=L(t,r)),e===t},e.escapeComponent=function(e,t){return e&&e.toString().replace(t&&t.iri?a.ESCAPE:s.ESCAPE,T)},e.unescapeComponent=Q,Object.defineProperty(e,"__esModule",{value:!0})}(t)},1143:e=>{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},1512:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},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})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{"use strict";var e,t,i;r.r(n),r.d(n,{Changes:()=>We,CollectionReference:()=>Be,DocumentReference:()=>Ye,GraphQLClient:()=>Aa,JoinQueryBuilder:()=>Le,QueryBuilder:()=>Ge,Squid:()=>sc,deserializeQuery:()=>Je}),function(e){e.database="database",e.api="api",e.observability="observability",e.crm="crm",e.auth="auth",e.ai="ai"}(e||(e={})),function(e){e.built_in_db="built_in_db",e.mongo="mongo",e.mysql="mysql",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_assistant="ai_assistant",e.cognito="cognito",e.okta="okta",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.clickhouse="clickhouse",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"}(t||(t={})),function(e){e.data="data",e.api="api",e.graphql="graphql"}(i||(i={})),t.built_in_db,t.mongo,t.mysql,t.mssql,t.postgres,t.cockroach,t.snowflake,t.oracledb,t.api,t.graphql,t.datadog,t.newrelic,t.auth0,t.jwt_rsa,t.jwt_hmac,t.cognito,t.okta;var o;t.built_in_db,t.mysql,t.oracledb,t.mssql,t.postgres,t.cockroach,t.mongo,t.api,t.graphql,t.snowflake,t.datadog,Object.keys({us1:"US1 - East",us3:"US3 - West",us5:"US5 - Central",eu1:"EU1 - Europe",ap1:"AP1 - Asia","us1-fed":"US1-FED (FedRamp)"}),t.newrelic,Object.keys({worldwide:"Worldwide",eu:"Europe"}),t.auth0,t.jwt_rsa,t.jwt_hmac,t.ai_assistant,t.cognito,t.okta,i.data,i.api,i.graphql,t.mysql,t.oracledb,t.mssql,t.postgres,t.cockroach,t.mongo,t.snowflake,t.graphql,t.mysql,t.oracledb,t.mssql,t.snowflake,t.postgres,t.cockroach,t.mongo,t.built_in_db,t.graphql,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 * * 0",e.EVERY_WEEKDAY="0 0 * * 1-5",e.EVERY_WEEKEND="0 0 * * 6,0",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 0 *",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"}(o||(o={}));var s=r(8784),a=r.n(s);function c(e){if(Array.isArray(e))return e.map((e=>c(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]=c(e[t])})),r}function u(e){return l(c(e))}function l(e){if(void 0===e)return null;const t=s.cloneDeepWith(e,(e=>s.isDate(e)?{$date:e.toISOString()}:void 0));return JSON.stringify(t)}function h(e){const t=JSON.parse(e);return s.cloneDeepWith(t,(e=>s.isObject(e)&&s.has(e,"$date")&&1===Object.keys(e).length?new Date(e.$date):void 0))}function f(e){if(void 0===e)throw new Error("INVALID_ENCODE_VALUE");const t=l(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)}}function d(e){return"fieldName"in e}function p(e){return u(e)}function m(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 a().isEqual(e,t);if("!="===r)return!a().isEqual(e,t);if(null===e||null===t)return!1;switch(r){case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"like":return"string"==typeof t&&"string"==typeof e&&y(t,e,!1);case"not like":return!("string"==typeof t&&"string"==typeof e&&y(t,e,!1));case"like_cs":return"string"==typeof t&&"string"==typeof e&&y(t,e,!0);case"not like_cs":return!("string"==typeof t&&"string"==typeof e&&y(t,e,!0));default:throw new Error(`Unsupported operator comparison: ${r}`)}}function y(e,t,r){r||(e=e.toLowerCase(),t=t.toLowerCase());const n=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&").replace(/%/g,".*");return new RegExp(`^${n}$`).test(e)}function v(e,t){return`${e}_${t}`}p({fields:[{fieldName:"name",operator:">",value:"Yossi"},{fieldName:"age",operator:"<",value:10}]}),p({fieldName:"age",operator:"==",value:10}),p({fieldName:"age",operator:"==",value:11}),p({fieldName:"age",operator:"==",value:12}),p({fieldName:"age",operator:">",value:20}),p({fieldName:"age",operator:"<",value:20}),p({fieldName:"name",operator:"!=",value:"Yossi"}),p({fieldName:"name",operator:"!=",value:"Nir"});const g={"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))};class b{constructor(e){this.query=e,this.query=e,this.parsedConditions=this.parseConditions(this.query.conditions.filter(d))}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!(0,s.isEqual)(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(d),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=s.get(e,r);if("in"===n){if(t.value.includes(i))continue;return!1}if("not in"!==n){if(!m(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=g[`${r}:${i}`];return!!s&&s(n,o)}evaluateIncludes(e,t){const{operator:r,value:n}=e,{operator:i,value:o}=this.parseConditions([t])[0],a=Array.isArray(n)?n.sort():n,c=Array.isArray(o)?o.sort():o;return i===r&&(0,s.isEqual)(c,a)}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 _{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.where(e,r?"like_cs":"like",t)}notLike(e,t,r){return this.where(e,r?"not like_cs":"not like",t)}}const w=require("rxjs");var E,S;(S=E||(E={}))[S.CONTINUE=100]="CONTINUE",S[S.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",S[S.PROCESSING=102]="PROCESSING",S[S.EARLYHINTS=103]="EARLYHINTS",S[S.OK=200]="OK",S[S.CREATED=201]="CREATED",S[S.ACCEPTED=202]="ACCEPTED",S[S.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",S[S.NO_CONTENT=204]="NO_CONTENT",S[S.RESET_CONTENT=205]="RESET_CONTENT",S[S.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",S[S.AMBIGUOUS=300]="AMBIGUOUS",S[S.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",S[S.FOUND=302]="FOUND",S[S.SEE_OTHER=303]="SEE_OTHER",S[S.NOT_MODIFIED=304]="NOT_MODIFIED",S[S.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",S[S.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",S[S.BAD_REQUEST=400]="BAD_REQUEST",S[S.UNAUTHORIZED=401]="UNAUTHORIZED",S[S.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",S[S.FORBIDDEN=403]="FORBIDDEN",S[S.NOT_FOUND=404]="NOT_FOUND",S[S.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",S[S.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",S[S.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",S[S.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",S[S.CONFLICT=409]="CONFLICT",S[S.GONE=410]="GONE",S[S.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",S[S.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",S[S.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",S[S.URI_TOO_LONG=414]="URI_TOO_LONG",S[S.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",S[S.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",S[S.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",S[S.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",S[S.MISDIRECTED=421]="MISDIRECTED",S[S.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",S[S.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",S[S.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",S[S.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",S[S.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",S[S.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",S[S.BAD_GATEWAY=502]="BAD_GATEWAY",S[S.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",S[S.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",S[S.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED";class O extends Error{constructor(e,t,r){super(e),this.statusCode=t,this.details=r}}function I(e){if(!(e instanceof Object))throw new Error("Field sort has to be an object");var t,r;k((t=e,r=["fieldName","asc"],!Array.isArray(t)&&[...Object.keys(t)].every((e=>r.includes(e)))),"Field sort should only contain a fieldName and asc"),k(T(e.asc,"boolean"),"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)}(e.fieldName)}function T(e,t){return Array.isArray(e)?e.every((e=>typeof e===t)):typeof e===t}function k(e,t){if(e)return;const r="function"==typeof t?t():t;throw r instanceof Error?r:new Error(null!=r?r:"Assertion error")}function N(e,t){return k(e,t),e}function D(e,t,r="."){const n=t.split(r);let i,o=e;for(;o&&n.length;){const e=N(n.shift());if(!(o instanceof Object&&e in o))return;i=o[e],o=i}return i}function A(e){return"object"==typeof e&&Reflect.getPrototypeOf(e)===Object.prototype}function x(e,t,r,n="."){var i;const o=t.split(n);let a=e;for(;o.length;){const e=N(o.shift());if(o.length){const t=A(a[e])&&null!==(i=s.clone(a[e]))&&void 0!==i?i:{};a[e]=t,a=t}else a[e]=r}}function R(e,t,r="."){var n;const i=t.split(r);let o=e;for(;i.length;){const e=N(i.shift());if(i.length){const t=A(o[e])&&null!==(n=s.clone(o[e]))&&void 0!==n?n:{};o[e]=t,o=t}else delete o[e]}}function P(e,t,r){if(e.has(t)){const n=e.get(t);e.delete(t),e.set(r,n)}}class C{constructor(e,t={}){this.internalStateObserver=new w.BehaviorSubject(null),this.firstElement=null,this.lastElement=null,this.isDestroyed=new w.BehaviorSubject(!1),this.snapshotSubject=new w.Subject,this.onFirstPage=!0,this.snapshotSubject.pipe((0,w.switchAll)()).subscribe((e=>this.dataReceived(e))),this.templateSnapshotEmitter=e.clone(),this.options=Object.assign({pageSize:100,subscribe:!0},t),this.goToFirstPage()}goToFirstPage(){this.onFirstPage=!0;const e=this.templateSnapshotEmitter.clone().limit(3*this.options.pageSize).snapshots(this.options.subscribe);this.snapshotSubject.next(e)}static compareValues(e,t){return e>t?1:e<t?-1:0}compare(e,t){if(null===t)return 1;for(const r of this.templateSnapshotEmitter.getSortOrders()){const n=C.compareValues(D(e,r.fieldName),D(t,r.fieldName));if(0!==n)return r.asc?n:-n}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&&null!==this.lastElement){const r=t.filter((e=>1===this.compare(e,this.lastElement))).length;this.firstElement=t[e.length-r-this.options.pageSize],this.lastElement=null}const r=t.filter((e=>-1===this.compare(e,this.firstElement))).length,n=Math.max(0,e.length-r-this.options.pageSize);r!==e.length?this.internalStateObserver.next({numBefore:r,numAfter:n,data:e,extractedData:t}):this.prevInternal({numBefore:r,numAfter:n,data:e,extractedData:t})}doNewQuery(e,t){if(this.onFirstPage=!1,t){const t=this.templateSnapshotEmitter.clone().limit(3*this.options.pageSize).flipSortOrder().addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((t=>({fieldName:t.fieldName,operator:t.asc?"<=":">=",value:D(e,t.fieldName)}))));this.snapshotSubject.next(t.snapshots(this.options.subscribe).pipe((0,w.map)((e=>e.reverse()))))}else{const t=this.templateSnapshotEmitter.clone().limit(3*this.options.pageSize).addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((t=>({fieldName:t.fieldName,operator:t.asc?">=":"<=",value:D(e,t.fieldName)}))));this.snapshotSubject.next(t.snapshots(this.options.subscribe))}}async waitForInternalState(){const e=this.internalStateObserver.value;return null!==e?e:await(0,w.firstValueFrom)((0,w.race)(this.isDestroyed.pipe((0,w.filter)(Boolean),(0,w.map)((e=>({data:[],extractedData:[],numBefore:0,numAfter:0})))),this.internalStateObserver.pipe((0,w.filter)((e=>null!==e)),(0,w.take)(1))))}internalStateToState(e){const{data:t,numBefore:r,numAfter:n,extractedData:i}=e;return{data:t.filter(((e,t)=>-1!==this.compare(i[t],this.firstElement))).slice(0,this.options.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,data:n,extractedData:i}=e;this.firstElement=null,this.lastElement=i[t-1],this.internalStateObserver.next(null),this.doNewQuery(i[i.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 this.firstElement=t[e+this.options.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,w.filter)((e=>null!==e)),(0,w.map)((e=>this.internalStateToState(e))))}}function j(e,t){return`${function(e){const[t,r,n,i]=e.split(/[_-]/);return k(!i,"Invalid appId: "+e),{appId:t,environmentId:null!=r?r:"prod",squidDeveloperId:n}}(e).appId}${t&&"prod"!==t?`-${t}`:""}`}r(2091);const $="__squidId";function M(e){return h(e)}function F(...e){const[t,r,n]=e,i="object"==typeof t?t:{docId:t,collectionName:r,integrationId:n};return i.integrationId||(i.integrationId=void 0),u(i)}var q;function L(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?s.cloneDeep(t.value):t.value;case"removeProperty":return;default:throw new Error("Unknown property mutation type: "+JSON.stringify(t))}}function V(e){return Object.entries(e.properties).sort((([e],[t])=>e.split(".").length-t.split(".").length))}function Q(e){let t=[];return(0,w.from)(e).pipe((0,w.groupBy)((e=>`${e.squidDocIdObj.integrationId}${e.squidDocIdObj.collectionName}/${e.squidDocIdObj.docId}`)),(0,w.mergeMap)((e=>e.pipe((0,w.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(k("update"===t.type,"Invalid mutation type"),"update"===e.type)return function(e,t){const r=s.cloneDeep(e);t=s.cloneDeep(t);for(const[e]of V(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 V(t))r.properties[e]=[...r.properties[e]||[],...n];return r}(e,t);const r=s.cloneDeep(e);for(const[e,n]of V(t)){const t=n;for(const n of t){const t=L(D(r.properties,e),n);void 0===t?R(r.properties,e):x(r.properties,e,t)}}return r}(e,t)))))),(0,w.toArray)()).subscribe((e=>{t=e})),t}!function(e){e.TRACE="trace",e.DEBUG="debug",e.INFO="info",e.WARN="warn",e.ERROR="error"}(q||(q={}));var U=r(6236),B=r.n(U),z=r(8414),Y=r.n(z);const K=new(B())({allErrors:!0,allowUnionTypes:!1,useDefaults:!1});function H(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?H(e,t,r,o+1,i):H(e,t,r,n,o-1)}function G(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){if(-1!==H(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 W(e,t,r=((e,t)=>e>t?1:e<t?-1:0)){const n=H(e,t,r);n>-1&&e.splice(n,1)}Y()(K),K.addKeyword({keyword:"isDate",type:"object",validate:(e,t)=>e===t instanceof Date}),K.addKeyword({keyword:"isJSON",type:"object",validate:(e,t)=>{try{const e=JSON.stringify(t);return JSON.parse(e),!0}catch(e){return!1}}}),K.addKeyword({keyword:"isComputed",validate:(e,t)=>!e||null!==t}),K.addKeyword({keyword:"isDefaultComputed",validate:(e,t)=>!e||null!==t}),K.addKeyword({keyword:"primaryKey",validate:(e,t)=>!e||null!==t}),K.addKeyword({keyword:"insertable",validate:(e,t)=>!e||null!==t}),K.addKeyword({keyword:"deletable",validate:(e,t)=>!e||null!==t}),K.addKeyword({keyword:"applyDefaultValueOn",validate:(e,t)=>!e||["always","empty","updateOrEmpty"].includes(e)}),K.addKeyword({keyword:"dataType",validate:(e,t)=>!0});class J extends Error{constructor(e,t){super(e),this.details=t}}const Z=["query","aiData","api","backend-function","webhooks"];function X(e,t,r){const n=new URL("https://squid.cloud");n.host=`${t}.${e}.${n.host}`;const i=r.split("/")[0]||"";ee(e)&&(n.protocol="http",n.port=Z.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();return(o.endsWith("/")?o:o+"/")+r}function ee(e){return/^local/.test(e)}function te(){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)}))}class re{constructor(){this.locks={}}async lock(...e){if(this.canGetLock(...e))return void this.lockSync(...e);const t=Object.entries(this.locks).filter((([t])=>e.includes(t))).map((([e,t])=>t));await(0,w.lastValueFrom)((0,w.combineLatest)(t).pipe((0,w.filter)((e=>!e.includes(!0))),(0,w.take)(1))),await this.lock(...e)}release(...e){for(const t of e){const e=N(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){k(this.canGetLock(...e),"Cannot acquire lock sync");for(const t of e)this.locks[t]=new w.BehaviorSubject(!0)}}function ne(e){return null!=e}function ie(e){return"function"==typeof e}function oe(e){return function(t){if(function(e){return ie(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 se=function(e,t){return se=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])},se(e,t)};function ae(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}se(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var ce=function(){return ce=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},ce.apply(this,arguments)};function ue(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 le(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))}function he(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(c){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,c])}}}function fe(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 de(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 pe(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;var me,ye,ve=(me=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}},(ye=me((function(e){Error.call(e),e.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),ye.prototype.constructor=ye,ye);function ge(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var be=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=fe(o),a=s.next();!a.done;a=s.next())a.value.remove(this)}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(ie(c))try{c()}catch(e){i=e instanceof ve?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=fe(u),h=l.next();!h.done;h=l.next()){var f=h.value;try{_e(f)}catch(e){i=null!=i?i:[],e instanceof ve?i=pe(pe([],de(i)),de(e.errors)):i.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(i)throw new ve(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)_e(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)&&ge(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&ge(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function _e(e){ie(e)?e():e.unsubscribe()}be.EMPTY;var we=null,Ee=null,Se=!1,Oe=!1,Ie={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=Ie.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,pe([e,t],de(r))):setTimeout.apply(void 0,pe([e,t],de(r)))},clearTimeout:function(e){var t=Ie.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Te(){}var ke=Ne("C",void 0,void 0);function Ne(e,t,r){return{kind:e,value:t,error:r}}var De=function(e){function t(t){var r,n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,((r=t)instanceof be||r&&"closed"in r&&ie(r.remove)&&ie(r.add)&&ie(r.unsubscribe))&&t.add(n)):n.destination=$e,n}return ae(t,e),t.create=function(e,t,r){return new Pe(e,t,r)},t.prototype.next=function(e){this.isStopped?je(function(e){return Ne("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?je(Ne("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?je(ke,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}(be),Ae=Function.prototype.bind;function xe(e,t){return Ae.call(e,t)}var Re=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){Ce(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Ce(e)}else Ce(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Ce(e)}},e}(),Pe=function(e){function t(t,r,n){var i,o,s=e.call(this)||this;return ie(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&Oe?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&xe(t.next,o),error:t.error&&xe(t.error,o),complete:t.complete&&xe(t.complete,o)}):i=t,s.destination=new Re(i),s}return ae(t,e),t}(De);function Ce(e){Se||function(e){Ie.setTimeout((function(){if(!we)throw e;we(e)}))}(e)}function je(e,t){var r=Ee;r&&Ie.setTimeout((function(){return r(e,t)}))}var $e={closed:!0,next:Te,error:function(e){throw e},complete:Te};function Me(e,t,r,n,i){return new Fe(e,t,r,n,i)}var Fe=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 ae(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}(De);function qe(e,t){return oe((function(r,n){var i=0;r.subscribe(Me(n,(function(r){n.next(e.call(t,r,i++))})))}))}class Le extends _{constructor(e,t,r,n,i,o,s,a,c,u,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=c,this.joinConditions=u,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}),c=Object.assign(Object.assign({},this.leftToRight),{[t]:[]});return c[s].push(t),new Le(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,this.rootAlias,t,c,Object.assign(Object.assign({},this.joins),{[t]:e.build()}),Object.assign(Object.assign({},this.joinConditions),{[t]:a}),this.queryBuilder)}snapshot(){return(0,w.firstValueFrom)(this.snapshots(!1))}snapshots(e=!0){return this.querySubscriptionManager.processQuery(this.build(),this.rootAlias,s.cloneDeep(this.joins),s.cloneDeep(this.joinConditions),e,!1).pipe(qe((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?F(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 Ue(this)}dereference(){return new Ve(this)}build(){return this.queryBuilder.build()}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){return new Le(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,this.rootAlias,this.latestAlias,s.cloneDeep(this.leftToRight),s.cloneDeep(this.joins),s.cloneDeep(this.joinConditions),this.queryBuilder.clone())}addCompositeCondition(e){return this.queryBuilder.addCompositeCondition(e),this}flipSortOrder(){return this.queryBuilder.flipSortOrder(),this}extractData(e){return e[this.rootAlias].data}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 C(this,e)}}class Ve{constructor(e){this.joinQueryBuilder=e}grouped(){return this.joinQueryBuilder.grouped().dereference()}snapshot(){return(0,w.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(qe((e=>e.map((e=>s.mapValues(e,(e=>null==e?void 0:e.data)))))))}peek(){throw new Error("peek is not currently supported for join queries")}getSortOrders(){return this.joinQueryBuilder.getSortOrders()}clone(){return new Ve(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 C(this,e)}serialize(){return Object.assign(Object.assign({},this.joinQueryBuilder.serialize()),{dereference:!0})}getLimit(){return this.joinQueryBuilder.getLimit()}}class Qe{constructor(e){this.groupedJoin=e}snapshot(){return(0,w.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.groupedJoin.snapshots(e).pipe(qe((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 Qe(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 C(this,e)}}class Ue{constructor(e){this.joinQueryBuilder=e}snapshot(){return(0,w.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.joinQueryBuilder.snapshots(e).pipe(qe((e=>this.groupData(e,this.joinQueryBuilder.rootAlias))))}peek(){throw new Error("peek is not currently supported for join queries")}dereference(){return new Qe(this)}groupData(e,t){const r=s.groupBy(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 Ue(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].data:e.data}serialize(){return Object.assign(Object.assign({},this.joinQueryBuilder.serialize()),{grouped:!0})}paginate(e){return new C(this,e)}}class Be{constructor(e,t,r,n,i){this.collectionName=e,this.integrationId=t,this.documentReferenceFactory=r,this.queryBuilderFactory=n,this.querySubscriptionManager=i,this.refId=te()}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!==t.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={[$]:te()};else e=e&&"string"!=typeof e?{__id:u(e)}:{__id:e||te()};const r=F(u(e),this.collectionName,this.integrationId);return this.documentReferenceFactory.create(r,this.queryBuilderFactory)}query(){return this.queryBuilderFactory.get(this.collectionName,this.integrationId)}joinQuery(e){return new Le(this.collectionName,this.integrationId,this.querySubscriptionManager,this.documentReferenceFactory,this.queryBuilderFactory,e,e,{[e]:[]},{},{},this.query())}or(...e){return new ze(...e)}}class ze{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,w.firstValueFrom)(this.snapshots(!1))}snapshots(e=!0){const t=this.snapshotEmitters.map((t=>t.snapshots(e)));return this.or(this.snapshotEmitters[0].getSortOrders(),...t)}peek(){throw new Error("peek is not currently supported for merged queries")}or(e,...t){return(0,w.combineLatest)([...t]).pipe((0,w.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=D(this.extractData(t),n),o=D(this.extractData(r),n);return m(e,o,"==")?0:m(o,e,"<")?i?-1:1:i?1:-1}return 0})).slice(0,this.getLimit())})))}clone(){return new ze(...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 C(this,e)}}class Ye{constructor(e,t,r){this._squidDocId=e,this.dataManager=t,this.queryBuilderFactory=r,this.refId=te()}get squidDocId(){return this._squidDocId}get data(){return N(this.dataManager.getProperties(this.squidDocId),(()=>{const{collectionName:e,integrationId:t,docId:r}=M(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.isTracked()&&this.hasData)return this.data;const e=await this.queryBuilderFactory.getForDocument(this.squidDocId).dereference().snapshot();return N(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,w.map)((e=>(N(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:M(this.squidDocId),properties:r};return this.dataManager.applyOutgoingMutation(n,t)}async setInPath(e,t,r){return this.update({[e]:s.cloneDeep(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:M(this.squidDocId),properties:{[e]:[n]}};return this.dataManager.applyOutgoingMutation(i,r)}decrementInPath(e,t,r){return this.incrementInPath(e,-t,r)}async insert(e,r){const n=M(this.squidDocId),i=n.integrationId;let o=h(n.docId);if(o[$]&&(o={}),i===t.built_in_db&&o.__id)try{const e=h(o.__id);o=Object.assign(Object.assign({},o),e)}catch(e){}const s={type:"insert",squidDocIdObj:n,properties:Object.assign(Object.assign(Object.assign({},e),{__docId__:n.docId}),o)};return this.dataManager.applyOutgoingMutation(s,r)}async delete(e){const t={type:"delete",squidDocIdObj:M(this.squidDocId)};return this.dataManager.applyOutgoingMutation(t,e)}migrateDocIds(e){const t=e[this.squidDocId];t&&(this._squidDocId=t)}}class Ke{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}=M(e),i=h(n),o=this.get(t,r);return Object.entries(i).forEach((([e,t])=>{o.where(e,"==",t)})),o}get(e,t){return new Ge(e,t,this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this,this.documentIdentityService)}}class He{constructor(e){this.queryBuilder=e}peek(){return this.queryBuilder.peek().map((e=>e.data))}snapshot(){return(0,w.firstValueFrom)(this.snapshots(!1))}snapshots(e){return this.queryBuilder.snapshots(e).pipe(qe((e=>e.map((e=>e.data)))))}getSortOrders(){return this.queryBuilder.getSortOrders()}clone(){return new He(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 C(this,e)}}class Ge extends _{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=r instanceof Array?[...r]:[r];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){k(T(e,"number"),"Limit needs to be a number"),-1!==e&&(k(e>0,"query limit has to be greater than 0"),k(Math.floor(e)===e,"query limit has to be an integer"),k(e<=2e4,"Limit can be maximum 20000"))}(e),this.query.limit=e,this}getLimit(){return this.query.limit}limitBy(e,...t){return this.query.limitBy={limit:e,fields:t,reverseSort:!1},this}sortBy(e,t=!0){const r={asc:t,fieldName:e};return I(r),k(!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=this.query.conditions.filter(d),t=[],r=s.groupBy(e||[],(e=>e.fieldName));for(const e of Object.values(r)){const r=s.groupBy(e,(e=>e.operator));for(const[e,n]of Object.entries(r)){if("=="===e||"!="===e){t.push(...n);continue}const r=s.sortBy(n,(e=>e.value));">"===e||">="===e?t.push(r[r.length-1]):t.push(r[0])}}return[...this.query.conditions.filter((e=>!d(e))),...t]}getSortOrder(){return this.query.sortOrder}snapshot(){return(0,w.firstValueFrom)(this.snapshots(!1))}setForceFetchFromServer(){return this.forceFetchFromServer=!0,this}peek(){return this.localQueryManager.peek(this.build())}snapshots(e=!0){return this.querySubscriptionManager.processQuery(this.build(),this.collectionName,{},{},e,this.forceFetchFromServer).pipe(qe((e=>e.map((e=>{k(1===Object.keys(e).length);const t=F(N(e[this.collectionName]).__docId__,this.collectionName,this.integrationId);return this.documentReferenceFactory.create(t,this.queryBuilderFactory)})))))}changes(){let e,t=new Set;return this.snapshots().pipe((0,w.combineLatestWith)(this.documentIdentityService.observeChanges().pipe((0,w.switchMap)((t=>(Object.entries(t).forEach((([t,r])=>{!function(e,t,r){const n=e[t];void 0!==n&&(e[r]=n,delete e[t])}(e||{},t,r)})),w.NEVER))),(0,w.startWith)({}))),qe((([r])=>{let n=[];const i=[],o=[];if(e){for(const o of r){const r=o.squidDocId,s=o.data;if(t.has(s))delete e[r],t.delete(s);else if(e[r]){i.push(o);const n=e[r];delete e[r],t.delete(n)}else n.push(o)}for(const e of t)o.push(e)}else n=r;e={},t=new Set;for(const n of r){const r=n.data;e[n.squidDocId]=r,t.add(r)}return new We(n,i,o)})))}get hash(){return f(this.build())}dereference(){return new He(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=s.cloneDeep(this.query),e}addCompositeCondition(e){return this.query.conditions.push({fields:e}),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.data}paginate(e){return new C(this,e)}}class We{constructor(e,t,r){this.inserts=e,this.updates=t,this.deletes=r}}function Je(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=Ze(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:c}=r.query;let u=e.collection(a,c).joinQuery(r.alias);return u=Ze(u,r.query),Object.entries(n).map((([t,r])=>{const{collectionName:n,integrationId:o}=r,{left:s,right:a,leftAlias:c}=i[t];let l=e.collection(n,o).query();l=Ze(l,r),u=u.join(l,t,{left:s,right:a},{leftAlias:c})})),o&&s?u.grouped().dereference():o?u.dereference():s?u.grouped():u}(e,t);case"merged":return function(e,t){const{queries:r}=t,{collectionName:n,integrationId:i}=Xe(r[0]),o=r.map((t=>Je(e,t)));return e.collection(n,i).or(...o)}(e,t)}}function Ze(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 Xe(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 Xe(e.queries[0])}}class et{constructor(e,t,r){this.rpcManager=e,this.socketManager=t,this.integrationId=r,this.ongoingChatRequests={},this.socketManager.observeNotifications().pipe((0,w.filter)((e=>"aiAssistant"===e.type)),qe((e=>e))).subscribe((e=>{this.handleChatResponse(e)}))}profile(e){return new tt(this,this.integrationId,e)}async mutate(e){await this.rpcManager.post("ai/assistant/mutate",e)}chat(e,t){const r=te(),n=new w.BehaviorSubject("");this.ongoingChatRequests[r]=n;const i={profileId:e,prompt:t,integrationId:this.integrationId,clientRequestId:r};return this.rpcManager.post("ai/assistant/chat",i).catch((e=>{n.error(e),n.complete()})),n.pipe((0,w.finalize)((()=>{delete this.ongoingChatRequests[r]})),(0,w.share)())}handleChatResponse(e){const t=this.ongoingChatRequests[e.clientRequestId];t&&(e.payload.complete?t.complete():t.next(t.value+e.payload.token))}}class tt{constructor(e,t,r){this.client=e,this.integrationId=t,this.profileId=r}chat(e){return this.client.chat(this.profileId,e)}context(e){return new rt(this.client,this.integrationId,this.profileId,e)}instruction(e){return new nt(this.client,this.integrationId,this.profileId,e)}insert(e){const{modelName:t}=e,r={type:"insert",resource:"profile",profileId:this.profileId,payload:{modelName:t,strictContext:!1},integrationId:this.integrationId};return this.client.mutate(r)}update(e){const{modelName:t}=e,r={type:"update",resource:"profile",profileId:this.profileId,payload:{modelName:t,strictContext:!1},integrationId:this.integrationId};return this.client.mutate(r)}delete(){const e={type:"delete",resource:"profile",profileId:this.profileId,integrationId:this.integrationId,payload:{}};return this.client.mutate(e)}}class rt{constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||te()}insert(e){const{title:t,context:r}=e,n={type:"insert",resource:"context",profileId:this.profileId,integrationId:this.integrationId,payload:{id:this.id,title:t,context:r}};return this.client.mutate(n)}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 nt{constructor(e,t,r,n){this.client=e,this.integrationId=t,this.profileId=r,this.id=n||te()}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 it{constructor(e,t){this.rpcManager=e,this.socketManager=t,this.assistantsMap=new Map}getAssistant(e){let t=this.assistantsMap.get(e);return t||(t=new et(this.rpcManager,this.socketManager,e),this.assistantsMap.set(e,t),t)}}class ot{constructor(e,t,r,n={}){this.clientIdService=e,this.rpcManager=t,this.socketManager=r,this.apiServerUrlOverrideMapping=n,this.ongoingApiExecutions={},r.observeNotifications().pipe((0,w.filter)((e=>"api"===e.type)),qe((e=>e))).subscribe((e=>{this.handleApiResponse(e.clientRequestId,e).then()}))}callApiAndSubscribe(e,t,r){const n=te(),i=new w.Subject;this.ongoingApiExecutions[n]=i;const o={integrationId:e,endpointId:t,request:r,clientRequestId:n,serverUrlOverride:this.apiServerUrlOverrideMapping[e]};return this.rpcManager.post("api/call",o).catch((n=>{console.error("Got error while calling API",e,t,r,n),i.error(n),i.complete()})),(0,w.race)(i.pipe((0,w.finalize)((()=>{delete this.ongoingApiExecutions[n]})),(0,w.share)()),this.clientIdService.observeClientTooOld().pipe(qe((()=>{throw new Error("CLIENT_NOT_CONNECTED")}))))}async handleApiResponse(e,t){const r=this.ongoingApiExecutions[e];r&&(t.success?r.next(h(t.payload)):r.error((0,s.pick)(t,"httpStatus","payload")),r.complete())}}class st{constructor(e,t){this.destructManager=e,this.apiKey=t,this.authIdTokenSet=new w.BehaviorSubject(!1),this.authIdTokenObservableSubject=new w.Subject,this.shouldWaitForAuth=!1,this.observeAuthIdToken().subscribe((e=>{this.idToken=e.token,this.integrationId=e.integrationId,this.authIdTokenSet.next(!0)}))}setAuthIdToken(e,t){this.shouldWaitForAuth=!0,this.authIdTokenSet.next(!1);const r=e&&"string"!=typeof e?(0,w.from)(e).pipe((0,w.map)((e=>({token:e,integrationId:t})))):(0,w.of)({token:e,integrationId:t});this.authIdTokenObservableSubject.next(r)}observeAuthIdToken(){return this.authIdTokenObservableSubject.pipe((0,w.switchMap)((e=>e)),(0,w.takeUntil)(this.destructManager.observeIsDestructing()))}async waitForReadyState(){this.shouldWaitForAuth&&!this.destructManager.isDestructing&&await(0,w.firstValueFrom)((0,w.race)(this.authIdTokenSet.asObservable().pipe((0,w.filter)(Boolean)),this.destructManager.observeIsDestructing()))}getApiKey(){return this.apiKey}getAuthToken(){return this.apiKey?{type:"ApiKey",token:this.apiKey}:this.idToken?{type:"Bearer",token:this.idToken,integrationId:this.integrationId}:void 0}}class at{constructor(e,t,r){this.clientIdService=e,this.rpcManager=t,this.socketManager=r,this.ongoingFunctionExecutions={},r.observeNotifications().pipe((0,w.filter)((e=>"backendFunction"===e.type)),qe((e=>e))).subscribe((e=>{this.handleFunctionResponse(e.clientRequestId,e.payload)}))}executeFunctionAndSubscribe(e,...t){const r=te(),n=new w.Subject;this.ongoingFunctionExecutions[r]=n;const i={functionName:e,paramsArrayStr:l(t),clientRequestId:r};return this.rpcManager.post("backend-function/execute",i).catch((t=>{console.error("Got error while executing function",e,t),n.error(t),n.complete()})),(0,w.race)(n.pipe((0,w.finalize)((()=>{delete this.ongoingFunctionExecutions[r]})),(0,w.share)()),this.clientIdService.observeClientTooOld().pipe(qe((()=>{throw new Error("CLIENT_NOT_CONNECTED")}))))}handleFunctionResponse(e,t){const r=this.ongoingFunctionExecutions[e];if(!r)return;const n=h(t);n.success?r.next(n.response):(r.error(new Error(n.response)),r.complete())}}class ct{constructor(e){this.destructManager=e,this.clientTooOldSubject=new w.BehaviorSubject(!1),this.clientIdSubject=new w.BehaviorSubject(te()),this.destructManager.onDestruct((()=>{this.clientTooOldSubject.complete(),this.clientIdSubject.complete()}))}observeClientId(){return this.clientIdSubject}observeClientTooOld(){return this.clientTooOldSubject.pipe((0,w.filter)((e=>e)),(0,w.map)((e=>{})))}notifyClientTooOld(){this.clientTooOldSubject.next(!0),this.clientIdSubject.next(te())}notifyClientReadyToBeRegenerated(){this.clientTooOldSubject.next(!1)}observeClientReadyToBeRegenerated(){return this.clientTooOldSubject.pipe((0,w.skip)(1),(0,w.filter)((e=>!e)),(0,w.map)((e=>{})))}getClientId(){return this.clientIdSubject.value}isClientTooOld(){return this.clientTooOldSubject.value}}class ut{constructor(e,t,r){this.documentReferenceFactory=e,this.queryBuilderFactory=t,this.querySubscriptionManager=r,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 Be(e,t,this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager),r.set(e,n),n)}}class lt{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 ht=r(3910);const ft="dataManager_runInTransaction";class dt{constructor(e,t,r,n,i,o,s,a){this.documentStore=e,this.mutationSender=t,this.socketManager=r,this.querySubscriptionManager=n,this.queryBuilderFactory=i,this.lockManager=o,this.destructManager=s,this.documentIdentityService=a,this.docIdToLocalTimestamp=new Map,this.batchClientRequestIds=new Set,this.docIdToServerTimestamp=new Map,this.pendingIncomingUpdates=new Map,this.pendingOutgoingMutations=new Map,this.pendingOutgoingMutationsChanged=new w.Subject,this.outgoingMutationsEmpty=new w.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.querySubscriptionManager.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){return t?(k(t===this.currentTransactionId,"Transaction already ended."),e(t).then((e=>Promise.resolve()))):(this.lockManager.canGetLock(ft)?this.lockManager.lockSync(ft):await this.lockManager.lock(ft),new Promise((async(t,r)=>{try{this.currentTransactionId=te();try{return await e(this.currentTransactionId)}catch(e){console.error("error while executing callback function in transaction",e)}finally{this.finishTransaction({resolve:t,reject:r})}}catch(e){console.error("error while executing transaction",e)}finally{this.lockManager.release(ft)}})))}async applyOutgoingMutation(e,t){var r;const n=F(e.squidDocIdObj);this.knownDirtyDocs.add(n),t||this.lockManager.canGetLock(ft)||(await this.lockManager.lock(ft),this.lockManager.release(ft)),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=Q([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=V(t);for(const[e,t]of n){const n=t;for(const t of n){const n=L(D(r,e),t);void 0===n?R(r,e):x(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 k(t===this.currentTransactionId,"Transaction already ended."),void e(t);await this.lockManager.lock(ft);try{this.currentTransactionId=te();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(ft)}}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,w.filter)((e=>"mutations"===e.type)),qe((e=>e))).subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,w.filter)(Boolean),(0,w.take)(1)).subscribe((()=>{this.handleIncomingMutations(e.payload)}))})),this.socketManager.observeNotifications().pipe((0,w.filter)((e=>"query"===e.type)),qe((e=>e))).subscribe((e=>{this.outgoingMutationsEmpty.pipe((0,w.filter)(Boolean),(0,w.take)(1)).subscribe((()=>{this.handleIncomingQuerySnapshots(e.payload)}))}))}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=F(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;for(const[t,i]of Object.entries(e))this.addPendingIncomingUpdate(t,i),this.pendingIncomingUpdates.get(t)||(r=!0),n.add(t);return this.runInTransactionSync((()=>{for(const e of n)this.maybeApplyIncomingUpdate(e)}),t).then(),r}addPendingIncomingUpdate(e,t){const r=this.pendingIncomingUpdates.get(e),n=this.docIdToServerTimestamp.get(e);r&&r.timestamp>t.timestamp||n&&n.timestamp>t.timestamp||this.pendingIncomingUpdates.set(e,t)}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.querySubscriptionManager.setClientRequestIdsForLocalDoc(e,t.properties).forEach((e=>{this.batchClientRequestIds.add(e)})),t.properties&&(this.querySubscriptionManager.findQueriesForDocument(t.properties,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||u(Object.assign(Object.assign({},t),{__ts__:void 0}))!==u(r))&&(this.documentStore.saveDocument(e,t),!0))}finishTransaction(e){this.currentTransactionId=void 0;const t=[...this.batchClientRequestIds.values()];this.batchClientRequestIds.clear(),this.querySubscriptionManager.notifyAllSubscriptions(t),this.sendAllUnsentOutgoingMutations(e).then()}async sendAllUnsentOutgoingMutations(e){const t=this.groupOutgoingMutationsByIntegrationId();try{await ht.PromisePool.for(t).withConcurrency(t.length||1).handleError((e=>{throw e})).process((async([e,t])=>{await this.sendMutationsForIntegration([...t],e)})),this.pendingOutgoingMutations.size||this.outgoingMutationsEmpty.next(!0),await this.refreshUpdatedDocuments(),this.hasPendingSentMutations()?(await(0,w.firstValueFrom)(this.pendingOutgoingMutationsChanged.pipe((0,w.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);await 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=F(e.mutation.squidDocIdObj),r=N(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){this.setExpiration(t,!0);try{const e=await this.queryBuilderFactory.getForDocument(t).setForceFetchFromServer().snapshot();if(N(e.length<=1,"Got more than one doc for the same id:"+t),!e.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,r]of[...this.pendingOutgoingMutations.entries()]){const t=r[r.length-1];if(t&&!t.sentToServer){const r=t.mutation.squidDocIdObj.integrationId;(e[r]||(e[r]=[])).push(t),t.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=F(t.mutation.squidDocIdObj),n=e[r];n&&(t.mutation.squidDocIdObj=M(n))}))})),Object.entries(e).forEach((([e,t])=>{P(this.pendingOutgoingMutations,e,t),P(this.docIdToLocalTimestamp,e,t),P(this.docIdToServerTimestamp,e,t)}))}hasPendingSentMutations(){for(const e of this.pendingOutgoingMutations.values())for(const t of e)if(t.sentToServer)return!0;return!1}}class pt{constructor(){this.predestructors=[],this.destructors=[],this.isDestructedSubject=new w.BehaviorSubject(!1)}get isDestructing(){return this.isDestructedSubject.value}observeIsDestructing(){return this.isDestructedSubject.asObservable().pipe((0,w.filter)(Boolean),qe((()=>{})))}onPreDestruct(e){this.predestructors.push(e)}onDestruct(e){this.destructors.push(e)}async destruct(){if(this.isDestructing)return;this.isDestructedSubject.next(!0);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()}}}class mt{constructor(e,t){this.socketManager=e,this.destructManager=t,this.ongoingLocks={},this.acquireLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,w.filter)((e=>"lockAcquired"===e.type))),this.releaseLockMessagesFromServer=this.socketManager.observeNotifications().pipe((0,w.filter)((e=>"lockReleased"===e.type))),this.lockWaitForConnectionThreshold=2e3,t.onPreDestruct((()=>{this.releaseAllLocks()})),this.socketManager.observeConnectionReady().subscribe((e=>{e||this.releaseAllLocks()})),this.releaseLockMessagesFromServer.subscribe((e=>{const t=this.ongoingLocks[e.payload.clientRequestId];void 0!==t&&t.release().then()}))}async lock(e,t){if(!await(0,w.firstValueFrom)((0,w.race)((0,w.timer)(this.lockWaitForConnectionThreshold).pipe(qe((()=>!1))),this.socketManager.observeConnectionReady().pipe((0,w.filter)(Boolean)),this.destructManager.observeIsDestructing())))return Promise.reject("CLIENT_NOT_CONNECTED");const r=te(),n={type:"acquireLock",payload:{mutex:e,exclusive:t,clientRequestId:r}};this.socketManager.sendMessage(n);const i=await(0,w.firstValueFrom)((0,w.race)((0,w.timer)(5e3).pipe((0,w.take)(1),qe((()=>({payload:{error:"TIMEOUT_GETTING_LOCK",lockId:void 0}})))),this.acquireLockMessagesFromServer.pipe((0,w.filter)((e=>e.payload.clientRequestId===r)))));if(!i.payload.lockId)throw new Error(`Failed to acquire lock: ${i.payload.error}`);const o=i.payload.lockId,s=new yt(o,r,this.ongoingLocks,this.socketManager);return this.ongoingLocks[o]=s,s}releaseAllLocks(){for(const[e,t]of Object.entries(this.ongoingLocks))t.release().then(),delete this.ongoingLocks[e]}}class yt{constructor(e,t,r,n){this.lockId=e,this.clientRequestId=t,this.ongoingLocks=r,this.socketManager=n,this.released=!1,this.onReleaseSubject=new w.Subject}async 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 vt{constructor(e,t){this.documentStore=e,this.destructManager=t,this.changeNotifier=new w.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 gt{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 Ye(e,N(this.dataManager,"dataManager not found"),t);const{integrationId:n,collectionName:i}=M(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,r]of this.documents)r.migrateDocIds(e);Object.entries(e).forEach((([e,t])=>{const r=M(e),n=M(t);P(this.documents,r.docId,n.docId)}))}getCollectionKey(e,t){return`${e}_${t}`}}class bt{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=(0,s.cloneDeep)(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 N(this.getDocumentOrUndefined(e))}getDocumentOrUndefined(e){return this.squidDocIdToDoc.get(e)}sortAndLimitDocs(e,t){if(0===e.size)return[];const r=[...e].map((e=>this.squidDocIdToDoc.get(e))).filter(ne),{sortOrder:n,limitBy:i}=t,o=n.map((e=>e.fieldName)),c=n.map((e=>e.asc?"asc":"desc")),l=(0,s.orderBy)(r,o,c),h=t.limit<0?2e3:t.limit;if(!i)return l.slice(0,h);const{limit:f,fields:d,reverseSort:p}=i,m=function(e,t,r){const n=Object.values(a().groupBy(e,(e=>u(t.map((t=>D(e,t))))))),i=t.map((e=>t=>{D(t[0],e)}));return(0,s.orderBy)(n,i,r)}(l,d,c);let y;return y=p?m.map((e=>e.slice(-f))):m.map((e=>e.slice(0,f))),y.flat().slice(0,h)}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;P(this.squidDocIdToDoc,e,t);const n=M(t),i=h(n.docId);this.saveDocument(t,Object.assign(Object.assign(Object.assign({},r),i),{__docId__:n.docId}))}}var _t="Invariant Violation",wt=Object.setPrototypeOf,Et=void 0===wt?function(e,t){return e.__proto__=t,e}:wt,St=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,Et(n,t.prototype),n}return ae(t,e),t}(Error);function Ot(e,t){if(!e)throw new St(t)}var It=["debug","log","warn","error","silent"],Tt=It.indexOf("log");function kt(e){return function(){if(It.indexOf(e)>=Tt)return(console[e]||console.log).apply(console,arguments)}}function Nt(e){try{return e()}catch(e){}}!function(e){e.debug=kt("debug"),e.log=kt("log"),e.warn=kt("warn"),e.error=kt("error")}(Ot||(Ot={}));const Dt=Nt((function(){return globalThis}))||Nt((function(){return window}))||Nt((function(){return self}))||Nt((function(){return global}))||Nt((function(){return Nt.constructor("return this")()}));var At="__",xt=[At,At].join("DEV");const Rt=function(){try{return Boolean(__DEV__)}catch(e){return Object.defineProperty(Dt,xt,{value:"production"!==Nt((function(){return"production"})),enumerable:!1,configurable:!0,writable:!0}),Dt[xt]}}();function Pt(e){try{return e()}catch(e){}}var Ct=Pt((function(){return globalThis}))||Pt((function(){return window}))||Pt((function(){return self}))||Pt((function(){return global}))||Pt((function(){return Pt.constructor("return this")()})),jt=!1;function $t(e,t){if(!Boolean(e))throw new Error(t)}!Ct||Pt((function(){return"production"}))||Pt((function(){return process}))||(Object.defineProperty(Ct,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),jt=!0);const Mt=10,Ft=2;function qt(e){return Lt(e,[])}function Lt(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:Lt(t,r)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Ft)return"[Array]";const r=Math.min(Mt,e.length),n=e.length-r,i=[];for(let n=0;n<r;++n)i.push(Lt(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>Ft)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+": "+Lt(r,t)));return"{ "+n.join(", ")+" }"}(e,r)}(e,t);default:return String(e)}}class Vt{constructor(e,t="GraphQL request",r={line:1,column:1}){"string"==typeof e||$t(!1,`Body must be a string. Received: ${qt(e)}.`),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||$t(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||$t(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}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 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 Bt(e,t,r){return t&&Ut(e.prototype,t),r&&Ut(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}jt&&(delete Ct.process,jt=!1),__DEV__?Ot("boolean"==typeof Rt,Rt):Ot("boolean"==typeof Rt,39);var zt=function(){return"function"==typeof Symbol},Yt=function(e){return zt()&&Boolean(Symbol[e])},Kt=function(e){return Yt(e)?Symbol[e]:"@@"+e};zt()&&!Yt("observable")&&(Symbol.observable=Symbol("observable"));var Ht=Kt("iterator"),Gt=Kt("observable"),Wt=Kt("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 Zt(e){var t=e.constructor;return void 0!==t&&null===(t=t[Wt])&&(t=void 0),void 0!==t?t:cr}function Xt(e){return e instanceof cr}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))},Bt(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")},Bt(e,[{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),cr=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(Zt(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(Zt(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=Zt(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=Zt(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=Zt(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=Jt(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=Jt(t,Ht)))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 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){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()}}))}))},Bt(e,null,[{key:Wt,get:function(){return this}}]),e}();function ur(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 __DEV__?new St("Found a ".concat(e.operation," operation").concat(e.name?" named '".concat(e.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new St(44);"FragmentDefinition"===e.kind&&n.push(e)})),void 0===r&&(__DEV__?Ot(1===n.length,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):Ot(1===n.length,45),r=n[0].name.value),ce(ce({},e),{definitions:pe([{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 fr(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 __DEV__?Ot(n,"No fragment named ".concat(r)):Ot(n,46),n||null;default:return null}}function dr(e){return{__ref:String(e)}}function pr(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function mr(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 mr(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 mr(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 __DEV__?new St('The inline argument "'.concat(t.value,'" of kind "').concat(r.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new St(55);e[t.value]=null}}zt()&&Object.defineProperty(cr,Symbol("extensions"),{value:{symbol:Gt,hostReportError:er},configurable:!0});var yr=["connection","include","skip","client","rest","export"],vr=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(gr(i),")")}return r.connection.key}var o=e;if(t){var s=gr(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(gr(r[e]),")"):o+="@".concat(e))})),o}),{setStringify:function(e){var t=gr;return gr=e,t}}),gr=function(e){return JSON.stringify(e,br)};function br(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 _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 mr(r,n,i,t)})),r}return null}function wr(e){return e.alias?e.alias.value:e.name.value}function Er(e,t,r){if("string"==typeof e.__typename)return e.__typename;for(var n=0,i=t.selections;n<i.length;n++){var o=i[n];if(Sr(o)){if("__typename"===o.name.value)return e[wr(o)]}else{var s=Er(e,fr(o,r).selectionSet,r);if("string"==typeof s)return s}}}function Sr(e){return"Field"===e.kind}function Or(e){__DEV__?Ot(e&&"Document"===e.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):Ot(e&&"Document"===e.kind,47);var t=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw __DEV__?new St('Schema type definitions not allowed in queries. Found: "'.concat(e.kind,'"')):new St(48);return e}));return __DEV__?Ot(t.length<=1,"Ambiguous GraphQL document: contains ".concat(t.length," operations")):Ot(t.length<=1,49),e}function Ir(e){return Or(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 kr(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function Nr(e){var t=Ir(e);return __DEV__?Ot(t&&"query"===t.operation,"Must contain a query definition."):Ot(t&&"query"===t.operation,50),t}function Dr(e){var t;Or(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 __DEV__?new St("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new St(54)}function Ar(e){var t=Object.create(null),r=e&&e.variableDefinitions;return r&&r.length&&r.forEach((function(e){e.defaultValue&&mr(t,e.variable.name,e.defaultValue)})),t}function xr(e,t){return t?t(e):cr.of()}function Rr(e){return"function"==typeof e?new jr(e):e}function Pr(e){return e.request.length<=1}var Cr=function(e){function t(t,r){var n=e.call(this,t)||this;return n.link=r,n}return ae(t,e),t}(Error),jr=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return cr.of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(Rr).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,r,n){var i=Rr(r),o=Rr(n||new e(xr));return Pr(i)&&Pr(o)?new e((function(e){return t(e)?i.request(e)||cr.of():o.request(e)||cr.of()})):new e((function(e,r){return t(e)?i.request(e,r)||cr.of():o.request(e,r)||cr.of()}))},e.execute=function(e,t){return e.request(function(e,t){var r=ce({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){r=ce(ce({},r),"function"==typeof e?e(r):e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return ce({},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 __DEV__?new St("illegal argument: ".concat(i)):new St(27)}return e}(t))))||cr.of()},e.concat=function(t,r){var n=Rr(t);if(Pr(n))return __DEV__&&Ot.warn(new Cr("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Rr(r);return Pr(i)?new e((function(e){return n.request(e,(function(e){return i.request(e)||cr.of()}))||cr.of()})):new e((function(e,t){return n.request(e,(function(e){return i.request(e,t)||cr.of()}))||cr.of()}))},e.prototype.split=function(t,r,n){return this.concat(e.split(t,r,n||new e(xr)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw __DEV__?new St("request is not implemented"):new St(22)},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}(),$r=jr.execute;class Mr{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 Fr{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 qr={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"]},Lr=new Set(Object.keys(qr));function Vr(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&Lr.has(t)}var Qr,Ur,Br;!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(Qr||(Qr={})),(Br=Ur||(Ur={})).NAME="Name",Br.DOCUMENT="Document",Br.OPERATION_DEFINITION="OperationDefinition",Br.VARIABLE_DEFINITION="VariableDefinition",Br.SELECTION_SET="SelectionSet",Br.FIELD="Field",Br.ARGUMENT="Argument",Br.FRAGMENT_SPREAD="FragmentSpread",Br.INLINE_FRAGMENT="InlineFragment",Br.FRAGMENT_DEFINITION="FragmentDefinition",Br.VARIABLE="Variable",Br.INT="IntValue",Br.FLOAT="FloatValue",Br.STRING="StringValue",Br.BOOLEAN="BooleanValue",Br.NULL="NullValue",Br.ENUM="EnumValue",Br.LIST="ListValue",Br.OBJECT="ObjectValue",Br.OBJECT_FIELD="ObjectField",Br.DIRECTIVE="Directive",Br.NAMED_TYPE="NamedType",Br.LIST_TYPE="ListType",Br.NON_NULL_TYPE="NonNullType",Br.SCHEMA_DEFINITION="SchemaDefinition",Br.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",Br.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",Br.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",Br.FIELD_DEFINITION="FieldDefinition",Br.INPUT_VALUE_DEFINITION="InputValueDefinition",Br.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",Br.UNION_TYPE_DEFINITION="UnionTypeDefinition",Br.ENUM_TYPE_DEFINITION="EnumTypeDefinition",Br.ENUM_VALUE_DEFINITION="EnumValueDefinition",Br.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",Br.DIRECTIVE_DEFINITION="DirectiveDefinition",Br.SCHEMA_EXTENSION="SchemaExtension",Br.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",Br.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",Br.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",Br.UNION_TYPE_EXTENSION="UnionTypeExtension",Br.ENUM_TYPE_EXTENSION="EnumTypeExtension",Br.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension";const zr=Object.freeze({});function Yr(e,t,r=qr){const n=new Map;for(const e of Object.values(Ur))n.set(e,Kr(t,e));let i,o,s,a=Array.isArray(e),c=[e],u=-1,l=[],h=e;const f=[],d=[];do{u++;const e=u===c.length,v=e&&0!==l.length;if(e){if(o=0===d.length?void 0:f[f.length-1],h=s,s=d.pop(),v)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}u=i.index,c=i.keys,l=i.edits,a=i.inArray,i=i.prev}else if(s){if(o=a?u:c[u],h=s[o],null==h)continue;f.push(o)}let g;if(!Array.isArray(h)){var p,m;Vr(h)||$t(!1,`Invalid AST Node: ${qt(h)}.`);const r=e?null===(p=n.get(h.kind))||void 0===p?void 0:p.leave:null===(m=n.get(h.kind))||void 0===m?void 0:m.enter;if(g=null==r?void 0:r.call(t,h,o,s,f,d),g===zr)break;if(!1===g){if(!e){f.pop();continue}}else if(void 0!==g&&(l.push([o,g]),!e)){if(!Vr(g)){f.pop();continue}h=g}}var y;void 0===g&&v&&l.push([o,h]),e?f.pop():(i={inArray:a,index:u,keys:c,edits:l,prev:i},a=Array.isArray(h),c=a?h:null!==(y=r[h.kind])&&void 0!==y?y:[],u=-1,l=[],s&&d.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 Hr(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;__DEV__?Ot(r&&1===r.length,"Incorrect number of arguments for the @".concat(n," directive.")):Ot(r&&1===r.length,41);var i=r[0];__DEV__?Ot(i.name&&"if"===i.name.value,"Invalid argument for the @".concat(n," directive.")):Ot(i.name&&"if"===i.name.value,42);var o=i.value;__DEV__?Ot(o&&("Variable"===o.kind||"BooleanValue"===o.kind),"Argument for the @".concat(n," directive must be a variable or a boolean value.")):Ot(o&&("Variable"===o.kind||"BooleanValue"===o.kind),43),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],__DEV__?Ot(void 0!==i,"Invalid variable referenced in @".concat(r.name.value," directive.")):Ot(void 0!==i,40)):i=n.value.value,"skip"===r.name.value?!i:i}))}function Gr(e,t,r){var n=new Set(e),i=n.size;return Yr(t,{Directive:function(e){if(n.delete(e.name.value)&&(!r||!n.size))return zr}}),r?!n.size:n.size<i}function Wr(e){return e&&Gr(["client","export"],e,!0)}var Jr=function(e,t){var r;try{r=JSON.stringify(e)}catch(e){var n=__DEV__?new St("Network request failed. ".concat(t," is not serializable: ").concat(e.message)):new St(24);throw n.parseError=e,n}return r},Zr="function"==typeof WeakMap&&"ReactNative"!==Nt((function(){return navigator.product})),Xr="function"==typeof WeakSet,en="function"==typeof Symbol&&"function"==typeof Symbol.for,tn=en&&Symbol.asyncIterator;function rn(e){var t={next:function(){return e.read()}};return tn&&(t[Symbol.asyncIterator]=function(){return this}),t}function nn(e){var t,r,n,i,o=e;if(e.body&&(o=e.body),i=o,tn&&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 rn(o.getReader());if(function(e){return!!e.stream}(o))return rn(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)})))}},tn&&(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 c(){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",c),e.removeListener("finish",c),e.removeListener("close",c)},e.on("data",s),e.on("error",a),e.on("end",c),e.on("finish",c),e.on("close",c);var u={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 tn&&(u[Symbol.asyncIterator]=function(){return this}),u}(o);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}Nt((function(){return window.document.createElement})),Nt((function(){return navigator.userAgent.indexOf("jsdom")>=0}));var on=function(e,t,r){var n=new Error(r);throw n.name="ServerError",n.response=e,n.statusCode=e.status,n.result=t,n},sn=Object.prototype.hasOwnProperty;function an(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 cn(e,t){e.status>=300&&on(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 un(e,t){var r,n;"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&(null===(r=t.next)||void 0===r||r.call(t,e.result)),null===(n=t.error)||void 0===n||n.call(t,e))}function ln(e){return 9===e||32===e}function hn(e){return e>=48&&e<=57}function fn(e){return e>=97&&e<=122||e>=65&&e<=90}function dn(e){return fn(e)||95===e}function pn(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&&ln(e.charCodeAt(t));)++t;return t}const yn=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function vn(e){return gn[e.charCodeAt(0)]}const gn=["\\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"];function bn(e){return Yr(e,_n)}const _n={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>wn(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Sn("(",wn(e.variableDefinitions,", "),")"),r=wn([e.operation,wn([e.name,t]),wn(e.directives," ")]," ");return("query"===r?"":r+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:r,directives:n})=>e+": "+t+Sn(" = ",r)+Sn(" ",wn(n," "))},SelectionSet:{leave:({selections:e})=>En(e)},Field:{leave({alias:e,name:t,arguments:r,directives:n,selectionSet:i}){const o=Sn("",e,": ")+t;let s=o+Sn("(",wn(r,", "),")");return s.length>80&&(s=o+Sn("(\n",On(wn(r,"\n")),"\n)")),wn([s,wn(n," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Sn(" ",wn(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:r})=>wn(["...",Sn("on ",e),wn(t," "),r]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:r,directives:n,selectionSet:i})=>`fragment ${e}${Sn("(",wn(r,", "),")")} on ${t} ${Sn("",wn(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||ln(e.charCodeAt(0)))),s=r.endsWith('\\"""'),a=e.endsWith('"')&&!s,c=e.endsWith("\\"),u=a||c,l=!i||e.length>70||u||o||s;let h="";const f=i&&ln(e.charCodeAt(0));return(l&&!f||o)&&(h+="\n"),h+=r,(l||u)&&(h+="\n"),'"""'+h+'"""'}(e):`"${e.replace(yn,vn)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+wn(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+wn(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Sn("(",wn(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:r})=>Sn("",e,"\n")+wn(["schema",wn(t," "),En(r)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:r})=>Sn("",e,"\n")+wn(["scalar",t,wn(r," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Sn("",e,"\n")+wn(["type",t,Sn("implements ",wn(r," & ")),wn(n," "),En(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:r,type:n,directives:i})=>Sn("",e,"\n")+t+(In(r)?Sn("(\n",On(wn(r,"\n")),"\n)"):Sn("(",wn(r,", "),")"))+": "+n+Sn(" ",wn(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:r,defaultValue:n,directives:i})=>Sn("",e,"\n")+wn([t+": "+r,Sn("= ",n),wn(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>Sn("",e,"\n")+wn(["interface",t,Sn("implements ",wn(r," & ")),wn(n," "),En(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:r,types:n})=>Sn("",e,"\n")+wn(["union",t,wn(r," "),Sn("= ",wn(n," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:r,values:n})=>Sn("",e,"\n")+wn(["enum",t,wn(r," "),En(n)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:r})=>Sn("",e,"\n")+wn([t,wn(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:r,fields:n})=>Sn("",e,"\n")+wn(["input",t,wn(r," "),En(n)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:r,repeatable:n,locations:i})=>Sn("",e,"\n")+"directive @"+t+(In(r)?Sn("(\n",On(wn(r,"\n")),"\n)"):Sn("(",wn(r,", "),")"))+(n?" repeatable":"")+" on "+wn(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>wn(["extend schema",wn(e," "),En(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>wn(["extend scalar",e,wn(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>wn(["extend type",e,Sn("implements ",wn(t," & ")),wn(r," "),En(n)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>wn(["extend interface",e,Sn("implements ",wn(t," & ")),wn(r," "),En(n)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:r})=>wn(["extend union",e,wn(t," "),Sn("= ",wn(r," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:r})=>wn(["extend enum",e,wn(t," "),En(r)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:r})=>wn(["extend input",e,wn(t," "),En(r)]," ")}};function wn(e,t=""){var r;return null!==(r=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==r?r:""}function En(e){return Sn("{\n",On(wn(e,"\n")),"\n}")}function Sn(e,t,r=""){return null!=t&&""!==t?e+t+r:""}function On(e){return Sn(" ",e.replace(/\n/g,"\n "))}function In(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}var Tn={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},kn=function(e,t){return t(e)};function Nn(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},o={};r.forEach((function(e){i=ce(ce(ce({},i),e.options),{headers:ce(ce({},i.headers),e.headers)}),e.credentials&&(i.credentials=e.credentials),o=ce(ce({},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,u=e.query,l={operationName:s,variables:c};return o.includeExtensions&&(l.extensions=a),o.includeQuery&&(l.query=t(u,bn)),{options:i,body:l}}function Dn(e){return new cr((function(t){t.error(e)}))}var An=Nt((function(){return fetch})),xn=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?kn:i,s=e.includeExtensions,a=e.preserveHeaderCase,c=e.useGETForQueries,u=e.includeUnusedVariables,l=void 0!==u&&u,h=ue(e,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&function(e){if(!e&&"undefined"==typeof fetch)throw __DEV__?new St("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n "):new St(23)}(n||An);var f={http:{includeExtensions:s,preserveHeaderCase:a},options:h.fetchOptions,credentials:h.credentials,headers:h.headers};return new jr((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,u=a.name,h=a.version;u&&(s["apollographql-client-name"]=u),h&&(s["apollographql-client-version"]=h)}var d,p=ce(ce({},s),i.headers),m={http:i.http,options:i.fetchOptions,credentials:i.credentials,headers:p},y=Nn(e,o,Tn,f,m),v=y.options,g=y.body;if(g.variables&&!l){var b=new Set(Object.keys(g.variables));Yr(e.query,{Variable:function(e,t,r){r&&"VariableDefinition"!==r.kind&&b.delete(e.name.value)}}),b.size&&(g.variables=ce({},g.variables),b.forEach((function(e){delete g.variables[e]})))}if(!v.signal){var _=function(){if("undefined"==typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController;return{controller:e,signal:e.signal}}(),w=_.controller,E=_.signal;(d=w)&&(v.signal=E)}if(c&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(v.method="GET"),Gr(["defer"],e.query)&&(v.headers=v.headers||{},v.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),"GET"===v.method){var S=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=Jr(t.variables,"Variables map")}catch(e){return{parseError:e}}n("variables",i)}if(t.extensions){var o=void 0;try{o=Jr(t.extensions,"Extensions map")}catch(e){return{parseError:e}}n("extensions",o)}var s="",a=e,c=e.indexOf("#");-1!==c&&(s=e.substr(c),a=e.substr(0,c));var u=-1===a.indexOf("?")?"?":"&";return{newURI:a+u+r.join("&")+s}}(t,g),O=S.newURI,I=S.parseError;if(I)return Dn(I);t=O}else try{v.body=Jr(g,"Payload")}catch(I){return Dn(I)}return new cr((function(r){return(n||Nt((function(){return fetch}))||An)(t,v).then((function(t){var n;e.setContext({response:t});var i=null===(n=t.headers)||void 0===n?void 0:n.get("content-type");return null!==i&&/^multipart\/mixed/i.test(i)?function(e,t){var r,n,i;return le(this,void 0,void 0,(function(){var o,s,a,c,u,l,h,f,d,p,m,y,v,g,b,_,w,E,S,O;return he(this,(function(I){switch(I.label){case 0:if(void 0===TextDecoder)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");o=new TextDecoder("utf-8"),s=null===(r=e.headers)||void 0===r?void 0:r.get("content-type"),a="boundary=",c=(null==s?void 0:s.includes(a))?null==s?void 0:s.substring((null==s?void 0:s.indexOf(a))+9).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",h=nn(e),f=!0,I.label=1;case 1:return f?[4,h.next()]:[3,3];case 2:for(d=I.sent(),p=d.value,m=d.done,y="string"==typeof p?p:o.decode(p),f=!m,v=(l+=y).indexOf(u);v>-1;){if(g=void 0,O=[l.slice(0,v),l.slice(v+u.length)],l=O[1],(g=O[0]).trim()){if(b=g.indexOf("\r\n\r\n"),_=an(g.slice(0,b)),(w=_["content-type"])&&-1===w.toLowerCase().indexOf("application/json"))throw new Error("Unsupported patch content type: application/json is required.");E=g.slice(b);try{S=cn(e,E.replace("\r\n","")),(Object.keys(S).length>1||"data"in S||"incremental"in S||"errors"in S)&&(null===(n=t.next)||void 0===n||n.call(t,S))}catch(e){un(e,t)}}v=l.indexOf(u)}return[3,1];case 3:return null===(i=t.complete)||void 0===i||i.call(t),[2]}}))}))}(t,r):function(e,t,r){var n;(n=t,function(e){return e.text().then((function(t){return cn(e,t)})).then((function(t){return e.status>=300&&on(e,t,"Response not successful: Received status code ".concat(e.status)),Array.isArray(t)||sn.call(t,"data")||sn.call(t,"errors")||on(e,t,"Server response was missing for query '".concat(Array.isArray(n)?n.map((function(e){return e.operationName})):n.operationName,"'.")),t}))})(e).then((function(e){var t,n;null===(t=r.next)||void 0===t||t.call(r,e),null===(n=r.complete)||void 0===n||n.call(r)})).catch((function(e){return un(e,r)}))}(t,e,r)})).catch((function(e){return un(e,r)})),function(){d&&d.abort()}}))}))},Rn=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,xn(t).request)||this;return r.options=t,r}return ae(t,e),t}(jr),Pn=Object.prototype,Cn=Pn.toString,jn=Pn.hasOwnProperty,$n=Function.prototype.toString,Mn=new Map;function Fn(e,t){try{return qn(e,t)}finally{Mn.clear()}}function qn(e,t){if(e===t)return!0;var r,n,i,o=Cn.call(e);if(o!==Cn.call(t))return!1;switch(o){case"[object Array]":if(e.length!==t.length)return!1;case"[object Object]":if(Un(e,t))return!0;var s=Ln(e),a=Ln(t),c=s.length;if(c!==a.length)return!1;for(var u=0;u<c;++u)if(!jn.call(t,s[u]))return!1;for(u=0;u<c;++u){var l=s[u];if(!qn(e[l],t[l]))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=="".concat(t);case"[object Map]":case"[object Set]":if(e.size!==t.size)return!1;if(Un(e,t))return!0;for(var h=e.entries(),f="[object Map]"===o;;){var d=h.next();if(d.done)break;var p=d.value,m=p[0],y=p[1];if(!t.has(m))return!1;if(f&&!qn(y,t.get(m)))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]":var v=e.byteLength;if(v===t.byteLength)for(;v--&&e[v]===t[v];);return-1===v;case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":var g=$n.call(e);return g===$n.call(t)&&(n=Qn,!((i=(r=g).length-n.length)>=0&&r.indexOf(n,i)===i))}return!1}function Ln(e){return Object.keys(e).filter(Vn,e)}function Vn(e){return void 0!==this[e]}var Qn="{ [native code] }";function Un(e,t){var r=Mn.get(e);if(r){if(r.has(t))return!0}else Mn.set(e,r=new Set);return r.add(t),!1}var Bn=Array.isArray;function zn(e){return Array.isArray(e)&&e.length>0}var Yn=Object.prototype.hasOwnProperty;function Kn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Hn(e)}function Hn(e){var t=e[0]||{},r=e.length;if(r>1)for(var n=new Wn,i=1;i<r;++i)t=n.merge(t,e[i]);return t}var Gn=function(e,t,r){return this.merge(e[r],t[r])},Wn=function(){function e(e){void 0===e&&(e=Gn),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(Yn.call(e,i)){var o=e[i];if(t[i]!==o){var s=r.reconciler.apply(r,pe([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):ce({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},e}();function Jn(e){return"incremental"in e}function Zn(e,t){var r=e,n=new Wn;return Jn(t)&&zn(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 Xn,ei,ti=function(){return Object.create(null)},ri=Array.prototype,ni=ri.forEach,ii=ri.slice,oi=function(){function e(e,t){void 0===e&&(e=!0),void 0===t&&(t=ti),this.weakness=e,this.makeData=t}return e.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},e.prototype.lookupArray=function(e){var t=this;return ni.call(e,(function(e){return t=t.getChildTrie(e)})),t.data||(t.data=this.makeData(ii.call(e)))},e.prototype.getChildTrie=function(t){var r=this.weakness&&function(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}(t)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),n=r.get(t);return n||r.set(t,n=new e(this.weakness,this.makeData)),n},e}(),si=function(){function e(){this.known=new(Xr?WeakSet:Set),this.pool=new oi(Zr),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)?Bn(e)?e.slice(0):ce({__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),__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,c=o.length;if(s.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(a=this.pool.lookupArray(o)).object){var u=a.object=Object.create(i);this.known.add(u),s.sorted.forEach((function(e,t){u[e]=o[c+t]})),__DEV__&&Object.freeze(u)}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}(),ai=Object.assign((function(e){if(ur(e)){void 0===Xn&&ci();var t=Xn.admit(e),r=ei.get(t);return void 0===r&&ei.set(t,r=JSON.stringify(t)),r}return JSON.stringify(e)}),{reset:ci});function ci(){Xn=new si,ei=new(Zr?WeakMap:Map)}function ui(e,t,r){return new cr((function(n){var i=n.next,o=n.error,s=n.complete,a=0,c=!1,u={then:function(e){return new Promise((function(t){return t(e())}))}};function l(e,t){return e?function(t){++a;var r=function(){return e(t)};u=u.then(r,r).then((function(e){--a,i&&i.call(n,e),c&&h.complete()}),(function(e){throw--a,e})).catch((function(e){o&&o.call(n,e)}))}:function(e){return t&&t.call(n,e)}}var h={next:l(t,i),error:l(r,o),complete:function(){c=!0,a||s&&s.call(n)}},f=e.subscribe(h);return function(){return f.unsubscribe()}}))}function li(e){return zn(hi(e))}function hi(e){var t=zn(e.errors)?e.errors.slice(0):[];return Jn(e)&&zn(e.incremental)&&e.incremental.forEach((function(e){e.errors&&t.push.apply(t,e.errors)})),t}var fi={kind:Ur.FIELD,name:{kind:Ur.NAME,value:"__typename"}};function di(e,t){return!e||e.selectionSet.selections.every((function(e){return e.kind===Ur.FRAGMENT_SPREAD&&di(t[e.name.value],t)}))}function pi(e){return di(Ir(e)||function(e){__DEV__?Ot("Document"===e.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):Ot("Document"===e.kind,51),__DEV__?Ot(e.definitions.length<=1,"Fragment must have exactly one definition."):Ot(e.definitions.length<=1,52);var t=e.definitions[0];return __DEV__?Ot("FragmentDefinition"===t.kind,"Must be a fragment definition."):Ot("FragmentDefinition"===t.kind,53),t}(e),hr(kr(e)))?null:e}function mi(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 yi(e,t){for(var r=mi(""),n=mi(""),i=function(e){for(var t=0,i=void 0;t<e.length&&(i=e[t]);++t)if(!Bn(i)){if(i.kind===Ur.OPERATION_DEFINITION)return r(i.name&&i.name.value);if(i.kind===Ur.FRAGMENT_DEFINITION)return n(i.name.value)}return __DEV__&&Ot.error("Could not find operation or fragment"),null},o=0,s=t.definitions.length-1;s>=0;--s)t.definitions[s].kind===Ur.OPERATION_DEFINITION&&++o;var a=function(e){var t=new Set,r=[];return e.forEach((function(e){e.name?t.add(e.name):e.test&&r.push(e.test)})),function(e){return t.has(e.name.value)||r.some((function(t){return t(e)}))}}(e),c=e.some((function(e){return e.remove})),u=function(e){return c&&e&&e.some(a)},l=new Map,h=!1,f={enter:function(e){if(u(e.directives))return h=!0,null}},d=Yr(t,{Field:f,InlineFragment:f,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(u(e.directives))return h=!0,null;var s=i(o);s&&s.fragmentSpreads.add(e.name.value)}},FragmentDefinition:{enter:function(e,t,r,n){l.set(JSON.stringify(n),e)},leave:function(e,t,r,i){return e===l.get(JSON.stringify(i))?e:o>0&&e.selectionSet.selections.every((function(e){return e.kind===Ur.FIELD&&"__typename"===e.name.value}))?(n(e.name.value).removed=!0,h=!0,null):void 0}},Directive:{leave:function(e){if(a(e))return h=!0,null}}});if(!h)return t;var p=function(e){return e.transitiveVars||(e.transitiveVars=new Set(e.variables),e.removed||e.fragmentSpreads.forEach((function(t){p(n(t)).transitiveVars.forEach((function(t){e.transitiveVars.add(t)}))}))),e},m=new Set;d.definitions.forEach((function(e){e.kind===Ur.OPERATION_DEFINITION?p(r(e.name&&e.name.value)).fragmentSpreads.forEach((function(e){m.add(e)})):e.kind!==Ur.FRAGMENT_DEFINITION||0!==o||n(e.name.value).removed||m.add(e.name.value)})),m.forEach((function(e){p(n(e)).fragmentSpreads.forEach((function(e){m.add(e)}))}));var y={enter:function(e){if(t=e.name.value,!m.has(t)||n(t).removed)return null;var t}};return pi(Yr(d,{FragmentSpread:y,FragmentDefinition:y,OperationDefinition:{leave:function(e){if(e.variableDefinitions){var t=p(r(e.name&&e.name.value)).transitiveVars;if(t.size<e.variableDefinitions.length)return ce(ce({},e),{variableDefinitions:e.variableDefinitions.filter((function(e){return t.has(e.variable.name.value)}))})}}}}))}var vi=Object.assign((function(e){return Yr(e,{SelectionSet:{enter:function(e,t,r){if(!r||r.kind!==Ur.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 ce(ce({},e),{selections:pe(pe([],n,!0),[fi],!1)})}}}}})}),{added:function(e){return e===fi}}),gi={test:function(e){var t="connection"===e.name.value;return t&&(e.arguments&&e.arguments.some((function(e){return"key"===e.name.value}))||__DEV__&&Ot.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key.")),t}};function bi(e){return"query"===Dr(e).operation?e:Yr(e,{OperationDefinition:{enter:function(e){return ce(ce({},e),{operation:"query"})}}})}var _i=new Map;function wi(e){var t=_i.get(e)||1;return _i.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function Ei(e,t,r){var n=[];e.forEach((function(e){return e[t]&&n.push(e)})),n.forEach((function(e){return e[t](r)}))}function Si(e){function t(t){Object.defineProperty(e,t,{value:cr})}return en&&Symbol.species&&t(Symbol.species),t("@@species"),e}function Oi(e){return e&&"function"==typeof e.then}var Ii=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),Ei(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),Ei(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?Oi(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"),Ei(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 cr(t)]),Oi(t)?t.then((function(e){return r.start(e)}),r.handlers.error):r.start(t),r}return ae(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}(cr);Si(Ii);var Ti,ki=function(e){function t(r){var n,i,o=r.graphQLErrors,s=r.clientErrors,a=r.networkError,c=r.errorMessage,u=r.extraInfo,l=e.call(this,c)||this;return l.name="ApolloError",l.graphQLErrors=o||[],l.clientErrors=s||[],l.networkError=a||null,l.message=c||(i="",(zn((n=l).graphQLErrors)||zn(n.clientErrors))&&(n.graphQLErrors||[]).concat(n.clientErrors||[]).forEach((function(e){var t=e?e.message:"Error message not found.";i+="".concat(t,"\n")})),n.networkError&&(i+="".concat(n.networkError.message,"\n")),i=i.replace(/\n$/,"")),l.extraInfo=u,l.__proto__=t.prototype,l}return ae(t,e),t}(Error);function Ni(e){return!!e&&e<7}!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"}(Ti||(Ti={}));var Di=Object.prototype.toString;function Ai(e){return xi(e)}function xi(e,t){switch(Di.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]=xi(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]=xi(e[r],t)})),n;default:return e}}function Ri(){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}var Pi=Object.assign,Ci=Object.hasOwnProperty,ji=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=Mi)}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.isTornDown=!1;var s=r.defaultOptions.watchQuery,a=(void 0===s?{}:s).fetchPolicy,c=void 0===a?"cache-first":a,u=i.fetchPolicy,l=void 0===u?c:u,h=i.initialFetchPolicy,f=void 0===h?"standby"===l?c:l:h;o.options=ce(ce({},i),{initialFetchPolicy:f,fetchPolicy:l}),o.queryId=n.queryId||r.generateQueryId();var d=Ir(o.query);return o.queryName=d&&d.name&&d.name.value,o}return ae(t,e),Object.defineProperty(t.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},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||Ti.ready,n=ce(ce({},t),{loading:Ni(r),networkStatus:r}),i=this.options.fetchPolicy,o=void 0===i?"cache-first":i;if("network-only"===o||"no-cache"===o||"standby"===o||this.queryManager.transform(this.options.query).hasForcedResolvers);else{var s=this.queryInfo.getDiff();(s.complete||this.options.returnPartialData)&&(n.data=s.result),Fn(n.data,{})&&(n.data=void 0),s.complete?(delete n.partial,!s.complete||n.networkStatus!==Ti.loading||"cache-first"!==o&&"cache-only"!==o||(n.networkStatus=Ti.ready,n.loading=!1)):n.partial=!0,!__DEV__||s.complete||this.options.partialRefetch||n.loading||n.data||n.error||Fi(s.missing)}return e&&this.updateLastResult(n),n},t.prototype.isDifferentFromLastResult=function(e,t){return!this.last||!Fn(this.last.result,e)||t&&!Fn(this.last.variables,t)},t.prototype.getLast=function(e,t){var r=this.last;if(r&&r[e]&&(!t||Fn(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",__DEV__&&e&&Ci.call(e,"variables")){var i=Nr(this.query),o=i.variableDefinitions;o&&o.some((function(e){return"variables"===e.variable.name.value}))||__DEV__&&Ot.warn("Called refetch(".concat(JSON.stringify(e),") for query ").concat((null===(t=i.name)||void 0===t?void 0:t.value)||JSON.stringify(i),", which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?"))}return e&&!Fn(this.options.variables,e)&&(r.variables=this.options.variables=ce(ce({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(r,Ti.refetch)},t.prototype.fetchMore=function(e){var t=this,r=ce(ce({},e.query?e:ce(ce(ce(ce({},this.options),{query:this.query}),e),{variables:ce(ce({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"}),n=this.queryManager.generateQueryId(),i=this.queryInfo,o=i.networkStatus;i.networkStatus=Ti.fetchMore,r.notifyOnNetworkStatusChange&&this.observe();var s=new Set;return this.queryManager.fetchQuery(n,r,Ti.fetchMore).then((function(a){return t.queryManager.removeQuery(n),i.networkStatus===Ti.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)||$i(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):__DEV__&&Ot.error("Unhandled GraphQL subscription error",t)}});return this.subscriptions.add(r),function(){t.subscriptions.delete(r)&&r.unsubscribe()}},t.prototype.setOptions=function(e){return this.reobserve(e)},t.prototype.setVariables=function(e){return Fn(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},Ti.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){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,e,t)},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){__DEV__?Ot(r,"Attempted to start a polling query without a polling interval."):Ot(r,13),(t||(this.pollingInfo={})).interval=r;var n=function(){e.pollingInfo&&(Ni(e.queryInfo.networkStatus)?i():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"network-only"},Ti.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){return void 0===t&&(t=this.variables),this.last=ce(ce({},this.last),{result:this.queryManager.assumeImmutableResults?e:Ai(e),variables:t}),zn(e.errors)||delete this.last.error,this.last},t.prototype.reobserve=function(e,t){var r=this;this.isTornDown=!1;var n=t===Ti.refetch||t===Ti.fetchMore||t===Ti.poll,i=this.options.variables,o=this.options.fetchPolicy,s=Ri(this.options,e||{}),a=n?s:Pi(this.options,s);n||(this.updatePolling(),e&&e.variables&&!Fn(e.variables,i)&&"standby"!==a.fetchPolicy&&a.fetchPolicy===o&&(this.applyNextFetchPolicy("variables-changed",a),void 0===t&&(t=Ti.setVariables)));var c=a.variables&&ce({},a.variables),u=this.fetch(a,t),l={next:function(e){r.reportResult(e,c)},error:function(e){r.reportError(e,c)}};return n||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=u,this.observer=l),u.addObserver(l),u.promise},t.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},t.prototype.reportResult=function(e,t){var r=this.getLastError();(r||this.isDifferentFromLastResult(e,t))&&((r||!e.partial||this.options.returnPartialData)&&this.updateLastResult(e,t),Ei(this.observers,"next",e))},t.prototype.reportError=function(e,t){var r=ce(ce({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:Ti.error,loading:!1});this.updateLastResult(r,t),Ei(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}(cr);function $i(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(){return this.nextFetchPolicy=n,"function"==typeof n?n.apply(this,arguments):r}}):e.reobserve()}function Mi(e){__DEV__&&Ot.error("Unhandled error",e.message,e.stack)}function Fi(e){__DEV__&&e&&__DEV__&&Ot.debug("Missing cache result fields: ".concat(JSON.stringify(e)),e)}function qi(e){return e.kind===Ur.FIELD||e.kind===Ur.FRAGMENT_SPREAD||e.kind===Ur.INLINE_FRAGMENT}Si(ji);var Li=null,Vi={},Qi=1;function Ui(e){try{return e()}catch(e){}}var Bi="@wry/context:Slot",zi=Ui((function(){return globalThis}))||Ui((function(){return r.g}))||Object.create(null),Yi=zi[Bi]||Array[Bi]||function(e){try{Object.defineProperty(zi,Bi,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}}(function(){function e(){this.id=["slot",Qi++,Date.now(),Math.random().toString(36).slice(2)].join(":")}return e.prototype.hasValue=function(){for(var e=Li;e;e=e.parent)if(this.id in e.slots){var t=e.slots[this.id];if(t===Vi)break;return e!==Li&&(Li.slots[this.id]=t),!0}return Li&&(Li.slots[this.id]=Vi),!1},e.prototype.getValue=function(){if(this.hasValue())return Li.slots[this.id]},e.prototype.withValue=function(e,t,r,n){var i,o=((i={__proto__:null})[this.id]=e,i),s=Li;Li={parent:s,slots:o};try{return t.apply(n,r)}finally{Li=s}},e.bind=function(e){var t=Li;return function(){var r=Li;try{return Li=t,e.apply(this,arguments)}finally{Li=r}}},e.noContext=function(e,t,r){if(!Li)return e.apply(r,t);var n=Li;try{return Li=null,e.apply(r,t)}finally{Li=n}},e}());function Ki(){}Yi.bind,Yi.noContext;var Hi,Gi=function(){function e(e,t){void 0===e&&(e=1/0),void 0===t&&(t=Ki),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},e.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var r=t.older,n=t.newer;n&&(n.older=r),r&&(r.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t},e.prototype.set=function(e,t){var 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)},e.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},e.prototype.delete=function(e){var 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)},e}(),Wi=new Yi,Ji=Object.prototype.hasOwnProperty,Zi=void 0===(Hi=Array.from)?function(e){var t=[];return e.forEach((function(e){return t.push(e)})),t}:Hi;function Xi(e){var t=e.unsubscribe;"function"==typeof t&&(e.unsubscribe=void 0,t())}var eo=[],to=100;function ro(e,t){if(!e)throw new Error(t||"assertion failure")}function no(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}var io=function(){function e(t){this.fn=t,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++e.count}return e.prototype.peek=function(){if(1===this.value.length&&!ao(this))return oo(this),this.value[0]},e.prototype.recompute=function(e){return ro(!this.recomputing,"already recomputing"),oo(this),ao(this)?function(e,t){return mo(e),Wi.withValue(e,so,[e,t]),function(e,t){if("function"==typeof e.subscribe)try{Xi(e),e.unsubscribe=e.subscribe.apply(null,t)}catch(t){return e.setDirty(),!1}return!0}(e,t)&&function(e){e.dirty=!1,ao(e)||uo(e)}(e),no(e.value)}(this,e):no(this.value)},e.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,co(this),Xi(this))},e.prototype.dispose=function(){var e=this;this.setDirty(),mo(this),lo(this,(function(t,r){t.setDirty(),yo(t,e)}))},e.prototype.forget=function(){this.dispose()},e.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=eo.pop()||new Set),this.deps.add(e)},e.prototype.forgetDeps=function(){var e=this;this.deps&&(Zi(this.deps).forEach((function(t){return t.delete(e)})),this.deps.clear(),eo.push(this.deps),this.deps=null)},e.count=0,e}();function oo(e){var t=Wi.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),ao(e)?ho(t,e):fo(t,e),t}function so(e,t){e.recomputing=!0,e.value.length=0;try{e.value[0]=e.fn.apply(null,t)}catch(t){e.value[1]=t}e.recomputing=!1}function ao(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function co(e){lo(e,ho)}function uo(e){lo(e,fo)}function lo(e,t){var r=e.parents.size;if(r)for(var n=Zi(e.parents),i=0;i<r;++i)t(n[i],e)}function ho(e,t){ro(e.childValues.has(t)),ro(ao(t));var r=!ao(e);if(e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=eo.pop()||new Set;e.dirtyChildren.add(t),r&&co(e)}function fo(e,t){ro(e.childValues.has(t)),ro(!ao(t));var r,n,i,o=e.childValues.get(t);0===o.length?e.childValues.set(t,t.value.slice(0)):(r=o,n=t.value,(i=r.length)>0&&i===n.length&&r[i-1]===n[i-1]||e.setDirty()),po(e,t),ao(e)||uo(e)}function po(e,t){var r=e.dirtyChildren;r&&(r.delete(t),0===r.size&&(eo.length<to&&eo.push(r),e.dirtyChildren=null))}function mo(e){e.childValues.size>0&&e.childValues.forEach((function(t,r){yo(e,r)})),e.forgetDeps(),ro(null===e.dirtyChildren)}function yo(e,t){t.parents.delete(e),e.childValues.delete(t),po(e,t)}var vo={setDirty:!0,dispose:!0,forget:!0};function go(e){var t=new Map,r=e&&e.subscribe;function n(e){var n=Wi.getValue();if(n){var i=t.get(e);i||t.set(e,i=new Set),n.dependOn(i),"function"==typeof r&&(Xi(i),i.unsubscribe=r(e))}}return n.dirty=function(e,r){var n=t.get(e);if(n){var i=r&&Ji.call(vo,r)?r:"setDirty";Zi(n).forEach((function(e){return e[i]()})),t.delete(e),Xi(n)}},n}function bo(){var e=new oi("function"==typeof WeakMap);return function(){return e.lookupArray(arguments)}}bo();var _o=new Set;function wo(e,t){void 0===t&&(t=Object.create(null));var r=new Gi(t.max||Math.pow(2,16),(function(e){return e.dispose()})),n=t.keyArgs,i=t.makeCacheKey||bo(),o=function(){var o=i.apply(null,n?n.apply(null,arguments):arguments);if(void 0===o)return e.apply(null,arguments);var s=r.get(o);s||(r.set(o,s=new io(e)),s.subscribe=t.subscribe,s.forget=function(){return r.delete(o)});var a=s.recompute(Array.prototype.slice.call(arguments));return r.set(o,s),_o.add(r),Wi.hasValue()||(_o.forEach((function(e){return e.clean()})),_o.clear()),a};function s(e){var t=r.get(e);t&&t.setDirty()}function a(e){var t=r.get(e);if(t)return t.peek()}function c(e){return r.delete(e)}return Object.defineProperty(o,"size",{get:function(){return r.map.size},configurable:!1,enumerable:!1}),o.dirtyKey=s,o.dirty=function(){s(i.apply(null,arguments))},o.peekKey=a,o.peek=function(){return a(i.apply(null,arguments))},o.forgetKey=c,o.forget=function(){return c(i.apply(null,arguments))},o.makeCacheKey=i,o.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(o)}var Eo=new Yi,So=new WeakMap;function Oo(e){var t=So.get(e);return t||So.set(e,t={vars:new Set,dep:go()}),t}function Io(e){Oo(e).vars.forEach((function(t){return t.forgetCache(e)}))}function To(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){Oo(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=Eo.getValue();a&&(i(a),Oo(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),Oo(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}var ko=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=Kn(t.resolvers,e)})):this.resolvers=Kn(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 le(this,void 0,void 0,(function(){return he(this,(function(e){return t?[2,this.resolveDocument(t,r.data,n,i,this.fragmentMatcher,s).then((function(e){return ce(ce({},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 Gr(["client"],e)&&this.resolvers?e:null},e.prototype.serverQuery=function(e){return function(e){return Or(e),yi([{test:function(e){return"client"===e.name.value},remove:!0}],e)}(e)},e.prototype.prepareContext=function(e){var t=this.cache;return ce(ce({},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={}),le(this,void 0,void 0,(function(){return he(this,(function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(r),t).then((function(e){return ce(ce({},t),e.exportedVariables)}))]:[2,ce({},t)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return Yr(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 zr}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:bi(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),le(this,void 0,void 0,(function(){var s,a,c,u,l,h,f,d,p,m;return he(this,(function(y){return s=Dr(e),a=kr(e),c=hr(a),u=this.collectSelectionsToResolve(s,c),l=s.operation,h=l?l.charAt(0).toUpperCase()+l.slice(1):"Query",d=(f=this).cache,p=f.client,m={fragmentMap:c,context:ce(ce({},r),{cache:d,client:p}),variables:n,fragmentMatcher:i,defaultOperationType:h,exportedVariables:{},selectionsToResolve:u,onlyRunForcedResolvers:o},[2,this.resolveSelectionSet(s.selectionSet,!1,t,m).then((function(e){return{result:e,exportedVariables:m.exportedVariables}}))]}))}))},e.prototype.resolveSelectionSet=function(e,t,r,n){return le(this,void 0,void 0,(function(){var i,o,s,a,c,u=this;return he(this,(function(l){return i=n.fragmentMap,o=n.context,s=n.variables,a=[r],c=function(e){return le(u,void 0,void 0,(function(){var c,u;return he(this,(function(l){return(t||n.selectionsToResolve.has(e))&&Hr(e,s)?Sr(e)?[2,this.resolveField(e,t,r,n).then((function(t){var r;void 0!==t&&a.push(((r={})[wr(e)]=t,r))}))]:(function(e){return"InlineFragment"===e.kind}(e)?c=e:(c=i[e.name.value],__DEV__?Ot(c,"No fragment named ".concat(e.name.value)):Ot(c,11)),c&&c.typeCondition&&(u=c.typeCondition.name.value,n.fragmentMatcher(r,u,o))?[2,this.resolveSelectionSet(c.selectionSet,t,r,n).then((function(e){a.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(e.selections.map(c)).then((function(){return Hn(a)}))]}))}))},e.prototype.resolveField=function(e,t,r,n){return le(this,void 0,void 0,(function(){var i,o,s,a,c,u,l,h,f,d=this;return he(this,(function(p){return r?(i=n.variables,o=e.name.value,s=wr(e),a=o!==s,c=r[s]||r[o],u=Promise.resolve(c),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(l=r.__typename||n.defaultOperationType,(h=this.resolvers&&this.resolvers[l])&&(f=h[a?o:s])&&(u=Promise.resolve(Eo.withValue(this.cache,f,[r,_r(e,i),n.context,{field:e,fragmentMap:n.fragmentMap}])))),[2,u.then((function(r){var i,o;if(void 0===r&&(r=c),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)?d.resolveSubSelectedArray(e,t||s,r,n):e.selectionSet?d.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),Yr(i,{Directive:function(e,t,n,i,s){"client"===e.name.value&&s.forEach((function(e){r(e)&&qi(e)&&o.add(e)}))},FragmentSpread:function(n,i,s,a,c){var u=t[n.name.value];__DEV__?Ot(u,"No fragment named ".concat(n.name.value)):Ot(u,12);var l=e(u);l.size>0&&(c.forEach((function(e){r(e)&&qi(e)&&o.add(e)})),o.add(n),l.forEach((function(e){o.add(e)})))}})}return n.get(i)}(e)},e}(),No=new(Zr?WeakMap:Map);function Do(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return No.set(e,(No.get(e)+1)%1e15),r.apply(this,arguments)})}function Ao(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var xo=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.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var r=this.cache=e.cache;No.has(r)||(No.set(r,0),Do(r,"evict"),Do(r,"modify"),Do(r,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||Ti.loading;return this.variables&&this.networkStatus!==Ti.loading&&!Fn(this.variables,e.variables)&&(t=Ti.setVariables),Fn(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(){Ao(this),this.dirty=!1},e.prototype.getDiff=function(e){void 0===e&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Fn(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var r=this.observableQuery;if(r&&"no-cache"===r.options.fetchPolicy)return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},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||Fn(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():$i(e)})):delete this.oqListener)},e.prototype.notify=function(){var e=this;Ao(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(Ni(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,this.subscriptions.forEach((function(e){return e.unsubscribe()}));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=ce(ce({},this.getDiffOptions(e)),{watcher:this,callback:function(e){return t.setDiff(e)}});this.lastWatch&&Fn(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===No.get(this.cache)&&Fn(t,r.variables)&&Fn(e.data,r.result.data))},e.prototype.markResult=function(e,t,r,n){var i=this,o=new Wn,s=zn(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&zn(e.incremental)){var a=Zn(this.getDiff().result,e);e.data=a}else if("hasNext"in e&&e.hasNext){var c=this.getDiff();e.data=o.merge(c.result,e.data)}this.graphQLErrors=s,"no-cache"===r.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(r.variables)):0!==n&&(Ro(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:No.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||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=Ti.ready},e.prototype.markError=function(e){return this.networkStatus=Ti.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function Ro(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!li(e);return!n&&r&&e.data&&(n=!0),n}var Po=Object.prototype.hasOwnProperty,Co=function(){function e(e){var t=e.cache,r=e.link,n=e.defaultOptions,i=e.queryDeduplication,o=void 0!==i&&i,s=e.onBroadcast,a=e.ssrMode,c=void 0!==a&&a,u=e.clientAwareness,l=void 0===u?{}:u,h=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Zr?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=l,this.localState=h||new ko({cache:t}),this.ssrMode=c,this.assumeImmutableResults=!!f,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return e.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(__DEV__?new St("QueryManager stopped while query was in flight"):new St(14))},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,u=e.awaitRefetchQueries,l=void 0!==u&&u,h=e.update,f=e.onQueryUpdated,d=e.fetchPolicy,p=void 0===d?(null===(t=this.defaultOptions.mutate)||void 0===t?void 0:t.fetchPolicy)||"network-only":d,m=e.errorPolicy,y=void 0===m?(null===(r=this.defaultOptions.mutate)||void 0===r?void 0:r.errorPolicy)||"none":m,v=e.keepRootFields,g=e.context;return le(this,void 0,void 0,(function(){var e,t,r,a,u,d;return he(this,(function(m){switch(m.label){case 0:return __DEV__?Ot(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):Ot(n,15),__DEV__?Ot("network-only"===p||"no-cache"===p,"Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):Ot("network-only"===p||"no-cache"===p,16),e=this.generateMutationId(),t=this.transform(n),r=t.document,a=t.hasClientExports,n=this.cache.transformForLink(r),i=this.getVariables(n,i),a?[4,this.localState.addExportedVariables(n,i,g)]:[3,2];case 1:i=m.sent(),m.label=2;case 2:return u=this.mutationStore&&(this.mutationStore[e]={mutation:n,variables:i,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:e,document:n,variables:i,fetchPolicy:p,errorPolicy:y,context:g,updateQueries:s,update:h,keepRootFields:v}),this.broadcastQueries(),d=this,[2,new Promise((function(t,r){return ui(d.getObservableFromLink(n,ce(ce({},g),{optimisticResponse:o}),i,!1),(function(t){if(li(t)&&"none"===y)throw new ki({graphQLErrors:hi(t)});u&&(u.loading=!1,u.error=null);var r=ce({},t);return"function"==typeof c&&(c=c(r)),"ignore"===y&&li(r)&&delete r.errors,d.markMutationResult({mutationId:e,result:r,document:n,variables:i,fetchPolicy:p,errorPolicy:y,context:g,update:h,updateQueries:s,awaitRefetchQueries:l,refetchQueries:c,removeOptimistic:o?e:void 0,onQueryUpdated:f,keepRootFields:v})})).subscribe({next:function(e){d.broadcastQueries(),"hasNext"in e&&!1!==e.hasNext||t(e)},error:function(t){u&&(u.loading=!1,u.error=t),o&&d.cache.removeOptimistic(e),d.broadcastQueries(),r(t instanceof ki?t:new ki({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&&Ro(n,e.errorPolicy)){if(Jn(n)||i.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Jn(n)&&zn(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),a=void 0;s.result&&(a=Zn(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&&Po.call(c,a)){var u=c[a],l=r.queries.get(o),h=l.document,f=l.variables,d=t.diff({query:h,variables:f,returnPartialData:!0,optimistic:!1}),p=d.result;if(d.complete&&p){var m=u(p,{mutationResult:n,queryName:h&&Tr(h)||void 0,queryVariables:f});m&&i.push({result:m,dataId:"ROOT_QUERY",query:h,variables:f})}}}))}if(i.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(t){o||i.forEach((function(e){return t.write(e)}));var s,a=e.update,c=!(Jn(s=n)||function(e){return"hasNext"in e&&"data"in e}(s))||Jn(n)&&!n.hasNext;if(a){if(!o){var u=t.diff({id:"ROOT_MUTATION",query:r.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});u.complete&&("incremental"in(n=ce(ce({},n),{data:u.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 u.push(e)})),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(u).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(ce(ce({},t),{result:{data:n}}),e)}catch(e){__DEV__&&Ot.error(e)}}),t.mutationId)},e.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).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){var t=this.transformCache;if(!t.has(e)){var r=this.cache.transformDocument(e),n=yi([gi],Or(r)),i=this.localState.clientQuery(r),o=n&&this.localState.serverQuery(n),s={document:r,hasClientExports:Wr(r),hasForcedResolvers:this.localState.shouldForceResolvers(r),clientQuery:i,serverQuery:o,defaultVars:Ar(Ir(r)),asQuery:ce(ce({},r),{definitions:r.definitions.map((function(e){return"OperationDefinition"===e.kind&&"query"!==e.operation?ce(ce({},e),{operation:"query"}):e}))})},a=function(e){e&&!t.has(e)&&t.set(e,s)};a(e),a(r),a(i),a(o)}return t.get(e)},e.prototype.getVariables=function(e,t){return ce(ce({},this.transform(e).defaultVars),t)},e.prototype.watchQuery=function(e){void 0===(e=ce(ce({},e),{variables:this.getVariables(e.query,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var t=new xo(this),r=new ji({queryManager:this,queryInfo:t,options:e});return this.queries.set(r.queryId,t),t.init({document:r.query,observableQuery:r,variables:r.variables}),r},e.prototype.query=function(e,t){var r=this;return void 0===t&&(t=this.generateQueryId()),__DEV__?Ot(e.query,"query option is required. You must specify your GraphQL document in the query option."):Ot(e.query,17),__DEV__?Ot("Document"===e.query.kind,'You must wrap the query string in a "gql" tag.'):Ot("Document"===e.query.kind,18),__DEV__?Ot(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):Ot(!e.returnPartialData,19),__DEV__?Ot(!e.pollInterval,"pollInterval option only supported on watchQuery."):Ot(!e.pollInterval,20),this.fetchQuery(t,e).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(__DEV__?new St("Store reset while query was in flight (not completed in link chain)"):new St(21)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=Ti.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).document,!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=wi("legacyOneTimeQuery"),i=t.getQuery(n).init({document:e.query,variables:e.variables}),o=new ji({queryManager:t,queryInfo:i,options:ce(ce({},e),{fetchPolicy:"network-only"})});Ot(o.queryId===n),i.setObservableQuery(o),r.set(n,o)})),__DEV__&&n.size&&n.forEach((function(e,t){e||__DEV__&&Ot.warn("Unknown query ".concat("string"==typeof t?"named ":"").concat(JSON.stringify(t,null,2)," requested in refetchQueries options.include array"))})),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=e.variables,s=e.context,a=void 0===s?{}:s;r=this.transform(r).document,o=this.getVariables(r,o);var c=function(e){return t.getObservableFromLink(r,a,e).map((function(o){if("no-cache"!==n&&(Ro(o,i)&&t.cache.write({query:r,result:o.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),li(o))throw new ki({graphQLErrors:o.errors});return o}))};if(this.transform(r).hasClientExports){var u=this.localState.addExportedVariables(r,o,a).then(c);return new cr((function(e){var t=null;return u.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return c(o)},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.transform(e).serverQuery;if(a){var c=this.inFlightLinkObservables,u=this.link,l={query:a,variables:r,operationName:Tr(a)||void 0,context:this.prepareContext(ce(ce({},t),{forceFetch:!n}))};if(t=l.context,n){var h=c.get(a)||new Map;c.set(a,h);var f=ai(r);if(!(o=h.get(f))){var d=new Ii([$r(u,l)]);h.set(f,o=d),d.beforeNext((function(){h.delete(f)&&h.size<1&&c.delete(a)}))}}else o=new Ii([$r(u,l)])}else o=new Ii([cr.of({data:{}})]),t=this.prepareContext(t);var p=this.transform(e).clientQuery;return p&&(o=ui(o,(function(e){return s.localState.runResolvers({document:p,remoteResult:e,context:t,variables:r})}))),o},e.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId(),i=this.cache.transformForLink(this.transform(e.document).document);return ui(this.getObservableFromLink(i,r.context,r.variables),(function(o){var s=hi(o),a=s.length>0;if(n>=e.lastRequestId){if(a&&"none"===r.errorPolicy)throw e.markError(new ki({graphQLErrors:s}));e.markResult(o,i,r,t),e.markReady()}var c={data:o.data,loading:!1,networkStatus:Ti.ready};return a&&"ignore"!==r.errorPolicy&&(c.errors=s,c.networkStatus=Ti.error),c}),(function(t){var r=t.hasOwnProperty("graphQLErrors")?t:new ki({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},e.prototype.fetchQueryObservable=function(e,t,r){var n=this;void 0===r&&(r=Ti.loading);var i=this.transform(t.query).document,o=this.getVariables(i,t.variables),s=this.getQuery(e),a=this.defaultOptions.watchQuery,c=t.fetchPolicy,u=void 0===c?a&&a.fetchPolicy||"cache-first":c,l=t.errorPolicy,h=void 0===l?a&&a.errorPolicy||"none":l,f=t.returnPartialData,d=void 0!==f&&f,p=t.notifyOnNetworkStatusChange,m=void 0!==p&&p,y=t.context,v=void 0===y?{}:y,g=Object.assign({},t,{query:i,variables:o,fetchPolicy:u,errorPolicy:h,returnPartialData:d,notifyOnNetworkStatusChange:m,context:v}),b=function(e){g.variables=e;var i=n.fetchQueryByPolicy(s,g,r);return"standby"!==g.fetchPolicy&&i.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),i},_=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,(function(e){_(),setTimeout((function(){return w.cancel(e)}))}));var w=new Ii(this.transform(g.query).hasClientExports?this.localState.addExportedVariables(g.query,g.variables,g.context).then(b):b(g.variables));return w.promise.then(_,_),w},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?wi("refetchQueries"):void 0:s,c=e.onQueryUpdated,u=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){u.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 xo&&e.watcher.observableQuery;if(n){if(c){u.delete(n.queryId);var i=c(n,t,r);return!0===i&&(i=n.refetch()),!1!==i&&l.set(n,i),i}null!==c&&u.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),u.size&&u.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,s=e.diff;if(c){if(!s){var a=i.queryInfo;a.reset(),s=a.getDiff()}n=c(i,s,o)}c&&!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,u=t.returnPartialData,l=t.context,h=t.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(i).document,variables:o,networkStatus:r});var d=function(){return e.getDiff(o)},p=function(t,r){void 0===r&&(r=e.networkStatus||Ti.loading);var s=t.result;!__DEV__||u||Fn(s,{})||Fi(t.missing);var a=function(e){return cr.of(ce({data:e,loading:Ni(r),networkStatus:r},t.complete?null:{partial:!0}))};return s&&n.transform(i).hasForcedResolvers?n.localState.runResolvers({document:i,remoteResult:{data:s},context:l,variables:o,onlyRunForcedResolvers:!0}).then((function(e){return a(e.data||void 0)})):"none"===c&&r===Ti.refetch&&Array.isArray(t.missing)?a(void 0):a(s)},m="no-cache"===s?0:r===Ti.refetch&&"merge"!==a?1:2,y=function(){return n.getResultsFromLink(e,m,{variables:o,context:l,fetchPolicy:s,errorPolicy:c})},v=h&&"number"==typeof f&&f!==r&&Ni(r);switch(s){default:case"cache-first":return(g=d()).complete?[p(g,e.markReady())]:u||v?[p(g),y()]:[y()];case"cache-and-network":var g;return(g=d()).complete||u||v?[p(g),y()]:[y()];case"cache-only":return[p(d(),e.markReady())];case"network-only":return v?[p(d()),y()]:[y()];case"no-cache":return v?[p(e.getDiff()),y()]:[y()];case"standby":return[]}},e.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new xo(this,e)),this.queries.get(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return ce(ce({},t),{clientAwareness:this.clientAwareness})},e}();function jo(e,t){return Ri(e,t,t.variables&&{variables:ce(ce({},e&&e.variables),t.variables)})}var $o=!1,Mo=function(){function e(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var r=e.uri,n=e.credentials,i=e.headers,o=e.cache,s=e.ssrMode,a=void 0!==s&&s,c=e.ssrForceFetchDelay,u=void 0===c?0:c,l=e.connectToDevTools,h=void 0===l?"object"==typeof window&&!window.__APOLLO_CLIENT__&&__DEV__:l,f=e.queryDeduplication,d=void 0===f||f,p=e.defaultOptions,m=e.assumeImmutableResults,y=void 0!==m&&m,v=e.resolvers,g=e.typeDefs,b=e.fragmentMatcher,_=e.name,w=e.version,E=e.link;if(E||(E=r?new Rn({uri:r,credentials:n,headers:i}):jr.empty()),!o)throw __DEV__?new St("To initialize Apollo Client, you must specify a 'cache' property in the options object. \nFor more information, please visit: https://go.apollo.dev/c/docs"):new St(9);if(this.link=E,this.cache=o,this.disableNetworkFetches=a||u>0,this.queryDeduplication=d,this.defaultOptions=p||Object.create(null),this.typeDefs=g,u&&setTimeout((function(){return t.disableNetworkFetches=!1}),u),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),h&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),!$o&&h&&__DEV__&&($o=!0,"undefined"!=typeof window&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var S=window.navigator,O=S&&S.userAgent,I=void 0;"string"==typeof O&&(O.indexOf("Chrome/")>-1?I="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":O.indexOf("Firefox/")>-1&&(I="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),I&&__DEV__&&Ot.log("Download the Apollo DevTools for a better development experience: "+I)}this.version="3.7.9",this.localState=new ko({cache:o,client:this,resolvers:v,fragmentMatcher:b}),this.queryManager=new Co({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:d,ssrMode:a,clientAwareness:{name:_,version:w},localState:this.localState,assumeImmutableResults:y,onBroadcast:h?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=jo(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=ce(ce({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=jo(this.defaultOptions.query,e)),__DEV__?Ot("cache-and-network"!==e.fetchPolicy,"The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):Ot("cache-and-network"!==e.fetchPolicy,10),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=ce(ce({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=jo(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){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},e.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return $r(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){__DEV__&&Ot.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(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}(),Fo=function(){function e(){this.getFragmentDoc=wo(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(ce(ce({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(ce(ce({},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=ue(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=ue(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(ce(ce({},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(ce(ce({},e),{data:i})),i)}})},e}(),qo=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 c=a.path.length-1;c>=0;--c)a.missing=((s={})[a.path[c]]=a.missing,s)}else a.missing=a.path;return a.__proto__=t.prototype,a}return ae(t,e),t}(Error);function Lo(e){return __DEV__&&(t=e,(r=new Set([t])).forEach((function(e){ur(e)&&function(e){if(__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 Vo=Object.prototype.hasOwnProperty;function Qo(e){return null==e}function Uo(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=Qo(n)?Qo(i)?void 0:{_id:i}:{id:n}),Qo(n)&&!Qo(i)&&(n=i),!Qo(n)))return"".concat(r,":").concat("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))}var Bo={dataIdFromObject:Uo,addTypename:!0,resultCaching:!0,canonizeResults:!1};function zo(e){var t=e.canonizeResults;return void 0===t?Bo.canonizeResults:t}var Yo=/^[_a-z][_0-9a-z]*/i;function Ko(e){var t=e.match(Yo);return t?t[0]:e}function Ho(e,t,r){return!!ur(t)&&(Bn(t)?t.every((function(t){return Ho(e,t,r)})):e.selections.every((function(e){if(Sr(e)&&Hr(e,r)){var n=wr(e);return Vo.call(t,n)&&(!e.selectionSet||Ho(e.selectionSet,t[n],r))}return!0})))}function Go(e){return ur(e)&&!pr(e)&&!Bn(e)}function Wo(e,t){var r=hr(kr(e));return{fragmentMap:r,lookupFragment:function(e){var n=r[e];return!n&&t&&(n=t.lookup(e)),n||null}}}var Jo=Object.create(null),Zo=function(){return Jo},Xo=Object.create(null),es=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 Lo(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 dr(e);if(pr(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 ce({},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),Vo.call(this.data,e)){var r=this.data[e];if(r&&Vo.call(r,t))return r[t]}return"__typename"===t&&Vo.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof is?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),Vo.call(this.data,e)?this.data[e]:this instanceof is?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){__DEV__?Ot("string"==typeof r,"store.merge expects a string ID"):Ot("string"==typeof r,1);var s=new Wn(ss).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=Ko(e);t===e||n.policies.hasKeyArgs(s.__typename,t)||(a[t]=1),void 0!==s[e]||n instanceof is||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:Jo,INVALIDATE:Xo,isReference:pr,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 u=Ko(c),l=n[c];if(void 0!==l){var h="function"==typeof t?t:t[c]||t[u];if(h){var f=h===Zo?Jo:h(Lo(l),ce(ce({},a),{fieldName:u,storeFieldName:c,storage:r.getStorage(e,c)}));f===Xo?r.group.dirty(e,c):(f===Jo&&(f=void 0),f!==l&&(i[c]=f,o=!0,l=f))}void 0!==l&&(s=!1)}})),o)return this.merge(e,i),s&&(this instanceof is?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]=Zo,n):Zo)}return!1},e.prototype.evict=function(e,t){var r=!1;return e.id&&(Vo.call(this.data,e.id)&&(r=this.delete(e.id,e.fieldName,e.args)),this instanceof is&&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){Vo.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&&Vo.call(e,r)||t.delete(r)})),e){var r=e.__META,n=ue(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 is?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){Vo.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 is;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},e.prototype.findChildRefIds=function(e){if(!Vo.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),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}(),ts=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?go():null,this.keyMaker=new oi(Zr)},e.prototype.depend=function(e,t){if(this.d){this.d(rs(e,t));var r=Ko(t);r!==t&&this.d(rs(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(rs(e,t),"__exists"===t?"forget":"setDirty")},e}();function rs(e,t){return t+"#"+e}function ns(e,t){as(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 ts(i))||this;return s.stump=new os(s),s.storageTrie=new oi(Zr),o&&s.replace(o),s}return ae(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}(es||(es={}));var is=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 ae(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){Fn(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 ce(ce({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var r=this.parent.findChildRefIds(t);return Vo.call(this.data,t)?ce(ce({},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}(es),os=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,(function(){}),new ts(t.group.caching,t.group))||this}return ae(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},t}(is);function ss(e,t,r){var n=e[r],i=t[r];return Fn(n,i)?n:i}function as(e){return!!(e instanceof es&&e.group.caching)}function cs(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var us=function(){function e(e){var t=this;this.knownResults=new(Zr?WeakMap:Map),this.config=Ri(e,{addTypename:!1!==e.addTypename,canonizeResults:zo(e)}),this.canon=e.canon||new si,this.executeSelectionSet=wo((function(e){var r,n=e.context.canonizeResults,i=cs(e);i[3]=!n;var o=(r=t.executeSelectionSet).peek.apply(r,i);return o?n?ce(ce({},o),{result:t.canon.admit(o.result)}):o:(ns(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))}),{max:this.config.resultCacheMaxSize,keyArgs:cs,makeCacheKey:function(e,t,r,n){if(as(r.store))return r.store.makeCacheKey(e,pr(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=wo((function(e){return ns(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(as(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return e.prototype.resetCanon=function(){this.canon=new si},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,u=void 0===c?this.config.canonizeResults:c,l=this.config.cache.policies;o=ce(ce({},Ar(Nr(r))),o);var h,f=dr(i),d=this.executeSelectionSet({selectionSet:Dr(r).selectionSet,objectOrReference:f,enclosingRef:f,context:ce({store:t,query:r,policies:l,variables:o,varString:ai(o),canonizeResults:u},Wo(r,this.config.fragments))});if(d.missing&&(h=[new qo(ls(d.missing),d.missing,r,o)],!a))throw h[0];return{result:d.result,complete:!h,missing:h}},e.prototype.isFresh=function(e,t,r,n){if(as(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,c=o.policies,u=o.store.getFieldValue(n,"__typename"),l=[],h=new Wn;function f(e,t){var r;return e.missing&&(s=h.merge(s,((r={})[t]=e.missing,r))),e.result}this.config.addTypename&&"string"==typeof u&&!c.rootIdsByTypename[u]&&l.push({__typename:u});var d=new Set(r.selections);d.forEach((function(e){var r,p;if(Hr(e,a))if(Sr(e)){var m=c.readField({fieldName:e.name.value,field:e,variables:o.variables,from:n},o),y=wr(e);void 0===m?vi.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))):Bn(m)?m=f(t.executeSubSelectedArray({field:e,array:m,enclosingRef:i,context:o}),y):e.selectionSet?null!=m&&(m=f(t.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:m,enclosingRef:pr(m)?m:i,context:o}),y)):o.canonizeResults&&(m=t.canon.pass(m)),void 0!==m&&l.push(((p={})[y]=m,p))}else{var v=fr(e,o.lookupFragment);if(!v&&e.kind===Ur.FRAGMENT_SPREAD)throw __DEV__?new St("No fragment named ".concat(e.name.value)):new St(5);v&&c.fragmentMatches(v,u)&&v.selectionSet.selections.forEach(d.add,d)}}));var p={result:Hn(l),missing:s},m=o.canonizeResults?this.canon.admit(p):Lo(p);return m.result&&this.knownResults.set(m.result,r),m},e.prototype.execSubSelectedArrayImpl=function(e){var t,r=this,n=e.field,i=e.array,o=e.enclosingRef,s=e.context,a=new Wn;function c(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:Bn(e)?c(r.executeSubSelectedArray({field:n,array:e,enclosingRef:o,context:s}),t):n.selectionSet?c(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:e,enclosingRef:pr(e)?e:o,context:s}),t):(__DEV__&&function(e,t,r){if(!t.selectionSet){var n=new Set([r]);n.forEach((function(r){ur(r)&&(__DEV__?Ot(!pr(r),"Missing selection set for object of type ".concat(function(e,t){return pr(t)?e.get(t.__ref,"__typename"):t&&t.__typename}(e,r)," returned for query field ").concat(t.name.value)):Ot(!pr(r),6),Object.values(r).forEach(n.add,n))}))}}(s.store,n,e),e)})),{result:s.canonizeResults?this.canon.admit(i):i,missing:t}},e}();function ls(e){try{JSON.stringify(e,(function(e,t){if("string"==typeof t)throw t;return t}))}catch(e){return e}}var hs=Object.create(null);function fs(e){var t=JSON.stringify(e);return hs[t]||(hs[t]=Object.create(null))}function ds(e){var t=fs(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,r){var n=function(e,t){return r.readField(t,e)},i=r.keyObject=ms(e,(function(e){var i=gs(r.storeObject,e,n);return void 0===i&&t!==r.storeObject&&Vo.call(t,e[0])&&(i=gs(t,e,vs)),__DEV__?Ot(void 0!==i,"Missing field '".concat(e.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):Ot(void 0!==i,2),i}));return"".concat(r.typename,":").concat(JSON.stringify(i))})}function ps(e){var t=fs(e);return t.keyArgsFn||(t.keyArgsFn=function(t,r){var n=r.field,i=r.variables,o=r.fieldName,s=ms(e,(function(e){var r=e[0],o=r.charAt(0);if("@"!==o)if("$"!==o){if(t)return gs(t,e)}else{var s=r.slice(1);if(i&&Vo.call(i,s)){var a=e.slice(0);return a[0]=s,gs(i,a)}}else if(n&&zn(n.directives)){var c=r.slice(1),u=n.directives.find((function(e){return e.name.value===c})),l=u&&_r(u,i);return l&&gs(l,e.slice(1))}})),a=JSON.stringify(s);return(t||"{}"!==a)&&(o+=":"+a),o})}function ms(e,t){var r=new Wn;return ys(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 ys(e){var t=fs(e);if(!t.paths){var r=t.paths=[],n=[];e.forEach((function(t,i){Bn(t)?(ys(t).forEach((function(e){return r.push(n.concat(e))})),n.length=0):(n.push(t),Bn(e[i+1])||(r.push(n.slice(0)),n.length=0))}))}return t.paths}function vs(e,t){return e[t]}function gs(e,t,r){return r=r||vs,bs(t.reduce((function e(t,n){return Bn(t)?t.map((function(t){return e(t,n)})):t&&r(t,n)}),e))}function bs(e){return ur(e)?Bn(e)?e.map(bs):ms(Object.keys(e).sort(),(function(t){return gs(e,t)})):e}function _s(e){return void 0!==e.args?e.args:e.field?_r(e.field,e.variables):null}vr.setStringify(ai);var ws=function(){},Es=function(e,t){return t.fieldName},Ss=function(e,t,r){return(0,r.mergeObjects)(e,t)},Os=function(e,t){return t},Is=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=ce({dataIdFromObject:Uo},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=ce(ce({},t),{typename:i,storeObject:s,readField:t&&t.readField||function(){var e=ks(arguments,s);return n.readField(e,{store:n.cache.data,variables:e.variables})}}),c=i&&this.getTypePolicy(i),u=c&&c.keyFn||this.config.dataIdFromObject;u;){var l=u(e,a);if(!Bn(l)){o=l;break}u=ds(l)}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=ue(n,["queryType","mutationType","subscriptionType"]);i&&t.setRootTypename("Query",r),o&&t.setRootTypename("Mutation",r),s&&t.setRootTypename("Subscription",r),Vo.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?Ss:!1===t?Os:e.merge}s(n,t.merge),n.keyFn=!1===i?ws:Bn(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,c=i.read,u=i.merge;n.keyFn=!1===a?Es:Bn(a)?ps(a):"function"==typeof a?a:n.keyFn,"function"==typeof c&&(n.read=c),s(n,u)}n.read&&n.merge&&(n.keyFn=n.keyFn||Es)}))},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var r="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[r];t!==n&&(__DEV__?Ot(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):Ot(!n||n===e,3),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(Yo);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},e.prototype.getTypePolicy=function(e){var t=this;if(!Vo.call(this.typePolicies,e)){var r=this.typePolicies[e]=Object.create(null);r.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach((function(e){var n=t.getTypePolicy(e),i=n.fields,o=ue(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],c=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&a.indexOf(t)<0&&a.push(t)},u=!(!r||!this.fuzzySubtypes.size),l=!1,h=0;h<a.length;++h){var f=a[h];if(f.has(o))return s.has(o)||(l&&__DEV__&&Ot.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;f.forEach(c),u&&h===a.length-1&&Ho(e.selectionSet,r,n)&&(u=!1,l=!0,this.fuzzySubtypes.forEach((function(e,r){var n=t.match(e);n&&n[0]===t&&c(r)})))}return!1},e.prototype.hasKeyArgs=function(e,t){var r=this.getFieldPolicy(e,t,!1);return!(!r||!r.keyFn)},e.prototype.getStoreFieldName=function(e){var t,r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},a=_s(e);o;){var c=o(a,s);if(!Bn(c)){t=c||n;break}o=ps(c)}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 mr(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 mr(n,r,i,t)}))),vr(e.name.value,n,r)}(e.field,e.variables):vr(n,_s(e))),!1===t?n:n===Ko(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=Ko(i),s=t.store.getFieldValue(r,i),a=this.getFieldPolicy(e.typename,o,!1),c=a&&a.read;if(c){var u=Ts(this,r,e,t,t.store.getStorage(pr(r)?r.__ref:r,i));return Eo.withValue(this.cache,c,[s,u])}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===Ss?Ns(n.store)(e,t):a===Os?t:(n.overwrite&&(e=void 0),a(e,t,Ts(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,i||Object.create(null))))},e}();function Ts(e,t,r,n,i){var o=e.getStoreFieldName(r),s=Ko(o),a=r.variables||n.variables,c=n.store,u=c.toReference,l=c.canRead;return{args:_s(r),field:r.field||null,fieldName:s,storeFieldName:o,variables:a,isReference:pr,toReference:u,storage:i,cache:e.cache,canRead:l,readField:function(){return e.readField(ks(arguments,t,a),n)},mergeObjects:Ns(n.store)}}function ks(e,t,r){var n,i,o,s=e[0],a=e[1],c=e.length;return"string"==typeof s?n={fieldName:s,from:c>1?a:t}:(n=ce({},s),Vo.call(n,"from")||(n.from=t)),__DEV__&&void 0===n.from&&__DEV__&&Ot.warn("Undefined 'from' passed to readField with arguments ".concat((i=Array.from(e),o=wi("stringifyForDisplay"),JSON.stringify(i,(function(e,t){return void 0===t?o:t})).split(JSON.stringify(o)).join("<undefined>")))),void 0===n.variables&&(n.variables=r),n}function Ns(e){return function(t,r){if(Bn(t)||Bn(r))throw __DEV__?new St("Cannot automatically merge arrays"):new St(4);if(ur(t)&&ur(r)){var n=e.getFieldValue(t,"__typename"),i=e.getFieldValue(r,"__typename");if(n&&i&&n!==i)return r;if(pr(t)&&Go(r))return e.merge(t.__ref,r),t;if(Go(t)&&pr(r))return e.merge(t,r.__ref),r;if(Go(t)&&Go(r))return ce(ce({},t),r)}return r}}function Ds(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:ce(ce({},e),{clientOnly:t,deferred:r})),i}var As=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=Ir(n),u=new Wn;s=ce(ce({},Ar(c)),s);var l=ce(ce({store:e,written:Object.create(null),merge:function(e,t){return u.merge(e,t)},variables:s,varString:ai(s)},Wo(n,this.fragments)),{overwrite:!!a,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),h=this.processSelectionSet({result:i||Object.create(null),dataId:o,selectionSet:c.selectionSet,mergeTree:{map:new Map},context:l});if(!pr(h))throw __DEV__?new St("Could not identify object ".concat(JSON.stringify(i))):new St(7);return l.incomingById.forEach((function(t,n){var i=t.storeObject,o=t.mergeTree,s=t.fieldNodeSet,a=dr(n);if(o&&o.map.size){var c=r.applyMerges(o,a,i,l);if(pr(c))return;i=c}if(__DEV__&&!l.overwrite){var u=Object.create(null);s.forEach((function(e){e.selectionSet&&(u[e.name.value]=!0)})),Object.keys(i).forEach((function(e){(function(e){return!0===u[Ko(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)&&!Fn(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"),c=Ko(r),u="".concat(a,".").concat(c);if(!$s.has(u)){$s.add(u);var l=[];Bn(o)||Bn(s)||[o,s].forEach((function(e){var t=n.getFieldValue(e,"__typename");"string"!=typeof t||l.includes(t)||l.push(t)})),__DEV__&&Ot.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(a," object.\n\nTo address this problem (which is not a bug in Apollo Client), ").concat(l.length?"either ensure all objects of type "+l.join(" and ")+" have an ID or a custom merge function, or ":"","define a custom merge function for the ").concat(u," field, so InMemoryCache can safely merge these objects:\n\n existing: ").concat(JSON.stringify(o).slice(0,1e3),"\n incoming: ").concat(JSON.stringify(s).slice(0,1e3),"\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"))}}}}(a,i,e,l.store)}))}e.merge(n,i)})),e.retain(h.__ref),h},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),u=r&&a.rootTypenamesById[r]||Er(n,i,o.fragmentMap)||r&&o.store.get(r,"__typename");"string"==typeof u&&(c.__typename=u);var l=function(){var e=ks(arguments,c,o.variables);if(pr(e.from)){var t=o.incomingById.get(e.from.__ref);if(t){var r=a.readField(ce(ce({},e),{from:t.storeObject}),o);if(void 0!==r)return r}}return a.readField(e,o)},h=new Set;this.flattenFields(i,n,o,u).forEach((function(e,r){var i,o=wr(r),f=n[o];if(h.add(r),void 0!==f){var d=a.getStoreFieldName({typename:u,fieldName:r.name.value,field:r,variables:e.variables}),p=Rs(s,d),m=t.processFieldValue(f,r,r.selectionSet?Ds(e,!1,!1):e,p),y=void 0;r.selectionSet&&(pr(m)||Go(m))&&(y=l("__typename",m));var v=a.getMergeFunction(u,r.name.value,y);v?p.info={field:r,typename:u,merge:v}:js(s,d),c=e.merge(c,((i={})[d]=m,i))}else!__DEV__||e.clientOnly||e.deferred||vi.added(r)||a.getReadFunction(u,r.name.value)||__DEV__&&Ot.error("Missing field '".concat(wr(r),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))}));try{var f=a.identify(n,{typename:u,selectionSet:i,fragmentMap:o.fragmentMap,storeObject:c,readField:l}),d=f[0],p=f[1];r=r||d,p&&(c=o.merge(c,p))}catch(e){if(!r)throw e}if("string"==typeof r){var m=dr(r),y=o.written[r]||(o.written[r]=[]);if(y.indexOf(i)>=0)return m;if(y.push(i),this.reader&&this.reader.isFresh(n,m,i,o))return m;var v=o.incomingById.get(r);return v?(v.storeObject=o.merge(v.storeObject,c),v.mergeTree=Ps(v.mergeTree,s),h.forEach((function(e){return v.fieldNodeSet.add(e)}))):o.incomingById.set(r,{storeObject:c,mergeTree:Cs(s)?void 0:s,fieldNodeSet:h}),m}return c},e.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?Bn(e)?e.map((function(e,o){var s=i.processFieldValue(e,t,r,Rs(n,o));return js(n,o),s})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):__DEV__?Ai(e):e},e.prototype.flattenFields=function(e,t,r,n){void 0===n&&(n=Er(t,e,r.fragmentMap));var i=new Map,o=this.cache.policies,s=new oi(!1);return function e(a,c){var u=s.lookup(a,c.clientOnly,c.deferred);u.visited||(u.visited=!0,a.selections.forEach((function(s){if(Hr(s,r.variables)){var a=c.clientOnly,u=c.deferred;if(a&&u||!zn(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||(u=!0)}})),Sr(s)){var l=i.get(s);l&&(a=a&&l.clientOnly,u=u&&l.deferred),i.set(s,Ds(r,a,u))}else{var h=fr(s,r.lookupFragment);if(!h&&s.kind===Ur.FRAGMENT_SPREAD)throw __DEV__?new St("No fragment named ".concat(s.name.value)):new St(8);h&&o.fragmentMatches(h,n,t,r.variables)&&e(h.selectionSet,Ds(r,a,u))}}})))}(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=Bn(r)||!pr(t)&&!Go(t)?void 0:t,u=r;c&&!i&&(i=[pr(c)?c.__ref:c]);var l=function(e,t){return Bn(e)?"number"==typeof t?e[t]:void 0:n.store.getFieldValue(e,String(t))};e.map.forEach((function(e,t){var r=l(c,t),o=l(u,t);if(void 0!==o){i&&i.push(t);var h=s.applyMerges(e,r,o,n,i);h!==o&&(a=a||new Map).set(t,h),i&&Ot(i.pop()===t)}})),a&&(r=Bn(u)?u.slice(0):ce({},u),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}(),xs=[];function Rs(e,t){var r=e.map;return r.has(t)||r.set(t,xs.pop()||{map:new Map}),r.get(t)}function Ps(e,t){if(e===t||!t||Cs(t))return e;if(!e||Cs(e))return t;var r=e.info&&t.info?ce(ce({},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,Ps(e,t.map.get(r))),o.delete(r)})),o.forEach((function(r){i.map.set(r,Ps(t.map.get(r),e.map.get(r)))}))}return i}function Cs(e){return!e||!(e.info||e.map.size)}function js(e,t){var r=e.map,n=r.get(t);n&&Cs(n)&&(xs.push(n),r.delete(t))}var $s=new Set,Ms=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.watches=new Set,r.typenameDocumentCache=new Map,r.makeVar=To,r.txCount=0,r.config=function(e){return Ri(Bo,e)}(t),r.addTypename=!!r.config.addTypename,r.policies=new Is({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return ae(t,e),t.prototype.init=function(){var e=this.data=new es.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 As(this,this.storeReader=new us({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:zo(this.config),canon:e?void 0:r&&r.canon,fragments:n}),n),this.maybeBroadcastWatch=wo((function(e,r){return t.broadcastWatch(e,r)}),{max:this.config.resultCacheMaxSize,makeCacheKey:function(e){var r=e.optimistic?t.optimisticData:t.data;if(as(r)){var n=e.optimistic,i=e.id,o=e.variables;return r.makeCacheKey(e.query,e.callback,ai({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(ce(ce({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:r})).result||null}catch(e){if(e instanceof qo)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(Vo.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(ce(ce({},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||Oo(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&&Io(r),r.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){ai.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){__DEV__&&Ot.warn(e)}},t.prototype.evict=function(e){if(!e.id){if(Vo.call(e,"id"))return!1;e=ce(ce({},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(),ai.reset(),e&&e.discardWatches?(this.watches.forEach((function(e){return t.maybeBroadcastWatch.forget(e)})),this.watches.clear(),Io(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}},u=new Set;return a&&!this.txCount&&this.broadcastWatches(ce(ce({},e),{onWatchUpdated:function(e){return u.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&&u.size?(this.broadcastWatches(ce(ce({},e),{onWatchUpdated:function(e,t){var r=a.call(this,e,t);return!1!==r&&u.delete(e),r}})),u.size&&u.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){if(this.addTypename){var t=this.typenameDocumentCache.get(e);return t||(t=vi(e),this.typenameDocumentCache.set(e,t),this.typenameDocumentCache.set(t,t)),t}return e},t.prototype.transformForLink=function(e){var t=this.config.fragments;return t?t.transform(e):e},t.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,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&&Fn(r.result,n.result)||e.callback(e.lastDiff=n,r)},t}(Fo);function Fs(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const qs=/\r\n|[\n\r]/g;function Ls(e,t){let r=0,n=1;for(const i of e.body.matchAll(qs)){if("number"==typeof i.index||Fs(!1),i.index>=t)break;r=i.index+i[0].length,n+=1}return{line:n,column:t+1-r}}function Vs(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,c=t.column+a,u=`${e.name}:${s}:${c}\n`,l=n.split(/\r\n|[\n\r]/g),h=l[i];if(h.length>120){const e=Math.floor(c/80),t=c%80,r=[];for(let e=0;e<h.length;e+=80)r.push(h.slice(e,e+80));return u+Qs([[`${s} |`,r[0]],...r.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",r[e+1]]])}return u+Qs([[s-1+" |",l[i-1]],[`${s} |`,h],["|","^".padStart(c)],[`${s+1} |`,l[i+1]]])}function Qs(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 Us extends Error{constructor(e,...t){var r,n,i;const{nodes:o,source:s,positions:a,path:c,originalError:u,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!=c?c:void 0,this.originalError=null!=u?u:void 0,this.nodes=Bs(Array.isArray(o)?o:o?[o]:void 0);const h=Bs(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=>Ls(s,e))):null==h?void 0:h.map((e=>Ls(e.source,e.start)));const f="object"==typeof(d=null==u?void 0:u.extensions)&&null!==d?null==u?void 0:u.extensions:void 0;var d;this.extensions=null!==(i=null!=l?l:f)&&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!=u&&u.stack?Object.defineProperty(this,"stack",{value:u.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Us):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"+Vs((t=r.loc).source,Ls(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+Vs(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 Bs(e){return void 0===e||0===e.length?void 0:e}function zs(e,t,r){return new Us(`Syntax Error: ${r}`,{source:e,positions:[t]})}var Ys,Ks,Hs;!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"}(Ys||(Ys={})),(Hs=Ks||(Ks={})).SOF="<SOF>",Hs.EOF="<EOF>",Hs.BANG="!",Hs.DOLLAR="$",Hs.AMP="&",Hs.PAREN_L="(",Hs.PAREN_R=")",Hs.SPREAD="...",Hs.COLON=":",Hs.EQUALS="=",Hs.AT="@",Hs.BRACKET_L="[",Hs.BRACKET_R="]",Hs.BRACE_L="{",Hs.PIPE="|",Hs.BRACE_R="}",Hs.NAME="Name",Hs.INT="Int",Hs.FLOAT="Float",Hs.STRING="String",Hs.BLOCK_STRING="BlockString",Hs.COMMENT="Comment";class Gs{constructor(e){const t=new Fr(Ks.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!==Ks.EOF)do{if(e.next)e=e.next;else{const t=ra(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===Ks.COMMENT);return e}}function Ws(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Js(e,t){return Zs(e.charCodeAt(t))&&Xs(e.charCodeAt(t+1))}function Zs(e){return e>=55296&&e<=56319}function Xs(e){return e>=56320&&e<=57343}function ea(e,t){const r=e.source.body.codePointAt(t);if(void 0===r)return Ks.EOF;if(r>=32&&r<=126){const e=String.fromCodePoint(r);return'"'===e?"'\"'":`"${e}"`}return"U+"+r.toString(16).toUpperCase().padStart(4,"0")}function ta(e,t,r,n,i){const o=e.line,s=1+r-e.lineStart;return new Fr(t,r,n,o,s,i)}function ra(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 na(e,i);case 33:return ta(e,Ks.BANG,i,i+1);case 36:return ta(e,Ks.DOLLAR,i,i+1);case 38:return ta(e,Ks.AMP,i,i+1);case 40:return ta(e,Ks.PAREN_L,i,i+1);case 41:return ta(e,Ks.PAREN_R,i,i+1);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return ta(e,Ks.SPREAD,i,i+3);break;case 58:return ta(e,Ks.COLON,i,i+1);case 61:return ta(e,Ks.EQUALS,i,i+1);case 64:return ta(e,Ks.AT,i,i+1);case 91:return ta(e,Ks.BRACKET_L,i,i+1);case 93:return ta(e,Ks.BRACKET_R,i,i+1);case 123:return ta(e,Ks.BRACE_L,i,i+1);case 124:return ta(e,Ks.PIPE,i,i+1);case 125:return ta(e,Ks.BRACE_R,i,i+1);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?fa(e,i):sa(e,i)}if(hn(t)||45===t)return ia(e,i,t);if(dn(t))return da(e,i);throw zs(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":Ws(t)||Js(r,i)?`Unexpected character: ${ea(e,i)}.`:`Invalid character: ${ea(e,i)}.`)}return ta(e,Ks.EOF,n,n)}function na(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(Ws(e))++i;else{if(!Js(r,i))break;i+=2}}return ta(e,Ks.COMMENT,t,i,r.slice(t+1,i))}function ia(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),hn(o))throw zs(e.source,i,`Invalid number, unexpected digit after 0: ${ea(e,i)}.`)}else i=oa(e,i,o),o=n.charCodeAt(i);if(46===o&&(s=!0,o=n.charCodeAt(++i),i=oa(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=oa(e,i,o),o=n.charCodeAt(i)),46===o||dn(o))throw zs(e.source,i,`Invalid number, expected digit but got: ${ea(e,i)}.`);return ta(e,s?Ks.FLOAT:Ks.INT,t,i,n.slice(t,i))}function oa(e,t,r){if(!hn(r))throw zs(e.source,t,`Invalid number, expected digit but got: ${ea(e,t)}.`);const n=e.source.body;let i=t+1;for(;hn(n.charCodeAt(i));)++i;return i}function sa(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),ta(e,Ks.STRING,t,i+1,s);if(92!==n){if(10===n||13===n)break;if(Ws(n))++i;else{if(!Js(r,i))throw zs(e.source,i,`Invalid character within String: ${ea(e,i)}.`);i+=2}}else{s+=r.slice(o,i);const t=117===r.charCodeAt(i+1)?123===r.charCodeAt(i+2)?aa(e,i):ca(e,i):ha(e,i);s+=t.value,i+=t.size,o=i}}throw zs(e.source,i,"Unterminated string.")}function aa(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||!Ws(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|la(e),n<0)break}throw zs(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+i)}".`)}function ca(e,t){const r=e.source.body,n=ua(r,t+2);if(Ws(n))return{value:String.fromCodePoint(n),size:6};if(Zs(n)&&92===r.charCodeAt(t+6)&&117===r.charCodeAt(t+7)){const e=ua(r,t+8);if(Xs(e))return{value:String.fromCodePoint(n,e),size:12}}throw zs(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+6)}".`)}function ua(e,t){return la(e.charCodeAt(t))<<12|la(e.charCodeAt(t+1))<<8|la(e.charCodeAt(t+2))<<4|la(e.charCodeAt(t+3))}function la(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function ha(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 zs(e.source,t,`Invalid character escape sequence: "${r.slice(t,t+2)}".`)}function fa(e,t){const r=e.source.body,n=r.length;let i=e.lineStart,o=t+3,s=o,a="";const c=[];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),c.push(a);const n=ta(e,Ks.BLOCK_STRING,t,o+3,pn(c).join("\n"));return e.line+=c.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(Ws(n))++o;else{if(!Js(r,o))throw zs(e.source,o,`Invalid character within String: ${ea(e,o)}.`);o+=2}else a+=r.slice(s,o),c.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 zs(e.source,o,"Unterminated string.")}function da(e,t){const r=e.source.body,n=r.length;let i=t+1;for(;i<n&&(fn(o=r.charCodeAt(i))||hn(o)||95===o);)++i;var o;return ta(e,Ks.NAME,t,i,r.slice(t,i))}class pa{constructor(e,t={}){const r=function(e){return e instanceof Vt}(e)?e:new Vt(e);this._lexer=new Gs(r),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(Ks.NAME);return this.node(e,{kind:Ur.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Ur.DOCUMENT,definitions:this.many(Ks.SOF,this.parseDefinition,Ks.EOF)})}parseDefinition(){if(this.peek(Ks.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===Ks.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 zs(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(Ks.BRACE_L))return this.node(e,{kind:Ur.OPERATION_DEFINITION,operation:Qr.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let r;return this.peek(Ks.NAME)&&(r=this.parseName()),this.node(e,{kind:Ur.OPERATION_DEFINITION,operation:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Ks.NAME);switch(e.value){case"query":return Qr.QUERY;case"mutation":return Qr.MUTATION;case"subscription":return Qr.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Ks.PAREN_L,this.parseVariableDefinition,Ks.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Ur.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Ks.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Ks.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Ks.DOLLAR),this.node(e,{kind:Ur.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Ur.SELECTION_SET,selections:this.many(Ks.BRACE_L,this.parseSelection,Ks.BRACE_R)})}parseSelection(){return this.peek(Ks.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let r,n;return this.expectOptionalToken(Ks.COLON)?(r=t,n=this.parseName()):n=t,this.node(e,{kind:Ur.FIELD,alias:r,name:n,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Ks.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Ks.PAREN_L,t,Ks.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,r=this.parseName();return this.expectToken(Ks.COLON),this.node(t,{kind:Ur.ARGUMENT,name:r,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Ks.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(Ks.NAME)?this.node(e,{kind:Ur.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Ur.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:Ur.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:Ur.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 Ks.BRACKET_L:return this.parseList(e);case Ks.BRACE_L:return this.parseObject(e);case Ks.INT:return this.advanceLexer(),this.node(t,{kind:Ur.INT,value:t.value});case Ks.FLOAT:return this.advanceLexer(),this.node(t,{kind:Ur.FLOAT,value:t.value});case Ks.STRING:case Ks.BLOCK_STRING:return this.parseStringLiteral();case Ks.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Ur.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Ur.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Ur.NULL});default:return this.node(t,{kind:Ur.ENUM,value:t.value})}case Ks.DOLLAR:if(e){if(this.expectToken(Ks.DOLLAR),this._lexer.token.kind===Ks.NAME){const e=this._lexer.token.value;throw zs(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:Ur.STRING,value:e.value,block:e.kind===Ks.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:Ur.LIST,values:this.any(Ks.BRACKET_L,(()=>this.parseValueLiteral(e)),Ks.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:Ur.OBJECT,fields:this.any(Ks.BRACE_L,(()=>this.parseObjectField(e)),Ks.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,r=this.parseName();return this.expectToken(Ks.COLON),this.node(t,{kind:Ur.OBJECT_FIELD,name:r,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(Ks.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(Ks.AT),this.node(t,{kind:Ur.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(Ks.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(Ks.BRACKET_R),t=this.node(e,{kind:Ur.LIST_TYPE,type:r})}else t=this.parseNamedType();return this.expectOptionalToken(Ks.BANG)?this.node(e,{kind:Ur.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Ur.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Ks.STRING)||this.peek(Ks.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(Ks.BRACE_L,this.parseOperationTypeDefinition,Ks.BRACE_R);return this.node(e,{kind:Ur.SCHEMA_DEFINITION,description:t,directives:r,operationTypes:n})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(Ks.COLON);const r=this.parseNamedType();return this.node(e,{kind:Ur.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:Ur.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:Ur.OBJECT_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:i,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Ks.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Ks.BRACE_L,this.parseFieldDefinition,Ks.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName(),n=this.parseArgumentDefs();this.expectToken(Ks.COLON);const i=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:Ur.FIELD_DEFINITION,description:t,name:r,arguments:n,type:i,directives:o})}parseArgumentDefs(){return this.optionalMany(Ks.PAREN_L,this.parseInputValueDef,Ks.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName();this.expectToken(Ks.COLON);const n=this.parseTypeReference();let i;this.expectOptionalToken(Ks.EQUALS)&&(i=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:Ur.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:Ur.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:Ur.UNION_TYPE_DEFINITION,description:t,name:r,directives:n,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(Ks.EQUALS)?this.delimitedMany(Ks.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:Ur.ENUM_TYPE_DEFINITION,description:t,name:r,directives:n,values:i})}parseEnumValuesDefinition(){return this.optionalMany(Ks.BRACE_L,this.parseEnumValueDefinition,Ks.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseEnumValueName(),n=this.parseConstDirectives();return this.node(e,{kind:Ur.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 zs(this._lexer.source,this._lexer.token.start,`${ma(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:Ur.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:r,directives:n,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(Ks.BRACE_L,this.parseInputValueDef,Ks.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Ks.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(Ks.BRACE_L,this.parseOperationTypeDefinition,Ks.BRACE_R);if(0===t.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:Ur.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:Ur.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:Ur.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:Ur.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:Ur.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:Ur.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:Ur.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:r,fields:n})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Ks.AT);const r=this.parseName(),n=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:Ur.DIRECTIVE_DEFINITION,description:t,name:r,arguments:n,repeatable:i,locations:o})}parseDirectiveLocations(){return this.delimitedMany(Ks.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(Ys,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new Mr(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 zs(this._lexer.source,t.start,`Expected ${ya(e)}, found ${ma(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==Ks.NAME||t.value!==e)throw zs(this._lexer.source,t.start,`Expected "${e}", found ${ma(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===Ks.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return zs(this._lexer.source,t.start,`Unexpected ${ma(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!==Ks.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw zs(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function ma(e){const t=e.value;return ya(e.kind)+(null!=t?` "${t}"`:"")}function ya(e){return function(e){return e===Ks.BANG||e===Ks.DOLLAR||e===Ks.AMP||e===Ks.PAREN_L||e===Ks.PAREN_R||e===Ks.SPREAD||e===Ks.COLON||e===Ks.EQUALS||e===Ks.AT||e===Ks.BRACKET_L||e===Ks.BRACKET_R||e===Ks.BRACE_L||e===Ks.PIPE||e===Ks.BRACE_R}(e)?`"${e}"`:e}var va=new Map,ga=new Map,ba=!0,_a=!1;function wa(e){return e.replace(/[\s,]+/g," ").trim()}function Ea(e){var t,r,n,i=wa(e);if(!va.has(i)){var o=function(e,t){return new pa(e,t).parseDocument()}(e,{experimentalFragmentVariables:_a,allowLegacyFragmentVariables:_a});if(!o||"Document"!==o.kind)throw new Error("Not a valid GraphQL document.");va.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=wa((s=e.loc).source.body.substring(s.start,s.end)),o=ga.get(t);o&&!o.has(i)?ba&&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||ga.set(t,o=new Set),o.add(i),r.has(i)||(r.add(i),n.push(e))}else n.push(e);var s})),ce(ce({},t),{definitions:n}))))}return va.get(i)}function Sa(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]})),Ea(n)}var Oa,Ia=Sa;(Oa=Sa||(Sa={})).gql=Ia,Oa.resetCaches=function(){va.clear(),ga.clear()},Oa.disableFragmentWarnings=function(){ba=!1},Oa.enableExperimentalFragmentVariables=function(){_a=!0},Oa.disableExperimentalFragmentVariables=function(){_a=!1},Sa.default=Sa;const Ta=require("cross-fetch");var ka,Na,Da=r.n(Ta);class Aa{constructor(e,t,r,n){this.rpcManager=e,this.region=r,this.appId=n;const i=X(this.region,this.appId,`${t}/graphql`);this.client=new Mo({link:new Rn({uri:i,headers:this.rpcManager.getStaticHeaders(),fetch:Da()}),cache:new Ms})}async query(e){return(await this.client.query({query:Sa`
|
|
9
9
|
${e.query}
|
|
10
10
|
`,variables:e.variables})).data}async mutate(e){return(await this.client.mutate({mutation:Sa`
|
|
11
11
|
${e.query}
|
|
12
|
-
`})).data}}class xa{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 Aa(this.rpcManager,e,this.region,this.appId),this.clientsMap.set(e,t),t)}}class Ra{constructor(e,t,r){this.rpcManager=e,this.lockManager=t,this.querySubscriptionManager=r}async sendMutations(e,t){const r=Q(e),n=r.map((e=>`sendMutation_${F(e.squidDocIdObj)}`));await this.lockManager.lock(...n),await this.querySubscriptionManager.waitForAllQueriesToFinish();try{const e={mutations:r,integrationId:t};return await this.rpcManager.post("mutation/mutate",e)}finally{this.lockManager.release(...n)}}}class Pa{constructor(e,t){this.rpcManager=e,this.socketManager=t,this.ongoingNamedQueryExecutions={},t.observeNotifications().pipe((0,b.filter)((e=>"namedQuery"===e.type)),qe((e=>e))).subscribe((e=>{this.handleNamedQueryResponse(e.clientRequestId,e.payload)}))}executeNamedQueryAndSubscribe(e,t,r){const n=te(),i=new b.Subject;this.ongoingNamedQueryExecutions[n]=i;const o={integrationId:e,queryName:t,paramsRecordStr:u(r),clientRequestId:n};return this.rpcManager.post("named-query/execute",o).catch((r=>{console.error("Got error while executing named query",t,"for integration",e,r),i.error(r),i.complete()})),i.pipe((0,b.finalize)((()=>{delete this.ongoingNamedQueryExecutions[n]})),(0,b.share)())}handleNamedQueryResponse(e,t){const r=this.ongoingNamedQueryExecutions[e];if(!r)return;const n=l(t);n.success?r.next(n.result):(r.error(new Error(n.result)),r.complete())}}class ja{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 g(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[F(e.__docId__,r,t)]))}}function Ca(e,t){return oe((function(r,n){var i=0;r.subscribe(Me(n,(function(r){return e.call(t,r,i++)&&n.next(r)})))}))}function $a(e){return[ka.SET_PATH,ka.DELETE_PATH].includes(e.type)}function Ma(e){return e.type===ka.BATCH_ACTION}function Fa(e){const t=[];if($a(e))t.push(e);else if(Ma(e))for(const r of e.payload)t.push(...Fa(r));return t}function qa(e,t){return Va(e,t)}function La(e){return"object"==typeof e}function Va(e,t){let r=e;if($a(t))r=function(e,t,r=[]){switch(t.type){case ka.DELETE_PATH:return Qa(e,t.path);case ka.SET_PATH:const n=t;return function(e,t,r,n){return Ua(e,t,r,n)}(e,t.path,r,n.payload);case ka.BATCH_ACTION:throw new Error("Unsupported")}}(e,t,[]);else{if(!Ma(t))throw new Error(`Invalid action type: ${t.type}`);r=t.payload.reduce(((e,t)=>Va(e,t)),e)}return r}function Qa(e,t){if(!t.length)throw new Error("can not delete an empty path");const r=t[0];if(1===t.length)return function(e,t){if(e instanceof Array)throw new Error("Cannot remove an item from an array");const r=Object.assign({},e);return delete r[t],r}(e,r);const n=t.slice(1),i=za(e,r);if(!i)return e;if(!La(i))throw new Error("Cannot delete from a non object state.");const o=Qa(i,n);return o===i?e:Ba(e,r,o)}function Ua(e,t,r,n){if(!t.length){if(La(n))return n;throw new Error("Relative path cannot be of length 0 when the new value is not an object.")}const i=t[0],o=[...r,i];if(1===t.length)return Ba(e,i,n);const s=t.slice(1),a=za(e,i);return void 0!==a&&La(a)?Ba(e,i,Ua(a,s,o,n)):Ua(e=Ba(e,i,{}),t,r,n)}function Ba(e,t,r){return(e=Object.assign({},e))[t]=r,e}function za(e,t){return e instanceof Array?e[function(e){const t=Number(e);if(isNaN(t))throw new Error(`The value is not a number: Actual: ${e}`);return Math.floor(t)}(t)]:e[t]}!function(e){e.DELETE_PATH="DELETE_PATH",e.SET_PATH="SET_PATH",e.BATCH_ACTION="BATCH_ACTION"}(ka||(ka={}));class Ya{constructor(){this.root=new Wa}getOrCreatePathTrieNode(e,t){let r=this.root;for(const t of e)r.children.get(t)||r.children.set(t,new Wa),r=r.children.get(t);return void 0!==t&&(r.nodeData=t),r}getPathTrieNode(e){let t=this.root;for(const r of e){if(!t)return;t=t.children.get(r)}return t}getPathTrie(e){let t=this.root;for(const r of e){if(!t)return;t=t.children.get(r)}if(t){const e=new Ya;return e.root=t,e}}iterateBfs(e){this.iterateInternal(this.root,e,[])}removeNode(e){e.length||(this.root=new Wa);const t=[this.root];for(const r of e){const e=t[t.length-1].children.get(r);if(!e)throw new Error("Node does not exist");t.push(e)}for(let r=t.length-1;r>0;r--){const n=t[r],i=e[r-1];if((n.nodeData||n.children.size)&&r!==t.length-1)break;t[r-1].children.delete(i)}}clearNodeData(e){const t=this.getPathTrieNode(e);t&&(t.nodeData=void 0,t.children.size||this.removeNode(e))}getNodeList(e){const t=[];let r=this.root;for(const n of e){if(!r)return t;t.push(r),r=r.children.get(n)}return t}iterateInternal(e,t,r){if(!1!==t(e.nodeData,r))for(const[n,i]of e.children)this.iterateInternal(i,t,r.concat(n))}}class Wa{constructor(){this.children=new Map([])}}class Ka{constructor(){this.subscriptionsTree=new Ya,this.state={},this.batchCount=0,this.batchedActions=[]}dispatch(e){this.batchCount>0&&this.batchedActions.push(e),this.state=qa(this.state,e),0===this.batchCount&&this.dispatchSubscriptions(e)}runInBatch(e){this.batchCount++;try{e()}finally{if(this.batchCount--,0===this.batchCount&&this.batchedActions.length){const e={type:ka.BATCH_ACTION,payload:[...this.batchedActions]};this.batchedActions.splice(0),this.dispatch(e)}}}observePath(e,t){return new b.Observable((r=>{const n=this.getOrCreateSubjectForPath(e);r.next(this.getStateInPath(e));const i=n.pipe(Ca((e=>{if(!t)return!0;const r=new Ya,n=t();for(const e of n)r.getOrCreatePathTrieNode(e,!0);const i=Fa(e.action).map((e=>e.path));let o=!1;for(const e of i)if(0===r.getNodeList(e).length){o=!0;break}return o})),qe((e=>e.data))).subscribe(r);return()=>{i.unsubscribe(),n.observed||(n.complete(),this.subscriptionsTree.clearNodeData(e))}}))}setKeyInPath(e,t,r,n=!1){this.setInPath([...e,t],r,n)}setPartial(e,t,r=!1){let n=this.getStateInPath(e);n||(n={}),this.setInPath(e,Object.assign(Object.assign({},n),t),r)}setInPath(e,t,r=!1){if(r&&this.getStateInPath(e)===t)return;const n={type:ka.SET_PATH,path:e,payload:t};this.dispatch(n)}pushToArray(e,t){let r=this.getStateInPath(e);r=r?[...r]:[],r.push(t),this.setInPath(e,r)}deletePath(e){const t={type:ka.DELETE_PATH,path:e};this.dispatch(t)}getState(){return this.state}getStateInPath(e){return Ha(this.state,e)}destroy(){this.subscriptionsTree.iterateBfs((e=>{e&&e.subject&&e.subject.complete()}))}getOrCreateSubjectForPath(e){const t=this.subscriptionsTree.getOrCreatePathTrieNode(e);t.nodeData||(t.nodeData=new Ga);const r=t.nodeData;return r.subject||(r.subject=new b.Subject),r.subject}dispatchSubscriptions(e){const t=function(e,t){const r=new Ya;for(const n of Fa(e)){let e=r.getOrCreatePathTrieNode(n.path);if(!t||e.nodeData)continue;let i=t.getPathTrieNode(n.path);if(i){const t=[[e,i]];for(;t.length;){const r=t.shift();if(e=r[0],i=r[1],!e.nodeData){for(const[r,n]of i.children)e.children.get(r)||e.children.set(r,new Wa),t.push([e.children.get(r),n]);e.nodeData=!0}}}}return r}(e,this.subscriptionsTree);t.iterateBfs(((t,r)=>{const n=this.subscriptionsTree.getPathTrieNode(r);n&&n.nodeData&&n.nodeData.subject.next({action:e,data:Ha(this.getState(),r)})}))}}function Ha(e,t){let r=e;for(const e of t){if(null==r)return;if(!La(r))throw new Error("result must be a state object");r=r[e]}return r}class Ga{}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.DISABLED=1]="DISABLED",e[e.ENABLED=2]="ENABLED"}(Da||(Da={}));const Ja="client";class Za{constructor(e,t,r,n,i){this.rpcManager=e,this.clientIdService=t,this.documentStore=r,this.destructManager=n,this.documentIdentityService=i,this.safeToSendQueriesToServer=new b.BehaviorSubject(!0),this.onOrphanDocuments=new b.Subject,this.ongoingQueries=new Map,this.inflightQueriesCount=new b.BehaviorSubject(0),this.clientRequestIdToLocalDocuments=new Map,this.localDocumentToClientRequestIds=new Map,this.queryMappingManager=new ec,this.documentIdentityService.observeChanges().subscribe(this.migrateDocIds.bind(this)),this.clientIdService.observeClientReadyToBeRegenerated().subscribe((()=>{this.refreshOngoingQueries()})),this.destructManager.onPreDestruct((()=>{this.predestruct()}))}hasOngoingQuery(e){return this.ongoingQueries.has(e)}getQuery(e){return T(this.ongoingQueries.get(e),"UNKNOWN_QUERY").query}setGotInitialResult(e){const t=this.ongoingQueries.get(e);t&&!t.gotInitialResponse?t.gotInitialResponse=!0:this.removeClientRequestIdMapping(e)}findQueriesForDocument(e,t){const{collectionName:r,integrationId:n}=M(t),i=this.queryMappingManager.getMapping(Ja,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=l(n);let s;if(f(e)){const n=null!==(r=k(t,e.fieldName))&&void 0!==r?r:null;s=p(e.value,n,e.operator)}else s=Xa(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&&(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)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=T(null==s?void 0:s.supportingOngoingQuery);if(o&&t.add(s),e.query.limit>0)switch(e.limitUnderflowState){case Da.UNKNOWN:e.limitUnderflowState=n.size===e.query.limit+100?Da.ENABLED:Da.DISABLED;break;case Da.DISABLED:break;case Da.ENABLED:if(n.size<e.query.limit+20)return e.limitUnderflowState=Da.UNKNOWN,void this.sendQueryToServerOrUseParentQuery(e)}e.dataSubject.next(i)}for(const e of t){const t=this.collectAllObservables(e);T(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 g(e.query);for(const r of this.ongoingQueries.values())if(e!==r&&this.isValidParent(r)&&t.isSubqueryOfQuery(r.query))return r}findValidParentOfQuery(e){const t=new g(e);for(const e of this.ongoingQueries.values())if(this.isValidParent(e)&&t.isSubqueryOfQuery(e.query))return e}processQuery(e,t,r,n,i,s){return(0,b.defer)((()=>{const a=this.createOngoingQueryGraph(e,t,r,n,i,!0);s&&(a.forceFetchFromServer=!0),this.sendQueryToServerOrUseParentQuery(a),a.allObservables=new b.ReplaySubject(1);const c=a.allObservables.pipe((0,b.switchMap)((e=>(0,b.combineLatest)(e).pipe(qe((e=>this.joinResults(e,n,a)))))),Ca((()=>this.allOngoingQueriesGotInitialResult(a))),(0,b.startWith)(void 0),(0,b.pairwise)(),Ca((([e,t])=>!o.isEqual(e,t))),qe((([e,t])=>t)),i?(0,b.tap)():(0,b.take)(1),(0,b.finalize)((()=>{var e;a.dataSubject.complete(),a.done=!0,this.completeAllSupportedQueries(a).then(),null===(e=a.allObservables)||void 0===e||e.complete()}))),u=this.collectAllObservables(a);return a.allObservables.next(u),c})).pipe((0,b.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=T(this.localDocumentToClientRequestIds.get(n));t.delete(e),t.size||(this.localDocumentToClientRequestIds.delete(n),r.push(n))}r.length&&this.onOrphanDocuments.next(r)}async waitForAllQueriesToFinish(){return(0,b.firstValueFrom)(this.inflightQueriesCount.pipe(Ca((e=>0===e)))).then((()=>{}))}registerQueryFinalizer(e){const t=e.clientRequestId,r=y(this.clientIdService.getClientId(),t);e.dataSubject.pipe((0,b.finalize)((async()=>{if(e.unsubscribeBlockerCount.value>0&&await(0,b.firstValueFrom)((0,b.race)(this.destructManager.observeIsDestructing(),e.unsubscribeBlockerCount.pipe(Ca((e=>0===e))))),this.queryMappingManager.removeQuery(t,r).then(),this.ongoingQueries.delete(t),e.subscribe&&!e.isEmptyForJoin&&e.activated){const r={clientRequestId:t};this.rpcManager.post("query/unsubscribe",r).catch((t=>{console.error("Got error while unsubscribing from query",e.query,t)}))}this.removeClientRequestIdMapping(t),this.ongoingQueries.delete(t)})),Ca(Boolean)).subscribe({error:()=>{}})}createOngoingQueryGraph(e,t,r,n,i,o,s={}){if(s[t])return s[t];const a=te(),c=[],u={clientRequestId:a,activated:o,alias:t,query:e,subscribe:i,dataSubject:new b.BehaviorSubject(null),supportedQueries:c,supportingOngoingQuery:void 0,joinCondition:void 0,gotInitialResponse:!1,isEmptyForJoin:!1,unsubscribeBlockerCount:new b.BehaviorSubject(0),queryRegistered:new b.BehaviorSubject(!1),done:!1,isInFlight:!1,forceFetchFromServer:!1,limitUnderflowState:Da.UNKNOWN};this.registerQueryFinalizer(u),this.ongoingQueries.set(a,u),s[t]=u;for(const[e,o]of Object.entries(n)){const a=o.leftAlias;if(a!==t&&e!==t)continue;const l=a===t?e:a;if(a===t){const e=this.createOngoingQueryGraph(r[l],l,r,n,i,!1,s);e.joinCondition=o,c.push(e)}else u.supportingOngoingQuery=this.createOngoingQueryGraph(r[l],l,r,n,i,!1,s)}return u}collectAllObservables(e,t=[]){if(e.isEmptyForJoin)return t;const r=e.alias;t.push(e.dataSubject.pipe(Ca(Boolean),qe((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,[]),T(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=T(r.shift());e.isEmptyForJoin||(t.push(e),r.push(...e.supportedQueries))}return t}updateOngoingQueryWithNewDataFromSupportingQuery(e,t){var r;const n=T(t.joinCondition),i=t.query;if(t.activated){const s=T(null===(r=t.supportingOngoingQuery)||void 0===r?void 0:r.supportedQueries).filter((e=>e.alias===t.alias)),a=new Set(e.map((e=>{var t;return null!==(t=e[n.left])&&void 0!==t?t:null})));for(const e of s)e.query.conditions.filter(f).filter((e=>e.fieldName===n.right)).forEach((e=>{a.delete(e.value)}));if(0===a.size)return!1;const c=o.cloneDeep(i);c.conditions=c.conditions.filter((e=>!f(e)||e.fieldName!==n.right)),[...a].forEach((e=>{c.conditions.push({fieldName:n.right,operator:"==",value:e})}));const u=Object.assign(Object.assign({},t),{query:c,activated:!0,gotInitialResponse:!1,dataSubject:new b.BehaviorSubject(null),clientRequestId:te(),isEmptyForJoin:!1});return this.registerQueryFinalizer(u),this.ongoingQueries.set(u.clientRequestId,u),T(t.supportingOngoingQuery).supportedQueries.push(u),this.sendQueryToServerOrUseParentQuery(u),!0}{const r=e.map((e=>{var t;return{fieldName:n.right,operator:"==",value:null!==(t=e[n.left])&&void 0!==t?t:null}}));return t.activated=!0,r.length?(i.conditions.push(...r),this.sendQueryToServerOrUseParentQuery(t)):t.isEmptyForJoin=!0,!0}}allOngoingQueriesGotInitialResult(e){return!!e.isEmptyForJoin||!!e.gotInitialResponse&&(!e.supportedQueries.length||e.supportedQueries.every((e=>this.allOngoingQueriesGotInitialResult(e))))}async completeAllSupportedQueries(e){const t=[...e.supportedQueries||[]];for(;t.length;){const e=T(t.shift());t.push(...e.supportedQueries||[]),await(0,b.firstValueFrom)(e.unsubscribeBlockerCount.pipe(Ca((e=>0===e)))),e.dataSubject.complete()}}predestruct(){this.safeToSendQueriesToServer.next(!1),this.safeToSendQueriesToServer.complete(),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=y(this.clientIdService.getClientId(),r);this.queryMappingManager.addQuery(Ja,t,n),this.ongoingQueries.set(r,e);const i=this.findValidParentOfOngoingQuery(e);i?this.useParentOngoingQuery(e,i).then():this.sendQueryToServer(e)}async useParentOngoingQuery(e,t){const r={clientRequestId:e.clientRequestId,query:e.query,parentClientRequestId:t.clientRequestId},n=new g(e.query);t.unsubscribeBlockerCount.next(t.unsubscribeBlockerCount.value+1);try{await(0,b.firstValueFrom)(t.queryRegistered.pipe(Ca(Boolean)))}catch(t){return e.dataSubject.error(t),e.queryRegistered.error(t),void(e.done=!0)}if(this.destructManager.isDestructing)return;if(e.done)return;this.rpcManager.post("query/register",r).then((()=>{e.queryRegistered.next(!0)})).catch((r=>{console.error("Query error",e.query,t.query,r),e.dataSubject.error(r),e.done=!0})).finally((()=>{t.unsubscribeBlockerCount.next(t.unsubscribeBlockerCount.value-1),e.isInFlight=!1}));const i=(0,b.race)(e.queryRegistered.pipe(Ca(Boolean),(0,b.delay)(2e3),(0,b.take)(1)),this.destructManager.observeIsDestructing().pipe((0,b.take)(1)));t.dataSubject.pipe((0,b.takeWhile)((()=>!e.done)),(0,b.takeUntil)(i),Ca(Boolean),(0,b.tap)((()=>{e.gotInitialResponse||this.setGotInitialResult(e.clientRequestId)})),qe((e=>e.filter((e=>n.documentMatchesQuery(e)))))).subscribe({next:t=>{for(const r of t)this.setClientRequestIdsForLocalDoc(F(r.__docId__,e.query.collectionName,e.query.integrationId),r);this.notifyAllSubscriptions([e.clientRequestId])},error:t=>e.dataSubject.error(t)})}sendQueryToServer(e){const t=e.query.limit,r=t>0?t+100:t,n={query:Object.assign(Object.assign({},e.query),{limit:r}),clientRequestId:e.clientRequestId,subscribe:e.subscribe};this.safeToSendQueriesToServer.pipe(Ca(Boolean),(0,b.take)(1)).subscribe((()=>{e.done||(this.inflightQueriesCount.next(this.inflightQueriesCount.value+1),e.isInFlight=!0,this.rpcManager.post("query/query",n).catch((t=>{e.dataSubject.error(t),e.done=!0,e.queryRegistered.error("query failed")})).then((()=>{e.queryRegistered.next(!0)})).finally((()=>{this.inflightQueriesCount.next(this.inflightQueriesCount.value-1),e.isInFlight=!1})))}))}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=>{x(this.localDocumentToClientRequestIds,t,e[t])}))}}function Xa(e,t){var r;for(const n of e.fields){const e=null!==(r=k(t,n.fieldName))&&void 0!==r?r:null;if(p(n.value,e,n.operator))return!0;if(p(n.value,e,"!="))return!1}return!1}class ec{constructor(){this.stateService=new Ka,this.querySubscriptionIdToQuery={}}addQuery(e,t,r){this.stateService.runInBatch((()=>{let e=0;const n=new Set;for(const i of t.conditions){if(f(i)&&["=="].includes(i.operator)){const t=h(i.fieldName);n.has(t)||(e++,n.add(t))}else e++;const o=this.getConditionStatePath(t,i),s=[...this.stateService.getStateInPath(o)||[]];H(s,r),this.stateService.setInPath(o,s)}if(!t.conditions.length){const e=["queryMapping",t.collectionName,t.integrationId,"mapping","unconditional"],n=[...this.stateService.getStateInPath(e)||[]];H(n,r),this.stateService.setInPath(e,n)}this.stateService.setInPath([...this.getQueryMetadataStatePath(t,r),"condCount"],e)})),this.querySubscriptionIdToQuery[r]=t}async removeQuery(e,t){const r=this.querySubscriptionIdToQuery[t];if(r)return this.stateService.runInBatch((()=>{for(const e of r.conditions){const n=this.getConditionStatePath(r,e),i=[...this.stateService.getStateInPath(n)||[]];G(i,t),i.length?this.stateService.setInPath(n,i):this.stateService.deletePath(n)}if(!r.conditions.length){const e=["queryMapping",r.collectionName,r.integrationId,"mapping","unconditional"],n=[...this.stateService.getStateInPath(e)||[]];G(n,t),this.stateService.setInPath(e,n)}this.stateService.deletePath(this.getQueryMetadataStatePath(r,t))})),r}getMapping(e,t,r){return this.stateService.getStateInPath(["queryMapping",t,r,"mapping"])}getQueryMetadataStatePath(e,t){return["queryMapping",e.collectionName,e.integrationId,"mapping","queriesMetadata",`${t}`]}getConditionStatePath(e,t){return["queryMapping",e.collectionName,e.integrationId,"mapping","conditional",d(t)]}}class tc{constructor(e,t,r,n,i={},o,s){this.region=e,this.appId=t,this.socketManager=r,this.destructManager=n,this.headers=i,this.authManager=o,this.clientIdService=s,this.staticHeaders={},this.onGoingRpcCounter=new b.BehaviorSubject(0);for(const[e,t]of Object.entries(i))this.setStaticHeader(e,t);const a=this.authManager.getApiKey();a&&this.setStaticHeader("Authorization",`ApiKey ${a}`),this.clientIdService.observeClientId().subscribe((e=>{e?this.setStaticHeader("x-squid-clientid",e):this.deleteStaticHeader("x-squid-clientid")})),this.authManager.observeAuthIdToken().subscribe((e=>{if(e.token){let t=`Bearer ${e.token}`;e.integrationId&&(t+=`; IntegrationId ${e.integrationId}`),this.setStaticHeader("Authorization",t)}else this.deleteStaticHeader("Authorization")})),n.onDestruct((async()=>{await this.awaitAllSettled()}))}async awaitAllSettled(){await(0,b.firstValueFrom)(this.onGoingRpcCounter.pipe((0,b.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){this.onGoingRpcCounter.next(this.onGoingRpcCounter.value+1);try{await(0,b.firstValueFrom)((0,b.race)(this.socketManager.observeConnectionReady().pipe((0,b.filter)(Boolean)),this.destructManager.observeIsDestructing())),await this.authManager.waitForReadyState();let r={"Content-Type":"application/json"};Object.keys(this.staticHeaders)&&(r=Object.assign(Object.assign({},r),this.staticHeaders));const n=X(this.region,this.appId,e),i=await Na()(n,{method:"POST",body:u(t),headers:r});let o,s;try{o=await i.text();try{s=JSON.parse(o)}catch(e){}}catch(e){o="Cannot read body"}if(!i.ok)throw new rc(i.status,i.statusText,i.headers,i.url,null==s?void 0:s.message);return s||o}finally{this.onGoingRpcCounter.next(this.onGoingRpcCounter.value-1)}}}class rc extends Error{constructor(e,t,r,n,i){super(i||`RPC error ${e} ${t} calling ${n}`),this.statusCode=e,this.statusText=t,this.headers=r,this.url=n}}const nc=require("socket.io-client"),ic=e=>e();class oc{constructor(e,t,r,n=ic,i,o={},s){this.clientIdService=e,this.region=t,this.appId=r,this.messageNotificationWrapper=n,this.destructManager=i,this.authManager=s,this.webSocketObserver=new b.Subject,this.allMessagesObserver=new b.Subject,this.connectionReady=new b.BehaviorSubject(!1),this.seenMessageIds=new Set,this.firstConnection=!0,this.clientTooOldThreshold=3e5,this.destructManager.onDestruct((async()=>{await this.destruct()})),this.setupMessageAcknowledgments(),this.connect(Object.assign({},o)),this.connectionReady.pipe((0,b.skip)(1),(0,b.filter)((e=>!e)),(0,b.switchMap)((()=>(0,b.race)((0,b.timer)(this.clientTooOldThreshold),this.connectionReady.pipe((0,b.filter)(Boolean)),this.destructManager.observeIsDestructing())))).subscribe((()=>{this.connectionReady.value||this.destructManager.isDestructing||(this.clientIdService.notifyClientTooOld(),this.connect(Object.assign({},o)))})),this.connectionReady.pipe((0,b.filter)(Boolean)).subscribe((()=>{this.clientIdService.isClientTooOld()&&this.clientIdService.notifyClientReadyToBeRegenerated()}))}observeNotifications(){return this.webSocketObserver.asObservable()}observeConnectionReady(){return this.connectionReady.asObservable().pipe((0,b.distinctUntilChanged)())}sendMessage(e){this.authManager.waitForReadyState().then((()=>{(0,b.firstValueFrom)(this.connectionReady.pipe((0,b.filter)(Boolean))).then((()=>{const t=this.authManager.getAuthToken();T(this.socket).emit("message",Object.assign(Object.assign({},e),{authToken:t}))}))}))}connect(e){const t=X(this.region,this.appId,""),r={clientId:this.clientIdService.getClientId()};this.socket=(0,nc.io)(t,{query:r,reconnectionDelay:5e3,transports:["websocket"],extraHeaders:e}),this.socket.on("connect",(()=>{})),this.socket.on("disconnect",((e,t)=>{this.connectionReady.next(!1)})),this.socket.on("connectionReady",(()=>{this.connectionReady.next(!0),this.firstConnection||this.sendMessage({type:"catchup"}),this.firstConnection=!1})),this.socket.on("message",(e=>{const t=l(e);for(const e of t)this.allMessagesObserver.next(e),this.seenMessageIds.has(e.messageId)||(this.seenMessageIds.add(e.messageId),this.messageNotificationWrapper((()=>{this.webSocketObserver.next(e)})))}))}setupMessageAcknowledgments(){const e=new b.Subject;this.allMessagesObserver.subscribe((t=>{(null==t?void 0:t.messageId)&&e.next(t.messageId)}));const t=[];e.pipe((0,b.tap)((e=>t.push(e))),(0,b.debounceTime)(100)).subscribe((async()=>{const e=[...t.splice(0)];this.sendMessage({type:"acknowledge",payload:e})}))}async destruct(){var e;this.sendMessage({type:"kill"}),this.connectionReady.next(!1),await(0,b.firstValueFrom)((0,b.timer)(0)),null===(e=this.socket)||void 0===e||e.disconnect(),this.webSocketObserver.complete(),this.allMessagesObserver.complete()}}class sc{constructor(e){this.destructManager=new pt,this.setAuthIdToken=(e,t)=>{this.authManager.setAuthIdToken(e,t)},this.collection=(e,r=t.built_in_db)=>(this.validateNotDestructed(),this.collectionReferenceFactory.get(e,r)),this.runInTransaction=e=>(this.validateNotDestructed(),this.dataManager.runInTransaction(e)),this.executeFunction=(e,...t)=>(this.validateNotDestructed(),(0,b.firstValueFrom)(this.backendFunctionManager.executeFunctionAndSubscribe(e,...t))),this.executeNamedQuery=(e,t,r)=>(this.validateNotDestructed(),(0,b.firstValueFrom)(this.namedQueryManager.executeNamedQueryAndSubscribe(e,t,r))),this.callApi=(e,t,r={})=>(this.validateNotDestructed(),(0,b.firstValueFrom)(this.apiManager.callApiAndSubscribe(e,t,r))),this.graphql=e=>(this.validateNotDestructed(),this.graphqlClientFactory.get(e)),this.ai=()=>(this.validateNotDestructed(),{assistant:e=>this.aiClientFactory.getAssistant(e)}),this.acquireLock=(e,t=!0)=>(this.validateNotDestructed(),this.distributedLockManager.lock(e,t)),this.destruct=async()=>{if(!this.destructManager.isDestructing)return this.destructManager.destruct().finally((()=>{const e=Object.entries(sc.squidInstancesMap).find((([,e])=>e===this));e&&delete sc.squidInstancesMap[e[0]]}))},this.connectionDetails=()=>(this.validateNotDestructed(),this._connectionDetails),this.unsubscribe=async()=>{this.querySubscriptionManager.unsubscribe(),await this.rpcManager.awaitAllSettled()},I(e.appId,"APP_ID_MUST_BE_PROVIDED");const r="prod"!==e.environmentId&&e.squidDeveloperId,n=function(e,t,r){return`${C(e,t)}${r?`-${r}`:""}`}(e.appId,e.environmentId,r?e.squidDeveloperId:void 0),i=function(e,t){const r={};return ee(e)&&(r["x-squid-appid"]=t),r}(e.region,n);this.clientIdService=new ct(this.destructManager),this.authManager=new st(this.destructManager,e.apiKey),this.socketManager=new oc(this.clientIdService,e.region,n,e.messageNotificationWrapper,this.destructManager,i,this.authManager),this.rpcManager=new tc(e.region,n,this.socketManager,this.destructManager,i,this.authManager,this.clientIdService),this.documentStore=new bt,this.lockManager=new re,this.distributedLockManager=new mt(this.socketManager,this.destructManager),this.documentIdentityService=new vt(this.documentStore,this.destructManager),this.documentReferenceFactory=new gt(this.documentIdentityService),this.querySubscriptionManager=new Za(this.rpcManager,this.clientIdService,this.documentStore,this.destructManager,this.documentIdentityService),this.localQueryManager=new ja(this.documentStore,this.documentReferenceFactory,this.querySubscriptionManager);const o=new Ra(this.rpcManager,this.lockManager,this.querySubscriptionManager);this.queryBuilderFactory=new We(this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.documentIdentityService),this.collectionReferenceFactory=new ut(this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager),this.dataManager=new dt(this.documentStore,o,this.socketManager,this.querySubscriptionManager,this.queryBuilderFactory,this.lockManager,this.destructManager,this.documentIdentityService),this.documentReferenceFactory.setDataManager(this.dataManager),this.backendFunctionManager=new at(this.clientIdService,this.rpcManager,this.socketManager),this.namedQueryManager=new Pa(this.rpcManager,this.socketManager),this.apiManager=new ot(this.clientIdService,this.rpcManager,this.socketManager,e.apiServerUrlOverrideMapping),this.graphqlClientFactory=new xa(this.rpcManager,e.region,n),this.aiClientFactory=new it(this.rpcManager,this.socketManager),this._connectionDetails=new lt(this.clientIdService,this.socketManager)}static getInstance(e){const t=c(e);let r=sc.squidInstancesMap[t];return r||(r=new sc(e),sc.squidInstancesMap[t]=r,r)}static getInstances(){return Object.values(sc.squidInstancesMap)}validateNotDestructed(){I(!this.destructManager.isDestructing,"The client was already destructed.")}}sc.squidInstancesMap={}})();var i=exports;for(var o in n)i[o]=n[o];n.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
|
|
12
|
+
`})).data}}class xa{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 Aa(this.rpcManager,e,this.region,this.appId),this.clientsMap.set(e,t),t)}}class Ra{constructor(e,t,r){this.rpcManager=e,this.lockManager=t,this.querySubscriptionManager=r}async sendMutations(e,t){const r=Q(e),n=r.map((e=>`sendMutation_${F(e.squidDocIdObj)}`));await this.lockManager.lock(...n),await this.querySubscriptionManager.waitForAllQueriesToFinish();try{const e={mutations:r,integrationId:t};return await this.rpcManager.post("mutation/mutate",e)}finally{this.lockManager.release(...n)}}}class Pa{constructor(e,t){this.rpcManager=e,this.socketManager=t,this.ongoingNamedQueryExecutions={},t.observeNotifications().pipe((0,w.filter)((e=>"namedQuery"===e.type)),qe((e=>e))).subscribe((e=>{this.handleNamedQueryResponse(e.clientRequestId,e.payload)}))}executeNamedQueryAndSubscribe(e,t,r){const n=te(),i=new w.Subject;this.ongoingNamedQueryExecutions[n]=i;const o={integrationId:e,queryName:t,paramsRecordStr:l(r),clientRequestId:n};return this.rpcManager.post("named-query/execute",o).catch((r=>{console.error("Got error while executing named query",t,"for integration",e,r),i.error(r),i.complete()})),i.pipe((0,w.finalize)((()=>{delete this.ongoingNamedQueryExecutions[n]})),(0,w.share)())}handleNamedQueryResponse(e,t){const r=this.ongoingNamedQueryExecutions[e];if(!r)return;const n=h(t);n.success?r.next(n.result):(r.error(new Error(n.result)),r.complete())}}class Ca{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 b(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[F(e.__docId__,r,t)]))}}function ja(e,t){return oe((function(r,n){var i=0;r.subscribe(Me(n,(function(r){return e.call(t,r,i++)&&n.next(r)})))}))}function $a(e){return[ka.SET_PATH,ka.DELETE_PATH].includes(e.type)}function Ma(e){return e.type===ka.BATCH_ACTION}function Fa(e){const t=[];if($a(e))t.push(e);else if(Ma(e))for(const r of e.payload)t.push(...Fa(r));return t}function qa(e,t){return Va(e,t)}function La(e){return"object"==typeof e}function Va(e,t){let r=e;if($a(t))r=function(e,t,r=[]){switch(t.type){case ka.DELETE_PATH:return Qa(e,t.path);case ka.SET_PATH:const n=t;return function(e,t,r,n){return Ua(e,t,r,n)}(e,t.path,r,n.payload);case ka.BATCH_ACTION:throw new Error("Unsupported")}}(e,t,[]);else{if(!Ma(t))throw new Error(`Invalid action type: ${t.type}`);r=t.payload.reduce(((e,t)=>Va(e,t)),e)}return r}function Qa(e,t){if(!t.length)throw new Error("can not delete an empty path");const r=t[0];if(1===t.length)return function(e,t){if(e instanceof Array)throw new Error("Cannot remove an item from an array");const r=Object.assign({},e);return delete r[t],r}(e,r);const n=t.slice(1),i=za(e,r);if(!i)return e;if(!La(i))throw new Error("Cannot delete from a non object state.");const o=Qa(i,n);return o===i?e:Ba(e,r,o)}function Ua(e,t,r,n){if(!t.length){if(La(n))return n;throw new Error("Relative path cannot be of length 0 when the new value is not an object.")}const i=t[0],o=[...r,i];if(1===t.length)return Ba(e,i,n);const s=t.slice(1),a=za(e,i);return void 0!==a&&La(a)?Ba(e,i,Ua(a,s,o,n)):Ua(e=Ba(e,i,{}),t,r,n)}function Ba(e,t,r){return(e=Object.assign({},e))[t]=r,e}function za(e,t){return e instanceof Array?e[function(e){const t=Number(e);if(isNaN(t))throw new Error(`The value is not a number: Actual: ${e}`);return Math.floor(t)}(t)]:e[t]}!function(e){e.DELETE_PATH="DELETE_PATH",e.SET_PATH="SET_PATH",e.BATCH_ACTION="BATCH_ACTION"}(ka||(ka={}));class Ya{constructor(){this.root=new Ka}getOrCreatePathTrieNode(e,t){let r=this.root;for(const t of e)r.children.get(t)||r.children.set(t,new Ka),r=r.children.get(t);return void 0!==t&&(r.nodeData=t),r}getPathTrieNode(e){let t=this.root;for(const r of e){if(!t)return;t=t.children.get(r)}return t}getPathTrie(e){let t=this.root;for(const r of e){if(!t)return;t=t.children.get(r)}if(t){const e=new Ya;return e.root=t,e}}iterateBfs(e){this.iterateInternal(this.root,e,[])}removeNode(e){e.length||(this.root=new Ka);const t=[this.root];for(const r of e){const e=t[t.length-1].children.get(r);if(!e)throw new Error("Node does not exist");t.push(e)}for(let r=t.length-1;r>0;r--){const n=t[r],i=e[r-1];if((n.nodeData||n.children.size)&&r!==t.length-1)break;t[r-1].children.delete(i)}}clearNodeData(e){const t=this.getPathTrieNode(e);t&&(t.nodeData=void 0,t.children.size||this.removeNode(e))}getNodeList(e){const t=[];let r=this.root;for(const n of e){if(!r)return t;t.push(r),r=r.children.get(n)}return t}iterateInternal(e,t,r){if(!1!==t(e.nodeData,r))for(const[n,i]of e.children)this.iterateInternal(i,t,r.concat(n))}}class Ka{constructor(){this.children=new Map([])}}class Ha{constructor(){this.subscriptionsTree=new Ya,this.state={},this.batchCount=0,this.batchedActions=[]}dispatch(e){this.batchCount>0&&this.batchedActions.push(e),this.state=qa(this.state,e),0===this.batchCount&&this.dispatchSubscriptions(e)}runInBatch(e){this.batchCount++;try{e()}finally{if(this.batchCount--,0===this.batchCount&&this.batchedActions.length){const e={type:ka.BATCH_ACTION,payload:[...this.batchedActions]};this.batchedActions.splice(0),this.dispatch(e)}}}observePath(e,t){return new w.Observable((r=>{const n=this.getOrCreateSubjectForPath(e);r.next(this.getStateInPath(e));const i=n.pipe(ja((e=>{if(!t)return!0;const r=new Ya,n=t();for(const e of n)r.getOrCreatePathTrieNode(e,!0);const i=Fa(e.action).map((e=>e.path));let o=!1;for(const e of i)if(0===r.getNodeList(e).length){o=!0;break}return o})),qe((e=>e.data))).subscribe(r);return()=>{i.unsubscribe(),n.observed||(n.complete(),this.subscriptionsTree.clearNodeData(e))}}))}setKeyInPath(e,t,r,n=!1){this.setInPath([...e,t],r,n)}setPartial(e,t,r=!1){let n=this.getStateInPath(e);n||(n={}),this.setInPath(e,Object.assign(Object.assign({},n),t),r)}setInPath(e,t,r=!1){if(r&&this.getStateInPath(e)===t)return;const n={type:ka.SET_PATH,path:e,payload:t};this.dispatch(n)}pushToArray(e,t){let r=this.getStateInPath(e);r=r?[...r]:[],r.push(t),this.setInPath(e,r)}deletePath(e){const t={type:ka.DELETE_PATH,path:e};this.dispatch(t)}getState(){return this.state}getStateInPath(e){return Ga(this.state,e)}destroy(){this.subscriptionsTree.iterateBfs((e=>{e&&e.subject&&e.subject.complete()}))}getOrCreateSubjectForPath(e){const t=this.subscriptionsTree.getOrCreatePathTrieNode(e);t.nodeData||(t.nodeData=new Wa);const r=t.nodeData;return r.subject||(r.subject=new w.Subject),r.subject}dispatchSubscriptions(e){const t=function(e,t){const r=new Ya;for(const n of Fa(e)){let e=r.getOrCreatePathTrieNode(n.path);if(!t||e.nodeData)continue;let i=t.getPathTrieNode(n.path);if(i){const t=[[e,i]];for(;t.length;){const r=t.shift();if(e=r[0],i=r[1],!e.nodeData){for(const[r,n]of i.children)e.children.get(r)||e.children.set(r,new Ka),t.push([e.children.get(r),n]);e.nodeData=!0}}}}return r}(e,this.subscriptionsTree);t.iterateBfs(((t,r)=>{const n=this.subscriptionsTree.getPathTrieNode(r);n&&n.nodeData&&n.nodeData.subject.next({action:e,data:Ga(this.getState(),r)})}))}}function Ga(e,t){let r=e;for(const e of t){if(null==r)return;if(!La(r))throw new Error("result must be a state object");r=r[e]}return r}class Wa{}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.DISABLED=1]="DISABLED",e[e.ENABLED=2]="ENABLED"}(Na||(Na={}));const Ja="client";class Za{constructor(e,t,r,n,i){this.rpcManager=e,this.clientIdService=t,this.documentStore=r,this.destructManager=n,this.documentIdentityService=i,this.safeToSendQueriesToServer=new w.BehaviorSubject(!0),this.onOrphanDocuments=new w.Subject,this.ongoingQueries=new Map,this.inflightQueriesCount=new w.BehaviorSubject(0),this.clientRequestIdToLocalDocuments=new Map,this.localDocumentToClientRequestIds=new Map,this.queryMappingManager=new ec,this.documentIdentityService.observeChanges().subscribe(this.migrateDocIds.bind(this)),this.clientIdService.observeClientReadyToBeRegenerated().subscribe((()=>{this.refreshOngoingQueries()})),this.destructManager.onPreDestruct((()=>{this.predestruct()}))}hasOngoingQuery(e){return this.ongoingQueries.has(e)}getQuery(e){return N(this.ongoingQueries.get(e),"UNKNOWN_QUERY").query}setGotInitialResult(e){const t=this.ongoingQueries.get(e);t&&!t.gotInitialResponse?t.gotInitialResponse=!0:this.removeClientRequestIdMapping(e)}findQueriesForDocument(e,t){const{collectionName:r,integrationId:n}=M(t),i=this.queryMappingManager.getMapping(Ja,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=h(n);let s;if(d(e)){const n=null!==(r=D(t,e.fieldName))&&void 0!==r?r:null;s=m(e.value,n,e.operator)}else s=Xa(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&&(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)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=N(null==s?void 0:s.supportingOngoingQuery);if(o&&t.add(s),e.query.limit>0)switch(e.limitUnderflowState){case Na.UNKNOWN:e.limitUnderflowState=n.size===e.query.limit+100?Na.ENABLED:Na.DISABLED;break;case Na.DISABLED:break;case Na.ENABLED:if(n.size<e.query.limit+20)return e.limitUnderflowState=Na.UNKNOWN,void this.sendQueryToServerOrUseParentQuery(e)}e.dataSubject.next(i)}for(const e of t){const t=this.collectAllObservables(e);N(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 b(e.query);for(const r of this.ongoingQueries.values())if(e!==r&&this.isValidParent(r)&&t.isSubqueryOfQuery(r.query))return r}findValidParentOfQuery(e){const t=new b(e);for(const e of this.ongoingQueries.values())if(this.isValidParent(e)&&t.isSubqueryOfQuery(e.query))return e}processQuery(e,t,r,n,i,o){return(0,w.defer)((()=>{const a=this.createOngoingQueryGraph(e,t,r,n,i,!0);o&&(a.forceFetchFromServer=!0),this.sendQueryToServerOrUseParentQuery(a),a.allObservables=new w.ReplaySubject(1);const c=a.allObservables.pipe((0,w.switchMap)((e=>(0,w.combineLatest)(e).pipe(qe((e=>this.joinResults(e,n,a)))))),ja((()=>this.allOngoingQueriesGotInitialResult(a))),(0,w.startWith)(void 0),(0,w.pairwise)(),ja((([e,t])=>!s.isEqual(e,t))),qe((([e,t])=>t)),i?(0,w.tap)():(0,w.take)(1),(0,w.finalize)((()=>{var e;a.dataSubject.complete(),a.done=!0,this.completeAllSupportedQueries(a).then(),null===(e=a.allObservables)||void 0===e||e.complete()}))),u=this.collectAllObservables(a);return a.allObservables.next(u),c})).pipe((0,w.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=N(this.localDocumentToClientRequestIds.get(n));t.delete(e),t.size||(this.localDocumentToClientRequestIds.delete(n),r.push(n))}r.length&&this.onOrphanDocuments.next(r)}async waitForAllQueriesToFinish(){return(0,w.firstValueFrom)(this.inflightQueriesCount.pipe(ja((e=>0===e)))).then((()=>{}))}registerQueryFinalizer(e){const t=e.clientRequestId,r=v(this.clientIdService.getClientId(),t);e.dataSubject.pipe((0,w.finalize)((async()=>{if(e.unsubscribeBlockerCount.value>0&&await(0,w.firstValueFrom)((0,w.race)(this.destructManager.observeIsDestructing(),e.unsubscribeBlockerCount.pipe(ja((e=>0===e))))),this.queryMappingManager.removeQuery(t,r).then(),this.ongoingQueries.delete(t),e.subscribe&&!e.isEmptyForJoin&&e.activated){const r={clientRequestId:t};this.rpcManager.post("query/unsubscribe",r).catch((t=>{console.error("Got error while unsubscribing from query",e.query,t)}))}this.removeClientRequestIdMapping(t),this.ongoingQueries.delete(t)})),ja(Boolean)).subscribe({error:()=>{}})}createOngoingQueryGraph(e,t,r,n,i,o,s={}){if(s[t])return s[t];const a=te(),c=[],u={clientRequestId:a,activated:o,alias:t,query:e,subscribe:i,dataSubject:new w.BehaviorSubject(null),supportedQueries:c,supportingOngoingQuery:void 0,joinCondition:void 0,gotInitialResponse:!1,isEmptyForJoin:!1,unsubscribeBlockerCount:new w.BehaviorSubject(0),queryRegistered:new w.BehaviorSubject(!1),done:!1,isInFlight:!1,forceFetchFromServer:!1,limitUnderflowState:Na.UNKNOWN};this.registerQueryFinalizer(u),this.ongoingQueries.set(a,u),s[t]=u;for(const[e,o]of Object.entries(n)){const a=o.leftAlias;if(a!==t&&e!==t)continue;const l=a===t?e:a;if(a===t){const e=this.createOngoingQueryGraph(r[l],l,r,n,i,!1,s);e.joinCondition=o,c.push(e)}else u.supportingOngoingQuery=this.createOngoingQueryGraph(r[l],l,r,n,i,!1,s)}return u}collectAllObservables(e,t=[]){if(e.isEmptyForJoin)return t;const r=e.alias;t.push(e.dataSubject.pipe(ja(Boolean),qe((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,[]),N(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=N(r.shift());e.isEmptyForJoin||(t.push(e),r.push(...e.supportedQueries))}return t}updateOngoingQueryWithNewDataFromSupportingQuery(e,t){var r;const n=N(t.joinCondition),i=t.query;if(t.activated){const o=N(null===(r=t.supportingOngoingQuery)||void 0===r?void 0:r.supportedQueries).filter((e=>e.alias===t.alias)),a=new Set(e.map((e=>{var t;return null!==(t=e[n.left])&&void 0!==t?t:null})));for(const e of o)e.query.conditions.filter(d).filter((e=>e.fieldName===n.right)).forEach((e=>{a.delete(e.value)}));if(0===a.size)return!1;const c=s.cloneDeep(i);c.conditions=c.conditions.filter((e=>!d(e)||e.fieldName!==n.right)),[...a].forEach((e=>{c.conditions.push({fieldName:n.right,operator:"==",value:e})}));const u=Object.assign(Object.assign({},t),{query:c,activated:!0,gotInitialResponse:!1,dataSubject:new w.BehaviorSubject(null),clientRequestId:te(),isEmptyForJoin:!1});return this.registerQueryFinalizer(u),this.ongoingQueries.set(u.clientRequestId,u),N(t.supportingOngoingQuery).supportedQueries.push(u),this.sendQueryToServerOrUseParentQuery(u),!0}{const r=e.map((e=>{var t;return{fieldName:n.right,operator:"==",value:null!==(t=e[n.left])&&void 0!==t?t:null}}));return t.activated=!0,r.length?(i.conditions.push(...r),this.sendQueryToServerOrUseParentQuery(t)):t.isEmptyForJoin=!0,!0}}allOngoingQueriesGotInitialResult(e){return!!e.isEmptyForJoin||!!e.gotInitialResponse&&(!e.supportedQueries.length||e.supportedQueries.every((e=>this.allOngoingQueriesGotInitialResult(e))))}async completeAllSupportedQueries(e){const t=[...e.supportedQueries||[]];for(;t.length;){const e=N(t.shift());t.push(...e.supportedQueries||[]),await(0,w.firstValueFrom)(e.unsubscribeBlockerCount.pipe(ja((e=>0===e)))),e.dataSubject.complete()}}predestruct(){this.safeToSendQueriesToServer.next(!1),this.safeToSendQueriesToServer.complete(),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=v(this.clientIdService.getClientId(),r);this.queryMappingManager.addQuery(Ja,t,n),this.ongoingQueries.set(r,e);const i=this.findValidParentOfOngoingQuery(e);i?this.useParentOngoingQuery(e,i).then():this.sendQueryToServer(e)}async useParentOngoingQuery(e,t){const r={clientRequestId:e.clientRequestId,query:e.query,parentClientRequestId:t.clientRequestId},n=new b(e.query);t.unsubscribeBlockerCount.next(t.unsubscribeBlockerCount.value+1);try{await(0,w.firstValueFrom)(t.queryRegistered.pipe(ja(Boolean)))}catch(t){return e.dataSubject.error(t),e.queryRegistered.error(t),void(e.done=!0)}if(this.destructManager.isDestructing)return;if(e.done)return;this.rpcManager.post("query/register",r).then((()=>{e.queryRegistered.next(!0)})).catch((r=>{console.error("Query error",e.query,t.query,r),e.dataSubject.error(r),e.done=!0})).finally((()=>{t.unsubscribeBlockerCount.next(t.unsubscribeBlockerCount.value-1),e.isInFlight=!1}));const i=(0,w.race)(e.queryRegistered.pipe(ja(Boolean),(0,w.delay)(2e3),(0,w.take)(1)),this.destructManager.observeIsDestructing().pipe((0,w.take)(1)));t.dataSubject.pipe((0,w.takeWhile)((()=>!e.done)),(0,w.takeUntil)(i),ja(Boolean),(0,w.tap)((()=>{e.gotInitialResponse||this.setGotInitialResult(e.clientRequestId)})),qe((e=>e.filter((e=>n.documentMatchesQuery(e)))))).subscribe({next:t=>{for(const r of t)this.setClientRequestIdsForLocalDoc(F(r.__docId__,e.query.collectionName,e.query.integrationId),r);this.notifyAllSubscriptions([e.clientRequestId])},error:t=>e.dataSubject.error(t)})}sendQueryToServer(e){const t=e.query.limit,r=t>0?t+100:t,n={query:Object.assign(Object.assign({},e.query),{limit:r}),clientRequestId:e.clientRequestId,subscribe:e.subscribe};this.safeToSendQueriesToServer.pipe(ja(Boolean),(0,w.take)(1)).subscribe((()=>{e.done||(this.inflightQueriesCount.next(this.inflightQueriesCount.value+1),e.isInFlight=!0,this.rpcManager.post("query/query",n).catch((t=>{e.dataSubject.error(t),e.done=!0,e.queryRegistered.error("query failed")})).then((()=>{e.queryRegistered.next(!0)})).finally((()=>{this.inflightQueriesCount.next(this.inflightQueriesCount.value-1),e.isInFlight=!1})))}))}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=>{P(this.localDocumentToClientRequestIds,t,e[t])}))}}function Xa(e,t){var r;for(const n of e.fields){const e=null!==(r=D(t,n.fieldName))&&void 0!==r?r:null;if(m(n.value,e,n.operator))return!0;if(m(n.value,e,"!="))return!1}return!1}class ec{constructor(){this.stateService=new Ha,this.querySubscriptionIdToQuery={}}addQuery(e,t,r){this.stateService.runInBatch((()=>{let e=0;const n=new Set;for(const i of t.conditions){if(d(i)&&["=="].includes(i.operator)){const t=f(i.fieldName);n.has(t)||(e++,n.add(t))}else e++;const o=this.getConditionStatePath(t,i),s=[...this.stateService.getStateInPath(o)||[]];G(s,r),this.stateService.setInPath(o,s)}if(!t.conditions.length){const e=["queryMapping",t.collectionName,t.integrationId,"mapping","unconditional"],n=[...this.stateService.getStateInPath(e)||[]];G(n,r),this.stateService.setInPath(e,n)}this.stateService.setInPath([...this.getQueryMetadataStatePath(t,r),"condCount"],e)})),this.querySubscriptionIdToQuery[r]=t}async removeQuery(e,t){const r=this.querySubscriptionIdToQuery[t];if(r)return this.stateService.runInBatch((()=>{for(const e of r.conditions){const n=this.getConditionStatePath(r,e),i=[...this.stateService.getStateInPath(n)||[]];W(i,t),i.length?this.stateService.setInPath(n,i):this.stateService.deletePath(n)}if(!r.conditions.length){const e=["queryMapping",r.collectionName,r.integrationId,"mapping","unconditional"],n=[...this.stateService.getStateInPath(e)||[]];W(n,t),this.stateService.setInPath(e,n)}this.stateService.deletePath(this.getQueryMetadataStatePath(r,t))})),r}getMapping(e,t,r){return this.stateService.getStateInPath(["queryMapping",t,r,"mapping"])}getQueryMetadataStatePath(e,t){return["queryMapping",e.collectionName,e.integrationId,"mapping","queriesMetadata",`${t}`]}getConditionStatePath(e,t){return["queryMapping",e.collectionName,e.integrationId,"mapping","conditional",p(t)]}}class tc{constructor(e,t,r,n,i={},o,s){this.region=e,this.appId=t,this.socketManager=r,this.destructManager=n,this.headers=i,this.authManager=o,this.clientIdService=s,this.staticHeaders={},this.onGoingRpcCounter=new w.BehaviorSubject(0);for(const[e,t]of Object.entries(i))this.setStaticHeader(e,t);const a=this.authManager.getApiKey();a&&this.setStaticHeader("Authorization",`ApiKey ${a}`),this.clientIdService.observeClientId().subscribe((e=>{e?this.setStaticHeader("x-squid-clientid",e):this.deleteStaticHeader("x-squid-clientid")})),this.authManager.observeAuthIdToken().subscribe((e=>{if(e.token){let t=`Bearer ${e.token}`;e.integrationId&&(t+=`; IntegrationId ${e.integrationId}`),this.setStaticHeader("Authorization",t)}else this.deleteStaticHeader("Authorization")})),n.onDestruct((async()=>{await this.awaitAllSettled()}))}async awaitAllSettled(){await(0,w.firstValueFrom)(this.onGoingRpcCounter.pipe((0,w.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){this.onGoingRpcCounter.next(this.onGoingRpcCounter.value+1);try{await(0,w.firstValueFrom)((0,w.race)(this.socketManager.observeConnectionReady().pipe((0,w.filter)(Boolean)),this.destructManager.observeIsDestructing())),await this.authManager.waitForReadyState();let r={"Content-Type":"application/json"};Object.keys(this.staticHeaders)&&(r=Object.assign(Object.assign({},r),this.staticHeaders));const n=X(this.region,this.appId,e),i=await Da()(n,{method:"POST",body:l(t),headers:r});let o,s;try{o=await i.text();try{s=JSON.parse(o)}catch(e){}}catch(e){o="Cannot read body"}if(!i.ok)throw new rc(i.status,i.statusText,i.headers,i.url,null==s?void 0:s.message);return s||o}finally{this.onGoingRpcCounter.next(this.onGoingRpcCounter.value-1)}}}class rc extends Error{constructor(e,t,r,n,i){super(i||`RPC error ${e} ${t} calling ${n}`),this.statusCode=e,this.statusText=t,this.headers=r,this.url=n}}const nc=require("socket.io-client"),ic=e=>e();class oc{constructor(e,t,r,n=ic,i,o={},s){this.clientIdService=e,this.region=t,this.appId=r,this.messageNotificationWrapper=n,this.destructManager=i,this.authManager=s,this.webSocketObserver=new w.Subject,this.allMessagesObserver=new w.Subject,this.connectionReady=new w.BehaviorSubject(!1),this.seenMessageIds=new Set,this.firstConnection=!0,this.clientTooOldThreshold=3e5,this.destructManager.onDestruct((async()=>{await this.destruct()})),this.setupMessageAcknowledgments(),this.connect(Object.assign({},o)),this.connectionReady.pipe((0,w.skip)(1),(0,w.filter)((e=>!e)),(0,w.switchMap)((()=>(0,w.race)((0,w.timer)(this.clientTooOldThreshold),this.connectionReady.pipe((0,w.filter)(Boolean)),this.destructManager.observeIsDestructing())))).subscribe((()=>{this.connectionReady.value||this.destructManager.isDestructing||(this.clientIdService.notifyClientTooOld(),this.connect(Object.assign({},o)))})),this.connectionReady.pipe((0,w.filter)(Boolean)).subscribe((()=>{this.clientIdService.isClientTooOld()&&this.clientIdService.notifyClientReadyToBeRegenerated()}))}observeNotifications(){return this.webSocketObserver.asObservable()}observeConnectionReady(){return this.connectionReady.asObservable().pipe((0,w.distinctUntilChanged)())}sendMessage(e){this.authManager.waitForReadyState().then((()=>{(0,w.firstValueFrom)(this.connectionReady.pipe((0,w.filter)(Boolean))).then((()=>{const t=this.authManager.getAuthToken();N(this.socket).emit("message",Object.assign(Object.assign({},e),{authToken:t}))}))}))}connect(e){const t=X(this.region,this.appId,""),r={clientId:this.clientIdService.getClientId()};this.socket=(0,nc.io)(t,{query:r,reconnectionDelay:5e3,transports:["websocket"],extraHeaders:e}),this.socket.on("connect",(()=>{})),this.socket.on("disconnect",((e,t)=>{this.connectionReady.next(!1)})),this.socket.on("connectionReady",(()=>{this.connectionReady.next(!0),this.firstConnection||this.sendMessage({type:"catchup"}),this.firstConnection=!1})),this.socket.on("message",(e=>{const t=h(e);for(const e of t)this.allMessagesObserver.next(e),this.seenMessageIds.has(e.messageId)||(this.seenMessageIds.add(e.messageId),this.messageNotificationWrapper((()=>{this.webSocketObserver.next(e)})))}))}setupMessageAcknowledgments(){const e=new w.Subject;this.allMessagesObserver.subscribe((t=>{(null==t?void 0:t.messageId)&&e.next(t.messageId)}));const t=[];e.pipe((0,w.tap)((e=>t.push(e))),(0,w.debounceTime)(100)).subscribe((async()=>{const e=[...t.splice(0)];this.sendMessage({type:"acknowledge",payload:e})}))}async destruct(){var e;this.sendMessage({type:"kill"}),this.connectionReady.next(!1),await(0,w.firstValueFrom)((0,w.timer)(0)),null===(e=this.socket)||void 0===e||e.disconnect(),this.webSocketObserver.complete(),this.allMessagesObserver.complete()}}class sc{constructor(e){this.destructManager=new pt,this.setAuthIdToken=(e,t)=>{this.authManager.setAuthIdToken(e,t)},this.collection=(e,r=t.built_in_db)=>(this.validateNotDestructed(),this.collectionReferenceFactory.get(e,r)),this.runInTransaction=e=>(this.validateNotDestructed(),this.dataManager.runInTransaction(e)),this.executeFunction=(e,...t)=>(this.validateNotDestructed(),(0,w.firstValueFrom)(this.backendFunctionManager.executeFunctionAndSubscribe(e,...t))),this.executeNamedQuery=(e,t,r)=>(this.validateNotDestructed(),(0,w.firstValueFrom)(this.namedQueryManager.executeNamedQueryAndSubscribe(e,t,r))),this.callApi=(e,t,r={})=>(this.validateNotDestructed(),(0,w.firstValueFrom)(this.apiManager.callApiAndSubscribe(e,t,r))),this.graphql=e=>(this.validateNotDestructed(),this.graphqlClientFactory.get(e)),this.ai=()=>(this.validateNotDestructed(),{assistant:e=>this.aiClientFactory.getAssistant(e)}),this.acquireLock=(e,t=!0)=>(this.validateNotDestructed(),this.distributedLockManager.lock(e,t)),this.destruct=async()=>{if(!this.destructManager.isDestructing)return this.destructManager.destruct().finally((()=>{const e=Object.entries(sc.squidInstancesMap).find((([,e])=>e===this));e&&delete sc.squidInstancesMap[e[0]]}))},this.connectionDetails=()=>(this.validateNotDestructed(),this._connectionDetails),this.unsubscribe=async()=>{this.querySubscriptionManager.unsubscribe(),await this.rpcManager.awaitAllSettled()},k(e.appId,"APP_ID_MUST_BE_PROVIDED");const r="prod"!==e.environmentId&&e.squidDeveloperId,n=function(e,t,r){return`${j(e,t)}${r?`-${r}`:""}`}(e.appId,e.environmentId,r?e.squidDeveloperId:void 0),i=function(e,t){const r={};return ee(e)&&(r["x-squid-appid"]=t),r}(e.region,n);this.clientIdService=new ct(this.destructManager),this.authManager=new st(this.destructManager,e.apiKey),this.socketManager=new oc(this.clientIdService,e.region,n,e.messageNotificationWrapper,this.destructManager,i,this.authManager),this.rpcManager=new tc(e.region,n,this.socketManager,this.destructManager,i,this.authManager,this.clientIdService),this.documentStore=new bt,this.lockManager=new re,this.distributedLockManager=new mt(this.socketManager,this.destructManager),this.documentIdentityService=new vt(this.documentStore,this.destructManager),this.documentReferenceFactory=new gt(this.documentIdentityService),this.querySubscriptionManager=new Za(this.rpcManager,this.clientIdService,this.documentStore,this.destructManager,this.documentIdentityService),this.localQueryManager=new Ca(this.documentStore,this.documentReferenceFactory,this.querySubscriptionManager);const o=new Ra(this.rpcManager,this.lockManager,this.querySubscriptionManager);this.queryBuilderFactory=new Ke(this.querySubscriptionManager,this.localQueryManager,this.documentReferenceFactory,this.documentIdentityService),this.collectionReferenceFactory=new ut(this.documentReferenceFactory,this.queryBuilderFactory,this.querySubscriptionManager),this.dataManager=new dt(this.documentStore,o,this.socketManager,this.querySubscriptionManager,this.queryBuilderFactory,this.lockManager,this.destructManager,this.documentIdentityService),this.documentReferenceFactory.setDataManager(this.dataManager),this.backendFunctionManager=new at(this.clientIdService,this.rpcManager,this.socketManager),this.namedQueryManager=new Pa(this.rpcManager,this.socketManager),this.apiManager=new ot(this.clientIdService,this.rpcManager,this.socketManager,e.apiServerUrlOverrideMapping),this.graphqlClientFactory=new xa(this.rpcManager,e.region,n),this.aiClientFactory=new it(this.rpcManager,this.socketManager),this._connectionDetails=new lt(this.clientIdService,this.socketManager)}static getInstance(e){const t=u(e);let r=sc.squidInstancesMap[t];return r||(r=new sc(e),sc.squidInstancesMap[t]=r,r)}static getInstances(){return Object.values(sc.squidInstancesMap)}validateNotDestructed(){k(!this.destructManager.isDestructing,"The client was already destructed.")}}sc.squidInstancesMap={}})();var i=exports;for(var o in n)i[o]=n[o];n.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
|