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GACrDtQ,EAAI+0G,EAAS1rH,OAAQ2W,IACzBy1G,EAAUV,EAAS/0G,GAChBs0G,EAAoBz4F,EAAE25F,EAAiBC,IAAYD,EAAgBC,IACrED,EAAgBC,GAAS,KAE1BD,EAAgBC,GAAW,EAE5B,OAAOnB,EAAoBQ,EAAEp/H,EAAO,EAGjCogI,EAAqBvX,KAAgC,0BAAIA,KAAgC,2BAAK,GAClGuX,EAAmB1gI,QAAQsgI,EAAqBK,KAAK,KAAM,IAC3DD,EAAmBn6H,KAAO+5H,EAAqBK,KAAK,KAAMD,EAAmBn6H,KAAKo6H,KAAKD,QC7CvF,IAAIE,EAAsB1B,EAAoBQ,OAAEz9H,EAAW,CAAC,IAAI,MAAM,IAAOi9H,EAAoB,QACjG0B,EAAsB1B,EAAoBQ,EAAEkB","sources":["webpack://fabric_client/webpack/runtime/chunk loaded","webpack://fabric_client/./src/destructables/index.ts","webpack://fabric_client/./src/destructables/lib/DestructableMap.ts","webpack://fabric_client/./src/destructables/lib/DestructableObject.ts","webpack://fabric_client/./src/destructables/lib/DestructableSet.ts","webpack://fabric_client/./src/destructables/lib/DestructorMap.ts","webpack://fabric_client/./src/destructables/lib/DestructorPool.ts","webpack://fabric_client/./src/destructables/lib/DestructorSet.ts","webpack://fabric_client/./src/destructables/lib/OnDemandEvaluatedMap.ts","webpack://fabric_client/./src/destructables/lib/SubscriptionMap.ts","webpack://fabric_client/./src/destructables/lib/utils.ts","webpack://fabric_client/./src/stream/index.ts","webpack://fabric_client/./src/stream/lib/And.ts","webpack://fabric_client/./src/stream/lib/Dictionary.ts","webpack://fabric_client/./src/stream/lib/ExpressionBuilder.ts","webpack://fabric_client/./src/stream/lib/Fallback.ts","webpack://fabric_client/./src/stream/lib/Filter.ts","webpack://fabric_client/./src/stream/lib/Get.ts","webpack://fabric_client/./src/stream/lib/GetSingleton.ts","webpack://fabric_client/./src/stream/lib/GroupBy.ts","webpack://fabric_client/./src/stream/lib/Map.ts","webpack://fabric_client/./src/stream/lib/MutableDictionary.ts","webpack://fabric_client/./src/stream/lib/Or.ts","webpack://fabric_client/./src/stream/lib/Pipe.ts","webpack://fabric_client/./src/stream/lib/Reduce.ts","webpack://fabric_client/./src/stream/lib/Scalar.ts","webpack://fabric_client/./src/stream/lib/StateSwitch.ts","webpack://fabric_client/./src/stream/lib/Variable.ts","webpack://fabric_client/./src/stream/lib/WeakCache.ts","webpack://fabric_client/./src/stream/lib/types.ts","webpack://fabric_client/./src/stream/lib/utils.ts","webpack://fabric_client/./src/webclient/src/client/common.ts","webpack://fabric_client/./src/webclient/src/client/index.ts","webpack://fabric_client/./src/webclient/src/client/lib/DestructorTree.ts","webpack://fabric_client/./src/webclient/src/client/lib/ReferenceCounter.ts","webpack://fabric_client/./src/webclient/src/client/lib/Sets.ts","webpack://fabric_client/./src/webclient/src/client/lib/Status.ts","webpack://fabric_client/./src/webclient/src/client/lib/Symbols.ts","webpack://fabric_client/./src/webclient/src/client/lib/TaskManager.ts","webpack://fabric_client/./src/webclient/src/client/lib/calendar/Gregorian_Date.ts","webpack://fabric_client/./src/webclient/src/client/lib/calendar/Gregorian_Datetime.ts","webpack://fabric_client/./src/webclient/src/client/lib/calendar/Hour_Time.ts","webpack://fabric_client/./src/webclient/src/client/lib/calendar/conversion.ts","webpack://fabric_client/./src/webclient/src/client/lib/calendar/current.ts","webpack://fabric_client/./src/webclient/src/client/lib/error-logging.ts","webpack://fabric_client/./src/webclient/src/client/lib/front 2 state/hashCode.ts","webpack://fabric_client/./src/webclient/src/client/lib/front 2 state/parseNumber.ts","webpack://fabric_client/./src/webclient/src/client/lib/front/deeplinkHandler.ts","webpack://fabric_client/./src/webclient/src/client/lib/front/messages.ts","webpack://fabric_client/./src/webclient/src/client/lib/front/openLandingPage.ts","webpack://fabric_client/./src/webclient/src/client/lib/front/openViewOnNode.ts","webpack://fabric_client/./src/webclient/src/client/lib/front/translate.ts","webpack://fabric_client/./src/webclient/src/client/lib/front/tryToOpenViewFromUrl.ts","webpack://fabric_client/./src/webclient/src/client/lib/graphIterators.ts","webpack://fabric_client/./src/webclient/src/client/lib/guiModel.ts","webpack://fabric_client/./src/webclient/src/client/lib/interface/DatastoreProxy.ts","webpack://fabric_client/./src/webclient/src/client/lib/interface/FilesResourceProxy.ts","webpack://fabric_client/./src/webclient/src/client/lib/interface/ReportResourceProxy.ts","webpack://fabric_client/./src/webclient/src/client/lib/microtaskQueue.ts","webpack://fabric_client/./src/webclient/src/client/lib/navigation/CsvColumnPathBuilder.ts","webpack://fabric_client/./src/webclient/src/client/lib/navigation/IdPathBuilder.ts","webpack://fabric_client/./src/webclient/src/client/lib/navigation/NodePathBuilder.ts","webpack://fabric_client/./src/webclient/src/client/lib/navigation/createClientIdPathFromNode.ts","webpack://fabric_client/./src/webclient/src/client/lib/navigation/createCollectionPathBuilder.ts","webpack://fabric_client/./src/webclient/src/client/lib/navigation/createConditionalChildPathBuilder.ts","webpack://fabric_client/./src/webclient/src/client/lib/navigation/createIdPathBuilderFromClientIdPath.ts","webpack://fabric_client/./src/webclient/src/client/lib/navigation/createIdPathBuilderFromReplyIdPath.ts","webpack://fabric_client/./src/webclient/src/client/lib/navigation/createIdPathFromNode.ts","webpack://fabric_client/./src/webclient/src/client/lib/navigation/walkNodePath.ts","webpack://fabric_client/./src/webclient/src/client/lib/observableTypes.ts","webpack://fabric_client/./src/webclient/src/client/lib/queryQueue.ts","webpack://fabric_client/./src/webclient/src/client/lib/renderQueue.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/MutationBuilder.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/SubscriptionBuilder.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/SubscriptionManager.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/authentication.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/createCollectionPathBuilderFromCollectionPath.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/createCollectionQueryFromQuery.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/createEscapedCsvHeader.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/createMutation.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/createPropertiesDictionaryFromColumns.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/createReportGenerationRequest.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/createSubscriptionFromDuplicationMapping.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/entryExists.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/initializeNewNodeFromSubscriptionResult.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/numericalTypeProperties.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/permissions.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/reQuery.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/referenceResolver.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/serializeNumber.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/style.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/todos.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/updateNodeFromSubscriptionReply.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/updateQueryFromCollectionQueryResult.ts","webpack://fabric_client/./src/webclient/src/client/lib/state 2 interface/webserver.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Cell.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/ClientIdPath.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/ClientState.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/ClientStateObjectProxy.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/CollationTable.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Collection.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/CollectionJoin.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Entry.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/GarbageCollector.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Graph.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Node.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Number.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Query.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Reference.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/ResolveStatus.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Rule.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/SaveModifiedStatus.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Stategroup.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Text.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/Variable.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/actions.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/addClientState.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/addQueryIfNotExistsAndGet.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/autoIncrement.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/clock.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/commands.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/createColumnsFromColumnsBinding.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/csv-importer.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/defaults.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/editMode.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/evaluateFileNameExpression.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/events.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/expressionSynchronized.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/expressions.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/getQueryInstanceKey.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/isKey.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/mapCommandParameters.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/mapToIdPathBuilder.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/modifications.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/numberLimit.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/operations.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/password.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/phrases.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/registerClientState.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/resetModifiedState.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/schema.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/selection.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/setLocation.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/sorting.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/step.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/subscribeToClientQueryEntry.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/subscribeToNodePropertyChange.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/subscribeToNodePropertyValid.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/supportsSelfReference.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/tasks.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/textValidation.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/updateQueryFromCollection.ts","webpack://fabric_client/./src/webclient/src/client/lib/state/uuid.ts","webpack://fabric_client/./src/webclient/src/client/lib/toStream.ts","webpack://fabric_client/./src/webclient/src/client/lib/utils.ts","webpack://fabric_client/./src/webclient/src/client/lib/validation.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/ControlLibrary.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/ImplementationVisitorContext.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/bindQuery.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/client_state_binder.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/context_selection.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/dom/Window.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/dom/hash.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/escapeIdentifier.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/execute_instruction.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/InstructionError.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/add.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/cancel.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/csv_import.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/deeplink.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/delete.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/discard.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/duplicate.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/execute.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/fileUpload.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/onSynchronized.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/open.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/queryFilter.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/reports.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/save.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/saveAs.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/select_candidate.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/instructions/update.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/number_converter.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/renderView.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/stackTraceMessage.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/to_color.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/view_context.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/visit_control_binding.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/visit_scalar.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/visit_widget_expression.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/visit_widget_implementation.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/visit_widget_implementation_expression.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/visit_widget_implementation_node.ts","webpack://fabric_client/./src/webclient/src/client/lib/widgets/wrapNode.ts","webpack://fabric_client/webpack/bootstrap","webpack://fabric_client/webpack/runtime/global","webpack://fabric_client/webpack/runtime/hasOwnProperty shorthand","webpack://fabric_client/webpack/runtime/jsonp chunk loading","webpack://fabric_client/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","import { Destructable } from \"./lib/types\";\nimport { addDependency } from \"./lib/utils\";\nimport DestructableObject from \"./lib/DestructableObject\";\n\nexport function addChild(parent: Destructable, child: Destructable = new DestructableObject()): Destructable {\n\tif (parent instanceof DestructableObject) {\n\t\tparent.addChild(child);\n\t} else {\n\t\taddDependency(child, parent, () => child.destroy());\n\t}\n\treturn child;\n}\n\nexport { DestructionObserver, Destructable, Subscription } from \"./lib/types\";\nexport { default as DestructableObject } from \"./lib/DestructableObject\";\nexport { default as DestructableMap } from \"./lib/DestructableMap\";\nexport { default as DestructableSet } from \"./lib/DestructableSet\";\nexport { default as DestructorSet } from \"./lib/DestructorSet\";\nexport { default as DestructorMap } from \"./lib/DestructorMap\";\nexport { default as OnDemandEvaluatedMap } from \"./lib/OnDemandEvaluatedMap\";\nexport { default as SubscriptionMap } from \"./lib/SubscriptionMap\";\nexport { default as DestructorPool } from \"./lib/DestructorPool\";\nexport { isDestructable, addDependency } from \"./lib/utils\";\n","import DestructableObject from \"./DestructableObject\";\n\nexport default class DestructableMap extends DestructableObject implements Map {\n\tprivate readonly map = new Map();\n\n\tconstructor(private readonly persistant = true) {\n\t\tsuper();\n\t}\n\thas(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\tget(key: K): V | undefined {\n\t\treturn this.map.get(key);\n\t}\n\tset(key: K, value: V): this {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\tget size(): number {\n\t\treturn this.map.size;\n\t}\n\tentries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\t[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.map[Symbol.iterator]();\n\t}\n\tforEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void {\n\t\treturn this.map.forEach(callbackfn, thisArg);\n\t}\n\tkeys(): IterableIterator {\n\t\treturn this.map.keys();\n\t}\n\tvalues(): IterableIterator {\n\t\treturn this.map.values();\n\t}\n\n\tdelete(key: K): boolean {\n\t\tconst result = this.map.delete(key);\n\t\tif (!this.persistant && this.map.size === 0) {\n\t\t\tthis.destroy();\n\t\t}\n\t\treturn result;\n\t}\n\tclear(): void {\n\t\tthis.map.clear();\n\t\tif (!this.destroyed && !this.persistant) {\n\t\t\tthis.destroy();\n\t\t}\n\t}\n\tdestroy(): void {\n\t\tthis.map.clear();\n\t\tsuper.destroy();\n\t}\n\n\tget [Symbol.toStringTag](): string {\n\t\treturn \"DestructableMap\";\n\t}\n}\n","import { Destructable, DestructionObserver, Subscription } from \"./types\";\n\nexport default class DestructableObject implements Destructable {\n\tprivate __private__parent?: Destructable;\n\tprivate _children?: Set;\n\tprivate _destruction_observers?: Set;\n\tprivate _destroyed = false;\n\n\tdestroy(): void {\n\t\tif (this._destroyed) return;\n\t\tthis._destroyed = true;\n\t\tif (this.__private__parent) {\n\t\t\t(this.__private__parent as DestructableObject)._children?.delete(this);\n\t\t}\n\t\tif (this._children) {\n\t\t\tfor (const child of this._children) {\n\t\t\t\tchild.destroy();\n\t\t\t}\n\t\t}\n\t\tif (this._destruction_observers) {\n\t\t\tfor (const observer of this._destruction_observers) {\n\t\t\t\tobserver();\n\t\t\t}\n\t\t\tthis._destruction_observers.clear();\n\t\t}\n\t}\n\n\tget destroyed(): boolean {\n\t\treturn this._destroyed;\n\t}\n\n\taddChild(child: Destructable) {\n\t\tif (this.destroyed) {\n\t\t\tchild.destroy();\n\t\t} else {\n\t\t\t(this._children ??= new Set()).add(child);\n\t\t\t(child as any).__private__parent = this;\n\t\t}\n\t\treturn child;\n\t}\n\n\tonDestroy(observer: DestructionObserver): Subscription {\n\t\tif (this.destroyed) {\n\t\t\tobserver();\n\t\t} else {\n\t\t\t(this._destruction_observers ??= new Set()).add(observer);\n\t\t}\n\t\treturn {\n\t\t\tunsubscribe: () => this._destruction_observers!.delete(observer),\n\t\t};\n\t}\n}\n","import DestructableObject from \"./DestructableObject\";\n\nexport default class DestructableSet extends DestructableObject implements Set {\n\tprivate readonly set = new Set();\n\n\tconstructor(private readonly persistant = true) {\n\t\tsuper();\n\t}\n\n\tdelete(key: T): boolean {\n\t\tconst result = this.set.delete(key);\n\t\tif (!this.persistant && this.size === 0) {\n\t\t\tthis.destroy();\n\t\t}\n\t\treturn result;\n\t}\n\n\tclear(): void {\n\t\tthis.set.clear();\n\t\tif (!this.destroyed && !this.persistant) {\n\t\t\tthis.destroy();\n\t\t}\n\t}\n\n\thas(value: T): boolean {\n\t\treturn this.set.has(value);\n\t}\n\tadd(value: T): this {\n\t\tthis.set.add(value);\n\t\treturn this;\n\t}\n\tget size(): number {\n\t\treturn this.set.size;\n\t}\n\tentries(): IterableIterator<[T, T]> {\n\t\treturn this.set.entries();\n\t}\n\t[Symbol.iterator](): IterableIterator {\n\t\treturn this.set[Symbol.iterator]();\n\t}\n\tforEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void {\n\t\treturn this.set.forEach(callbackfn, thisArg);\n\t}\n\tkeys(): IterableIterator {\n\t\treturn this.set.keys();\n\t}\n\tvalues(): IterableIterator {\n\t\treturn this.set.values();\n\t}\n\tdestroy(): void {\n\t\tsuper.destroy();\n\t\tthis.set.clear();\n\t}\n\n\tget [Symbol.toStringTag](): string {\n\t\treturn \"DestructableSet\";\n\t}\n}\n","import { Destructable } from \"./types\";\nimport { addDependency } from \"./utils\";\nimport DestructableMap from \"./DestructableMap\";\n\nexport default class DestructorMap extends DestructableMap {\n\tset(key: K, value: V): this {\n\t\tif (key.destroyed) return this;\n\t\tif (!this.has(key)) {\n\t\t\taddDependency(this, key, () => {\n\t\t\t\tthis.delete(key);\n\t\t\t});\n\t\t}\n\t\treturn super.set(key, value);\n\t}\n}\n","import { Destructable } from \"./types\";\nimport { addThreewayDependency } from \"./utils\";\nimport DestructableMap from \"./DestructableMap\";\nimport DestructableObject from \"./DestructableObject\";\n\nexport default class DestructorPool extends DestructableMap {\n\tget(parent: Destructable): Destructable {\n\t\tif (!this.has(parent)) {\n\t\t\tconst child = new DestructableObject();\n\t\t\tif (parent.destroyed) {\n\t\t\t\tchild.destroy();\n\t\t\t\treturn child;\n\t\t\t}\n\t\t\tsuper.set(parent, child);\n\n\t\t\taddThreewayDependency(this, parent, child, () => {\n\t\t\t\tsuper.delete(parent);\n\t\t\t\tchild.destroy();\n\t\t\t});\n\t\t\treturn child;\n\t\t} else {\n\t\t\treturn super.get(parent)!;\n\t\t}\n\t}\n\n\tdelete(parent: Destructable): boolean {\n\t\tif (this.has(parent)) {\n\t\t\tthis.get(parent)!.destroy();\n\t\t}\n\t\treturn super.delete(parent);\n\t}\n\n\tdestroy(): void {\n\t\tconst local_values = [...this.values()];\n\t\tsuper.destroy();\n\t\tfor (const child of local_values) {\n\t\t\tchild.destroy();\n\t\t}\n\t}\n}\n","import { Destructable } from \"./types\";\nimport { addDependency } from \"./utils\";\nimport DestructableSet from \"./DestructableSet\";\n\nexport default class DestructorSet extends DestructableSet {\n\tadd(value: V): this {\n\t\tif (value.destroyed) return this;\n\t\tif (!this.has(value)) {\n\t\t\taddDependency(this, value, () => {\n\t\t\t\tthis.delete(value);\n\t\t\t});\n\t\t}\n\t\treturn super.add(value);\n\t}\n}\n","import { addDependency, addThreewayDependency, isDestructable } from \"./utils\";\nimport DestructableObject from \"./DestructableObject\";\n\n//TODO edg: think of better name\nexport default class OnDemandEvaluatedMap extends DestructableObject {\n\tprivate readonly map = new Map();\n\n\tconstructor(private readonly evaluate: (key: K, ...args: A) => V, private readonly persistant = true) {\n\t\tsuper();\n\t}\n\n\tget size(): number {\n\t\treturn this.map.size;\n\t}\n\n\thas(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\tget(key: K, ...args: A): V {\n\t\tif (!this.map.has(key)) {\n\t\t\tconst value = this.evaluate(key, ...args);\n\t\t\tthis.map.set(key, value);\n\n\t\t\tconst key_is_destructable = isDestructable(key);\n\t\t\tconst value_is_destructable = isDestructable(value);\n\t\t\tif (key_is_destructable && value_is_destructable) {\n\t\t\t\taddThreewayDependency(this, key, value, () => this.delete(key));\n\t\t\t} else if (key_is_destructable) {\n\t\t\t\taddDependency(this, key, () => this.delete(key));\n\t\t\t} else if (value_is_destructable) {\n\t\t\t\taddDependency(this, value, () => this.delete(key));\n\t\t\t}\n\t\t\treturn value;\n\t\t} else {\n\t\t\treturn this.map.get(key)!;\n\t\t}\n\t}\n\n\tdelete(key: K): boolean {\n\t\tconst result = this.map.delete(key);\n\t\tif (!this.persistant && this.map.size === 0) {\n\t\t\tthis.destroy();\n\t\t}\n\t\treturn result;\n\t}\n\n\tentries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.map[Symbol.iterator]();\n\t}\n\n\tforEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void {\n\t\treturn this.map.forEach(callbackfn, thisArg);\n\t}\n\n\tkeys(): IterableIterator {\n\t\treturn this.map.keys();\n\t}\n\n\tvalues(): IterableIterator {\n\t\treturn this.map.values();\n\t}\n\n\tclear(): void {\n\t\tthis.map.clear();\n\t\tif (!this.destroyed && !this.persistant) {\n\t\t\tthis.destroy();\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\tthis.map.clear();\n\t\tsuper.destroy();\n\t}\n}\n","import { Destructable, Subscription } from \"./types\";\nimport DestructorMap from \"./DestructorMap\";\n\nexport default class SubscriptionMap extends DestructorMap {\n\tdelete(key: Destructable): boolean {\n\t\tthis.get(key)?.unsubscribe();\n\t\treturn super.delete(key);\n\t}\n\n\tclear(): void {\n\t\tfor (const subscription of this.values()) {\n\t\t\tsubscription.unsubscribe();\n\t\t}\n\t\tsuper.clear();\n\t}\n\n\tdestroy() {\n\t\tfor (const subscription of this.values()) {\n\t\t\tsubscription.unsubscribe();\n\t\t}\n\t\tsuper.destroy();\n\t}\n}\n","import { Destructable } from \"./types\";\n\nexport function isDestructable(object: any): object is Destructable {\n\treturn (\n\t\tobject !== null &&\n\t\ttypeof object === \"object\" &&\n\t\tobject.onDestroy !== undefined &&\n\t\tobject.destroy !== undefined &&\n\t\tobject.destroyed !== undefined\n\t);\n}\n\nexport function addDependency(destructor1: Destructable, destructor2: Destructable, func: () => void): void {\n\tif (destructor2.destroyed === true) {\n\t\tfunc();\n\t} else {\n\t\tconst sub1 = destructor2.onDestroy(() => {\n\t\t\tif (destructor1.destroyed === true) return;\n\t\t\tsub2.unsubscribe();\n\t\t\tfunc();\n\t\t});\n\t\tconst sub2 = destructor1.onDestroy(() => sub1.unsubscribe());\n\t}\n}\n\nexport function addThreewayDependency(\n\tparent: Destructable,\n\tchild1: Destructable,\n\tchild2: Destructable,\n\tfunc: () => void\n): void {\n\tif (child1.destroyed || child2.destroyed) {\n\t\tfunc();\n\t} else {\n\t\tconst sub_child1 = child1.onDestroy(() => {\n\t\t\tsub_parent.unsubscribe();\n\t\t\tsub_child2.unsubscribe();\n\t\t\tfunc();\n\t\t});\n\t\tconst sub_child2 = child2.onDestroy(() => {\n\t\t\tsub_parent.unsubscribe();\n\t\t\tsub_child1.unsubscribe();\n\t\t\tfunc();\n\t\t});\n\t\tconst sub_parent = parent.onDestroy(() => {\n\t\t\tsub_child1.unsubscribe();\n\t\t\tsub_child2.unsubscribe();\n\t\t});\n\t}\n}\n","export { awaitCondition } from \"./lib/utils\";\nexport { Scalar, ScalarProvider, ScalarConsumer, scalarValue, onScalarValue } from \"./lib/Scalar\";\nexport { DictionaryProvider, DictionaryConsumer } from \"./lib/Dictionary\";\nexport { MutableDictionary, createDictionary } from \"./lib/MutableDictionary\";\nexport {\n\tcreateExpressionBuilder,\n\tcreateStategroupExpressionBuilder,\n\tcreateDictionaryExpressionBuilder,\n\tlambda,\n\tStategroupExpressionBuilder,\n\tDictionaryExpressionBuilder,\n\tDefaultExpressionBuilder,\n\tInitializedStaticStategroupExpressionBuilder,\n\tInitializedStaticDictionaryExpressionBuilder,\n\tInitializedStaticDefaultExpressionBuilder,\n\tInitializedDynamicStategroupExpressionBuilder,\n\tInitializedDynamicDictionaryExpressionBuilder,\n\tInitializedDynamicDefaultExpressionBuilder,\n\tgetSourceOriginFromStacktrace,\n} from \"./lib/ExpressionBuilder\";\nexport { ReadonlyVariable, MutableVariable, createVariable } from \"./lib/Variable\";\nexport { None } from \"./lib/types\";\nexport { WeakCache } from \"./lib/WeakCache\";\n","import { Scalar, ScalarProvider, ScalarConsumer, scalarValue } from \"./Scalar\";\n\nexport class And\n\textends ScalarProvider<[LeftValueType, RightValueType]>\n\timplements ScalarConsumer\n{\n\tprivate _subscriber: ScalarConsumer<[LeftValueType, RightValueType]> | undefined;\n\tprivate _right_subscription: ScalarConsumer | undefined;\n\tprivate _left_value: LeftValueType | undefined;\n\tprivate _right_value: RightValueType | undefined;\n\n\tconstructor(\n\t\treadonly left_source: Scalar,\n\t\treadonly right_source: Scalar,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper();\n\t\tthis._left_value = left_source instanceof ScalarProvider ? undefined : left_source;\n\t\tthis._right_value = right_source instanceof ScalarProvider ? undefined : right_source;\n\t}\n\n\tget value(): [LeftValueType, RightValueType] {\n\t\tif (this._subscriber === undefined) {\n\t\t\treturn [scalarValue(this.left_source), scalarValue(this.right_source)];\n\t\t}\n\t\treturn [this._left_value!, this._right_value!];\n\t}\n\n\tupdate(left_value: LeftValueType) {\n\t\tthis._left_value = left_value;\n\t\tif (this._right_value !== undefined) {\n\t\t\tthis._subscriber!.update([left_value, this._right_value]);\n\t\t}\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer<[LeftValueType, RightValueType]>) {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tif (this.left_source instanceof ScalarProvider) {\n\t\t\tthis.left_source.subscribe(this);\n\t\t}\n\t\tif (this.right_source instanceof ScalarProvider) {\n\t\t\tthis._right_subscription = this.right_source.subscribe({\n\t\t\t\tupdate: (right_value) => {\n\t\t\t\t\tthis._right_value = right_value;\n\t\t\t\t\tthis._subscriber!.update([this._left_value!, right_value]);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer<[LeftValueType, RightValueType]>) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tif (this.left_source instanceof ScalarProvider) {\n\t\t\tthis.left_source.unsubscribe(this);\n\t\t}\n\t\tif (this.right_source instanceof ScalarProvider) {\n\t\t\tthis.right_source.unsubscribe(this._right_subscription!);\n\t\t}\n\t}\n}\n","import { ScalarConsumer, ScalarProvider } from \"./Scalar\";\n\nexport interface DictionaryConsumer {\n\tadd(key: KeyType, value: ValueType): void;\n\tremove(key: KeyType): void;\n}\n\nexport abstract class DictionaryProvider {\n\tabstract subscribe(subscriber: DictionaryConsumer): typeof subscriber;\n\tabstract unsubscribe(subscriber: DictionaryConsumer): void;\n\tabstract entries: ReadonlyMap;\n\tabstract size: ScalarProvider;\n}\n\nexport abstract class DictionaryExpression\n\textends DictionaryProvider\n\timplements DictionaryConsumer\n{\n\tprotected _subscriber: DictionaryConsumer | undefined;\n\n\tconstructor(readonly source: DictionaryProvider) {\n\t\tsuper();\n\t}\n\n\tabstract add(key: KeyInType, value: ValueInType): void;\n\n\tabstract remove(key: KeyInType): void;\n\n\tsubscribe(subscriber: DictionaryConsumer) {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tthis.source.subscribe(this);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: DictionaryConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tthis.source.unsubscribe(this);\n\t}\n}\n\nexport abstract class DynamicDictionaryExpression\n\textends ScalarProvider\n\timplements ScalarConsumer>\n{\n\tprivate _subscriber: ScalarConsumer | undefined;\n\tprivate _value: (ResultType & DictionaryConsumer) | undefined;\n\tprivate _source_dictionary: DictionaryProvider | undefined;\n\n\tconstructor(readonly source: ScalarProvider>) {\n\t\tsuper();\n\t}\n\n\tprotected abstract initialize(): ResultType & DictionaryConsumer;\n\n\tget value(): ResultType {\n\t\tif (this._subscriber === undefined) {\n\t\t\treturn this.initialize();\n\t\t} else {\n\t\t\treturn this._value!;\n\t\t}\n\t}\n\n\tupdate(value: DictionaryProvider) {\n\t\tif (this._source_dictionary && this._value) {\n\t\t\tthis._source_dictionary.unsubscribe(this._value);\n\t\t}\n\t\tthis._source_dictionary = value;\n\t\tthis._value = this.initialize();\n\t\tthis._subscriber!.update(this._value);\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer): typeof subscriber {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tthis.source.subscribe(this);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer): void {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tthis.source.unsubscribe(this);\n\t}\n}\n","import { None } from \"./types\";\nimport { Scalar, ScalarProvider } from \"./Scalar\";\nimport { Stategroup, StateSwitch } from \"./StateSwitch\";\nimport { Pipe } from \"./Pipe\";\nimport { And } from \"./And\";\nimport { Or } from \"./Or\";\nimport { Fallback } from \"./Fallback\";\nimport { DictionaryProvider } from \"./Dictionary\";\nimport { DictionaryMap, DynamicDictionaryMap } from \"./Map\";\nimport { GroupBy, DynamicGroupBy } from \"./GroupBy\";\nimport { Filter, DynamicFilter } from \"./Filter\";\nimport { Get } from \"./Get\";\nimport { Reduce } from \"./Reduce\";\nimport { GetSingleton } from \"./GetSingleton\";\n\nconst locationPattern = /:(\\d+):(\\d+)/;\n\nexport function getSourceOriginFromStacktrace(error: Error, line: number): string {\n\tconst stack = error.stack?.split(\"\\n\")[line - 1]?.replace(/http.*(?:engine)/i, \"engine\");\n\tif (stack === undefined) return \"\";\n\tconst location_parts = locationPattern.exec(stack)!;\n\treturn (global as any)?.sourceMapper(+location_parts[1], +location_parts[2]);\n}\n\ntype ExcludeNone = Type extends ScalarProvider ? ScalarProvider> : Exclude;\ntype Static = Type extends Scalar ? T : Type;\n\nexport class ExpressionBuilder {\n\tprivate readonly steps: Array<(arg: unknown) => unknown> = [];\n\n\tconstructor(input?: Scalar) {\n\t\tconst builder: any = function (args?: Scalar): Scalar {\n\t\t\tlet result: any = args ?? input!;\n\t\t\tfor (const step of builder.steps) {\n\t\t\t\tresult = step(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\t\tObject.assign(builder, this);\n\t\tObject.setPrototypeOf(builder, Object.getPrototypeOf(this));\n\t\treturn builder;\n\t}\n\n\tstateSwitch(\n\t\tstates: {\n\t\t\t[key in InType[\"tag\"]]: ($: Extract[\"value\"]) => Scalar;\n\t\t}\n\t) {\n\t\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\t\tthis.steps.push((source: Scalar) => {\n\t\t\tif (source instanceof ScalarProvider) {\n\t\t\t\treturn new StateSwitch(source, states, origin);\n\t\t\t} else {\n\t\t\t\treturn states[source.tag as InType[\"tag\"]](source.value);\n\t\t\t}\n\t\t});\n\t\treturn this;\n\t}\n\n\tmap(map_fn: ($: [KeyType, ValueInType]) => ValueOutType) {\n\t\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\t\tthis.steps.push((source: Scalar>) => {\n\t\t\tif (source instanceof ScalarProvider) {\n\t\t\t\treturn new DynamicDictionaryMap(source, map_fn, origin);\n\t\t\t} else {\n\t\t\t\treturn new DictionaryMap(source, map_fn, origin);\n\t\t\t}\n\t\t});\n\t\treturn this;\n\t}\n\n\tfilter() {\n\t\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\t\tthis.steps.push((source: Scalar>) => {\n\t\t\tif (source instanceof ScalarProvider) {\n\t\t\t\treturn new DynamicFilter(source, origin);\n\t\t\t} else {\n\t\t\t\treturn new Filter(source, origin);\n\t\t\t}\n\t\t});\n\t\treturn this;\n\t}\n\n\tgroupBy(group_fn: ($: [KeyType, ValueType]) => Scalar) {\n\t\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\t\tthis.steps.push((source: Scalar>) => {\n\t\t\tif (source instanceof ScalarProvider) {\n\t\t\t\treturn new DynamicGroupBy(source, group_fn, origin);\n\t\t\t} else {\n\t\t\t\treturn new GroupBy(source, group_fn, origin);\n\t\t\t}\n\t\t});\n\t\treturn this;\n\t}\n\n\tget(key_expr?: Scalar) {\n\t\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\t\tif (key_expr === undefined) {\n\t\t\tthis.steps.push((source: Scalar>) => new GetSingleton(source, origin));\n\t\t} else {\n\t\t\tthis.steps.push((source: Scalar>) => new Get(source, key_expr, origin));\n\t\t}\n\t\treturn this;\n\t}\n\n\treduce(fn: (accumulator: ResultType, value: ValueType) => ResultType, initial_value: ResultType) {\n\t\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\t\tthis.steps.push(\n\t\t\t(source: Scalar>) => new Reduce(source, fn, initial_value, origin)\n\t\t);\n\t\treturn this;\n\t}\n\n\tpipe(fn: ($: ResultType) => Scalar, extra_steps_to_origin = 0) {\n\t\tif (fn instanceof ExpressionBuilder) {\n\t\t\tfor (const step of fn.steps) {\n\t\t\t\tthis.steps.push(step);\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\tconst origin = (global)?.alan_debug\n\t\t\t? getSourceOriginFromStacktrace(new Error(), 2 + extra_steps_to_origin)\n\t\t\t: undefined;\n\t\tthis.steps.push((source: Scalar) => {\n\t\t\tif (source instanceof ScalarProvider) {\n\t\t\t\treturn new Pipe(source, fn, origin);\n\t\t\t} else {\n\t\t\t\treturn fn(source);\n\t\t\t}\n\t\t});\n\t\treturn this;\n\t}\n\n\tand(right: Scalar) {\n\t\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\t\tthis.steps.push((source: Scalar) => {\n\t\t\tif (source instanceof ScalarProvider || right instanceof ScalarProvider) {\n\t\t\t\treturn new And(source, right, origin);\n\t\t\t} else {\n\t\t\t\treturn [source, right];\n\t\t\t}\n\t\t});\n\t\treturn this;\n\t}\n\n\tor(right: Scalar) {\n\t\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\t\tthis.steps.push((source: Scalar) => {\n\t\t\tif (source instanceof ScalarProvider) {\n\t\t\t\treturn new Or(source, right, origin);\n\t\t\t} else {\n\t\t\t\treturn (source as any) === None ? right : source;\n\t\t\t}\n\t\t});\n\t\treturn this;\n\t}\n\n\tfallback(fallback_value: ResultType) {\n\t\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\t\tthis.steps.push((source: Scalar) => {\n\t\t\tif (source instanceof ScalarProvider) {\n\t\t\t\treturn new Fallback(source, fallback_value, origin);\n\t\t\t} else {\n\t\t\t\treturn source;\n\t\t\t}\n\t\t});\n\t\treturn this;\n\t}\n}\n\n/*\n * Uninitialized undetermined variant\n */\n\nexport interface StategroupExpressionBuilder\n\textends DefaultExpressionBuilder {\n\tstateSwitch(\n\t\tstates: {\n\t\t\t[key in ResultType[\"tag\"]]: ($: Extract[\"value\"]) => Scalar;\n\t\t}\n\t): DefaultExpressionBuilder;\n}\n\nexport interface DictionaryExpressionBuilder\n\textends DefaultExpressionBuilder>> {\n\tmap(\n\t\tmapping: ($: [KeyType, ValueType]) => Scalar\n\t): DictionaryExpressionBuilder;\n\tfilter(): DictionaryExpressionBuilder>;\n\tgroupBy(\n\t\tvalue_function: ($: [KeyType, ValueType]) => Scalar\n\t): DictionaryExpressionBuilder>;\n\tget(key_expr?: Scalar): DefaultExpressionBuilder;\n\treduce(\n\t\tfn: (accumulator: ResultType, value: ValueType) => ResultType,\n\t\tinitial_value: ResultType\n\t): DefaultExpressionBuilder;\n}\n\nexport interface DefaultExpressionBuilder {\n\tand(right: Scalar): DefaultExpressionBuilder;\n\tor(\n\t\tright: Scalar\n\t): DefaultExpressionBuilder | RightType>;\n\tpipe(\n\t\tfn: ($: ResultType) => Scalar,\n\t\textra_steps_to_origin?: number\n\t): DefaultExpressionBuilder;\n\tfallback(fallback_value: ResultType): DefaultExpressionBuilder;\n\t(args: Scalar): Scalar;\n}\n\n/*\n * Initialized static variant\n */\n\nexport interface InitializedStaticStategroupExpressionBuilder\n\textends InitializedStaticDefaultExpressionBuilder {\n\tstateSwitch(\n\t\tstates: {\n\t\t\t[key in ResultType[\"tag\"]]: ($: Extract[\"value\"]) => Scalar;\n\t\t}\n\t): InitializedDynamicDefaultExpressionBuilder;\n}\n\nexport interface InitializedStaticDictionaryExpressionBuilder\n\textends InitializedStaticDefaultExpressionBuilder>> {\n\tmap(\n\t\tmapping: ($: [KeyType, ValueType]) => Scalar\n\t): InitializedStaticDictionaryExpressionBuilder;\n\tfilter(): InitializedStaticDictionaryExpressionBuilder>;\n\tgroupBy(\n\t\tvalue_function: ($: [KeyType, ValueType]) => Scalar\n\t): InitializedStaticDictionaryExpressionBuilder<\n\t\tArgumentsType,\n\t\tGroupValueType,\n\t\tDictionaryProvider\n\t>;\n\tget(key_expr?: Scalar): InitializedDynamicDefaultExpressionBuilder;\n\treduce(\n\t\tfn: (accumulator: ResultType, value: ValueType) => ResultType,\n\t\tinitial_value: ResultType\n\t): InitializedDynamicDefaultExpressionBuilder;\n}\n\nexport interface InitializedStaticDefaultExpressionBuilder {\n\tand(\n\t\tright: ScalarProvider\n\t): InitializedDynamicDefaultExpressionBuilder;\n\tand(right: RightType): InitializedStaticDefaultExpressionBuilder;\n\tand(\n\t\tright: Scalar\n\t): InitializedDynamicDefaultExpressionBuilder;\n\tor(\n\t\tright: Scalar\n\t): InitializedDynamicDefaultExpressionBuilder | RightType>;\n\tpipe(\n\t\tfn: ($: ResultType) => ScalarProvider,\n\t\textra_steps_to_origin?: number\n\t): InitializedDynamicDefaultExpressionBuilder;\n\tpipe(\n\t\tfn: ($: ResultType) => Scalar,\n\t\textra_steps_to_origin?: number\n\t): InitializedDynamicDefaultExpressionBuilder;\n\tpipe(\n\t\tfn: ($: ResultType) => PipeResultType,\n\t\textra_steps_to_origin?: number\n\t): InitializedStaticDefaultExpressionBuilder;\n\tpipe(\n\t\tfn: ($: ResultType) => Scalar,\n\t\textra_steps_to_origin?: number\n\t): InitializedDynamicDefaultExpressionBuilder;\n\tfallback(fallback_value: ResultType): InitializedStaticDefaultExpressionBuilder;\n\t(): ResultType;\n}\n\n/*\n * Initialized dynamic variant\n */\n\nexport interface InitializedDynamicStategroupExpressionBuilder\n\textends InitializedDynamicDefaultExpressionBuilder {\n\tstateSwitch(\n\t\tstates: {\n\t\t\t[key in ResultType[\"tag\"]]: ($: Extract[\"value\"]) => Scalar;\n\t\t}\n\t): InitializedDynamicDefaultExpressionBuilder;\n}\n\nexport interface InitializedDynamicDictionaryExpressionBuilder\n\textends InitializedDynamicDefaultExpressionBuilder>> {\n\tmap(\n\t\tmapping: ($: [KeyType, ValueType]) => Scalar\n\t): InitializedDynamicDictionaryExpressionBuilder;\n\tfilter(): InitializedDynamicDictionaryExpressionBuilder>;\n\tgroupBy(\n\t\tvalue_function: ($: [KeyType, ValueType]) => Scalar\n\t): InitializedDynamicDictionaryExpressionBuilder<\n\t\tArgumentsType,\n\t\tGroupValueType,\n\t\tDictionaryProvider\n\t>;\n\tget(key_expr?: Scalar): InitializedDynamicDefaultExpressionBuilder;\n\treduce(\n\t\tfn: (accumulator: ResultType, value: ValueType) => ResultType,\n\t\tinitial_value: ResultType\n\t): InitializedDynamicDefaultExpressionBuilder;\n}\n\nexport interface InitializedDynamicDefaultExpressionBuilder {\n\tand(\n\t\tright: Scalar\n\t): InitializedDynamicDefaultExpressionBuilder;\n\tor(\n\t\tright: Scalar\n\t): InitializedDynamicDefaultExpressionBuilder | RightType>;\n\tpipe(\n\t\tfn: ($: Static) => Scalar,\n\t\textra_steps_to_origin?: number\n\t): InitializedDynamicDefaultExpressionBuilder;\n\tfallback(fallback_value: ResultType): InitializedDynamicDefaultExpressionBuilder;\n\t(): ScalarProvider;\n}\n\n/*\n * Caller\n */\n\nexport function createStategroupExpressionBuilder(\n\tinput: ScalarProvider\n): InitializedDynamicStategroupExpressionBuilder;\nexport function createStategroupExpressionBuilder(\n\tinput: ArgumentsType\n): InitializedStaticStategroupExpressionBuilder;\nexport function createStategroupExpressionBuilder(): StategroupExpressionBuilder<\n\tArgumentsType,\n\tArgumentsType\n>;\nexport function createStategroupExpressionBuilder(\n\tinput?: Scalar\n): (args?: Scalar) => Scalar {\n\treturn new ExpressionBuilder(input) as any;\n}\n\nexport function createDictionaryExpressionBuilder(\n\tinput: ScalarProvider>>\n): InitializedDynamicDictionaryExpressionBuilder>, KeyType, ValueType>;\nexport function createDictionaryExpressionBuilder(\n\tinput: DictionaryProvider>\n): InitializedStaticDictionaryExpressionBuilder>, KeyType, ValueType>;\nexport function createDictionaryExpressionBuilder(): DictionaryExpressionBuilder<\n\tDictionaryProvider>,\n\tKeyType,\n\tValueType\n>;\nexport function createDictionaryExpressionBuilder(\n\tinput?: Scalar\n): (args?: Scalar) => Scalar {\n\treturn new ExpressionBuilder(input) as any;\n}\n\nexport function createExpressionBuilder(\n\tinput: ScalarProvider\n): InitializedDynamicDefaultExpressionBuilder;\nexport function createExpressionBuilder(\n\tinput: Scalar\n): InitializedDynamicDefaultExpressionBuilder;\nexport function createExpressionBuilder(\n\tinput: ArgumentsType\n): InitializedStaticDefaultExpressionBuilder;\nexport function createExpressionBuilder(): DefaultExpressionBuilder;\nexport function createExpressionBuilder(\n\tinput?: Scalar\n): (args?: Scalar) => Scalar {\n\treturn new ExpressionBuilder(input) as any;\n}\n\nexport function lambda(fn: ($: ArgumentsType) => Scalar) {\n\treturn createExpressionBuilder().pipe(fn);\n}\n","import { ScalarConsumer, ScalarProvider } from \"./Scalar\";\n\nexport class Fallback extends ScalarProvider implements ScalarConsumer {\n\tprivate _subscriber: ScalarConsumer | undefined;\n\tprivate _value: Type | undefined;\n\n\tconstructor(readonly source: ScalarProvider, private readonly fallback: Type, readonly __origin?: string) {\n\t\tsuper();\n\t}\n\n\tget value() {\n\t\treturn this._value ?? this.fallback;\n\t}\n\n\tupdate(value: Type) {\n\t\tthis._value = value;\n\t\tthis._subscriber!.update(value);\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer): typeof subscriber {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tthis.source.subscribe(this);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tthis._value = undefined;\n\t\tthis.source.unsubscribe(this);\n\t}\n}\n","import { None } from \"./types\";\nimport {\n\tDictionaryConsumer,\n\tDictionaryProvider,\n\tDictionaryExpression,\n\tDynamicDictionaryExpression,\n} from \"./Dictionary\";\nimport { ScalarProvider, ScalarConsumer, Scalar, scalarValue } from \"./Scalar\";\nimport { MutableVariable } from \"./Variable\";\n\nclass Entry extends ScalarProvider implements ScalarConsumer {\n\tprivate readonly _subscribers = new Set>();\n\tprivate _value: ValueType | None = None;\n\n\tconstructor(\n\t\treadonly source: ScalarProvider,\n\t\tpublic key: KeyType,\n\t\tprivate parent: Filter\n\t) {\n\t\tsuper();\n\t\tsource.subscribe(this);\n\t}\n\n\tget value() {\n\t\treturn this._value as ValueType;\n\t}\n\n\tupdate(value: ValueType | None) {\n\t\tconst previous_value = this._value;\n\t\tif (value === previous_value) return;\n\t\tthis._value = value;\n\t\tif (value === None && previous_value !== None) {\n\t\t\tthis.parent.removeFromResult(this.key);\n\t\t}\n\t\tif (value !== None && previous_value === None) {\n\t\t\tthis.parent.addToResult(this.key, this);\n\t\t}\n\t\tif (value !== None && previous_value !== None) {\n\t\t\tfor (const subscriber of this._subscribers) {\n\t\t\t\tsubscriber.update(value);\n\t\t\t}\n\t\t}\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer): typeof subscriber {\n\t\tthis._subscribers.add(subscriber);\n\t\tsubscriber.update(this.value);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tthis._subscribers.delete(subscriber);\n\t}\n\n\tdestroy() {\n\t\tthis.source.unsubscribe(this);\n\t\tif (this._value !== None) {\n\t\t\tthis.parent.removeFromResult(this.key);\n\t\t}\n\t}\n}\n\nexport class Filter extends DictionaryExpression<\n\tKeyType,\n\tScalar,\n\tScalar\n> {\n\tprivate _entries = new Map>();\n\n\tconstructor(source: DictionaryProvider>, readonly __origin?: string) {\n\t\tsuper(source);\n\t}\n\n\taddToResult(key: KeyType, value: Scalar) {\n\t\tthis._subscriber!.add(key, value);\n\t\tthis._size?.ensure(this._size.value + 1);\n\t}\n\n\tremoveFromResult(key: KeyType) {\n\t\tthis._subscriber!.remove(key);\n\t\tthis._size?.ensure(this._size.value - 1);\n\t}\n\n\tadd(key: KeyType, value: Scalar) {\n\t\tif (value instanceof ScalarProvider) {\n\t\t\tconst entry = new Entry(value, key, this);\n\t\t\tthis._entries.set(key, entry);\n\t\t} else {\n\t\t\tthis._entries.set(key, value);\n\t\t\tif (value !== None) {\n\t\t\t\tthis.addToResult(key, value);\n\t\t\t}\n\t\t}\n\t}\n\n\tremove(key: KeyType) {\n\t\tconst value = this._entries.get(key)!;\n\t\tthis._entries.delete(key);\n\t\tif (value instanceof Entry) {\n\t\t\tvalue.destroy();\n\t\t} else if (value !== None) {\n\t\t\tthis.removeFromResult(key);\n\t\t}\n\t}\n\n\tget entries(): ReadonlyMap {\n\t\tconst entries = new Map();\n\t\tfor (const [key, entry] of this.source.entries) {\n\t\t\tconst value = scalarValue(entry);\n\t\t\tif (value !== None) {\n\t\t\t\tentries.set(key, value);\n\t\t\t}\n\t\t}\n\t\treturn entries;\n\t}\n\n\tprivate _size: MutableVariable | undefined;\n\tget size(): ScalarProvider {\n\t\treturn (this._size ??= new MutableVariable(this.entries.size));\n\t}\n\n\tunsubscribe(subscriber: DictionaryConsumer>) {\n\t\tsuper.unsubscribe(subscriber);\n\t\tfor (const entry of this._entries.values()) {\n\t\t\tif (entry instanceof Entry) entry.source.unsubscribe(entry);\n\t\t}\n\t\tthis._entries.clear();\n\t}\n}\n\nexport class DynamicFilter extends DynamicDictionaryExpression<\n\tKeyType,\n\tScalar,\n\tFilter\n> {\n\tconstructor(\n\t\tsource: ScalarProvider>>,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper(source);\n\t}\n\n\tinitialize() {\n\t\treturn new Filter(this.source.value);\n\t}\n}\n","import { None } from \"./types\";\nimport { DictionaryProvider, DictionaryConsumer } from \"./Dictionary\";\nimport { Scalar, ScalarProvider, ScalarConsumer, scalarValue, onScalarValue } from \"./Scalar\";\n\nexport class Get\n\textends ScalarProvider\n\timplements\n\t\tScalarConsumer>>,\n\t\tDictionaryConsumer>\n{\n\tprivate _subscriber: ScalarConsumer | undefined;\n\tprivate _key_subscription: ScalarConsumer | undefined;\n\tprivate _dictionary_source: DictionaryProvider | undefined;\n\tprivate _value: Scalar | undefined;\n\n\tconstructor(\n\t\treadonly scalar_source: Scalar>,\n\t\treadonly key_exp: Scalar,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper();\n\t}\n\n\tprivate ensure(value: Scalar) {\n\t\tif (this._value === value) return;\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.unsubscribe(this._subscriber!);\n\t\t}\n\t\tthis._value = value;\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.subscribe(this._subscriber!);\n\t\t} else {\n\t\t\tthis._subscriber!.update(this._value);\n\t\t}\n\t}\n\n\tget value() {\n\t\tif (this._subscriber) {\n\t\t\treturn scalarValue(this._value!);\n\t\t} else {\n\t\t\treturn scalarValue(scalarValue(this.scalar_source).entries.get(scalarValue(this.key_exp))) ?? None;\n\t\t}\n\t}\n\n\tupdate(value: DictionaryProvider) {\n\t\tthis._dictionary_source?.unsubscribe(this);\n\t\tthis._dictionary_source = value;\n\t\tthis._dictionary_source.subscribe(this);\n\t\tif (this._dictionary_source.entries.size === 0) {\n\t\t\tthis.ensure(None);\n\t\t}\n\t}\n\n\tadd(key: KeyType, value: Scalar) {\n\t\tif (key === scalarValue(this.key_exp)) {\n\t\t\tthis.ensure(value);\n\t\t}\n\t}\n\n\tremove(key: KeyType) {\n\t\tif (key === scalarValue(this.key_exp)) {\n\t\t\tthis.ensure(None);\n\t\t}\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer) {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tif (this.scalar_source instanceof ScalarProvider) {\n\t\t\tthis.scalar_source.subscribe(this);\n\t\t} else {\n\t\t\tthis.update(this.scalar_source);\n\t\t}\n\t\tonScalarValue(\n\t\t\tthis.key_exp,\n\t\t\t(key_value) => this.ensure(this._dictionary_source!.entries.get(key_value) ?? None),\n\t\t\t(_, subscription) => (this._key_subscription = subscription)\n\t\t);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.unsubscribe(subscriber);\n\t\t}\n\t\tif (this.scalar_source instanceof ScalarProvider) {\n\t\t\tthis.scalar_source.unsubscribe(this);\n\t\t}\n\t\tthis._dictionary_source!.unsubscribe(this);\n\t\tthis._dictionary_source = undefined;\n\t\tif (this.key_exp instanceof ScalarProvider) {\n\t\t\tthis.key_exp.unsubscribe(this._key_subscription!);\n\t\t\tthis._key_subscription = undefined;\n\t\t}\n\t}\n}\n","import { None } from \"./types\";\nimport { DictionaryProvider, DictionaryConsumer } from \"./Dictionary\";\nimport { Scalar, ScalarProvider, ScalarConsumer, scalarValue } from \"./Scalar\";\n\nfunction getSingleton(source: Scalar>) {\n\tconst entries = scalarValue(source).entries;\n\tif (entries.size === 1) {\n\t\treturn [...entries][0][1];\n\t} else {\n\t\treturn None;\n\t}\n}\n\nexport class GetSingleton\n\textends ScalarProvider\n\timplements ScalarConsumer>, DictionaryConsumer\n{\n\tprivate _subscriber: ScalarConsumer | undefined;\n\tprivate _dictionary_source: DictionaryProvider | undefined;\n\tprivate _value: ValueType | None | undefined;\n\n\tconstructor(readonly scalar_source: Scalar>, readonly __origin?: string) {\n\t\tsuper();\n\t}\n\n\tprivate ensure(value: ValueType | None) {\n\t\tif (this._value === value) return;\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.unsubscribe(this._subscriber!);\n\t\t}\n\t\tthis._value = value;\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.subscribe(this._subscriber!);\n\t\t} else {\n\t\t\tthis._subscriber!.update(value);\n\t\t}\n\t}\n\n\tget value() {\n\t\tif (this._subscriber) {\n\t\t\treturn this._value!;\n\t\t} else {\n\t\t\treturn getSingleton(this.scalar_source);\n\t\t}\n\t}\n\n\tupdate(value: DictionaryProvider) {\n\t\tthis._dictionary_source?.unsubscribe(this);\n\t\tthis._dictionary_source = value;\n\t\tthis._dictionary_source.subscribe(this);\n\t\tthis.ensure(getSingleton(this.scalar_source));\n\t}\n\n\tadd() {\n\t\tthis.ensure(getSingleton(this.scalar_source));\n\t}\n\n\tremove() {\n\t\tthis.ensure(getSingleton(this.scalar_source));\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer) {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tif (this.scalar_source instanceof ScalarProvider) {\n\t\t\tthis.scalar_source.subscribe(this);\n\t\t} else {\n\t\t\tthis.update(this.scalar_source);\n\t\t}\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.unsubscribe(subscriber);\n\t\t}\n\t\tif (this.scalar_source instanceof ScalarProvider) {\n\t\t\tthis.scalar_source.unsubscribe(this);\n\t\t}\n\t\tthis._dictionary_source!.unsubscribe(this);\n\t\tthis._dictionary_source = undefined;\n\t}\n}\n","import {\n\tDictionaryConsumer,\n\tDictionaryProvider,\n\tDictionaryExpression,\n\tDynamicDictionaryExpression,\n} from \"./Dictionary\";\nimport { MutableDictionary } from \"./MutableDictionary\";\nimport { Scalar, ScalarProvider, ScalarConsumer, scalarValue } from \"./Scalar\";\nimport { MutableVariable } from \"./Variable\";\n\nexport class GroupBy extends DictionaryExpression<\n\tKeyType,\n\tValueType,\n\tDictionaryProvider,\n\tGroupType\n> {\n\tprivate _entries = new Map>();\n\tprivate _inverse = new Map]>();\n\tprivate _subscriptions = new Map, ScalarConsumer]>();\n\n\tconstructor(\n\t\tsource: DictionaryProvider,\n\t\tprivate readonly group_fn: ($: [KeyType, ValueType]) => Scalar,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper(source);\n\t}\n\n\tprivate addToGroup(group_value: GroupType, key: KeyType, value: ValueType) {\n\t\tif (this._inverse.has(key)) {\n\t\t\tconst [prev_group_value] = this._inverse.get(key)!;\n\t\t\tif (prev_group_value === group_value) return;\n\t\t\tthis.removeFromGroup(key);\n\t\t}\n\t\tlet group = this._entries.get(group_value);\n\t\tif (group === undefined) {\n\t\t\tgroup = new MutableDictionary();\n\t\t\tthis._entries.set(group_value, group);\n\t\t\tthis._inverse.set(key, [group_value, group]);\n\t\t\tgroup.add(key, value);\n\t\t\tthis._subscriber!.add(group_value, group);\n\t\t} else {\n\t\t\tthis._inverse.set(key, [group_value, group]);\n\t\t\tgroup.add(key, value);\n\t\t}\n\t\tthis._size?.ensure(this._entries.size);\n\t}\n\n\tprivate removeFromGroup(key: KeyType) {\n\t\tconst [group_value, group] = this._inverse.get(key)!;\n\t\tthis._inverse.delete(key);\n\t\tgroup.remove(key);\n\t\tif (group.size.value === 0) {\n\t\t\tthis._entries.delete(group_value);\n\t\t\tthis._subscriber!.remove(group_value);\n\t\t}\n\t\tthis._size?.ensure(this._entries.size);\n\t}\n\n\tadd(key: KeyType, value: ValueType) {\n\t\tconst group_value = this.group_fn([key, value]);\n\t\tif (group_value instanceof ScalarProvider) {\n\t\t\tconst subscription = group_value.subscribe({\n\t\t\t\tupdate: (group_value: GroupType) => {\n\t\t\t\t\tthis.addToGroup(group_value, key, value);\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis._subscriptions.set(key, [group_value, subscription]);\n\t\t} else {\n\t\t\tthis.addToGroup(group_value, key, value);\n\t\t}\n\t}\n\n\tremove(key: KeyType) {\n\t\tif (this._subscriptions.has(key)) {\n\t\t\tconst [group_value_scalar, subscription] = this._subscriptions.get(key)!;\n\t\t\tthis._subscriptions.delete(key);\n\t\t\tgroup_value_scalar.unsubscribe(subscription);\n\t\t}\n\t\tthis.removeFromGroup(key);\n\t}\n\n\tget entries(): ReadonlyMap> {\n\t\tif (this._subscriber === undefined) {\n\t\t\tconst groups = new Map>();\n\t\t\tfor (const $ of this.source.entries) {\n\t\t\t\tconst group_value = scalarValue(this.group_fn($));\n\t\t\t\tlet group = groups.get(group_value);\n\t\t\t\tif (group === undefined) {\n\t\t\t\t\tgroup = new MutableDictionary();\n\t\t\t\t\tgroups.set(group_value, group);\n\t\t\t\t}\n\t\t\t\tgroup.add($[0], $[1]);\n\t\t\t}\n\t\t\treturn groups;\n\t\t}\n\t\treturn this._entries;\n\t}\n\n\tprivate _size: MutableVariable | undefined;\n\tget size(): ScalarProvider {\n\t\treturn (this._size ??= new MutableVariable(this._entries.size));\n\t}\n\n\tunsubscribe(subscriber: DictionaryConsumer>) {\n\t\tsuper.unsubscribe(subscriber);\n\t\tfor (const [, [group_value_scalar, subscription]] of this._subscriptions) {\n\t\t\tgroup_value_scalar.unsubscribe(subscription);\n\t\t}\n\t\tthis._subscriptions.clear();\n\t\tthis._inverse.clear();\n\t\tthis._entries.clear();\n\t}\n}\n\nexport class DynamicGroupBy extends DynamicDictionaryExpression<\n\tKeyType,\n\tValueType,\n\tGroupBy\n> {\n\tconstructor(\n\t\tsource: ScalarProvider>,\n\t\tprivate readonly group_fn: ($: [KeyType, ValueType]) => Scalar,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper(source);\n\t}\n\n\tinitialize() {\n\t\treturn new GroupBy(this.source.value, this.group_fn);\n\t}\n}\n","import { DictionaryProvider, DictionaryExpression, DynamicDictionaryExpression } from \"./Dictionary\";\nimport { Scalar, ScalarProvider, scalarValue } from \"./Scalar\";\nimport { MutableVariable } from \"./Variable\";\n\nexport class DictionaryMap extends DictionaryExpression<\n\tKeyType,\n\tValueInType,\n\tScalar\n> {\n\tprivate _entries = new Map>();\n\n\tconstructor(\n\t\tsource: DictionaryProvider,\n\t\tprivate readonly map_fn: ($: [KeyType, ValueInType]) => Scalar,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper(source);\n\t}\n\n\tadd(key: KeyType, value: ValueInType) {\n\t\tconst outvalue = this.map_fn([key, value]);\n\t\tthis._entries.set(key, outvalue);\n\t\tthis._subscriber!.add(key, outvalue);\n\t\tthis._size?.ensure(this._entries.size);\n\t}\n\n\tremove(key: KeyType) {\n\t\tthis._entries.delete(key);\n\t\tthis._subscriber!.remove(key);\n\t\tthis._size?.ensure(this._entries.size);\n\t}\n\n\tget entries(): ReadonlyMap {\n\t\tif (this._subscriber === undefined) {\n\t\t\tconst entries = new Map();\n\t\t\tfor (const $ of this.source.entries) {\n\t\t\t\tentries.set($[0], scalarValue(this.map_fn($)));\n\t\t\t}\n\t\t\treturn entries;\n\t\t} else {\n\t\t\treturn new Map([...this._entries].map(([k, v]) => [k, scalarValue(v)] as const));\n\t\t}\n\t}\n\n\tprivate _size: MutableVariable | undefined;\n\tget size(): ScalarProvider {\n\t\treturn (this._size ??= new MutableVariable(this._entries.size));\n\t}\n}\n\nexport class DynamicDictionaryMap extends DynamicDictionaryExpression<\n\tKeyType,\n\tValueInType,\n\tDictionaryMap\n> {\n\tconstructor(\n\t\tsource: ScalarProvider>,\n\t\tprivate readonly map_fn: ($: [KeyType, ValueInType]) => ValueOutType,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper(source);\n\t}\n\n\tinitialize() {\n\t\treturn new DictionaryMap(this.source.value, this.map_fn);\n\t}\n}\n","import { Destructable, DestructionObserver, Subscription } from \"../../destructables\";\nimport { ScalarProvider } from \"./Scalar\";\nimport { DictionaryProvider, DictionaryConsumer } from \"./Dictionary\";\nimport { MutableVariable } from \"./Variable\";\n\nexport class MutableDictionary\n\textends DictionaryProvider\n\timplements DictionaryConsumer, Destructable\n{\n\tprivate readonly _entries = new Map();\n\tprivate readonly _subscribers = new Set>();\n\n\tconstructor(private readonly expression?: DictionaryProvider) {\n\t\tsuper();\n\t}\n\n\tadd(key: KeyType, value: ValueType) {\n\t\tif (this._destroyed) throw new Error(\"Trying to access destroyed variable\");\n\t\tif (this._entries.has(key)) throw new Error(\"unexpected\");\n\t\tthis._entries.set(key, value);\n\t\tfor (const subscriber of this._subscribers) {\n\t\t\tsubscriber.add(key, value);\n\t\t}\n\t\tthis._size?.ensure(this._entries.size);\n\t}\n\n\tremove(key: KeyType) {\n\t\tif (this._destroyed) throw new Error(\"Trying to access destroyed variable\");\n\t\tif (!this._entries.has(key)) throw new Error(\"unexpected\");\n\t\tthis._entries.delete(key);\n\t\tfor (const subscriber of this._subscribers) {\n\t\t\tsubscriber.remove(key);\n\t\t}\n\t\tthis._size?.ensure(this._entries.size);\n\t}\n\n\tsubscribe(subscriber: DictionaryConsumer) {\n\t\tif (this._destroyed) throw new Error(\"Trying to access destroyed variable\");\n\t\tif (this._subscribers.has(subscriber)) throw new Error(\"unexpected\");\n\t\tthis._subscribers.add(subscriber);\n\t\tif (this.expression && this._subscribers.size === 1) {\n\t\t\tthis.expression.subscribe(this);\n\t\t} else {\n\t\t\tfor (const [key, value] of this._entries) {\n\t\t\t\tsubscriber.add(key, value);\n\t\t\t}\n\t\t}\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: DictionaryConsumer) {\n\t\tif (!this._subscribers.has(subscriber)) throw new Error(\"unexpected\");\n\t\tthis._subscribers.delete(subscriber);\n\t\tif (this.expression && this._subscribers.size === 0) {\n\t\t\tthis.expression.unsubscribe(this);\n\t\t\tthis._entries.clear();\n\t\t}\n\t}\n\n\tget entries(): ReadonlyMap {\n\t\tif (this._destroyed) throw new Error(\"Trying to access destroyed variable\");\n\t\tif (this.expression && this._subscribers.size === 0) {\n\t\t\treturn this.expression.entries;\n\t\t}\n\t\treturn this._entries;\n\t}\n\n\tprivate _size: MutableVariable | undefined;\n\tget size(): ScalarProvider {\n\t\tif (this._destroyed) throw new Error(\"Trying to access destroyed variable\");\n\t\treturn (this._size ??= new MutableVariable(this._entries.size));\n\t}\n\n\t/* Destructable interface implementation */\n\n\tprivate _destruction_observers?: Set;\n\tprivate _destroyed = false;\n\n\tdestroy(): void {\n\t\tif (this._destroyed) return;\n\t\tthis._destroyed = true;\n\n\t\tif (this._subscribers.size > 0) {\n\t\t\tthis._subscribers.clear();\n\t\t\tthis.expression?.unsubscribe(this);\n\t\t}\n\n\t\tif (this._destruction_observers) {\n\t\t\tfor (const observer of this._destruction_observers) {\n\t\t\t\tobserver();\n\t\t\t}\n\t\t\tthis._destruction_observers.clear();\n\t\t}\n\t}\n\n\tget destroyed(): boolean {\n\t\treturn this._destroyed;\n\t}\n\n\tonDestroy(observer: DestructionObserver): Subscription {\n\t\tif (this.destroyed) {\n\t\t\tobserver();\n\t\t} else {\n\t\t\t(this._destruction_observers ??= new Set()).add(observer);\n\t\t}\n\t\treturn {\n\t\t\tunsubscribe: () => this._destruction_observers!.delete(observer),\n\t\t};\n\t}\n}\n\ntype ReadonlyDictionary = Omit, \"add\" | \"remove\">;\n\nexport function createDictionary(): MutableDictionary;\nexport function createDictionary(\n\texpression: DictionaryProvider\n): ReadonlyDictionary;\nexport function createDictionary(\n\texpression?: DictionaryProvider\n): DictionaryProvider {\n\treturn new MutableDictionary(expression);\n}\n","import { None } from \"./types\";\nimport { Scalar, ScalarProvider, ScalarConsumer, scalarValue } from \"./Scalar\";\n\nexport class Or\n\textends ScalarProvider\n\timplements ScalarConsumer\n{\n\tprivate _left_value: LeftValueType | None;\n\tprivate _subscriber: ScalarConsumer | undefined;\n\n\tconstructor(\n\t\treadonly left_source: ScalarProvider,\n\t\treadonly right_source: Scalar,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper();\n\t}\n\n\tget value(): LeftValueType | RightValueType {\n\t\tconst left_value = this.left_source.value;\n\t\treturn left_value === None ? scalarValue(this.right_source) : left_value;\n\t}\n\n\tupdate(left_value: LeftValueType | None) {\n\t\tif (this._left_value === None && this.right_source instanceof ScalarProvider) {\n\t\t\tthis.right_source.unsubscribe(this._subscriber!);\n\t\t}\n\t\tthis._left_value = left_value;\n\t\tif (left_value === None) {\n\t\t\tif (this.right_source instanceof ScalarProvider) {\n\t\t\t\tthis.right_source.subscribe(this._subscriber!);\n\t\t\t} else {\n\t\t\t\tthis._subscriber!.update(this.right_source);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._subscriber!.update(left_value);\n\t\t}\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer) {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tthis.left_source.subscribe(this);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tthis.left_source.unsubscribe(this);\n\t\tif (this.right_source instanceof ScalarProvider && this._left_value === None) {\n\t\t\tthis.right_source.unsubscribe(subscriber);\n\t\t}\n\t}\n}\n","import { ScalarConsumer, ScalarProvider, Scalar, scalarValue } from \"./Scalar\";\n\nexport class Pipe extends ScalarProvider implements ScalarConsumer {\n\tprivate _subscriber: ScalarConsumer | undefined;\n\tprivate _value: Scalar | undefined;\n\n\tconstructor(\n\t\treadonly source: ScalarProvider,\n\t\tprivate readonly fn: ($: InType) => Scalar,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper();\n\t}\n\n\tget value() {\n\t\tlet value: Scalar;\n\t\tif (this._subscriber === undefined) {\n\t\t\tvalue = this.fn(this.source.value);\n\t\t} else {\n\t\t\tvalue = this._value!;\n\t\t}\n\t\treturn scalarValue(value);\n\t}\n\n\tupdate(value: InType) {\n\t\tconst new_value = this.fn(value);\n\t\tif (new_value === this._value) return;\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.unsubscribe(this._subscriber!);\n\t\t}\n\t\tthis._value = new_value;\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.subscribe(this._subscriber!);\n\t\t} else {\n\t\t\tthis._subscriber!.update(this._value);\n\t\t}\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer): typeof subscriber {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tthis.source.subscribe(this);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tthis.source.unsubscribe(this);\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.unsubscribe(subscriber);\n\t\t}\n\t\tthis._value = undefined;\n\t}\n}\n","import { DictionaryProvider, DictionaryConsumer } from \"./Dictionary\";\nimport { Scalar, ScalarProvider, ScalarConsumer, scalarValue } from \"./Scalar\";\n\nclass ReductionStep extends ScalarProvider implements ScalarConsumer {\n\tprivate _result: ResultType;\n\tprivate _value_subscription: ScalarConsumer | undefined;\n\n\tconstructor(\n\t\tpublic source: Scalar,\n\t\tprivate _value: Scalar,\n\t\tprivate readonly fn: (accumulator: ResultType, value: ValueType) => ResultType,\n\t\tpublic subscriber: ScalarConsumer,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper();\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value_subscription = this._value.subscribe({\n\t\t\t\tupdate: (value) => this.updateValue(value),\n\t\t\t});\n\t\t}\n\t\tif (source instanceof ScalarProvider) {\n\t\t\tsource.subscribe(this);\n\t\t} else {\n\t\t\tthis.evaluate(source, scalarValue(this._value));\n\t\t}\n\t}\n\n\tget value() {\n\t\treturn scalarValue(this._result);\n\t}\n\n\tsetSource(source: Scalar) {\n\t\tthis.source = source;\n\t}\n\n\tprivate evaluate(accumulator: ResultType, value: ValueType) {\n\t\tconst new_result = this.fn(accumulator, value);\n\t\tif (new_result === this._result) return;\n\t\tthis._result = new_result;\n\t\tthis.subscriber.update(this._result);\n\t}\n\n\tprivate updateValue(value: ValueType) {\n\t\tthis.evaluate(scalarValue(this.source), value);\n\t}\n\n\tupdate(accumulator: ResultType) {\n\t\tthis.evaluate(accumulator, scalarValue(this._value));\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer): typeof subscriber {\n\t\tthis.subscriber = subscriber;\n\t\tsubscriber.update(this._result);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe() {\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.unsubscribe(this._value_subscription!);\n\t\t\tthis._value_subscription = undefined;\n\t\t}\n\t}\n}\n\nexport class Reduce\n\textends ScalarProvider\n\timplements DictionaryConsumer>, ScalarConsumer>\n{\n\tprivate _subscriber: ScalarConsumer | undefined;\n\tprivate _value: Scalar;\n\tprivate _steps = new Map>();\n\tprivate _dictionary_source: DictionaryProvider | undefined;\n\n\tconstructor(\n\t\treadonly scalar_source: Scalar>,\n\t\treadonly fn: (accumulator: ResultType, value: ValueType) => ResultType,\n\t\treadonly initial_value: ResultType,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper();\n\t\tthis._value = initial_value;\n\t}\n\n\tget value() {\n\t\tif (this._subscriber) {\n\t\t\treturn scalarValue(this._value!);\n\t\t} else {\n\t\t\tlet result = this.initial_value;\n\t\t\tfor (const value of [...scalarValue(this.scalar_source).entries.values()]) {\n\t\t\t\tresult = this.fn(result, scalarValue(value));\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t}\n\n\tupdate(value: DictionaryProvider) {\n\t\tthis._dictionary_source?.unsubscribe(this);\n\t\tthis._dictionary_source = value;\n\t\tfor (const step of this._steps.values()) {\n\t\t\tstep.unsubscribe();\n\t\t}\n\t\tthis._steps.clear();\n\t\tthis._value = this.initial_value;\n\t\tthis._dictionary_source.subscribe(this);\n\t\tif (this._dictionary_source.size.value === 0) {\n\t\t\tthis._subscriber!.update(this.initial_value);\n\t\t}\n\t}\n\n\tadd(key: KeyType, value: Scalar) {\n\t\tconst new_value = new ReductionStep(this._value, value, this.fn, this._subscriber!, this.__origin);\n\t\tthis._steps.set(key, new_value);\n\t\tthis._value = new_value;\n\t}\n\n\tremove(key: KeyType) {\n\t\tconst step = this._steps.get(key)!;\n\t\tthis._steps.delete(key);\n\t\tif (this._value === step) {\n\t\t\tthis._value = step.source;\n\t\t}\n\t\tif (step.subscriber instanceof ReductionStep) {\n\t\t\tstep.subscriber.setSource(step.source);\n\t\t}\n\t\tif (step.source instanceof ScalarProvider) {\n\t\t\tstep.source.subscribe(step.subscriber);\n\t\t} else {\n\t\t\tstep.subscriber.update(step.source);\n\t\t}\n\t\tstep.unsubscribe();\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer) {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tif (this.scalar_source instanceof ScalarProvider) {\n\t\t\tthis.scalar_source.subscribe(this);\n\t\t} else {\n\t\t\tthis.update(this.scalar_source);\n\t\t}\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\n\t\tif (this.scalar_source instanceof ScalarProvider) {\n\t\t\tthis.scalar_source.unsubscribe(this);\n\t\t}\n\t\tthis._dictionary_source!.unsubscribe(this);\n\t\tthis._dictionary_source = undefined;\n\n\t\tfor (const step of this._steps.values()) {\n\t\t\tstep.unsubscribe();\n\t\t}\n\t\tthis._steps.clear();\n\t\tthis._value = this.initial_value;\n\t}\n}\n","export abstract class ScalarProvider {\n\tabstract value: ValueType;\n\tabstract subscribe(subscriber: ScalarConsumer): typeof subscriber;\n\tabstract unsubscribe(subscriber: ScalarConsumer): void;\n}\n\nexport type Scalar = ScalarProvider | ValueType;\n\nexport interface ScalarConsumer {\n\tupdate(value: ValueType): void;\n}\n\nexport function scalarValue(scalar: Scalar): Type {\n\treturn scalar instanceof ScalarProvider ? scalar.value : scalar;\n}\n\nexport function onScalarValue(\n\tscalar: Scalar,\n\tonValue: (value: Type) => void,\n\tonSubscription?: (scalar: ScalarProvider, subscriber: ScalarConsumer) => void\n) {\n\tif (scalar instanceof ScalarProvider) {\n\t\tconst subscription = scalar.subscribe({ update: onValue });\n\t\tonSubscription?.(scalar, subscription);\n\t} else {\n\t\tonValue(scalar);\n\t}\n}\n","import { ScalarConsumer, ScalarProvider, Scalar } from \"./Scalar\";\n\nexport type Stategroup = { tag: string; value: unknown };\n\nexport class StateSwitch\n\textends ScalarProvider\n\timplements ScalarConsumer\n{\n\tprivate _subscriber: ScalarConsumer | undefined;\n\tprivate _value: { tag: InType[\"tag\"]; expression: Scalar } | undefined;\n\n\tconstructor(\n\t\treadonly source: ScalarProvider,\n\t\tprivate readonly states: {\n\t\t\t[key in InType[\"tag\"]]: ($: Extract[\"value\"]) => Scalar;\n\t\t},\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper();\n\t}\n\n\tprivate evaluate(value: InType): Scalar {\n\t\treturn this.states[value.tag as InType[\"tag\"]](value.value);\n\t}\n\n\tget value() {\n\t\tlet value: Scalar;\n\t\tif (this._subscriber === undefined) {\n\t\t\tvalue = this.evaluate(this.source.value);\n\t\t} else {\n\t\t\tvalue = this._value!.expression;\n\t\t}\n\t\treturn value instanceof ScalarProvider ? value.value : value;\n\t}\n\n\tupdate(value: InType) {\n\t\t/* TODO: because the ts api allows resetting the same state with different value this check cannot yet be enabled */\n\t\t// if (this._value?.tag === value.tag) return;\n\t\tif (this._value?.expression instanceof ScalarProvider) {\n\t\t\tthis._value.expression.unsubscribe(this._subscriber!);\n\t\t}\n\t\tthis._value = { tag: value.tag, expression: this.evaluate(value) };\n\t\tif (this._subscriber === undefined) return; // Guard against unsubscribing during evaluation\n\t\tif (this._value.expression instanceof ScalarProvider) {\n\t\t\tthis._value.expression.subscribe(this._subscriber!);\n\t\t} else {\n\t\t\tthis._subscriber!.update(this._value.expression);\n\t\t}\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer): typeof subscriber {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tthis.source.subscribe(this);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tthis.source.unsubscribe(this);\n\t\tif (this._value?.expression instanceof ScalarProvider) {\n\t\t\tthis._value.expression.unsubscribe(subscriber);\n\t\t}\n\t\tthis._value = undefined;\n\t}\n}\n","import { Destructable, DestructionObserver, Subscription } from \"../../destructables\";\nimport { ScalarProvider, ScalarConsumer, Scalar, scalarValue } from \"./Scalar\";\nimport { getSourceOriginFromStacktrace } from \"./ExpressionBuilder\";\n\nexport type ReadonlyVariable = ScalarProvider & Destructable;\n\nexport class MutableVariable\n\textends ScalarProvider\n\timplements ScalarConsumer, Destructable\n{\n\tprivate _value: Scalar;\n\tprivate readonly _subscribers = new Set>();\n\n\tconstructor(\n\t\tprivate readonly expression: Scalar,\n\t\tprivate _on_abandoned: (() => void) | undefined = undefined,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper();\n\t\tthis._value = expression;\n\t}\n\n\tset(value: ValueType) {\n\t\tif (this._destroyed) throw new Error(\"Trying to access destroyed variable\");\n\t\tif (this._value instanceof ScalarProvider && this._subscribers.size > 0) {\n\t\t\tthis._value.unsubscribe(this);\n\t\t}\n\t\tthis._value = value;\n\t\tthis.update(value);\n\t}\n\n\tensure(value: ValueType) {\n\t\tif (this._destroyed) throw new Error(\"Trying to access destroyed variable\");\n\t\tif (this._value === value) return;\n\t\tthis.set(value);\n\t}\n\n\tget value() {\n\t\tif (this._destroyed) throw new Error(\"Trying to access destroyed variable\");\n\t\treturn scalarValue(this._value);\n\t}\n\n\tupdate(value: ValueType) {\n\t\tfor (const subscriber of this._subscribers) {\n\t\t\tsubscriber.update(value);\n\t\t}\n\t}\n\n\tdiscard() {\n\t\tif (this._destroyed) throw new Error(\"Trying to access destroyed variable\");\n\t\tif (this._value === this.expression) return;\n\t\tthis._value = this.expression;\n\t\tif (this._subscribers.size > 0) {\n\t\t\tif (this._value instanceof ScalarProvider) {\n\t\t\t\tthis._value.subscribe(this);\n\t\t\t} else {\n\t\t\t\tthis.update(this._value);\n\t\t\t}\n\t\t}\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer) {\n\t\tif (this._destroyed) throw new Error(\"Trying to access destroyed variable\");\n\t\tif (this._subscribers.has(subscriber)) throw new Error(\"unexpected\");\n\t\tthis._subscribers.add(subscriber);\n\t\tif (this._subscribers.size === 1 && this._value instanceof ScalarProvider) {\n\t\t\tthis._value.subscribe(this);\n\t\t} else {\n\t\t\tsubscriber.update(this.value);\n\t\t}\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && !this._subscribers.has(subscriber)) throw new Error(\"unexpected\");\n\t\tthis._subscribers.delete(subscriber);\n\t\tif (this._value instanceof ScalarProvider && this._subscribers.size === 0) {\n\t\t\tthis._value.unsubscribe(this);\n\t\t\tthis._on_abandoned?.();\n\t\t}\n\t}\n\n\t/* Destructable interface implementation */\n\n\tprivate _destruction_observers?: Set;\n\tprivate _destroyed = false;\n\n\tdestroy(): void {\n\t\tif (this._destroyed) return;\n\t\tthis._destroyed = true;\n\n\t\tif (this._subscribers.size > 0) {\n\t\t\tthis._subscribers.clear();\n\t\t\tif (this._value instanceof ScalarProvider) {\n\t\t\t\tthis._value.unsubscribe(this);\n\t\t\t}\n\t\t}\n\n\t\tif (this._destruction_observers) {\n\t\t\tfor (const observer of this._destruction_observers) {\n\t\t\t\tobserver();\n\t\t\t}\n\t\t\tthis._destruction_observers.clear();\n\t\t}\n\t}\n\n\tget destroyed(): boolean {\n\t\treturn this._destroyed;\n\t}\n\n\tonDestroy(observer: DestructionObserver): Subscription {\n\t\tif (this.destroyed) {\n\t\t\tobserver();\n\t\t} else {\n\t\t\t(this._destruction_observers ??= new Set()).add(observer);\n\t\t}\n\t\treturn {\n\t\t\tunsubscribe: () => this._destruction_observers!.delete(observer),\n\t\t};\n\t}\n}\n\nexport function createVariable(\n\texpression: Scalar,\n\tmutable: false,\n\ton_abandoned?: () => void\n): ReadonlyVariable;\nexport function createVariable(\n\tdefault_value: Scalar,\n\tmutable: true,\n\ton_abandoned?: () => void\n): MutableVariable;\nexport function createVariable(\n\texpression: Scalar,\n\tmutable: boolean,\n\ton_abandoned: (() => void) | undefined\n): MutableVariable {\n\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\treturn new MutableVariable(expression, on_abandoned, origin);\n}\n","export function WeakCache(\n\tinit: (key: KeyType) => ValueType\n): (key: KeyType) => ValueType {\n\tconst map = new WeakMap();\n\treturn (key) => {\n\t\tif (map.has(key)) return map.get(key)!;\n\t\tconst value = init(key);\n\t\tmap.set(key, value);\n\t\treturn value;\n\t};\n}\n","export const None: unique symbol = Symbol(\"None\");\nexport type None = typeof None;\n","import { Scalar, ScalarProvider } from \"./Scalar\";\nimport { Destructable } from \"../../destructables\";\n\nexport async function awaitCondition(\n\tvariable: Scalar,\n\tcondition: (value: T) => value is S,\n\tdestructor?: Destructable\n): Promise;\nexport async function awaitCondition(\n\tvariable: Scalar,\n\tcondition: (value: T) => boolean,\n\tdestructor?: Destructable\n): Promise;\nexport async function awaitCondition(\n\tvariable: Scalar,\n\tcondition: ((value: T) => value is S) | ((value: T) => boolean),\n\tdestructor?: Destructable\n): Promise {\n\tif (!(variable instanceof ScalarProvider)) {\n\t\tif (!condition(variable)) throw new Error(\"unexpected\");\n\t\treturn Promise.resolve(variable as S);\n\t}\n\treturn new Promise((resolve) => {\n\t\tlet resolved = false;\n\t\tconst subscription = {\n\t\t\tupdate: (value: T) => {\n\t\t\t\tif (resolved) return;\n\t\t\t\tif (condition(value)) {\n\t\t\t\t\tresolved = true;\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tresolve(value as S);\n\t\t\t\t\t\tif (destructor) {\n\t\t\t\t\t\t\tdestructor.onDestroy(() => variable.unsubscribe(subscription));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvariable.unsubscribe(subscription);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tvariable.subscribe(subscription);\n\t});\n}\n","export * as api_manifest from \"../../../common/apis-gui-manifest\";\nexport * as api_configuration from \"../../../common/api_configuration-state\";\n","import { api_configuration, api_manifest } from \"common\";\nimport api_main = api_configuration.libraries.gui_definition_lib.types.main.alan_api;\nimport read_api_application = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_application_decorator = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport messages = require(\"./lib/front/messages\");\nimport ClientState = require(\"./lib/state/ClientState\");\nimport { engine_version, UNKNOWN_CLIENT_VERSION } from \"./lib/state/ClientState\";\nimport DestructorTree from \"./lib/DestructorTree\";\nimport openViewOnNode from \"./lib/front/openViewOnNode\";\nimport openLandingPage from \"./lib/front/openLandingPage\";\nimport { DatastoreConnection, DataStoreProtocolError, DatastoreProxy } from \"./lib/interface/DatastoreProxy\";\nimport { IdPathBuilder } from \"./lib/navigation/IdPathBuilder\";\nimport { authenticate, AuthenticationData } from \"./lib/state 2 interface/authentication\";\nimport { getFileFromWebServer, getFilesFromWebserver } from \"./lib/state 2 interface/webserver\";\nimport * as SourceMap from \"source-map\";\nimport clock from \"./lib/state/clock\";\nimport { decorate, DecoratedSchemas } from \"./lib/state/schema\";\nimport Window = require(\"./lib/widgets/dom/Window\");\nimport hash = require(\"./lib/widgets/dom/hash\");\nimport { initializeCollectionTable } from \"./lib/state/CollationTable\";\nimport { setupErrorHandlers } from \"./lib/error-logging\";\nimport * as deeplinkHandler from \"./lib/front/deeplinkHandler\";\nimport { translate } from \"./lib/front/translate\";\nimport { julian_datetime_2_js_date } from \"./lib/calendar/conversion\";\n\n(global) = window;\nlet package_fingerprint = \"\";\n\nwindow.onload = () => {\n\tsetupErrorHandlers((title, error_message) => {\n\t\tglobalFailMessage(`${title}. ${error_message}`);\n\t});\n\tstart();\n};\n\n(global as any).unexpectedState = function unexpectedState(state: never): never {\n\tthrow new Error(\"Unexpected state '\" + (state).name + \"'\");\n};\n\nfunction resetModifierKeys() {\n\tClientState.client_state.properties.alt_key_pressed.ensure(\"no\", {});\n\tClientState.client_state.properties.ctrl_key_pressed.ensure(\"no\", {});\n\tClientState.client_state.properties.shift_key_pressed.ensure(\"no\", {});\n\tClientState.client_state.properties.meta_key_pressed.ensure(\"no\", {});\n\tClientState.client_state.properties.toggle_key_pressed.ensure(\"no\", {});\n}\n\nlet root_destructor: DestructorTree | undefined = undefined;\nlet renderRoot: ((main: api_main.Cmain) => void) | undefined = (main: api_main.Cmain) => {\n\tif (root_destructor) {\n\t\troot_destructor.destroy();\n\t}\n\tdocument.body.innerHTML = \"\";\n\tconst window_name = main.properties.root_window.ref.key;\n\troot_destructor = new DestructorTree();\n\tWindow.initialize(\n\t\twindow_name,\n\t\t() => document.body,\n\t\troot_destructor,\n\t\tClientState.client_state.properties.windows.create(window_name, {\n\t\t\t\"has active view\": [\"no\", {}],\n\t\t\t\"open views\": {},\n\t\t})\n\t);\n\topenViewOnNode(IdPathBuilder.create(), main.properties.root_view.ref, main.properties.root_window.ref);\n\tswitch (main.input.settings.properties.allow_deeplink.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst yes_allow_deeplink = main.input.settings.properties.allow_deeplink.state.node;\n\t\t\tif (window_name === yes_allow_deeplink.properties.target_window.ref.key) {\n\t\t\t\tdeeplinkHandler.startListening(yes_allow_deeplink.properties.target_window.ref);\n\t\t\t\troot_destructor.onDestroy(deeplinkHandler.stopListening);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tbreak;\n\t}\n\n\topenLandingPage(ClientState.main);\n\n\tif (!window.navigator.onLine) {\n\t\tClientState.client_state.properties.network_connection_status.set(\"dead\", {});\n\t\tmessages.addMessage(\"warning\", \"Check your internet connection.\", { key: \"NETWORK_CONNECTION_DOWN\" });\n\t}\n\twindow.ononline = function () {\n\t\tClientState.client_state.properties.network_connection_status.set(\"alive\", {});\n\t\tmessages.removeMessage(\"NETWORK_CONNECTION_DOWN\");\n\t};\n\twindow.onoffline = function () {\n\t\tClientState.client_state.properties.network_connection_status.set(\"dead\", {});\n\t\tmessages.addMessage(\"warning\", \"Check your internet connection.\", { key: \"NETWORK_CONNECTION_DOWN\" });\n\t};\n\n\twindow.addEventListener(\"keydown\", handleModifierKeys);\n\twindow.addEventListener(\"keyup\", resetModifierKeys);\n\twindow.addEventListener(\"blur\", resetModifierKeys);\n\twindow.addEventListener(\"focus\", resetModifierKeys);\n\n\twindow.onbeforeunload = () => {\n\t\tswitch (ClientState.client_state.properties.root.properties.modified.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tcase \"yes\": {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(ClientState.client_state.properties.root.properties.modified.state);\n\t\t}\n\t};\n};\n\nfunction handleModifierKeys(event: KeyboardEvent) {\n\tif (event.altKey) {\n\t\tClientState.client_state.properties.alt_key_pressed.ensure(\"yes\", {});\n\t}\n\tif (event.ctrlKey) {\n\t\tClientState.client_state.properties.ctrl_key_pressed.ensure(\"yes\", {});\n\t}\n\tif (event.shiftKey) {\n\t\tClientState.client_state.properties.shift_key_pressed.ensure(\"yes\", {});\n\t}\n\tif (event.metaKey) {\n\t\tClientState.client_state.properties.meta_key_pressed.ensure(\"yes\", {});\n\t}\n\tClientState.client_state.properties.platform_family.switch({\n\t\tAndroid: () => {\n\t\t\tClientState.client_state.properties.ctrl_key_pressed.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: () => {\n\t\t\t\t\tClientState.client_state.properties.toggle_key_pressed.ensure(\"yes\", {});\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tLinux: () => {\n\t\t\tClientState.client_state.properties.ctrl_key_pressed.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: () => {\n\t\t\t\t\tClientState.client_state.properties.toggle_key_pressed.ensure(\"yes\", {});\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tWindows: () => {\n\t\t\tClientState.client_state.properties.ctrl_key_pressed.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: () => {\n\t\t\t\t\tClientState.client_state.properties.toggle_key_pressed.ensure(\"yes\", {});\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tiOS: () => {\n\t\t\tClientState.client_state.properties.alt_key_pressed.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: () => {\n\t\t\t\t\tClientState.client_state.properties.toggle_key_pressed.ensure(\"yes\", {});\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tmacOS: () => {\n\t\t\tClientState.client_state.properties.alt_key_pressed.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: () => {\n\t\t\t\t\tClientState.client_state.properties.toggle_key_pressed.ensure(\"yes\", {});\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tundetermined: () => {\n\t\t\tClientState.client_state.properties.ctrl_key_pressed.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: () => {\n\t\t\t\t\tClientState.client_state.properties.toggle_key_pressed.ensure(\"yes\", {});\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n}\n\nfunction globalFailMessage(message: string) {\n\tif (DatastoreProxy.instance) {\n\t\tDatastoreProxy.instance.connection.disconnectWebSocket();\n\t}\n\tstopSynchronizingServerTime();\n\trenderRoot = undefined;\n\n\twindow.ononline = null;\n\twindow.onoffline = null;\n\twindow.onbeforeunload = null;\n\twindow.removeEventListener(\"keydown\", handleModifierKeys);\n\twindow.removeEventListener(\"keyup\", resetModifierKeys);\n\twindow.removeEventListener(\"blur\", resetModifierKeys);\n\twindow.removeEventListener(\"focus\", resetModifierKeys);\n\n\tif (ClientState.main) {\n\t\tClientState.main.input.settings.properties.settings.properties.reload_on_unexpected_error.switch({\n\t\t\tenabled: function () {\n\t\t\t\twindow.location.reload();\n\t\t\t},\n\t\t\tdisabled: function () {\n\t\t\t\tdocument.title = \"Warning\";\n\t\t\t\tdocument.body.innerHTML =\n\t\t\t\t\t'
' +\n\t\t\t\t\tmessage +\n\t\t\t\t\t\" 
\";\n\t\t\t},\n\t\t});\n\t} else {\n\t\tdocument.title = \"Warning\";\n\t\tdocument.body.innerHTML =\n\t\t\t'
' +\n\t\t\tmessage +\n\t\t\t\" 
\";\n\t}\n\tglobal.errorCaughtAndSent = true; // do not report errors anymore\n}\n\nfunction globalMessage(message: string) {\n\tdocument.body.innerHTML =\n\t\t'
' +\n\t\tmessage +\n\t\t\" 
\";\n}\n\nasync function synchronizeServerTime(connection: DatastoreConnection) {\n\tconst julian_time = await connection.getServerTime();\n\tconst synchronization_time = Date.now();\n\tclock.setNowFunction(function () {\n\t\treturn julian_time + Math.round((Date.now() - synchronization_time) / 1000);\n\t});\n}\n\nlet serverTimeInterval: number | undefined = undefined;\nfunction startSynchronizingServerTime(connection: DatastoreConnection) {\n\tconst sync = () => {\n\t\tsynchronizeServerTime(connection);\n\t};\n\tserverTimeInterval = setInterval(sync, 60 * 1000);\n}\nfunction stopSynchronizingServerTime() {\n\tif (serverTimeInterval) {\n\t\tclearInterval(serverTimeInterval);\n\t}\n}\n\nglobal.sourceMapper = () => \"\";\n\nfunction initializeSourceMapper() {\n\tif (global.alan_debug) {\n\t\tfetch(\"engine/main.js\")\n\t\t\t.then((response) => response.text())\n\t\t\t.then((source) => {\n\t\t\t\t// split the string so that it itself is not matched in the source code\n\t\t\t\tconst sourceMappingURL = source.split(\"source\" + \"Mapping\" + \"URL=\")[1];\n\t\t\t\tlet decodedSource: string;\n\t\t\t\ttry {\n\t\t\t\t\tconst supportedEncodingRegexp = /^data:application\\/json;([\\w=:\"-]+;)*base64,/;\n\t\t\t\t\tconst match = sourceMappingURL.match(supportedEncodingRegexp);\n\t\t\t\t\tconst sourceMapStart = match![0].length;\n\t\t\t\t\tconst encodedSource = sourceMappingURL.substr(sourceMapStart);\n\t\t\t\t\tdecodedSource = window.atob(encodedSource);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst sourceMapConsumer = new SourceMap.SourceMapConsumer(decodedSource as any);\n\t\t\t\tglobal.sourceMapper = (lineNumber: number, columnNumber: number) => {\n\t\t\t\t\tconst location = sourceMapConsumer.originalPositionFor({\n\t\t\t\t\t\tline: lineNumber,\n\t\t\t\t\t\tcolumn: columnNumber,\n\t\t\t\t\t});\n\t\t\t\t\tif (location.source) {\n\t\t\t\t\t\treturn `${location.source}:${location.line}:${location.column}`;\n\t\t\t\t\t}\n\t\t\t\t\treturn \"\";\n\t\t\t\t};\n\t\t\t});\n\t}\n}\n\nasync function start() {\n\tglobal.file_storage_url = \"../platform_filesresource/\";\n\n\trewriteUrlParameters();\n\tglobal.alan_debug = hash.getDebug();\n\tinitializeSourceMapper();\n\ttry {\n\t\tawait checkEngineVersion();\n\t\tconst datastore_connection = new DatastoreConnection(undefined);\n\t\tconst application_name = await getApplicationName();\n\t\tconst authentication_data = await authenticate(application_name, datastore_connection);\n\t\tif (authentication_data !== undefined) {\n\t\t\tdatastore_connection.token = authentication_data.token;\n\t\t}\n\t\tconst devserver_port = hash.getDevserverPort();\n\t\tif (devserver_port !== null) {\n\t\t\thash.clearDevserverPort();\n\t\t\tconst url = new URL(\"http://localhost\");\n\t\t\turl.port = devserver_port;\n\t\t\turl.pathname = \"/client/\";\n\t\t\tconst params = new URLSearchParams(window.location.hash.slice(1));\n\t\t\tif (authentication_data !== undefined) {\n\t\t\t\tparams.set(\"u\", authentication_data.username);\n\t\t\t\tparams.set(\"t\", authentication_data.token);\n\t\t\t}\n\t\t\turl.hash = params.toString();\n\t\t\twindow.location.href = url.toString();\n\t\t\treturn;\n\t\t}\n\n\t\tconst raw_manifest = await getFileFromWebServer(\"gui_definition/.manifest\", JSON.parse);\n\t\tconst manifest = api_manifest.initialize(raw_manifest, \"gui_definition/\");\n\n\t\tawait Promise.all([\n\t\t\tgetFilesFromWebserver(\n\t\t\t\t[\n\t\t\t\t\tmanifest.root[\"main.alan\"].path,\n\t\t\t\t\tmanifest.root[\"settings.alan\"].path,\n\t\t\t\t\tmanifest.root[\"phrases.alan\"].path,\n\t\t\t\t\tmanifest.root[\"model.alan\"].path,\n\t\t\t\t\tmanifest.root[\"model\"][\"application.alan\"].path,\n\t\t\t\t\tmanifest.root[\"client.lib\"][\"client_bindings.alan\"].path,\n\t\t\t\t],\n\t\t\t\tJSON.parse\n\t\t\t).then(async (result) => {\n\t\t\t\tconst application_model = api_application_decorator.Capplication.create(\n\t\t\t\t\tresult[manifest.root[\"model\"][\"application.alan\"].path]\n\t\t\t\t);\n\t\t\t\tpackage_fingerprint = manifest.fingerprint;\n\t\t\t\tconst views_to_get = Object.entries(manifest.root.views).map((value) => value[1].path);\n\t\t\t\tconst translations_to_get = Object.entries(manifest.root.translations).map((value) => value[1].path);\n\t\t\t\tconst widgets_to_get = Object.entries(manifest.root.widgets).map((value) => value[1].path);\n\t\t\t\tconst controls_to_get = Object.entries(manifest.root[\"control-bundle.lib\"][\"controls.lib\"].controls).map(\n\t\t\t\t\t(value) => value[1][\"control.alan\"].path\n\t\t\t\t);\n\t\t\t\tglobal.control_media_directory = \"gui_definition/package/control-bundle.lib/package/controls.lib/package/media\";\n\n\t\t\t\tconst control_implementations = Object.entries(manifest.root[\"control-bundle.lib\"])\n\t\t\t\t\t.filter((file) => /\\.js$/.test(file[0]))\n\t\t\t\t\t.map((value) => (value[1] as api_manifest.ManifestFile).path);\n\t\t\t\tconst control_styles = Object.entries(manifest.root[\"control-bundle.lib\"])\n\t\t\t\t\t.filter((file) => /\\.css$/.test(file[0]))\n\t\t\t\t\t.map((value) => (value[1] as api_manifest.ManifestFile).path);\n\t\t\t\tconst reports_to_get = Object.entries(manifest.root.reports).map((value) => value[1][\"parameters.alan\"].path);\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tcontrol_styles.map(\n\t\t\t\t\t\t(css_path) =>\n\t\t\t\t\t\t\tnew Promise((resolve) => {\n\t\t\t\t\t\t\t\tconst link = document.createElement(\"link\");\n\t\t\t\t\t\t\t\tlink.type = \"text/css\";\n\t\t\t\t\t\t\t\tlink.rel = \"stylesheet\";\n\t\t\t\t\t\t\t\tlink.href = css_path;\n\t\t\t\t\t\t\t\tlink.onload = () => resolve();\n\t\t\t\t\t\t\t\tdocument.head.append(link);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tcontrol_implementations.map(\n\t\t\t\t\t\t(script_source) =>\n\t\t\t\t\t\t\tnew Promise((resolve) => {\n\t\t\t\t\t\t\t\t// Load the control implementations later than the stylesheets to prevent weird\n\t\t\t\t\t\t\t\t// style and font artifacts.\n\t\t\t\t\t\t\t\tconst script = document.createElement(\"script\");\n\t\t\t\t\t\t\t\tscript.type = \"text/javascript\";\n\t\t\t\t\t\t\t\tscript.src = script_source;\n\t\t\t\t\t\t\t\tscript.onload = () => resolve();\n\t\t\t\t\t\t\t\tdocument.head.append(script);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tconst additional_file_result = await getFilesFromWebserver(\n\t\t\t\t\tviews_to_get\n\t\t\t\t\t\t.concat(translations_to_get)\n\t\t\t\t\t\t.concat(widgets_to_get)\n\t\t\t\t\t\t.concat(controls_to_get)\n\t\t\t\t\t\t.concat(reports_to_get),\n\t\t\t\t\tJSON.parse\n\t\t\t\t);\n\t\t\t\tinitializeClientState(\n\t\t\t\t\tdecorate(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgui_model: result[manifest.root[\"model.alan\"].path],\n\t\t\t\t\t\t\twidgets: Object.entries(manifest.root.widgets).reduce>((result, [key, file]) => {\n\t\t\t\t\t\t\t\tresult[key] = additional_file_result[file.path];\n\t\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t\t}, {}),\n\t\t\t\t\t\t\tmain: result[manifest.root[\"main.alan\"].path],\n\t\t\t\t\t\t\tphrases: result[manifest.root[\"phrases.alan\"].path],\n\t\t\t\t\t\t\tsettings: result[manifest.root[\"settings.alan\"].path],\n\t\t\t\t\t\t\tclient_bindings: result[manifest.root[\"client.lib\"][\"client_bindings.alan\"].path],\n\t\t\t\t\t\t\tcontrols: Object.entries(manifest.root[\"control-bundle.lib\"][\"controls.lib\"].controls).reduce<\n\t\t\t\t\t\t\t\tRecord\n\t\t\t\t\t\t\t>(function (c, [control_name, file]) {\n\t\t\t\t\t\t\t\tc[control_name] = additional_file_result[file[\"control.alan\"].path];\n\t\t\t\t\t\t\t\treturn c;\n\t\t\t\t\t\t\t}, {}),\n\t\t\t\t\t\t\tviews: Object.entries(manifest.root.views).reduce>(function (v, [view_name, file]) {\n\t\t\t\t\t\t\t\tv[view_name] = additional_file_result[file.path];\n\t\t\t\t\t\t\t\treturn v;\n\t\t\t\t\t\t\t}, {}),\n\t\t\t\t\t\t\treports: Object.entries(manifest.root.reports).reduce>(function (\n\t\t\t\t\t\t\t\tr,\n\t\t\t\t\t\t\t\t[report_name, file]\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tr[report_name] = additional_file_result[file[\"parameters.alan\"].path];\n\t\t\t\t\t\t\t\treturn r;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{}),\n\t\t\t\t\t\t\ttranslations: Object.entries(manifest.root.translations).reduce>(function (\n\t\t\t\t\t\t\t\tt,\n\t\t\t\t\t\t\t\t[translation_name, file]\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tt[translation_name] = additional_file_result[file.path];\n\t\t\t\t\t\t\t\treturn t;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tapplication_model\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tif (authentication_data !== undefined) {\n\t\t\t\t\tconst uri = await datastore_connection.getAuthenticationUri();\n\t\t\t\t\tconst request = new XMLHttpRequest();\n\t\t\t\t\tconst appendSlash = (text: string) => text + (text.charAt(text.length - 1) === \"/\" ? \"\" : \"/\");\n\t\t\t\t\trequest.open(\"POST\", appendSlash(uri) + \"request\");\n\t\t\t\t\trequest.setRequestHeader(\"Content-Type\", \"application/json\");\n\t\t\t\t\trequest.onload = () => {\n\t\t\t\t\t\tif (request.status === 200) {\n\t\t\t\t\t\t\tconst reponse_message: {\n\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\"known uris\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\turis: {\n\t\t\t\t\t\t\t\t\t\t\t[key: string]: { name: string };\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t} = JSON.parse(request.responseText);\n\t\t\t\t\t\t\tconst uris = reponse_message.type[1].uris;\n\t\t\t\t\t\t\tconst sorted_uris = Object.keys(reponse_message.type[1].uris)\n\t\t\t\t\t\t\t\t.map((key) => ({\n\t\t\t\t\t\t\t\t\tname: uris[key].name,\n\t\t\t\t\t\t\t\t\turl: key,\n\t\t\t\t\t\t\t\t}))\n\t\t\t\t\t\t\t\t.sort((a, b) => a.name.localeCompare(b.name));\n\t\t\t\t\t\t\tsorted_uris.forEach((uri) => {\n\t\t\t\t\t\t\t\tif (appendSlash(uri.url) !== appendSlash(window.location.origin + window.location.pathname)) {\n\t\t\t\t\t\t\t\t\tconst new_module = ClientState.client_state.properties.modules.create(uri.url, {\n\t\t\t\t\t\t\t\t\t\tname: uri.name,\n\t\t\t\t\t\t\t\t\t\t\"has logo\": \"no\",\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tconst logo_request = new XMLHttpRequest();\n\t\t\t\t\t\t\t\t\tconst logo_url = appendSlash(uri.url) + \"data/logo.png\";\n\t\t\t\t\t\t\t\t\tlogo_request.open(\"GET\", logo_url);\n\t\t\t\t\t\t\t\t\tlogo_request.onload = () => {\n\t\t\t\t\t\t\t\t\t\tif (logo_request.status === 200) {\n\t\t\t\t\t\t\t\t\t\t\tnew_module.properties.has_logo.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\turl: logo_url,\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tlogo_request.send();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\trequest.send(\n\t\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"known uris\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttoken: authentication_data.token,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst data_manifest = await getFileFromWebServer(\"data/.manifest\");\n\t\t\t\tconst files = data_manifest.split(\"\\n\").filter((f) => f.length > 1);\n\t\t\t\tconst handlers: Record void | Promise> = {\n\t\t\t\t\t\"logo.png\": (name) => {\n\t\t\t\t\t\tClientState.client_state.set_logo_url(\"data/\" + name);\n\t\t\t\t\t},\n\t\t\t\t\t\"logo-sideways.png\": (name) => {\n\t\t\t\t\t\tClientState.client_state.set_logo_sideways_url(\"data/\" + name);\n\t\t\t\t\t},\n\t\t\t\t\t\"config.json\": (name) =>\n\t\t\t\t\t\tgetFileFromWebServer(\"data/\" + name, JSON.parse).then((config) => {\n\t\t\t\t\t\t\tif (config[\"include data in error log\"]) {\n\t\t\t\t\t\t\t\tglobal.logClientStateOnError = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t};\n\t\t\t\tawait Promise.all(files.map((file) => handlers[file](file)));\n\t\t\t\tinitializeDataStoreProxy(application_model, authentication_data, datastore_connection);\n\t\t\t}),\n\t\t\t(async () => {\n\t\t\t\tconst raw_collation_table = await getFileFromWebServer(\n\t\t\t\t\tmanifest.root[\"collation_table.alan.json\"].path,\n\t\t\t\t\tJSON.parse\n\t\t\t\t);\n\t\t\t\tinitializeCollectionTable(raw_collation_table);\n\t\t\t})(),\n\t\t]);\n\t} catch (e) {\n\t\tif (e instanceof DataStoreProtocolError) {\n\t\t\tglobalMessage(\"Could not connect to the datastore. Please wait, we will try again.\");\n\t\t\tsetTimeout(() => {\n\t\t\t\tstart();\n\t\t\t}, 1000);\n\t\t}\n\t\tif (typeof e === \"string\") {\n\t\t\tglobalFailMessage(\"The application could not be loaded. Refresh to try again.\");\n\t\t} else {\n\t\t\tthrow e;\n\t\t}\n\t}\n}\n\nasync function getApplicationName(): Promise {\n\tif (ClientState.settings) {\n\t\tconst application_name_phrase = ClientState.settings.properties.settings.properties.application_name.entry;\n\t\treturn Promise.resolve(\n\t\t\tClientState.client_state.properties.selected_language.ref.key.ref.properties.translations.get(\n\t\t\t\tapplication_name_phrase\n\t\t\t)!.properties.translation\n\t\t);\n\t}\n\tconst raw_settings = await getFileFromWebServer(\"gui_definition/package/settings.alan.json\", JSON.parse);\n\treturn raw_settings.settings[\"application name\"];\n}\n\nfunction initializeClientState(schemas: DecoratedSchemas) {\n\tClientState.initialize(schemas);\n\tconst hash_language = hash.getLanguage();\n\tif (hash_language !== null) {\n\t\thash.clearLanguage();\n\t}\n\tconst lang_initialization_value = hash_language ?? window.localStorage.getItem(\"language\");\n\tif (\n\t\tlang_initialization_value &&\n\t\tClientState.main.input.settings.input.languages[lang_initialization_value] !== undefined\n\t) {\n\t\tClientState.client_state.set_selected_language(lang_initialization_value);\n\t}\n\n\tfunction platformMatch(platform: string) {\n\t\tif (navigator.platform.toLowerCase().search(platform) !== -1) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (platformMatch(\"mac\")) {\n\t\tClientState.client_state.properties.platform_family.set(\"macOS\", {});\n\t} else if (platformMatch(\"ipad\") || platformMatch(\"iphone\")) {\n\t\tClientState.client_state.properties.platform_family.set(\"iOS\", {});\n\t} else if (platformMatch(\"linux\")) {\n\t\tClientState.client_state.properties.platform_family.set(\"Linux\", {});\n\t} else if (platformMatch(\"android\")) {\n\t\tClientState.client_state.properties.platform_family.set(\"Android\", {});\n\t} else if (platformMatch(\"win\")) {\n\t\tClientState.client_state.properties.platform_family.set(\"Windows\", {});\n\t} else {\n\t\tClientState.client_state.properties.platform_family.set(\"undetermined\", {});\n\t}\n\n\tfunction browserMatch(browser: string) {\n\t\tif (navigator.userAgent.toLowerCase().search(browser) !== -1) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (browserMatch(\"edge\")) {\n\t\tClientState.client_state.properties.browser_family.set(\"Edge\", {});\n\t} else if (browserMatch(\"safari\") && !browserMatch(\"chrome\")) {\n\t\tClientState.client_state.properties.browser_family.set(\"Safari\", {});\n\t} else if (browserMatch(\"chrome\")) {\n\t\tClientState.client_state.properties.browser_family.set(\"Chromium\", {});\n\t} else {\n\t\tClientState.client_state.properties.browser_family.set(\"undetermined\", {});\n\t}\n\n\tClientState.client_state.set_version(engine_version.trim());\n\tClientState.client_state.subscribe_selected_language({\n\t\ton_update: function () {\n\t\t\tdocument.documentElement.lang = ClientState.client_state.properties.selected_language.entry.substr(\n\t\t\t\t0,\n\t\t\t\tClientState.client_state.properties.selected_language.entry.indexOf(\".\")\n\t\t\t);\n\t\t\tdocument.title = ClientState.client_state.properties.selected_language.ref.key.ref.properties.translations.get(\n\t\t\t\tClientState.main.input.settings.properties.settings.properties.application_name.entry\n\t\t\t)!.properties.translation;\n\t\t\twindow.localStorage.setItem(\"language\", ClientState.client_state.properties.selected_language.entry);\n\t\t},\n\t});\n\tClientState.settings.properties.settings.properties.content_selection.switch({\n\t\tenabled: function () {\n\t\t\tdocument.body.classList.remove(\"engine-content-selection-disabled\");\n\t\t},\n\t\tdisabled: function () {\n\t\t\tdocument.body.classList.add(\"engine-content-selection-disabled\");\n\t\t},\n\t});\n\tif (hash.getUpdated() !== null) {\n\t\tmessages.addMessage(\"success\", \"The application is updated\");\n\t\thash.clearUpdated();\n\t}\n}\n\nexport function initializeDataStoreProxy(\n\tapplication_model: read_api_application.Capplication,\n\tauthentication_data: AuthenticationData | undefined,\n\tconnection: DatastoreConnection\n) {\n\tif (DatastoreProxy.instance) {\n\t\t(DatastoreProxy.instance as any) = null;\n\t}\n\tDatastoreProxy.instance = new DatastoreProxy(application_model, connection);\n\tDatastoreProxy.instance\n\t\t.on(\"connect\", () => {\n\t\t\tstartSynchronizingServerTime(connection);\n\t\t\tclearWindowsFromClientState();\n\t\t\tsetAuthenticationStatus(authentication_data, connection);\n\t\t\trenderRoot?.(ClientState.main);\n\t\t\twindow.onunload = function () {\n\t\t\t\tDatastoreProxy.instance.unSubscribeAll();\n\t\t\t};\n\t\t})\n\t\t.on(\"reconnect\", () => {\n\t\t\tClientState.client_state.properties.server_connection_status.set(\"alive\", {});\n\t\t\tmessages.removeMessage(\"SERVER_DISCONNECTED\");\n\t\t\tstartSynchronizingServerTime(connection);\n\n\t\t\tgetFilesFromWebserver([\"gui_definition/.manifest\", \"engine/version.txt\"])\n\t\t\t\t.then((result) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tpackage_fingerprint !== JSON.parse(result[\"gui_definition/.manifest\"]).fingerprint ||\n\t\t\t\t\t\tengine_version !== result[\"engine/version.txt\"]\n\t\t\t\t\t) {\n\t\t\t\t\t\tdeeplinkHandler.stopListening();\n\t\t\t\t\t\thash.setUpdated();\n\t\t\t\t\t\tconst hash_before_destroy = window.location.hash;\n\t\t\t\t\t\troot_destructor?.destroy();\n\t\t\t\t\t\twindow.location.hash = hash_before_destroy;\n\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch((e) => {\n\t\t\t\t\tif (typeof e === \"string\") {\n\t\t\t\t\t\tglobalFailMessage(\"The application could not be loaded. Refresh to try again.\");\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t})\n\t\t.on(\"disconnect\", () => {\n\t\t\tClientState.client_state.properties.server_connection_status.set(\"dead\", {});\n\t\t\tstopSynchronizingServerTime();\n\t\t\tmessages.addMessage(\"waiting\", \"Performing maintenance, please wait…\", { key: \"SERVER_DISCONNECTED\" });\n\t\t})\n\t\t.on(\"invalid token\", async () => {\n\t\t\tstopSynchronizingServerTime();\n\t\t\tconst application_name = await getApplicationName();\n\t\t\tconst authentication_data = await authenticate(application_name, DatastoreProxy.instance.connection);\n\t\t\tsetAuthenticationStatus(authentication_data, connection);\n\t\t})\n\t\t.on_announcement((message) => {\n\t\t\tmessages.addMessage(\"success\", \"Server announcement\", {\n\t\t\t\traw_body: parseServerAnnouncement(message),\n\t\t\t});\n\t\t});\n}\n\nfunction parseServerAnnouncement(message: string) {\n\ttry {\n\t\tconst parsed_message: {\n\t\t\tmessage: [\"unstructured\", { text: string }] | [\"maintenance\", { at: number }];\n\t\t} = JSON.parse(message);\n\t\tswitch (parsed_message.message[0]) {\n\t\t\tcase \"unstructured\":\n\t\t\t\treturn parsed_message.message[1].text ?? message;\n\t\t\tcase \"maintenance\": {\n\t\t\t\tconst timestamp = parsed_message.message[1].at;\n\t\t\t\tif (timestamp !== undefined) {\n\t\t\t\t\treturn translate(\"Updated scheduled\") + \" \" + julian_datetime_2_js_date(timestamp).toString();\n\t\t\t\t}\n\t\t\t\treturn message;\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\treturn message;\n\t}\n}\n\nfunction setAuthenticationStatus(authentication_data: AuthenticationData | undefined, connection: DatastoreConnection) {\n\tif (authentication_data !== undefined) {\n\t\tconnection.token = authentication_data.token;\n\t}\n\tif (connection.token) {\n\t\tClientState.client_state.properties.session.properties.status.set(\"authenticated\", {\n\t\t\ttoken: connection.token,\n\t\t\t\"anonymous session\": [\n\t\t\t\t\"no\",\n\t\t\t\t{\n\t\t\t\t\tusername: authentication_data?.username ?? \"\",\n\t\t\t\t\t\"user found\": [\"no\", {}],\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t} else {\n\t\tClientState.client_state.properties.session.properties.status.set(\"authenticated\", {\n\t\t\ttoken: \"\",\n\t\t\t\"anonymous session\": [\"yes\", {}],\n\t\t});\n\t}\n}\n\nasync function checkEngineVersion(): Promise {\n\tconst result = await getFilesFromWebserver([\"engine/version.txt\"]);\n\tif (engine_version === UNKNOWN_CLIENT_VERSION) {\n\t\tClientState.engine_version = result[\"engine/version.txt\"];\n\t} else if (engine_version !== result[\"engine/version.txt\"]) {\n\t\tglobalFailMessage(\"A new version is available. Refresh to continue.\");\n\t\tthrow new Error(\"Newer engine is available.\");\n\t}\n}\n\nfunction clearWindowsFromClientState() {\n\tif (ClientState.client_state) {\n\t\tClientState.client_state.transact(() => {\n\t\t\tconst attributes = ClientState.client_state.properties.root.properties.attributes;\n\t\t\tfor (const [name] of attributes.entries()) {\n\t\t\t\tattributes.delete(name);\n\t\t\t}\n\t\t\tconst root_queries = ClientState.client_state.properties.root.properties.queries;\n\t\t\tfor (const [name] of root_queries) {\n\t\t\t\troot_queries.delete(name);\n\t\t\t}\n\t\t\tClientState.client_state.properties.windows.forEach(($) => {\n\t\t\t\tWindow.getWindowInstance($.key.entry).destructor.destroy();\n\t\t\t});\n\t\t});\n\t}\n}\n\nfunction rewriteUrlParameters() {\n\tconst search_params = new URLSearchParams(window.location.hash.substring(1));\n\tconst serialized_parameters = search_params.get(\"parameters\");\n\tif (serialized_parameters) {\n\t\tsearch_params.delete(\"parameters\");\n\t\tlet deserialized_parameters = \"\";\n\t\ttry {\n\t\t\tdeserialized_parameters = atob(serialized_parameters);\n\t\t} catch (\n\t\t\te\n\t\t\t// eslint-disable-next-line no-empty\n\t\t) {}\n\t\tif (deserialized_parameters) {\n\t\t\tconst orginal_seach_params = new URLSearchParams(deserialized_parameters);\n\t\t\tfor (const entry of orginal_seach_params) {\n\t\t\t\tif (entry[0] !== \"parameters\") {\n\t\t\t\t\tsearch_params.append(entry[0], entry[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst url = new URL(window.location.href);\n\t\turl.hash = search_params.toString();\n\t\twindow.location.replace(url.toString());\n\t}\n}\n","import { api_configuration } from \"../common\";\nimport { ObserversOfType } from \"./types\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_modifications = api_configuration.types.modifications.alan_api;\n\nexport function addChild(parent: api_cs.IDestructable, child?: DestructorTree): DestructorTree;\nexport function addChild(parent: api_cs.IDestructable, child: api_cs.IDestructable): api_cs.IDestructable;\nexport function addChild(\n\tparent: api_cs.IDestructable,\n\tchild: DestructorTree | api_cs.IDestructable = new DestructorTree()\n): DestructorTree | api_cs.IDestructable {\n\tif (parent.destroyed) {\n\t\tchild.destroy();\n\t} else {\n\t\tconst subscription = parent.onDestroy(() => child.destroy());\n\t\tchild.onDestroy(() => subscription.unsubscribe());\n\t}\n\treturn child;\n}\n\nexport default class DestructorTree implements api_cs.IDestructable {\n\tprivate __private__parent?: api_cs.IDestructable;\n\tprivate _children?: Set;\n\tprivate _observers?: Set;\n\tprivate _destroyed = false;\n\n\tstatic create(): DestructorTree {\n\t\treturn new DestructorTree();\n\t}\n\tpublic get destroyed(): boolean {\n\t\treturn this._destroyed;\n\t}\n\n\tdestroy(): void {\n\t\tif (this._destroyed) return;\n\t\tthis._destroyed = true;\n\t\tif (this.__private__parent) {\n\t\t\t(this.__private__parent as DestructorTree)._children?.delete(this);\n\t\t}\n\t\tif (this._children) {\n\t\t\tfor (const child of this._children) {\n\t\t\t\tchild.destroy();\n\t\t\t}\n\t\t}\n\t\tif (this._observers) {\n\t\t\tfor (const observer of this._observers) {\n\t\t\t\tobserver();\n\t\t\t}\n\t\t\tthis._observers.clear();\n\t\t}\n\t}\n\n\tonDestroy(observer: api_cs.DestructionObserver): api_cs.Subscription {\n\t\tif (this.destroyed) {\n\t\t\tobserver();\n\t\t} else {\n\t\t\t(this._observers ??= new Set()).add(observer);\n\t\t}\n\t\treturn {\n\t\t\tunsubscribe: () => this._observers?.delete(observer),\n\t\t};\n\t}\n\n\taddChild(child?: DestructorTree): DestructorTree;\n\taddChild(child: api_cs.IDestructable): api_cs.IDestructable;\n\taddChild(child: DestructorTree | api_cs.IDestructable = new DestructorTree()): DestructorTree | api_cs.IDestructable {\n\t\tif (this.destroyed) {\n\t\t\tchild.destroy();\n\t\t} else {\n\t\t\t(this._children ??= new Set()).add(child);\n\t\t\t(child as any).__private__parent = this;\n\t\t}\n\t\treturn child;\n\t}\n\n\tsubscribeToText(\n\t\tobject: T,\n\t\tsubscribe_function_name: ObserversOfType,\n\t\tcallback: (value: string, destructor: DestructorTree, first: boolean) => void,\n\t\tinit = true\n\t): void {\n\t\tthis.subscribeToValue(\n\t\t\tobject,\n\t\t\tsubscribe_function_name,\n\t\t\t(destructor, first, value) => callback(value, destructor, first),\n\t\t\tinit\n\t\t);\n\t}\n\n\tsubscribeToNumber(\n\t\tobject: T,\n\t\tsubscribe_function_name: ObserversOfType,\n\t\tcallback: (value: number, destructor: DestructorTree, first: boolean) => void,\n\t\tinit = true\n\t): void {\n\t\tthis.subscribeToValue(\n\t\t\tobject,\n\t\t\tsubscribe_function_name,\n\t\t\t(destructor, first, value) => callback(value, destructor, first),\n\t\t\tinit\n\t\t);\n\t}\n\n\tsubscribeToStategroup>(\n\t\tstategroup: T,\n\t\tcallback: (destructor: DestructorTree, first: boolean) => void,\n\t\tinit = true\n\t): void {\n\t\tif (stategroup.subscribe !== undefined) {\n\t\t\tthis.subscribeToValue(stategroup, \"subscribe\", callback, init);\n\t\t} else if (init) {\n\t\t\tcallback(this.addChild(), true);\n\t\t}\n\t}\n\n\tsubscribeToCollection(\n\t\tdictionary: api_cs.AlanDictionary<{ node: T; init: any }, any>,\n\t\tcallbacks: {\n\t\t\ton_add?: (entry: T, destructor: DestructorTree, init: () => boolean) => void;\n\t\t\ton_remove?: (key: string) => void;\n\t\t\ton_change?: () => void;\n\t\t},\n\t\tinit = false\n\t): void {\n\t\tif (this.destroyed || dictionary.destroyed) return;\n\t\tconst children = new Map();\n\t\tconst on_add = (entry: T, init: boolean) => {\n\t\t\tconst key: string = entry.key_value;\n\t\t\tconst entry_destructor = this.addChild();\n\t\t\tchildren.get(key)?.destroy();\n\t\t\tchildren.set(key, entry_destructor);\n\t\t\tentry.onDestroy(() => on_remove(key));\n\t\t\tcallbacks.on_add?.(entry, entry_destructor, () => init);\n\t\t\tinit = false;\n\t\t};\n\t\tconst on_remove = (key: string) => {\n\t\t\tif (this.destroyed || dictionary.destroyed) return;\n\t\t\tchildren.get(key)?.destroy();\n\t\t\tchildren.delete(key);\n\t\t\tcallbacks.on_remove?.(key);\n\t\t\tcallbacks.on_change?.();\n\t\t};\n\t\tif (init) {\n\t\t\tfor (const entry of dictionary.values()) {\n\t\t\t\ton_add(entry, true);\n\t\t\t}\n\t\t\tcallbacks.on_change?.();\n\t\t}\n\t\tconst observer = dictionary.subscribe({\n\t\t\ton_add: (e) => {\n\t\t\t\tif (this.destroyed) return;\n\t\t\t\ton_add(e, false);\n\t\t\t\tcallbacks.on_change?.();\n\t\t\t},\n\t\t\ton_remove: (key) => {\n\t\t\t\ton_remove(key);\n\t\t\t},\n\t\t});\n\t\tthis.onDestroy(() => {\n\t\t\tobserver.unsubscribe();\n\t\t});\n\t}\n\n\tsubscribeToEntry(\n\t\tdictionary: api_cs.AlanDictionary<{ node: T; init: any }, any>,\n\t\tkey: string,\n\t\tcallbacks: {\n\t\t\ton_add?: (entry: T, destructor: DestructorTree) => void;\n\t\t\ton_remove?: () => void;\n\t\t},\n\t\tinit = true\n\t): void {\n\t\tif (this.destroyed || dictionary.destroyed) return;\n\t\tlet entry_destructor: DestructorTree;\n\t\tif (init) {\n\t\t\tif (dictionary.has(key)) {\n\t\t\t\tentry_destructor = this.addChild();\n\t\t\t\tcallbacks.on_add?.(dictionary.get(key)!, entry_destructor);\n\t\t\t} else {\n\t\t\t\tcallbacks.on_remove?.();\n\t\t\t}\n\t\t}\n\t\tconst observer = dictionary.subscribe({\n\t\t\ton_add: (entry) => {\n\t\t\t\tif (this.destroyed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst added_key: string = entry.key_value;\n\t\t\t\tif (added_key === key) {\n\t\t\t\t\tentry_destructor?.destroy();\n\t\t\t\t\tentry_destructor = this.addChild();\n\t\t\t\t\tcallbacks.on_add?.(entry, entry_destructor);\n\t\t\t\t}\n\t\t\t},\n\t\t\ton_remove: (removed_key) => {\n\t\t\t\tif (this.destroyed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (removed_key === key) {\n\t\t\t\t\tentry_destructor?.destroy();\n\t\t\t\t\tcallbacks.on_remove?.();\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tthis.onDestroy(() => {\n\t\t\tobserver.unsubscribe();\n\t\t});\n\t}\n\n\tprivate subscribeToValue api_cs.Subscription>(\n\t\tobject: api_cs.IDestructable,\n\t\tsubscribe_function_name: string | number | symbol,\n\t\tcallback: (destructor: DestructorTree, first: boolean, value?: string | number) => void,\n\t\tinit: boolean\n\t) {\n\t\tif (this.destroyed || object.destroyed) return;\n\t\tlet child_destructor: DestructorTree | undefined;\n\t\tlet first = true;\n\t\tconst observer = ((object as any)[subscribe_function_name] as T)({\n\t\t\ton_update: (value) => {\n\t\t\t\tif (this.destroyed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (first && !init) {\n\t\t\t\t\tfirst = false;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tchild_destructor?.destroy();\n\t\t\t\tchild_destructor = this.addChild();\n\t\t\t\tcallback(child_destructor, first, value);\n\t\t\t},\n\t\t});\n\t\tconst destruction_observer = object.onDestroy(() => child_destructor?.destroy());\n\t\tthis.onDestroy(() => {\n\t\t\tobserver.unsubscribe();\n\t\t\tdestruction_observer.unsubscribe();\n\t\t});\n\t}\n}\n","import { ObservableNumber } from \"./observableTypes\";\nimport DestructorTree from \"./DestructorTree\";\n\nexport default class ReferenceCounter extends ObservableNumber {\n\tprivate on_empty_handlers = new Map<() => void, boolean>();\n\tprivate on_destroy_handlers = new Set<() => void>();\n\tprivate _destroyed = false;\n\tconstructor() {\n\t\tsuper(0);\n\t}\n\tget destroyed(): boolean {\n\t\treturn this._destroyed;\n\t}\n\tprivate deregister(): void {\n\t\tif (this.destroyed) return;\n\t\tthis.decrement();\n\t\tif (this.value <= 0) {\n\t\t\tfor (const [handler, persist] of this.on_empty_handlers) {\n\t\t\t\thandler();\n\t\t\t\tif (!persist) {\n\t\t\t\t\tthis.on_empty_handlers.delete(handler);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tadd_registration(destructor: DestructorTree): void {\n\t\tthis.increment();\n\t\tdestructor.onDestroy(() => this.deregister());\n\t}\n\tonEmpty(handler: () => void, persist = false, skip_first = false): void {\n\t\tthis.on_empty_handlers.set(handler, persist);\n\t\tif (!skip_first && this.value === 0) {\n\t\t\thandler();\n\t\t\tif (!persist) {\n\t\t\t\tthis.on_empty_handlers.delete(handler);\n\t\t\t}\n\t\t}\n\t}\n\tget count(): number {\n\t\treturn this.value;\n\t}\n\tonDestroy(handler: () => void): {unsubscribe: () => void} {\n\t\tthis.on_destroy_handlers.add(handler);\n\t\treturn {\n\t\t\tunsubscribe: () => this.on_destroy_handlers.delete(handler)\n\t\t};\n\t}\n\tdestroy(): void {\n\t\tfor (const handler of this.on_destroy_handlers.keys()) {\n\t\t\thandler();\n\t\t}\n\t\tthis._destroyed = true;\n\t}\n}\n","// Some set operations\nexport function union

(setA: Set

, setB: Set

): Set

{\n\tconst result = new Set(setA);\n\tfor (const elem of setB) result.add(elem);\n\treturn result;\n}\n\nexport function intersection

(setA: Set

, setB: Set

): Set

{\n\tconst result = new Set

();\n\tfor (const elem of setB) if (setA.has(elem)) result.add(elem);\n\treturn result;\n}\n\nexport function symmetricDifference

(setA: Set

, setB: Set

): Set

{\n\tconst result = new Set(setA);\n\tfor (const elem of setB)\n\t\tif (result.has(elem)) result.delete(elem);\n\t\telse result.add(elem);\n\treturn result;\n}\n\nexport function difference

(setA: Set

, setB: Set

): Set

{\n\tconst result = new Set(setA);\n\tfor (const elem of setB) result.delete(elem);\n\treturn result;\n}\n\nexport function map(set: Set

, f: (e: P) => R): Set {\n\tconst result = new Set();\n\tfor (const elem of set) result.add(f(elem));\n\treturn result;\n}\n\nexport function reduce(set: Set

, f: (r: R, e: P) => R, initial: R): R {\n\tlet result = initial;\n\tfor (const elem of set) result = f(result, elem);\n\treturn result;\n}\n\nexport function filter

(set: Set

, f: (e: P) => boolean): Set

{\n\tconst result = new Set

();\n\tfor (const elem of set) if (f(elem)) result.add(elem);\n\treturn result;\n}\n","export const Pending: unique symbol = Symbol(\"Pending\");\nexport const Unknown: unique symbol = Symbol(\"Unknown\");\nexport const Failed: unique symbol = Symbol(\"Failed\");\nexport type Pending = typeof Pending;\nexport type Unknown = typeof Unknown;\nexport type Failed = typeof Failed;\nexport type Result = Pending | Unknown | Failed | T;\nexport function isResolved(value: Result): value is T {\n\treturn value !== Pending && value !== Unknown && value !== Failed;\n}\nexport function valueOrFailed(value: Result): value is T | Failed {\n\treturn value !== Pending && value !== Unknown;\n}\n","export const Source: unique symbol = Symbol(\"Source\");\nexport type Source = typeof Source;\nexport const Sink: unique symbol = Symbol(\"Sink\");\nexport type Sink = typeof Sink;\nexport const None: unique symbol = Symbol(\"None\");\nexport type None = typeof None;\n","import { DestructableObject } from \"../../../../destructables\";\n\nexport class TaskManager extends DestructableObject {\n\tprivate tasks = new Set<() => any>();\n\tprivate timeout: number;\n\tprivate timeout_ms: number;\n\tprivate executing = false;\n\tprivate callback?: () => void;\n\tprivate promise?: Promise;\n\n\tconstructor(timeout_ms = 0) {\n\t\tsuper();\n\t\tthis.timeout_ms = timeout_ms;\n\t}\n\tqueue(task: () => any): void {\n\t\tif (this.destroyed) return;\n\t\tthis.tasks.add(task);\n\t\tif (!this.executing) {\n\t\t\tthis.executing = true;\n\t\t\tthis.promise = new Promise((res) => {\n\t\t\t\tthis.callback = res;\n\t\t\t});\n\t\t\tclearTimeout(this.timeout);\n\t\t\tthis.timeout = setTimeout(() => this.execute(), this.timeout_ms);\n\t\t}\n\t}\n\tprivate execute(): void {\n\t\tfor (const task of this.tasks) {\n\t\t\ttask();\n\t\t\tthis.tasks.delete(task);\n\t\t}\n\t\tthis.callback?.();\n\t\tthis.executing = false;\n\t\tthis.promise = undefined;\n\t\tthis.callback = undefined;\n\t}\n\tasync finished(): Promise {\n\t\treturn this.promise ?? Promise.resolve();\n\t}\n\tdestroy(): void {\n\t\tsuper.destroy();\n\t\tthis.tasks.clear();\n\t\tthis.callback?.();\n\t\tthis.executing = false;\n\t\tthis.promise = undefined;\n\t\tthis.callback = undefined;\n\t}\n}\n\nexport class AsyncTaskManager {\n\tprivate tasks = new Set<() => any>();\n\tprivate timeout: number;\n\tprivate timeout_ms: number;\n\tprivate executing = false;\n\tprivate callback?: () => void;\n\tprivate promise?: Promise;\n\n\tconstructor(timeout_ms = 0) {\n\t\tthis.timeout_ms = timeout_ms;\n\t}\n\tqueue(task: () => any): void {\n\t\tthis.tasks.add(task);\n\t\tif (!this.executing) {\n\t\t\tthis.executing = true;\n\t\t\tthis.promise = new Promise((res) => {\n\t\t\t\tthis.callback = res;\n\t\t\t});\n\t\t\tclearTimeout(this.timeout);\n\t\t\tthis.timeout = setTimeout(() => this.execute(), this.timeout_ms);\n\t\t}\n\t}\n\tprivate async execute(): Promise {\n\t\tfor (const task of this.tasks) {\n\t\t\tawait task();\n\t\t\tthis.tasks.delete(task);\n\t\t}\n\t\tthis.callback?.();\n\t\tthis.executing = false;\n\t\tthis.promise = undefined;\n\t\tthis.callback = undefined;\n\t}\n\tasync finished(): Promise {\n\t\treturn this.promise ?? Promise.resolve();\n\t}\n}\n\nexport class SingleTaskManager {\n\tprivate task: () => R;\n\tprivate timeout: number;\n\tprivate timeout_ms: number;\n\tprivate queued = false;\n\tprivate promise?: Promise;\n\tprivate resolve?: (res: R) => void;\n\tprivate reject?: (e: Error) => void;\n\n\tconstructor(task: () => R, timeout_ms = 0) {\n\t\tthis.task = task;\n\t\tthis.timeout_ms = timeout_ms;\n\t}\n\tqueue(): void {\n\t\tif (!this.queued) {\n\t\t\tthis.queued = true;\n\t\t\tif (this.promise === undefined) {\n\t\t\t\t// Only reinitialize promise if it does not already exist\n\t\t\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\t\t\tthis.resolve = resolve;\n\t\t\t\t\tthis.reject = reject;\n\t\t\t\t});\n\t\t\t}\n\t\t\tclearTimeout(this.timeout);\n\t\t\tthis.timeout = setTimeout(() => this.execute(), this.timeout_ms);\n\t\t}\n\t}\n\tprivate async execute(): Promise {\n\t\tthis.queued = false;\n\t\ttry {\n\t\t\tconst result = await this.task();\n\t\t\tif (!this.queued) this.resolve?.(result);\n\t\t} catch (e) {\n\t\t\tthis.reject?.(e);\n\t\t} finally {\n\t\t\t// If the task is queued again while executing, let it run again.\n\t\t\tif (!this.queued) {\n\t\t\t\tthis.promise = undefined;\n\t\t\t\tthis.resolve = undefined;\n\t\t\t\tthis.reject = undefined;\n\t\t\t}\n\t\t}\n\t}\n\tcancel(): void {\n\t\tthis.queued = false;\n\t\tthis.promise = undefined;\n\t\tthis.resolve = undefined;\n\t}\n\tasync finished(): Promise {\n\t\treturn this.promise ?? Promise.resolve();\n\t}\n}\n","function padTwo(number: number): string {\n\tconst result = \"\" + number;\n\tif (result.length === 1) {\n\t\treturn \"0\" + number;\n\t}\n\treturn result;\n}\n\nexport default class Gregorian_Date {\n\tyear: number;\n\tmonth: number;\n\tday: number;\n\n\tconstructor(year: number, month: number, day: number) {\n\t\tif (month < 1) {\n\t\t\tthrow new Error(\"expected a month bigger than 0\");\n\t\t}\n\t\tif (month > 12) {\n\t\t\tthrow new Error(\"expected a month smaller than 13\");\n\t\t}\n\t\tif (day < 1) {\n\t\t\tthrow new Error(\"expected a day bigger than 0\");\n\t\t}\n\t\tif (day > 31) {\n\t\t\tthrow new Error(\"expected a day smaller than 32\");\n\t\t}\n\n\t\tthis.year = year;\n\t\tthis.month = month;\n\t\tthis.day = day;\n\t}\n\n\tgetYear(): number {\n\t\treturn this.year;\n\t}\n\n\tgetMonth(): number {\n\t\treturn this.month;\n\t}\n\n\tgetDay(): number {\n\t\treturn this.day;\n\t}\n\n\t// don't add any other formatting here, it's not up this library to provide that.\n\n\tcanonicalformat(): string {\n\t\treturn this.year + \"-\" + padTwo(this.month) + \"-\" + padTwo(this.day);\n\t}\n}\n","import Gregorian_Date from \"./Gregorian_Date\";\nimport Hour_Time from \"./Hour_Time\";\n\nexport default class Gregorian_Datetime {\n\tdate: Gregorian_Date;\n\ttime: Hour_Time;\n\n\tconstructor(date: Gregorian_Date, time: Hour_Time) {\n\t\tthis.date = date;\n\t\tthis.time = time;\n\t}\n\n\tgetDate(): Gregorian_Date {\n\t\treturn this.date;\n\t}\n\n\tgetTime(): Hour_Time {\n\t\treturn this.time;\n\t}\n\n\t// don't add any other formatting here, it's not up this library to provide that.\n\n\tcanonicalformat(): string {\n\t\treturn this.date.canonicalformat() + \" \" + this.time.canonicalformat();\n\t}\n\n\thtmlformat(): string {\n\t\treturn this.date.canonicalformat() + \"T\" + this.time.canonicalformat();\n\t}\n}\n","function padTwo(number: number): string {\n\tconst result = \"\" + number;\n\tif (result.length === 1) {\n\t\treturn \"0\" + number;\n\t}\n\treturn result;\n}\n\nexport default class Hour_Time {\n\thour: number;\n\tminute: number;\n\tsecond: number;\n\n\tconstructor(hour: number, minute: number, second: number) {\n\t\tif (hour < 0) {\n\t\t\tthrow new Error(\"expected an hour bigger than or equal to 0\");\n\t\t}\n\t\tif (hour > 23) {\n\t\t\tthrow new Error(\"expected an hour smaller than 24\");\n\t\t}\n\t\tif (minute < 0) {\n\t\t\tthrow new Error(\"expected a minute bigger than or equal to 0\");\n\t\t}\n\t\tif (minute > 59) {\n\t\t\tthrow new Error(\"expected a minute smaller than 60\");\n\t\t}\n\t\tif (second < 0) {\n\t\t\tthrow new Error(\"expected a second bigger than or equal to 0\");\n\t\t}\n\t\tif (second > 59) {\n\t\t\tthrow new Error(\"expected a second smaller than 60\");\n\t\t}\n\n\t\tthis.hour = hour;\n\t\tthis.minute = minute;\n\t\tthis.second = second;\n\t}\n\n\tgetHour(): number {\n\t\treturn this.hour;\n\t}\n\n\tgetMinute(): number {\n\t\treturn this.minute;\n\t}\n\n\tgetSecond(): number {\n\t\treturn this.second;\n\t}\n\n\t// don't add any other formatting here, it's not up this library to provide that.\n\n\tcanonicalformat(): string {\n\t\treturn padTwo(this.hour) + \":\" + padTwo(this.minute) + \":\" + padTwo(this.second);\n\t}\n}\n","import Gregorian_Date from \"./Gregorian_Date\";\nimport Gregorian_Datetime from \"./Gregorian_Datetime\";\nimport Hour_Time from \"./Hour_Time\";\n\nconst milliseconds_in_a_day = 86400000; // 1000 * 60 * 60 * 24;\nconst seconds_in_a_day = 86400; // 1000 * 60 * 60 * 24;\n/*\n Corno:\n the number 2440587 is correct, it should not be 2440587.5 as we want days to change at midnight.\n*/\nconst difference_between_day_0_of_unix_and_day_0_of_julian = 2440587;\nconst difference_in_seconds_between_day_0_of_unix_and_day_0_of_julian =\n\tdifference_between_day_0_of_unix_and_day_0_of_julian * seconds_in_a_day;\nconst milliseconds_in_a_second = 1000;\n\nexport function gregorian_date_2_julian_date(gregorian_date: Gregorian_Date): number {\n\tconst js_date = Date.UTC(gregorian_date.getYear(), gregorian_date.getMonth() - 1, gregorian_date.getDay());\n\treturn Math.floor(js_date / milliseconds_in_a_day + difference_between_day_0_of_unix_and_day_0_of_julian);\n}\n\nexport function gregorian_datetime_2_julian_datetime(gregorian_datetime: Gregorian_Datetime): number {\n\tconst elapsed_unix_seconds =\n\t\tnew Date(\n\t\t\tgregorian_datetime.getDate().getYear(),\n\t\t\tgregorian_datetime.getDate().getMonth() - 1,\n\t\t\tgregorian_datetime.getDate().getDay(),\n\t\t\tgregorian_datetime.getTime().getHour(),\n\t\t\tgregorian_datetime.getTime().getMinute(),\n\t\t\tgregorian_datetime.getTime().getSecond()\n\t\t).getTime() / milliseconds_in_a_second;\n\treturn elapsed_unix_seconds + difference_in_seconds_between_day_0_of_unix_and_day_0_of_julian;\n}\n\nexport function parseHtmlDate(value: string): Date | undefined {\n\tconst match = value.match(/^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2}))?/);\n\tif (match === null) {\n\t\treturn undefined;\n\t}\n\tconst matches = match\n\t\t.slice(1) //skip the whole regex match\n\t\t.map(function (s) {\n\t\t\treturn s === undefined ? 0 : Number(s);\n\t\t}); //convert the strings to numbers.\n\tconst parsedDate = new Date(matches[0], matches[1] - 1, matches[2], matches[3], matches[4], matches[5]);\n\treturn new Date(parsedDate.getTime());\n}\n\nexport function jstimestamp_2_julian_datetime(timestamp: number): number {\n\treturn (\n\t\tMath.floor(timestamp / milliseconds_in_a_second) + difference_in_seconds_between_day_0_of_unix_and_day_0_of_julian\n\t);\n}\n\nexport function jsdate_2_julian_datetime(jsdate: Date): number {\n\treturn jstimestamp_2_julian_datetime(jsdate.getTime());\n}\n\nexport function jsdate_2_julian_date(jsdate: Date): number {\n\treturn Math.floor(\n\t\t(jsdate.getTime() - jsdate.getTimezoneOffset() * 60 * 1000) / milliseconds_in_a_day +\n\t\t\tdifference_between_day_0_of_unix_and_day_0_of_julian\n\t);\n}\n\nexport function julian_date_2_gregorian_date(julian_date: number): Gregorian_Date {\n\tconst date = new Date((julian_date - difference_between_day_0_of_unix_and_day_0_of_julian) * milliseconds_in_a_day);\n\treturn new Gregorian_Date(date.getFullYear(), date.getMonth() + 1, date.getDate());\n}\n\nexport function julian_date_2_js_date(julian_date: number): Date {\n\treturn new Date((julian_date - difference_between_day_0_of_unix_and_day_0_of_julian) * milliseconds_in_a_day);\n}\n\nexport function julian_datetime_2_gregorian_datetime(julian_datetime: number): Gregorian_Datetime {\n\tconst elapsed_unix_seconds = julian_datetime - difference_in_seconds_between_day_0_of_unix_and_day_0_of_julian;\n\tconst date = new Date(elapsed_unix_seconds * milliseconds_in_a_second);\n\n\treturn new Gregorian_Datetime(\n\t\tnew Gregorian_Date(date.getFullYear(), date.getMonth() + 1, date.getDate()),\n\t\tnew Hour_Time(date.getHours(), date.getMinutes(), date.getSeconds())\n\t);\n}\n\nexport function julian_datetime_2_js_date(julian_datetime: number): Date {\n\tconst elapsed_unix_seconds = julian_datetime - difference_in_seconds_between_day_0_of_unix_and_day_0_of_julian;\n\n\treturn new Date(elapsed_unix_seconds * milliseconds_in_a_second);\n}\n","import Gregorian_Date from \"./Gregorian_Date\";\nimport Gregorian_Datetime from \"./Gregorian_Datetime\";\nimport Hour_Time from \"./Hour_Time\";\nimport { gregorian_datetime_2_julian_datetime, gregorian_date_2_julian_date } from \"./conversion\";\n\nexport function getCurrentDate(): number {\n\tconst d = new Date();\n\tconst date = new Gregorian_Date(d.getFullYear(), d.getMonth() + 1, d.getDate());\n\treturn gregorian_date_2_julian_date(date);\n}\n\nexport function getCurrentDateAndTime(): number {\n\tconst d = new Date();\n\tconst date_time = new Gregorian_Datetime(\n\t\tnew Gregorian_Date(d.getFullYear(), d.getMonth() + 1, d.getDate()),\n\t\tnew Hour_Time(d.getHours(), d.getMinutes(), d.getSeconds())\n\t);\n\treturn gregorian_datetime_2_julian_datetime(date_time);\n}\n","import { api_configuration } from \"common\";\nimport * as Stacktrace from \"stacktrace-js\";\nimport {\n\tclient_state,\n\tengine_version,\n\tgenerateClientStateReport,\n\tlistLastInstructions,\n\tsettings,\n} from \"./state/ClientState\";\nimport { DataStoreProtocolError, DatastoreProxy } from \"./interface/DatastoreProxy\";\nimport * as messages from \"./front/messages\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport ClientStateObjectProxy from \"./state/ClientStateObjectProxy\";\n\nasync function mapStack(error: Error): Promise {\n\ttry {\n\t\tconst mapped = await Stacktrace.fromError(error);\n\t\treturn \"\\t\" + mapped.map((f) => f.toString()).join(\"\\n\\t\");\n\t} catch (e) {\n\t\treturn error.stack || \"\";\n\t}\n}\n\nfunction ignoreError(error: Error) {\n\tif (error instanceof DataStoreProtocolError) {\n\t\treturn true;\n\t}\n\tif (ignoreMessage(error.message)) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nfunction ignoreMessage(message: string) {\n\tif (message.toLowerCase().indexOf(\"script error\") >= 0) {\n\t\treturn true;\n\t}\n\tif (message.toLowerCase().indexOf(\"request error\") >= 0) {\n\t\treturn true;\n\t}\n\tif (message.toLowerCase().indexOf(\"failed to fetch\") >= 0) {\n\t\treturn true;\n\t}\n\tif (message.toLocaleLowerCase() === \"load failed\") {\n\t\t// https://stackoverflow.com/questions/71280168/javascript-typeerror-load-failed-error-when-calling-fetch-on-ios\n\t\treturn true;\n\t}\n\tif (message.toLowerCase().indexOf(\"possible side-effect in debug-evaluate\") >= 0) {\n\t\treturn true;\n\t}\n\t//The loop limit exceeded message can be ignored according to the internet\n\t//https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded\n\tif (message === \"ResizeObserver loop limit exceeded\") {\n\t\treturn true;\n\t}\n\t//https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors\n\tif (message === \"ResizeObserver loop completed with undelivered notifications.\") {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport function setupErrorHandlers(on_error: (title: string, message: string) => void) {\n\tconst old_console_error = console.error;\n\t(Error).stackTraceLimit = Infinity;\n\tfunction formatStackLine(s: string) {\n\t\treturn \"\\tat \" + s;\n\t}\n\n\tconst stacktracelimit = 15;\n\t(Error).prepareStackTrace = function (_: any, structuredStackTrace: string[]) {\n\t\tconst stacksize = structuredStackTrace.length;\n\t\tlet formattedStack = structuredStackTrace.slice(0, stacktracelimit).map(formatStackLine);\n\t\tif (stacksize > stacktracelimit) {\n\t\t\tconst taillimit = Math.min(stacktracelimit, stacksize - stacktracelimit);\n\t\t\tformattedStack = formattedStack\n\t\t\t\t.concat(\"\\t... (\" + (stacksize - stacktracelimit - taillimit) + \")\")\n\t\t\t\t.concat(structuredStackTrace.slice(-taillimit).map(formatStackLine));\n\t\t}\n\t\treturn formattedStack.join(\"\\n\");\n\t};\n\tfunction logErrorToServer(error: string) {\n\t\tif (!global.errorCaughtAndSent) {\n\t\t\tsendMessageToServer(error);\n\t\t\tglobal.errorCaughtAndSent = true;\n\t\t\tif (settings) {\n\t\t\t\tsettings.properties.settings.properties.reload_on_unexpected_error.switch({\n\t\t\t\t\tenabled: function () {\n\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t},\n\t\t\t\t\tdisabled: function () {\n\t\t\t\t\t\tif (client_state) {\n\t\t\t\t\t\t\tmessages.addMessage(\"error\", \"Unexpected error\", {\n\t\t\t\t\t\t\t\tbody: \"The error has been reported. Refresh your browser before continuing.\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ton_error(\"Unexpected error\", \"The error has been reported. Refresh your browser before continuing.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (client_state) {\n\t\t\t\t\tmessages.addMessage(\"error\", \"Unexpected error\", {\n\t\t\t\t\t\tbody: \"The error has been reported. Refresh your browser before continuing.\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\ton_error(\"Unexpected error\", \"The error has been reported. Refresh your browser before continuing.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction tryGetApplicationStateSnapShot() {\n\t\ttry {\n\t\t\treturn JSON.stringify(\n\t\t\t\tcreateApplicationStateSnapShot({\n\t\t\t\t\tinclude_browser_details: true,\n\t\t\t\t\tinclude_client_state: include_client_state,\n\t\t\t\t\tinclude_url: global.logClientStateOnError,\n\t\t\t\t}),\n\t\t\t\tcreateClientStateStringyfier(),\n\t\t\t\t2\n\t\t\t);\n\t\t} catch (e) {\n\t\t\treturn \"Application state can not be determined.\";\n\t\t}\n\t}\n\tfunction createMessageAndSendToServer(message_to_server: string) {\n\t\tlogErrorToServer(message_to_server + \"\\n\" + tryGetApplicationStateSnapShot());\n\t}\n\tconsole.error = async function (...args) {\n\t\told_console_error.apply(console, args);\n\t\tconst message = await Promise.all(\n\t\t\tArray.from(args).map(async (arg) => {\n\t\t\t\tif (arg instanceof Error) {\n\t\t\t\t\treturn arg.name + \" \" + arg.message + \"\\n\" + (await mapStack(arg));\n\t\t\t\t} else {\n\t\t\t\t\treturn arg;\n\t\t\t\t}\n\t\t\t})\n\t\t);\n\t\tcreateMessageAndSendToServer(message.join(\"\"));\n\t};\n\twindow.addEventListener(\"error\", async function (evt) {\n\t\tif (evt.error instanceof Error && ignoreError(evt.error)) {\n\t\t\treturn;\n\t\t}\n\t\tif (ignoreMessage(evt.message)) {\n\t\t\treturn;\n\t\t}\n\t\tlet errorStack = \"\";\n\t\tif (evt.error instanceof Error) {\n\t\t\terrorStack = await mapStack(evt.error);\n\t\t\terrorStack = \"\\n\" + errorStack + \"\\n\";\n\t\t}\n\t\tcreateMessageAndSendToServer(\"'\" + evt.message + \"' from \" + evt.filename + \":\" + evt.lineno + errorStack);\n\t});\n\twindow.addEventListener(\"unhandledrejection\", async function (rejection) {\n\t\tif (rejection.reason instanceof Error && ignoreError(rejection.reason)) {\n\t\t\treturn;\n\t\t}\n\t\tlet message = \"\";\n\t\tif (rejection.reason instanceof Error) {\n\t\t\tmessage = rejection.reason.message;\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tmessage = JSON.stringify(rejection.reason);\n\t\t\t} catch (e) {\n\t\t\t\tmessage = rejection.reason?.toString();\n\t\t\t}\n\t\t}\n\t\tif (ignoreMessage(message)) {\n\t\t\treturn;\n\t\t}\n\t\tlet errorStack = \"\";\n\t\tif (rejection.reason?.stack !== undefined) {\n\t\t\tif (rejection.reason instanceof Error) {\n\t\t\t\terrorStack = await mapStack(rejection.reason);\n\t\t\t\terrorStack = \"\\n\" + errorStack + \"\\n\";\n\t\t\t} else {\n\t\t\t\terrorStack = \"\\n\" + rejection.reason.stack + \"\\n\";\n\t\t\t}\n\t\t}\n\t\tcreateMessageAndSendToServer(\"'\" + message + errorStack);\n\t});\n}\n\nfunction sendMessageToServer(message: string) {\n\tconst http_request = new XMLHttpRequest();\n\thttp_request.open(\"POST\", \"__log_error\");\n\thttp_request.send(message);\n}\n\nfunction createClientStateStringyfier() {\n\tlet client_state_seen = false;\n\treturn (key: string, value: any) => {\n\t\tif (client_state_seen) {\n\t\t\treturn value;\n\t\t} else if (key === \"client state\") {\n\t\t\tclient_state_seen = true;\n\t\t\treturn JSON.stringify(value, ignoreAlanObjects);\n\t\t} else {\n\t\t\treturn value;\n\t\t}\n\t};\n}\n\nfunction ignoreAlanObjects(key: string, value: any) {\n\tif (key === \"_$\") return undefined;\n\tif (value instanceof api_cs.AlanObject) return \"…\";\n\tif (value instanceof ClientStateObjectProxy) return \"…\";\n\treturn value;\n}\n\nlet include_client_state = false;\nexport function includeClientStateInErrorLog() {\n\tinclude_client_state = true;\n}\n\nexport function sendFeedback(message: string): void {\n\tconst snapshot = createApplicationStateSnapShot({\n\t\tinclude_client_state: true,\n\t\tinclude_url: true,\n\t\tinclude_browser_details: true,\n\t});\n\tsendMessageToServer(message + \"\\n\" + JSON.stringify(snapshot, createClientStateStringyfier(), 2));\n}\n\nexport function createApplicationStateSnapShot(\n\toptions = {\n\t\tinclude_client_state: false,\n\t\tinclude_url: false,\n\t\tinclude_browser_details: true,\n\t}\n) {\n\tfunction tryGetWebSocketConnectionState() {\n\t\ttry {\n\t\t\treturn DatastoreProxy.instance.connection.isWebSocketOpen() ? \"Websocket connected\" : \"Websocket disconnected\";\n\t\t} catch (e) {\n\t\t\treturn \"could not be determined\";\n\t\t}\n\t}\n\n\tfunction tryGetAuthenticationStatus() {\n\t\tif (!global.logClientStateOnError) {\n\t\t\treturn \"not available\";\n\t\t}\n\t\ttry {\n\t\t\tconst session = client_state.properties.session;\n\t\t\tswitch (session.properties.status.state.name) {\n\t\t\t\tcase \"not authenticated\": {\n\t\t\t\t\treturn \"not authenticated\";\n\t\t\t\t}\n\t\t\t\tcase \"authenticated\": {\n\t\t\t\t\tconst $ = session.properties.status.state.node;\n\t\t\t\t\treturn [\n\t\t\t\t\t\t\"authenticated\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tuser: $.properties.anonymous_session.switch({\n\t\t\t\t\t\t\t\tyes: \"\",\n\t\t\t\t\t\t\t\tno: ($) => $.properties.username,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\treturn \"could not be determined\";\n\t\t}\n\t}\n\n\tfunction tryserializeIdPath(id_path: api_configuration.types.client_state.alan_api.Cclient_id_path): string {\n\t\treturn id_path.properties.has_steps.switch({\n\t\t\tyes: function ($) {\n\t\t\t\treturn (\n\t\t\t\t\t$.properties.type.switch({\n\t\t\t\t\t\toperation: ($) => \".\" + $.properties.operation.entry,\n\t\t\t\t\t\t\"collection entry\": function ($) {\n\t\t\t\t\t\t\tlet key_value = $.properties.entry.entry;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst key = $.properties.entry.ref.properties.key.ref;\n\t\t\t\t\t\t\t\tswitch (key.properties.is_set.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tkey_value = key.properties.is_set.state.node.properties.text + \":\" + key_value;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t\t// ignore\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn \".\" + $.properties.collection.entry + \"[\" + key_value + \"]\";\n\t\t\t\t\t\t},\n\t\t\t\t\t\tgroup: function ($) {\n\t\t\t\t\t\t\treturn \".\" + $.properties.group.entry;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tstate: function ($) {\n\t\t\t\t\t\t\treturn \".\" + $.properties.state_group.entry + \"?\" + $.properties.state.entry;\n\t\t\t\t\t\t},\n\t\t\t\t\t}) + tryserializeIdPath($.properties.tail)\n\t\t\t\t);\n\t\t\t},\n\t\t\tno: \"\",\n\t\t});\n\t}\n\n\tfunction tryGetOpenViews(): any {\n\t\tif (!global.logClientStateOnError) {\n\t\t\treturn \"not available\";\n\t\t}\n\t\ttry {\n\t\t\tconst open_views: Record = {};\n\t\t\tclient_state.properties.windows.forEach(function (window) {\n\t\t\t\twindow.properties.open_views.forEach(function (open_view) {\n\t\t\t\t\topen_views[open_view.key] = {\n\t\t\t\t\t\tcontext: tryserializeIdPath(open_view.properties.view_context),\n\t\t\t\t\t\t\"view definition\": open_view.properties.view_definition.ref.path,\n\t\t\t\t\t\tactive: open_view.properties.is_active_view.switch({\n\t\t\t\t\t\t\tyes: \"YES!\",\n\t\t\t\t\t\t\tno: \"no\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn open_views;\n\t\t} catch (e) {\n\t\t\treturn \"could not be determined\";\n\t\t}\n\t}\n\n\tfunction tryListLastInstructions() {\n\t\tif (!global.logClientStateOnError) {\n\t\t\treturn \"not available\";\n\t\t}\n\t\treturn listLastInstructions();\n\t}\n\n\tconst log = {\n\t\t\"engine version\": engine_version,\n\t\t\"websocket status\": tryGetWebSocketConnectionState(),\n\t\t\"authentication status\": tryGetAuthenticationStatus(),\n\t\t\"open views\": tryGetOpenViews(),\n\t\t\"last instructions\": tryListLastInstructions(),\n\t};\n\tif (options.include_url) {\n\t\ttry {\n\t\t\t(log as any)[\"url\"] = window.location.toString();\n\t\t} catch (e) {\n\t\t\t// ignore error\n\t\t}\n\t}\n\tif (options.include_browser_details) {\n\t\tconst any_performance = (window as any).performance.memory;\n\t\tif (any_performance) {\n\t\t\ttry {\n\t\t\t\tconst memory = {\n\t\t\t\t\tjsHeapSizeLimit: any_performance.jsHeapSizeLimit,\n\t\t\t\t\ttotalJSHeapSize: any_performance.totalJSHeapSize,\n\t\t\t\t\tusedJSHeapSize: any_performance.usedJSHeapSize,\n\t\t\t\t};\n\t\t\t\t(log as any)[\"memory\"] = memory;\n\t\t\t} catch (e) {\n\t\t\t\t// too bad\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\tconst browser_details = {\n\t\t\t\tuserAgent: window.navigator.userAgent,\n\t\t\t\tlanguage: window.navigator.language,\n\t\t\t};\n\t\t\t(log as any)[\"browser\"] = browser_details;\n\t\t} catch (e) {\n\t\t\tconsole.warn(\"Could not log browser details\");\n\t\t}\n\t}\n\tif (options.include_client_state) {\n\t\ttry {\n\t\t\t(log as any)[\"client state\"] = generateClientStateReport();\n\t\t} catch (e) {\n\t\t\t(log as any)[\"client state\"] = \"Client state could not be created\";\n\t\t\tconsole.warn(\"Client state could not be created\");\n\t\t}\n\t}\n\treturn log;\n}\n","// From https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst encoding = require(\"text-encoding\"); //trigger TextEncoder polyfill for Edge.\nif (window && !window[\"TextEncoder\"]) {\n\twindow[\"TextEncoder\"] = encoding.TextEncoder;\n}\nif (window && !window[\"TextDecoder\"]) {\n\twindow[\"TextDecoder\"] = encoding.TextDecoder;\n}\n\nexport function sha256(str: string): Promise {\n\t// We transform the string into an arraybuffer.\n\tconst buffer = new TextEncoder().encode(str);\n\tif (crypto.subtle) {\n\t\treturn crypto.subtle.digest(\"SHA-256\", buffer).then(function (hash) {\n\t\t\treturn hex(hash);\n\t\t});\n\t} else {\n\t\t//fall back to JS SHA function if running in an insecure context and crypto.subtle is not available.\n\t\treturn Promise.resolve(Sha256.hash(str));\n\t}\n}\n\nfunction hex(buffer: ArrayBuffer) {\n\tconst hexCodes: string[] = [];\n\tconst view = new DataView(buffer);\n\tfor (let i = 0; i < view.byteLength; i += 4) {\n\t\t// Using getUint32 reduces the number of iterations needed (we process 4 bytes each time)\n\t\tconst value = view.getUint32(i);\n\t\t// toString(16) will give the hex representation of the number without padding\n\t\tconst stringValue = value.toString(16);\n\t\t// We use concatenation and slice for padding\n\t\tconst padding = \"00000000\";\n\t\tconst paddedValue = (padding + stringValue).slice(-padding.length);\n\t\thexCodes.push(paddedValue);\n\t}\n\n\t// Join all the hex strings into one\n\treturn hexCodes.join(\"\");\n}\n\n//from: https://www.movable-type.co.uk/scripts/sha256.html\n\n/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\n/* Utf8 class: encode / decode between multi-byte Unicode characters and UTF-8 multiple */\n/* single-byte character encoding (c) Chris Veness 2002-2010 */\n/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\nclass Utf8 {\n\t/**\n\t * Encode multi-byte Unicode string into utf-8 multiple single-byte characters\n\t * (BMP / basic multilingual plane only)\n\t *\n\t * Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars\n\t *\n\t * @param {String} strUni Unicode string to be encoded as UTF-8\n\t * @returns {String} encoded string\n\t */\n\tstatic encode(strUni: string) {\n\t\t// use regular expressions & String.replace callback function for better efficiency\n\t\t// than procedural approaches\n\t\tlet strUtf = strUni.replace(\n\t\t\t/[\\u0080-\\u07ff]/g, // U+0080 - U+07FF => 2 bytes 110yyyyy, 10zzzzzz\n\t\t\tfunction (c) {\n\t\t\t\tconst cc = c.charCodeAt(0);\n\t\t\t\treturn String.fromCharCode(0xc0 | (cc >> 6), 0x80 | (cc & 0x3f));\n\t\t\t}\n\t\t);\n\t\tstrUtf = strUtf.replace(\n\t\t\t/[\\u0800-\\uffff]/g, // U+0800 - U+FFFF => 3 bytes 1110xxxx, 10yyyyyy, 10zzzzzz\n\t\t\tfunction (c) {\n\t\t\t\tconst cc = c.charCodeAt(0);\n\t\t\t\treturn String.fromCharCode(0xe0 | (cc >> 12), 0x80 | ((cc >> 6) & 0x3f), 0x80 | (cc & 0x3f));\n\t\t\t}\n\t\t);\n\t\treturn strUtf;\n\t}\n\n\t/**\n\t * Decode utf-8 encoded string back into multi-byte Unicode characters\n\t *\n\t * @param {String} strUtf UTF-8 string to be decoded back to Unicode\n\t * @returns {String} decoded string\n\t */\n\tstatic decode(strUtf: string) {\n\t\t// note: decode 3-byte chars first as decoded 2-byte strings could appear to be 3-byte char!\n\t\tlet strUni = strUtf.replace(\n\t\t\t/[\\u00e0-\\u00ef][\\u0080-\\u00bf][\\u0080-\\u00bf]/g, // 3-byte chars\n\t\t\tfunction (c) {\n\t\t\t\t// (note parentheses for precence)\n\t\t\t\tconst cc = ((c.charCodeAt(0) & 0x0f) << 12) | ((c.charCodeAt(1) & 0x3f) << 6) | (c.charCodeAt(2) & 0x3f);\n\t\t\t\treturn String.fromCharCode(cc);\n\t\t\t}\n\t\t);\n\t\tstrUni = strUni.replace(\n\t\t\t/[\\u00c0-\\u00df][\\u0080-\\u00bf]/g, // 2-byte chars\n\t\t\tfunction (c) {\n\t\t\t\t// (note parentheses for precence)\n\t\t\t\tconst cc = ((c.charCodeAt(0) & 0x1f) << 6) | (c.charCodeAt(1) & 0x3f);\n\t\t\t\treturn String.fromCharCode(cc);\n\t\t\t}\n\t\t);\n\t\treturn strUni;\n\t}\n}\n\n/**\n * SHA-256 implementation in JavaScript | (c) Chris Veness 2002-2010 | www.movable-type.co.uk\n * - see http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html\n * http://csrc.nist.gov/groups/ST/toolkit/examples.html\n *\n */\nclass Sha256 {\n\t/**\n\t * Generates SHA-256 hash of string\n\t *\n\t * @param {String} msg String to be hashed\n\t * @param {Boolean} [utf8encode=true] Encode msg as UTF-8 before generating hash\n\t * @returns {String} Hash of msg as hex character string\n\t */\n\tstatic hash(msg: string, utf8encode = true) {\n\t\t// convert string to UTF-8, as SHA only deals with byte-streams\n\t\tif (utf8encode) {\n\t\t\tmsg = Utf8.encode(msg);\n\t\t}\n\n\t\t// constants [§4.2.2]\n\t\tconst K = [\n\t\t\t0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98,\n\t\t\t0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n\t\t\t0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8,\n\t\t\t0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n\t\t\t0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,\n\t\t\t0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n\t\t\t0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7,\n\t\t\t0xc67178f2,\n\t\t];\n\t\t// initial hash value [§5.3.1]\n\t\tconst H = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];\n\n\t\t// PREPROCESSING\n\n\t\tmsg += String.fromCharCode(0x80); // add trailing '1' bit (+ 0's padding) to string [§5.1.1]\n\n\t\t// convert string msg into 512-bit/16-integer blocks arrays of ints [§5.2.1]\n\t\tconst l = msg.length / 4 + 2; // length (in 32-bit integers) of msg + ‘1’ + appended length\n\t\tconst N = Math.ceil(l / 16); // number of 16-integer-blocks required to hold 'l' ints\n\t\tconst M = new Array(N);\n\n\t\tfor (let i = 0; i < N; i++) {\n\t\t\tM[i] = new Array(16);\n\t\t\tfor (let j = 0; j < 16; j++) {\n\t\t\t\t// encode 4 chars per integer, big-endian encoding\n\t\t\t\tM[i][j] =\n\t\t\t\t\t(msg.charCodeAt(i * 64 + j * 4) << 24) |\n\t\t\t\t\t(msg.charCodeAt(i * 64 + j * 4 + 1) << 16) |\n\t\t\t\t\t(msg.charCodeAt(i * 64 + j * 4 + 2) << 8) |\n\t\t\t\t\tmsg.charCodeAt(i * 64 + j * 4 + 3);\n\t\t\t} // note running off the end of msg is ok 'cos bitwise ops on NaN return 0\n\t\t}\n\t\t// add length (in bits) into final pair of 32-bit integers (big-endian) [§5.1.1]\n\t\t// note: most significant word would be (len-1)*8 >>> 32, but since JS converts\n\t\t// bitwise-op args to 32 bits, we need to simulate this by arithmetic operators\n\t\tM[N - 1][14] = ((msg.length - 1) * 8) / Math.pow(2, 32);\n\t\tM[N - 1][14] = Math.floor(M[N - 1][14]);\n\t\tM[N - 1][15] = ((msg.length - 1) * 8) & 0xffffffff;\n\n\t\t// HASH COMPUTATION [§6.1.2]\n\n\t\tconst W = new Array(64);\n\t\t/* tslint:disable:one-variable-per-declaration */\n\t\tlet a;\n\t\tlet b;\n\t\tlet c;\n\t\tlet d;\n\t\tlet e;\n\t\tlet f;\n\t\tlet g;\n\t\tlet h;\n\t\t/* tslint:enable */\n\t\tfor (let i = 0; i < N; i++) {\n\t\t\t// 1 - prepare message schedule 'W'\n\t\t\tfor (let t = 0; t < 16; t++) {\n\t\t\t\tW[t] = M[i][t];\n\t\t\t}\n\t\t\tfor (let t = 16; t < 64; t++) {\n\t\t\t\tW[t] = (Sha256.sigma1(W[t - 2]) + W[t - 7] + Sha256.sigma0(W[t - 15]) + W[t - 16]) & 0xffffffff;\n\t\t\t}\n\n\t\t\t// 2 - initialise working variables a, b, c, d, e, f, g, h with previous hash value\n\t\t\ta = H[0];\n\t\t\tb = H[1];\n\t\t\tc = H[2];\n\t\t\td = H[3];\n\t\t\te = H[4];\n\t\t\tf = H[5];\n\t\t\tg = H[6];\n\t\t\th = H[7];\n\n\t\t\t// 3 - main loop (note 'addition modulo 2^32')\n\t\t\tfor (let t = 0; t < 64; t++) {\n\t\t\t\tconst T1: number = h + Sha256.Sigma1(e) + Sha256.Ch(e, f, g) + K[t] + W[t];\n\t\t\t\tconst T2: number = Sha256.Sigma0(a) + Sha256.Maj(a, b, c);\n\t\t\t\th = g;\n\t\t\t\tg = f;\n\t\t\t\tf = e;\n\t\t\t\te = (d + T1) & 0xffffffff;\n\t\t\t\td = c;\n\t\t\t\tc = b;\n\t\t\t\tb = a;\n\t\t\t\ta = (T1 + T2) & 0xffffffff;\n\t\t\t}\n\t\t\t// 4 - compute the new intermediate hash value (note 'addition modulo 2^32')\n\t\t\tH[0] = (H[0] + a) & 0xffffffff;\n\t\t\tH[1] = (H[1] + b) & 0xffffffff;\n\t\t\tH[2] = (H[2] + c) & 0xffffffff;\n\t\t\tH[3] = (H[3] + d) & 0xffffffff;\n\t\t\tH[4] = (H[4] + e) & 0xffffffff;\n\t\t\tH[5] = (H[5] + f) & 0xffffffff;\n\t\t\tH[6] = (H[6] + g) & 0xffffffff;\n\t\t\tH[7] = (H[7] + h) & 0xffffffff;\n\t\t}\n\n\t\treturn (\n\t\t\tSha256.toHexStr(H[0]) +\n\t\t\tSha256.toHexStr(H[1]) +\n\t\t\tSha256.toHexStr(H[2]) +\n\t\t\tSha256.toHexStr(H[3]) +\n\t\t\tSha256.toHexStr(H[4]) +\n\t\t\tSha256.toHexStr(H[5]) +\n\t\t\tSha256.toHexStr(H[6]) +\n\t\t\tSha256.toHexStr(H[7])\n\t\t);\n\t}\n\n\tstatic ROTR(n: number, x: number) {\n\t\treturn (x >>> n) | (x << (32 - n));\n\t}\n\tstatic Sigma0(x: number) {\n\t\treturn Sha256.ROTR(2, x) ^ Sha256.ROTR(13, x) ^ Sha256.ROTR(22, x);\n\t}\n\tstatic Sigma1(x: number) {\n\t\treturn Sha256.ROTR(6, x) ^ Sha256.ROTR(11, x) ^ Sha256.ROTR(25, x);\n\t}\n\tstatic sigma0(x: number) {\n\t\treturn Sha256.ROTR(7, x) ^ Sha256.ROTR(18, x) ^ (x >>> 3);\n\t}\n\tstatic sigma1(x: number) {\n\t\treturn Sha256.ROTR(17, x) ^ Sha256.ROTR(19, x) ^ (x >>> 10);\n\t}\n\tstatic Ch(x: number, y: number, z: number) {\n\t\treturn (x & y) ^ (~x & z);\n\t}\n\tstatic Maj(x: number, y: number, z: number) {\n\t\treturn (x & y) ^ (x & z) ^ (y & z);\n\t}\n\n\t//\n\t// hexadecimal representation of a number\n\t// (note toString(16) is implementation-dependant, and\n\t// in IE returns signed numbers when used on full words)\n\t//\n\tstatic toHexStr(n: number) {\n\t\tlet s = \"\";\n\t\tlet v;\n\t\tfor (let i = 7; i >= 0; i--) {\n\t\t\tv = (n >>> (i * 4)) & 0xf;\n\t\t\ts += v.toString(16);\n\t\t}\n\t\treturn s;\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport { gregorian_date_2_julian_date, gregorian_datetime_2_julian_datetime } from \"../calendar/conversion\";\nimport Gregorian_Datetime from \"../calendar/Gregorian_Datetime\";\nimport Gregorian_Date from \"../calendar/Gregorian_Date\";\nimport Hour_Time from \"../calendar/Hour_Time\";\nimport { gui_model } from \"../state/ClientState\";\n\nconst SECONDS_PER_MINUTE = 60;\nconst MINUTES_PER_HOUR = 60;\nconst SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;\n\nexport function parseHours(duration: string): number {\n\treturn Math.floor(parseSeconds(duration) / SECONDS_PER_HOUR);\n}\n\nexport function parseMinutes(duration: string): number {\n\treturn Math.floor(parseSeconds(duration) / SECONDS_PER_MINUTE);\n}\n\nexport function parseSeconds(secondsstring: string): number {\n\tconst res = /^(-)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s?)?$/.exec(secondsstring);\n\treturn res === null ||\n\t\t(res[1] === undefined &&\n\t\t\tres[3] === undefined &&\n\t\t\tres[5] === undefined &&\n\t\t\tres[7] === undefined &&\n\t\t\tres[9] === undefined)\n\t\t? NaN\n\t\t: (res[1] === undefined ? 1 : -1) *\n\t\t\t\t((res[3] === undefined ? 0 : parseInt(res[3], 10)) * SECONDS_PER_HOUR +\n\t\t\t\t\t(res[5] === undefined ? 0 : parseInt(res[5], 10)) * SECONDS_PER_MINUTE +\n\t\t\t\t\t(res[7] === undefined ? 0 : parseInt(res[7], 10)));\n}\n\nfunction parseDate(datestring: string): number {\n\tconst res = /^(\\d+)-(\\d+)-(\\d+)$/.exec(datestring);\n\tif (res === null) {\n\t\treturn NaN;\n\t}\n\tconst year = parseInt(res[1], 10);\n\tconst month = parseInt(res[2], 10);\n\tconst day = parseInt(res[3], 10);\n\tif (month < 1 || month > 12 || day < 1 || day > 31) {\n\t\treturn NaN;\n\t}\n\treturn gregorian_date_2_julian_date(new Gregorian_Date(year, month, day));\n}\n\nexport function parseDateTime(datetimestring: string): number {\n\tconst res = /^(\\d+)-(\\d+)-(\\d+)(\\s|\\w)(\\d+):(\\d+):(\\d+)$/.exec(datetimestring);\n\tif (res === null) {\n\t\treturn NaN;\n\t}\n\tconst year = parseInt(res[1], 10);\n\tconst month = parseInt(res[2], 10);\n\tconst day = parseInt(res[3], 10);\n\tconst hour = parseInt(res[5], 10);\n\tconst minutes = parseInt(res[6], 10);\n\tconst seconds = parseInt(res[7], 10);\n\tif (\n\t\tmonth < 1 ||\n\t\tmonth > 12 ||\n\t\tday < 1 ||\n\t\tday > 31 ||\n\t\thour < 0 ||\n\t\thour > 24 ||\n\t\tminutes < 0 ||\n\t\tminutes > 60 ||\n\t\tseconds < 0 ||\n\t\tseconds > 60\n\t) {\n\t\treturn NaN;\n\t}\n\treturn gregorian_datetime_2_julian_datetime(\n\t\tnew Gregorian_Datetime(new Gregorian_Date(year, month, day), new Hour_Time(hour, minutes, seconds))\n\t);\n}\ntype NumberParseResult = [\"no\", { error: string }] | [\"yes\", { number: number }];\nfunction convertToParseResult(value: number, error: string): NumberParseResult {\n\treturn isNaN(value)\n\t\t? [\n\t\t\t\t\"no\",\n\t\t\t\t{\n\t\t\t\t\terror: error,\n\t\t\t\t},\n\t\t ]\n\t\t: [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\tnumber: value,\n\t\t\t\t},\n\t\t ];\n}\n\nconst DECIMAL_SEPARATOR = (1.1)\n\t.toLocaleString(window.navigator.language || window.navigator.languages[0])\n\t.substring(1, 2);\nconst THOUSAND_SEPARATOR = (1000)\n\t.toLocaleString(window.navigator.language || window.navigator.languages[0])\n\t.substring(1, 2)\n\t.replace(\"0\", \"\");\nconst NUMBER_REGEX = new RegExp(\n\t`^(?-)?(?:(?[0-9 ${THOUSAND_SEPARATOR}]+${DECIMAL_SEPARATOR}?)|(?:(?[0-9 ${THOUSAND_SEPARATOR}]*)${DECIMAL_SEPARATOR}(?[0-9]+)))$`\n);\nconst THOUSAND_SEPARATOR_REGEX = new RegExp(`[${THOUSAND_SEPARATOR}]`);\nexport function parse(\n\tnumberstring: string,\n\tnumerical_type: api_app.Cnumerical_types,\n\tset_type: \"integer\" | \"positive\",\n\tpoint_translation: number\n): NumberParseResult {\n\tconst gui_numerical_type = gui_model.root.properties.numerical_types.get(numerical_type.key);\n\tconst gui_result = gui_numerical_type?.properties.representation_type.switch({\n\t\tdate: () => convertToParseResult(parseDate(numberstring), \"expected format yyyy-mm-dd\"),\n\t\t\"date and time\": () => convertToParseResult(parseDateTime(numberstring), \"expected format yyyy-mm-dd h:m:s\"),\n\t\t\"HTML date and time\": () => convertToParseResult(parseDateTime(numberstring), \"expected format yyyy-mm-dd h:m:s\"),\n\t\tmodel: () => undefined,\n\t\tduration: (duration) =>\n\t\t\tduration.properties.unit.switch({\n\t\t\t\thours: () =>\n\t\t\t\t\tconvertToParseResult(parseHours(numberstring), \"expected format [#h][#m][#s] (e.g. 5h, 1h30s or 30m)\"),\n\t\t\t\tminutes: () =>\n\t\t\t\t\tconvertToParseResult(parseMinutes(numberstring), \"expected format [#h][#m][#s] (e.g. 5h, 1h30s or 30m)\"),\n\t\t\t\tseconds: () =>\n\t\t\t\t\tconvertToParseResult(parseSeconds(numberstring), \"expected format [#h][#m][#s] (e.g. 5h, 1h30s or 30m)\"),\n\t\t\t}),\n\t});\n\tif (gui_result !== undefined) {\n\t\treturn gui_result;\n\t} else {\n\t\tconst match = numberstring.match(NUMBER_REGEX);\n\t\tif (match === null || match.groups === undefined) {\n\t\t\treturn [\n\t\t\t\t\"no\",\n\t\t\t\t{\n\t\t\t\t\terror: \"value is not a number\",\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\tconst minor_string = match.groups[\"minor\"];\n\t\tif (minor_string !== undefined && minor_string.length > point_translation) {\n\t\t\treturn [\n\t\t\t\t\"no\",\n\t\t\t\t{\n\t\t\t\t\terror: `expected max ${point_translation} decimals`,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\tlet minor = 0;\n\t\tif (minor_string !== undefined) {\n\t\t\tminor = parseInt(minor_string);\n\t\t\tconst decimal_point_modification = point_translation - minor_string.length;\n\t\t\tif (decimal_point_modification > 0) {\n\t\t\t\tminor = minor * Math.pow(10, decimal_point_modification);\n\t\t\t}\n\t\t}\n\t\tconst sign = match.groups[\"sign\"] === undefined ? 1 : -1;\n\t\tlet major = 0;\n\t\tlet major_string = match.groups[\"major1\"] ?? match.groups[\"major2\"];\n\t\tif (major_string !== undefined) {\n\t\t\tmajor_string = major_string.replace(THOUSAND_SEPARATOR_REGEX, \"\");\n\t\t\tif (major_string.length > 0) {\n\t\t\t\tmajor = parseInt(major_string);\n\t\t\t}\n\t\t}\n\t\tconst number_value = sign * (major * Math.pow(10, point_translation) + minor);\n\t\tswitch (set_type) {\n\t\t\tcase \"positive\":\n\t\t\t\tif (number_value <= 0) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t\"no\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\terror: \"expected value > 0\",\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"integer\":\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(set_type);\n\t\t}\n\t\treturn [\n\t\t\t\"yes\",\n\t\t\t{\n\t\t\t\tnumber: number_value,\n\t\t\t},\n\t\t];\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_gui_model = api_configuration.libraries.gui_definition_lib.types.settings.alan_api;\nimport tryToOpenViewFromUrl from \"./tryToOpenViewFromUrl\";\n\nlet popStateEventListener: (() => void) | undefined = undefined;\nexport function startListening(target_window: api_gui_model.Cwindows) {\n\tstopListening();\n\tpopStateEventListener = () => {\n\t\ttryToOpenViewFromUrl(target_window);\n\t};\n\tsetTimeout(popStateEventListener, 0);\n\twindow.addEventListener(\"popstate\", popStateEventListener);\n}\n\nexport function stopListening() {\n\tif (popStateEventListener === undefined) return;\n\twindow.removeEventListener(\"popstate\", popStateEventListener);\n\tpopStateEventListener = undefined;\n}\n","import { api_configuration } from \"../../common\";\nimport client_state_decorator = api_configuration.types.client_state.alan_api;\nimport ClientState = require(\"../state/ClientState\");\nimport uuid = require(\"../state/uuid\");\nimport { translate, TranslationKey, FormatString } from \"./translate\";\n\ntype MessageType = Exclude;\ntype RawBodyOptions = {\n\traw_body?: string;\n};\ntype TranslatedBodyOptions = {\n\tbody?: TranslationKey | FormatString;\n};\ntype Options = (TranslatedBodyOptions | RawBodyOptions) & {\n\tkey?: string;\n};\n\nfunction isTranslatedBodyOptions(options: Options): options is Required {\n\treturn (options as TranslatedBodyOptions)?.body !== undefined;\n}\n\nfunction isRawBodyOptions(options: Options): options is Required {\n\treturn (options as RawBodyOptions)?.raw_body !== undefined;\n}\n\nexport function addMessage(type: MessageType, title: TranslationKey | FormatString, options?: Options): string {\n\tconst message_id = options && options.key ? options.key : uuid.generate();\n\tlet body_text: string | undefined = undefined;\n\tif (options !== undefined) {\n\t\tif (isTranslatedBodyOptions(options)) {\n\t\t\tbody_text = translate(options.body);\n\t\t} else if (isRawBodyOptions(options)) {\n\t\t\tbody_text = options.raw_body;\n\t\t}\n\t}\n\tClientState.client_state.properties.messages.switchOnEntryExists(message_id, undefined, function () {\n\t\tClientState.client_state.properties.messages.create(message_id, {\n\t\t\ttype: [type, {}],\n\t\t\ttitle: translate(title),\n\t\t\t\"has body\":\n\t\t\t\tbody_text === undefined\n\t\t\t\t\t? \"no\"\n\t\t\t\t\t: [\n\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbody: body_text,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ],\n\t\t});\n\t});\n\treturn message_id;\n}\n\nexport function addRawMessage(type: MessageType, title: string, body: string) {\n\tClientState.client_state.properties.messages.create(uuid.generate(), {\n\t\ttype: [type, {}],\n\t\ttitle: title,\n\t\t\"has body\": [\n\t\t\t\"yes\",\n\t\t\t{\n\t\t\t\tbody: body,\n\t\t\t},\n\t\t],\n\t});\n}\n\nexport function removeAllMessages(): void {\n\tClientState.client_state.properties.messages.forEach(function ($) {\n\t\t$.properties.type.switch({\n\t\t\terror: function () {\n\t\t\t\tClientState.client_state.properties.messages.delete($.key);\n\t\t\t},\n\t\t\twarning: function () {\n\t\t\t\tClientState.client_state.properties.messages.delete($.key);\n\t\t\t},\n\t\t\tsuccess: function () {\n\t\t\t\tClientState.client_state.properties.messages.delete($.key);\n\t\t\t},\n\t\t\twaiting: undefined,\n\t\t});\n\t});\n}\nexport function removeMessage(id: string): void {\n\tClientState.client_state.properties.messages.switchOnEntryExists(\n\t\tid,\n\t\tfunction () {\n\t\t\tClientState.client_state.properties.messages.delete(id);\n\t\t},\n\t\tundefined\n\t);\n}\n","import { api_configuration } from \"common\";\nimport api_main = api_configuration.libraries.gui_definition_lib.types.main.alan_api;\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport api_settings = api_configuration.libraries.gui_definition_lib.types.settings.alan_api;\nimport api_application = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport { client_state, gui_model } from \"../state/ClientState\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport { CollectionPathBuilder } from \"../navigation/createCollectionPathBuilder\";\nimport openViewOnNode from \"./openViewOnNode\";\nimport * as mapToIdPathBuilder from \"../state/mapToIdPathBuilder\";\nimport * as Rule from \"../state/Rule\";\nimport NodePathBuilder from \"../navigation/NodePathBuilder\";\nimport { Failed } from \"../Status\";\n\nexport default function openLandingPage(main: api_main.Cmain): void {\n\tlet has_landing_page = false;\n\tfor (const [, initial_view_expression] of main.properties.initial_content) {\n\t\tswitch (initial_view_expression.properties.from.state.name) {\n\t\t\tcase \"root\": {\n\t\t\t\tvisitViewExpression(\n\t\t\t\t\tinitial_view_expression.properties.expression,\n\t\t\t\t\tIdPathBuilder.create(),\n\t\t\t\t\tinitial_view_expression.key.ref\n\t\t\t\t);\n\t\t\t\thas_landing_page = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"user\": {\n\t\t\t\tswitch (client_state.properties.session.properties.status.state.name) {\n\t\t\t\t\tcase \"authenticated\": {\n\t\t\t\t\t\tconst authenticated = client_state.properties.session.properties.status.state.node;\n\t\t\t\t\t\tswitch (authenticated.properties.anonymous_session.state.name) {\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\tconst not_anonymous = authenticated.properties.anonymous_session.state.node;\n\t\t\t\t\t\t\t\tconst user_id = createIdFromUser(not_anonymous);\n\t\t\t\t\t\t\t\thas_landing_page = true;\n\t\t\t\t\t\t\t\tvisitViewExpression(\n\t\t\t\t\t\t\t\t\tinitial_view_expression.properties.expression,\n\t\t\t\t\t\t\t\t\tuser_id,\n\t\t\t\t\t\t\t\t\tinitial_view_expression.key.ref\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(authenticated.properties.anonymous_session.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"not authenticated\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(client_state.properties.session.properties.status.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(initial_view_expression.properties.from.state);\n\t\t}\n\t}\n\tif (has_landing_page) {\n\t\tclient_state.properties.has_landing_page.ensure(\"yes\", {});\n\t} else {\n\t\tclient_state.properties.has_landing_page.ensure(\"no\", {});\n\t}\n}\n\nasync function visitViewExpression(\n\texpression: api_main.Cview_expression,\n\tcontext: IdPathBuilder,\n\ttarget_window: api_settings.Cwindows\n): Promise {\n\tswitch (expression.properties.type.state.name) {\n\t\tcase \"branches\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\treturn await visitViewExpressionList($.properties.list, context, target_window);\n\t\t}\n\t\tcase \"collection lookup\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tswitch (client_state.properties.session.properties.status.state.name) {\n\t\t\t\tcase \"authenticated\": {\n\t\t\t\t\tconst authenticated = client_state.properties.session.properties.status.state.node;\n\t\t\t\t\tswitch (authenticated.properties.anonymous_session.state.name) {\n\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\tconst not_anonymous = authenticated.properties.anonymous_session.state.node;\n\t\t\t\t\t\t\treturn await visitViewExpression(\n\t\t\t\t\t\t\t\t$.properties.expression,\n\t\t\t\t\t\t\t\tcontext.collectionEntry($.properties.collection.entry, not_anonymous.properties.username),\n\t\t\t\t\t\t\t\ttarget_window\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn unexpectedState(authenticated.properties.anonymous_session.state);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"not authenticated\":\n\t\t\t\t\treturn false;\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(client_state.properties.session.properties.status.state);\n\t\t\t}\n\t\t}\n\t\tcase \"group step\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\treturn await visitViewExpression($.properties.expression, context.group($.properties.group.entry), target_window);\n\t\t}\n\t\tcase \"none\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"reference step\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tlet reference: IdPathBuilder | undefined;\n\t\t\tswitch ($.properties.type.state.name) {\n\t\t\t\tcase \"reference\": {\n\t\t\t\t\tconst $reference = $.properties.type.state.node;\n\t\t\t\t\treference = await referencedEntry(context, $reference.properties.reference.entry);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"property rule\": {\n\t\t\t\t\tconst $property_rule = $.properties.type.state.node;\n\t\t\t\t\treference = await new Promise((resolve) => {\n\t\t\t\t\t\tconst stream = Rule.query_constraint(\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tnew NodePathBuilder().reference_rule(\n\t\t\t\t\t\t\t\t$property_rule.properties.property.entry,\n\t\t\t\t\t\t\t\t$property_rule.properties.rule.entry\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstream.subscribe({\n\t\t\t\t\t\t\tupdate: (result) => {\n\t\t\t\t\t\t\t\tif (result === Failed) {\n\t\t\t\t\t\t\t\t\tstream.destroy();\n\t\t\t\t\t\t\t\t\tresolve(undefined);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (result instanceof IdPathBuilder) {\n\t\t\t\t\t\t\t\t\tstream.destroy();\n\t\t\t\t\t\t\t\t\tresolve(result);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"context rule\": {\n\t\t\t\t\tconst $context_rule = $.properties.type.state.node;\n\t\t\t\t\treference = await new Promise((resolve) => {\n\t\t\t\t\t\tconst stream = Rule.query_constraint(\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tnew NodePathBuilder().state_rule($context_rule.properties.rule.entry)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstream.subscribe({\n\t\t\t\t\t\t\tupdate: (result) => {\n\t\t\t\t\t\t\t\tif (result === Failed) {\n\t\t\t\t\t\t\t\t\tstream.destroy();\n\t\t\t\t\t\t\t\t\tresolve(undefined);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (result instanceof IdPathBuilder) {\n\t\t\t\t\t\t\t\t\tstream.destroy();\n\t\t\t\t\t\t\t\t\tresolve(result);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (reference === undefined) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn await visitViewExpression($.properties.expression, reference, target_window);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state switch\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tfor (const [state_name, case_] of $.properties.cases) {\n\t\t\t\tconst state_context = context.state($.properties.stategroup.entry, state_name);\n\t\t\t\tif (\n\t\t\t\t\t(await contextExists(state_context)) &&\n\t\t\t\t\t(await visitViewExpression(\n\t\t\t\t\t\tcase_.properties.expression,\n\t\t\t\t\t\tvisitAncestor(state_context, case_.properties.path),\n\t\t\t\t\t\ttarget_window\n\t\t\t\t\t))\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tcase \"view open\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tif (await contextExists(context)) {\n\t\t\t\treturn openView(context, $, target_window);\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(expression.properties.type.state);\n\t}\n}\n\nasync function visitViewExpressionList(\n\texpression: api_main.Cview_expression_list,\n\tcontext: IdPathBuilder,\n\ttarget_window: api_settings.Cwindows\n): Promise {\n\tif (await visitViewExpression(expression.properties.expression, context, target_window)) {\n\t\treturn true;\n\t} else {\n\t\tswitch (expression.properties.has_alternative.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = expression.properties.has_alternative.state.node;\n\t\t\t\treturn await visitViewExpressionList($.properties.tail, context, target_window);\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(expression.properties.has_alternative.state);\n\t\t}\n\t}\n}\n\nfunction openView(\n\tcontext: IdPathBuilder,\n\tview_open: api_main.Cview_open,\n\ttarget_window: api_settings.Cwindows\n): boolean {\n\tswitch (view_open.properties.node.state.name) {\n\t\tcase \"current\": {\n\t\t\tconst $ = view_open.properties.node.state.node;\n\t\t\topenViewOnNode(visitAncestor(context, $.properties.path), view_open.properties.view.ref, target_window, false);\n\t\t\treturn true;\n\t\t}\n\t\tcase \"root\": {\n\t\t\topenViewOnNode(IdPathBuilder.create(), view_open.properties.view.ref, target_window, false);\n\t\t\treturn true;\n\t\t}\n\t\tcase \"user\": {\n\t\t\tswitch (client_state.properties.session.properties.status.state.name) {\n\t\t\t\tcase \"authenticated\": {\n\t\t\t\t\tconst authenticated = client_state.properties.session.properties.status.state.node;\n\t\t\t\t\tswitch (authenticated.properties.anonymous_session.state.name) {\n\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\tconst not_anonymous = authenticated.properties.anonymous_session.state.node;\n\t\t\t\t\t\t\tconst user_id = createIdFromUser(not_anonymous);\n\t\t\t\t\t\t\topenViewOnNode(user_id, view_open.properties.view.ref, target_window, false);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn unexpectedState(authenticated.properties.anonymous_session.state);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"not authenticated\": {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(client_state.properties.session.properties.status.state);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(view_open.properties.node.state);\n\t}\n}\n\nfunction createIdFromUser(not_anonymous: api_client_state.Cno__anonymous_session): IdPathBuilder {\n\tconst users_collection_path =\n\t\tgui_model.input.application.properties.has_dynamic_users.cast(\"yes\").properties.users_collection_path;\n\tconst users_collection = users_collection_path.properties.property.entry;\n\tconst users_collection_context = vititObjectPathTail(IdPathBuilder.create(), users_collection_path.properties.head);\n\treturn users_collection_context.collectionEntry(users_collection, not_anonymous.properties.username);\n}\n\nasync function contextExists(context: IdPathBuilder): Promise {\n\tconst result = await DatastoreProxy.instance.collectionQuery({\n\t\t\"context node path\": context.build(),\n\t\t\"collection path\": CollectionPathBuilder.create().build(),\n\t\t\"select entries\": \"no\",\n\t\tfilters: {\n\t\t\t\"todo filter\": [\"no\", {}],\n\t\t\t\"value filters\": {},\n\t\t},\n\t\taggregates: {},\n\t});\n\n\tswitch (result.properties.context.state.name) {\n\t\tcase \"does not exist\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"exists\": {\n\t\t\treturn true;\n\t\t}\n\t\tcase \"permission denied\": {\n\t\t\treturn false;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(result.properties.context.state);\n\t}\n}\n\nasync function referencedEntry(context: IdPathBuilder, reference: string): Promise {\n\tconst result = await DatastoreProxy.instance.subscribeOnce({\n\t\t\"context node\": context.build(),\n\t\t\"mutation permissions\": \"ignore\",\n\t\t\"node subscription\": {\n\t\t\tattributes: {\n\t\t\t\t[reference]: {\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"property\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"include reference\": [\"yes\", {}],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t});\n\tswitch (result.properties.context.state.name) {\n\t\tcase \"does not exist\": {\n\t\t\treturn undefined;\n\t\t}\n\t\tcase \"exists\": {\n\t\t\tconst $ = result.properties.context.state.node;\n\t\t\tswitch ($.properties.subscription_result_data.properties.read_permitted.state.name) {\n\t\t\t\tcase \"no\": {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst read_permitted = $.properties.subscription_result_data.properties.read_permitted.state.node;\n\t\t\t\t\tconst reference_result = read_permitted.properties.attributes.get(reference);\n\t\t\t\t\tif (reference_result === undefined) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst text_property = reference_result.properties.type.cast(\"property\").properties.type.cast(\"text\");\n\t\t\t\t\t\tswitch (text_property.properties.reference_result.state.name) {\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst $ = text_property.properties.reference_result.state.node;\n\t\t\t\t\t\t\t\tswitch ($.properties.result.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"disconnected\": {\n\t\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"node\": {\n\t\t\t\t\t\t\t\t\t\tconst node = $.properties.result.state.node;\n\t\t\t\t\t\t\t\t\t\treturn mapToIdPathBuilder.fromClientReply(node.properties.id_path);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"permission denied\": {\n\t\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\treturn unexpectedState($.properties.result.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn unexpectedState(text_property.properties.reference_result.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState($.properties.subscription_result_data.properties.read_permitted.state);\n\t\t\t}\n\t\t}\n\t\tcase \"permission denied\": {\n\t\t\treturn undefined;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(result.properties.context.state);\n\t}\n}\n\nfunction visitAncestor(context: IdPathBuilder, path: api_main.Cancestor_node_path): IdPathBuilder {\n\treturn path.properties.has_step.switch({\n\t\tno: context,\n\t\tyes: ($) => visitAncestor(context.removeTail(), $.properties.tail),\n\t});\n}\n\nfunction vititObjectPathTail(id: IdPathBuilder, path: api_application.Cobject_path_tail): IdPathBuilder {\n\tlet property: string | undefined;\n\twhile (path.properties.has_steps.state.name === \"yes\") {\n\t\tconst has_steps = path.properties.has_steps.state.node;\n\t\tswitch (has_steps.properties.type.state.name) {\n\t\t\tcase \"property value\": {\n\t\t\t\tconst $ = has_steps.properties.type.state.node;\n\t\t\t\tproperty = $.properties.property.properties.property.entry;\n\t\t\t\tswitch ($.properties.property.properties.property.ref.properties.type.state.name) {\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tid = id.group(property);\n\t\t\t\t\t\tproperty = undefined;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.property.properties.property.ref.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state\":\n\t\t\t\tif (property !== undefined) {\n\t\t\t\t\tconst state = has_steps.properties.type.state.node.properties.state.entry;\n\t\t\t\t\tid = id.state(property, state);\n\t\t\t\t\tproperty = undefined;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"parent\":\n\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\tcase \"dependency\":\n\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\tcase \"reference set\":\n\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\tdefault:\n\t\t\t\tunexpectedState(has_steps.properties.type.state);\n\t\t}\n\t\tpath = has_steps.properties.tail;\n\t}\n\treturn id;\n}\n","import { api_configuration } from \"../../common\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_settings = api_configuration.libraries.gui_definition_lib.types.settings.alan_api;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { registerIdPath, registerNodeContext } from \"../state/registerClientState\";\nimport Window = require(\"../widgets/dom/Window\");\nimport DestructorTree from \"../DestructorTree\";\n\nexport default function (\n\tcontext: IdPathBuilder | api_cs.Cnode,\n\tview: api_views.Cviews__,\n\twindow: api_settings.Cwindows,\n\tin_front = true\n): api_cs.Copen_views {\n\tconst window_instance = Window.getWindowInstance(window.key);\n\tlet open_view = window_instance.is_view_open(context, view);\n\tif (open_view === \"no\") {\n\t\tconst destructor = new DestructorTree();\n\t\tlet node: api_cs.Cnode;\n\t\tif (context instanceof IdPathBuilder) {\n\t\t\tnode = registerIdPath(context, destructor);\n\t\t} else {\n\t\t\tnode = context;\n\t\t\tregisterNodeContext(node, destructor);\n\t\t}\n\t\topen_view = window_instance.open_view(node, view, undefined, in_front);\n\t\topen_view.onDestroy(() => destructor.destroy());\n\t} else {\n\t\twindow_instance.activate_view(open_view, in_front);\n\t}\n\treturn open_view;\n}\n","type Translation = {\n\t\"Modifications detected, do you want to discard and close?\": string;\n\t\"Delete template\": string;\n\t\"of type\": string;\n\t\"Discard your changes?\": string;\n\t'Replace \"{0}\"?': string;\n\t\"An error occurred\": string;\n\t\"Could not open view.\": string;\n\t\"Performing maintenance, please wait…\": string;\n\t\"Your browser is not supported. Proceed with caution.\": string;\n\tUsername: string;\n\tPassword: string;\n\t\"Change password\": string;\n\t\"Remember me\": string;\n\t\"Log in anonymously\": string;\n\t\"Log in\": string;\n\t\"Login failed: username and/or password is incorrect.\": string;\n\t\"Unexpected error\": string;\n\t\"The error has been reported. Refresh your browser before continuing.\": string;\n\t\"Check your internet connection.\": string;\n\t\"Not all subcollections duplicated\": string;\n\t\"{0} have not been duplicated because it contains too many items.\": string;\n\t\"{0} have not been duplicated because its items could not be retrieved.\": string;\n\t\"Invalid context {0}\": string;\n\t\"The view does not exist {0} {1}\": string;\n\t\"The view doest not match the type of the id.\": string;\n\t\"The URL might be wrong. {0}\": string;\n\t\"Cannot requery\": string;\n\t\"Download failed\": string;\n\t\"Entry does not exist (anymore).\": string;\n\t\"Permission denied.\": string;\n\t\"Incomplete file name\": string;\n\t\"Not all values of the file name could be retreived.\": string;\n\t\"Cannot initialize command\": string;\n\t\"Matrix '{0}' candidates could not be initialized. {1}\": string;\n\t\"Could not reset password\": string;\n\t\"No permission to reset password.\": string;\n\t\"Can not reset password.\": string;\n\t\"Username is unknown.\": string;\n\t\"Can not send password\": string;\n\t\"Reset the password.\": string;\n\t\"Password reset link copied to clipboard\": string;\n\t\"Can't copy password\": string;\n\t\"Clipboard is not supported.\": string;\n\t\"Failed to write to the clipboard.\": string;\n\t\"Not all subcollections copied\": string;\n\t\"{0} have not been copied because it contains too many items.\": string;\n\t\"{0} have not been copied because its items could not be retrieved.\": string;\n\t\"Cannot upload file\": string;\n\t\"The file can not be uploaded because the property is not editable.\": string;\n\t\"Window is not intialized.\": string;\n\t\"Window '{0}' is not initialized.\": string;\n\t\"Cannot add entry\": string;\n\t\"The reference is not resolved. Try again later\": string;\n\t\"The link is not resolved. Try again later\": string;\n\t\"Failed to import file\": string;\n\t\"Sucessfully imported CSV file\": string;\n\t\"Cannot open new window\": string;\n\t\"Save the entry, then try again.\": string;\n\t\"Cannot copy link\": string;\n\t\"Save the entry first, then try again\": string;\n\t\"Item not removed\": string;\n\t\"Cannot delete item\": string;\n\t\"Something went wrong.\": string;\n\t\"Could not remove {0} from {1} because it has blocking dependencies.\": string;\n\t\"Could not remove {0} from {1} because it does not exist in backend.\": string;\n\t\"Could not remove {0} from {1} because you're not allowed to read it.\": string;\n\t\"Could not remove {0} from {1}. Cause: {2}\": string;\n\t\"The key is unknown.\": string;\n\t\"Cannot remove the root\": string;\n\t\"Duplication not allowed\": string;\n\t\"Can not duplicate the root.\": string;\n\t\"You do not have the sufficient rights to perform this operation.\": string;\n\t\"Cannot duplicate this item.\": string;\n\t\"Parameter not set\": string;\n\t\"Unable to resolve\": string;\n\t\"This reference depends on another reference that is not yet set. Set that reference and try again.\": string;\n\t\"Unable to resolve this reference: {0}\": string;\n\t\"This link depends on another link that is not set.\": string;\n\t\"Invalid parameters\": string;\n\t\"Check all fields and try again.\": string;\n\t\"Item does not exist.\": string;\n\t\"The reference {0} is not set.\": string;\n\t\"The reference {0} is not readable.\": string;\n\t\"The reference {0} output {1} is not readable.\": string;\n\t\"The state constraint {0} is not readable.\": string;\n\t\"The stategroup {0} output parameter {1} is not readable.\": string;\n\t\"Failed to duplicate entry\": string;\n\t\"Entry doesnt exist anymore...\": string;\n\t\"Failed to query entries.\": string;\n\t\"Failed to query entries for linked node mapping '{0}'.\": string;\n\t\"Linked item not found\": string;\n\t\"Cannot open item\": string;\n\t\"The item cannot be found.\": string;\n\t\"Unable to find entry\": string;\n\t\"Text filter limit exceeded.\": string;\n\t\"Could not download report {0}\": string;\n\t\"Reopen the view and try again.\": string;\n\t\"Cannot upload template\": string;\n\t\"Cannot read template\": string;\n\t\"Upload the file again.\": string;\n\t\"Changes not saved\": string;\n\t\"There are invalid fields remaining. Check all fields and try again.\": string;\n\t\"Item not saved\": string;\n\t\"Parent item removed.\": string;\n\t\"Permission denied. Permissions may have changed while you were editing. Try saving again.\": string;\n\t\"Item cannot be saved, the datastore did not accept your changes.\": string;\n\t\"Datastore update failed.\": string;\n\t\"Can not rename the entry.\": string;\n\t\"Breaks linear order.\": string;\n\t\"Name is not valid or already in use.\": string;\n\t\"Cannot select reference\": string;\n\t\"Cannot reset password.\": string;\n\t\"The username changed.\": string;\n\t\"Could not determine inline view\": string;\n\t\"hour (short)\": string;\n\t\"minutes (short)\": string;\n\t\"seconds (short)\": string;\n\t\"out of range\": string;\n\t\"Add entry not allowed\": string;\n\t\"The application is updated\": string;\n\t\"Can't download report because the parameters are invalid\": string;\n\t\"Unable to put item in order\": string;\n\t\"Unable to reorder items.\": string;\n\t\"The CSV file is not valid. Refer to the error report and try again.\": string;\n\t\"Something went wrong. Please try again.\": string;\n\t\"The file name '{0}' is invalid.\": string;\n\t\"The file '{0}' already exists.\": string;\n\t\"Server announcement\": string;\n\t\"There are unsaved changes which might be overwritten. Are you sure you want to continue?\": string;\n\t\"Imported CSV file\": string;\n\t\"Not all changes have been saved. Please review and save again.\": string;\n\t\"Changes have been saved\": string;\n\t\"Did not complete operation\": string;\n\t\"The operation was lost before it was completed\": string;\n\t\"Updated scheduled\": string;\n};\ntype Translations = {\n\tenglish: Translation;\n\tdutch: Translation;\n};\nexport type TranslationKey = keyof Translation;\nexport type Languages = keyof Translations;\n\nconst translations: Translations = {\n\tenglish: {\n\t\t\"Modifications detected, do you want to discard and close?\":\n\t\t\t\"Modifications detected, do you want to discard and close?\",\n\t\t\"Delete template\": \"Delete template\",\n\t\t\"of type\": \"of type\",\n\t\t\"Discard your changes?\": \"Discard your changes?\",\n\t\t'Replace \"{0}\"?': 'Replace \"{0}\"?',\n\t\t\"An error occurred\": \"An error occurred\",\n\t\t\"Could not open view.\": \"Could not open view.\",\n\t\t\"Performing maintenance, please wait…\": \"Performing maintenance, please wait…\",\n\t\t\"Your browser is not supported. Proceed with caution.\": \"Your browser is not supported. Proceed with caution.\",\n\t\tUsername: \"Username\",\n\t\tPassword: \"Password\",\n\t\t\"Change password\": \"Change password\",\n\t\t\"Remember me\": \"Remember me\",\n\t\t\"Log in anonymously\": \"Log in anonymously\",\n\t\t\"Log in\": \"Log in\",\n\t\t\"Login failed: username and/or password is incorrect.\": \"Login failed: username and/or password is incorrect.\",\n\t\t\"Unexpected error\": \"Unexpected error\",\n\t\t\"The error has been reported. Refresh your browser before continuing.\":\n\t\t\t\"The error has been reported. Refresh your browser before continuing.\",\n\t\t\"Check your internet connection.\": \"Check your internet connection.\",\n\t\t\"Not all subcollections duplicated\": \"Not all subcollections duplicated\",\n\t\t\"{0} have not been duplicated because it contains too many items.\":\n\t\t\t\"{0} have not been duplicated because it contains too many items.\",\n\t\t\"{0} have not been duplicated because its items could not be retrieved.\":\n\t\t\t\"{0} have not been duplicated because its items could not be retrieved.\",\n\t\t\"Invalid context {0}\": \"Invalid context {0}\",\n\t\t\"The view does not exist {0} {1}\": \"The view does not exist {0} {1}\",\n\t\t\"The view doest not match the type of the id.\": \"The view doest not match the type of the id.\",\n\t\t\"The URL might be wrong. {0}\": \"The URL might be wrong. {0}\",\n\t\t\"Cannot requery\": \"Cannot requery\",\n\t\t\"Download failed\": \"Download failed\",\n\t\t\"Entry does not exist (anymore).\": \"Entry does not exist (anymore).\",\n\t\t\"Permission denied.\": \"Permission denied.\",\n\t\t\"Incomplete file name\": \"Incomplete file name\",\n\t\t\"Not all values of the file name could be retreived.\": \"Not all values of the file name could be retreived.\",\n\t\t\"Cannot initialize command\": \"Cannot initialize command\",\n\t\t\"Matrix '{0}' candidates could not be initialized. {1}\": \"Matrix '{0}' candidates could not be initialized. {1}\",\n\t\t\"Could not reset password\": \"Could not reset password\",\n\t\t\"No permission to reset password.\": \"No permission to reset password.\",\n\t\t\"Can not reset password.\": \"Can not reset password.\",\n\t\t\"Username is unknown.\": \"Username is unknown.\",\n\t\t\"Can not send password\": \"Can not send password\",\n\t\t\"Reset the password.\": \"Reset the password.\",\n\t\t\"Password reset link copied to clipboard\": \"Password reset link copied to clipboard\",\n\t\t\"Can't copy password\": \"Can't copy password\",\n\t\t\"Clipboard is not supported.\": \"Clipboard is not supported.\",\n\t\t\"Failed to write to the clipboard.\": \"Failed to write to the clipboard.\",\n\t\t\"Not all subcollections copied\": \"Not all subcollections copied\",\n\t\t\"{0} have not been copied because it contains too many items.\":\n\t\t\t\"{0} have not been copied because it contains too many items.\",\n\t\t\"{0} have not been copied because its items could not be retrieved.\":\n\t\t\t\"{0} have not been copied because its items could not be retrieved.\",\n\t\t\"Cannot upload file\": \"Cannot upload file\",\n\t\t\"The file can not be uploaded because the property is not editable.\":\n\t\t\t\"The file can not be uploaded because the property is not editable.\",\n\t\t\"Window is not intialized.\": \"Window is not intialized.\",\n\t\t\"Window '{0}' is not initialized.\": \"Window '{0}' is not initialized.\",\n\t\t\"Cannot add entry\": \"Cannot add entry\",\n\t\t\"The reference is not resolved. Try again later\": \"The reference is not resolved. Try again later\",\n\t\t\"The link is not resolved. Try again later\": \"The link is not resolved. Try again later\",\n\t\t\"Failed to import file\": \"Failed to import file\",\n\t\t\"Sucessfully imported CSV file\": \"Sucessfully imported CSV file\",\n\t\t\"Cannot open new window\": \"Cannot open new window\",\n\t\t\"Save the entry, then try again.\": \"Save the entry, then try again.\",\n\t\t\"Cannot copy link\": \"Cannot copy link\",\n\t\t\"Save the entry first, then try again\": \"Save the entry first, then try again\",\n\t\t\"Item not removed\": \"Item not removed\",\n\t\t\"Cannot delete item\": \"Cannot delete item\",\n\t\t\"Something went wrong.\": \"Something went wrong.\",\n\t\t\"Could not remove {0} from {1} because it has blocking dependencies.\":\n\t\t\t\"Could not remove {0} from {1} because it has blocking dependencies.\",\n\t\t\"Could not remove {0} from {1} because it does not exist in backend.\":\n\t\t\t\"Could not remove {0} from {1} because it does not exist in backend.\",\n\t\t\"Could not remove {0} from {1} because you're not allowed to read it.\":\n\t\t\t\"Could not remove {0} from {1} because you're not allowed to read it.\",\n\t\t\"Could not remove {0} from {1}. Cause: {2}\": \"Could not remove {0} from {1}. Cause: {2}\",\n\t\t\"The key is unknown.\": \"The key is unknown.\",\n\t\t\"Cannot remove the root\": \"Cannot remove the root\",\n\t\t\"Duplication not allowed\": \"Duplication not allowed\",\n\t\t\"Can not duplicate the root.\": \"Can not duplicate the root.\",\n\t\t\"You do not have the sufficient rights to perform this operation.\":\n\t\t\t\"You do not have the sufficient rights to perform this operation.\",\n\t\t\"Cannot duplicate this item.\": \"Cannot duplicate this item.\",\n\t\t\"Parameter not set\": \"Parameter not set\",\n\t\t\"Unable to resolve\": \"Unable to resolve\",\n\t\t\"This reference depends on another reference that is not yet set. Set that reference and try again.\":\n\t\t\t\"This reference depends on another reference that is not yet set. Set that reference and try again.\",\n\t\t\"Unable to resolve this reference: {0}\": \"Unable to resolve this reference: {0}\",\n\t\t\"This link depends on another link that is not set.\": \"This link depends on another link that is not set.\",\n\t\t\"Invalid parameters\": \"Invalid parameters\",\n\t\t\"Check all fields and try again.\": \"Check all fields and try again.\",\n\t\t\"Item does not exist.\": \"Item does not exist.\",\n\t\t\"The reference {0} is not set.\": \"The reference {0} is not set.\",\n\t\t\"The reference {0} is not readable.\": \"The reference {0} is not readable.\",\n\t\t\"The reference {0} output {1} is not readable.\": \"The reference {0} output {1} is not readable.\",\n\t\t\"The state constraint {0} is not readable.\": \"The state constraint {0} is not readable.\",\n\t\t\"The stategroup {0} output parameter {1} is not readable.\":\n\t\t\t\"The stategroup {0} output parameter {1} is not readable.\",\n\t\t\"Failed to duplicate entry\": \"Failed to duplicate entry\",\n\t\t\"Entry doesnt exist anymore...\": \"Entry doesnt exist anymore...\",\n\t\t\"Failed to query entries.\": \"Failed to query entries.\",\n\t\t\"Failed to query entries for linked node mapping '{0}'.\": \"Failed to query entries for linked node mapping '{0}'.\",\n\t\t\"Linked item not found\": \"Linked item not found\",\n\t\t\"Cannot open item\": \"Cannot open item\",\n\t\t\"The item cannot be found.\": \"The item cannot be found.\",\n\t\t\"Unable to find entry\": \"Unable to find entry\",\n\t\t\"Text filter limit exceeded.\": \"Text filter limit exceeded.\",\n\t\t\"Could not download report {0}\": \"Could not download report {0}\",\n\t\t\"Reopen the view and try again.\": \"Reopen the view and try again.\",\n\t\t\"Cannot upload template\": \"Cannot upload template\",\n\t\t\"Cannot read template\": \"Cannot read template\",\n\t\t\"Upload the file again.\": \"Upload the file again.\",\n\t\t\"Changes not saved\": \"Changes not saved\",\n\t\t\"There are invalid fields remaining. Check all fields and try again.\":\n\t\t\t\"There are invalid fields remaining. Check all fields and try again.\",\n\t\t\"Item not saved\": \"Item not saved\",\n\t\t\"Parent item removed.\": \"Parent item removed.\",\n\t\t\"Permission denied. Permissions may have changed while you were editing. Try saving again.\":\n\t\t\t\"Permission denied. Permissions may have changed while you were editing. Try saving again.\",\n\t\t\"Item cannot be saved, the datastore did not accept your changes.\":\n\t\t\t\"Item cannot be saved, the datastore did not accept your changes.\",\n\t\t\"Datastore update failed.\": \"Datastore update failed.\",\n\t\t\"Can not rename the entry.\": \"Can not rename the entry.\",\n\t\t\"Breaks linear order.\": \"Breaks linear order.\",\n\t\t\"Name is not valid or already in use.\": \"Name is not valid or already in use.\",\n\t\t\"Cannot select reference\": \"Cannot select reference\",\n\t\t\"Cannot reset password.\": \"Cannot reset password.\",\n\t\t\"The username changed.\": \"The username changed.\",\n\t\t\"Could not determine inline view\": \"Could not determine inline view\",\n\t\t\"hour (short)\": \"h\",\n\t\t\"minutes (short)\": \"m\",\n\t\t\"seconds (short)\": \"s\",\n\t\t\"out of range\": \"out of range\",\n\t\t\"Add entry not allowed\": \"Add entry not allowed\",\n\t\t\"The application is updated\": \"The application is updated\",\n\t\t\"Can't download report because the parameters are invalid\":\n\t\t\t\"Can't download report because the parameters are invalid\",\n\t\t\"Unable to put item in order\": \"Unable to put item in order\",\n\t\t\"Unable to reorder items.\": \"Unable to reorder items.\",\n\t\t\"The CSV file is not valid. Refer to the error report and try again.\":\n\t\t\t\"The CSV file is not valid. Refer to the error report and try again.\",\n\t\t\"Something went wrong. Please try again.\": \"Something went wrong. Please try again.\",\n\t\t\"The file name '{0}' is invalid.\": \"The file name '{0}' is invalid.\",\n\t\t\"The file '{0}' already exists.\": \"The file '{0}' already exists.\",\n\t\t\"Server announcement\": \"Server announcement\",\n\t\t\"There are unsaved changes which might be overwritten. Are you sure you want to continue?\":\n\t\t\t\"There are unsaved changes which might be overwritten. Are you sure you want to continue?\",\n\t\t\"Imported CSV file\": \"Imported CSV file\",\n\t\t\"Not all changes have been saved. Please review and save again.\":\n\t\t\t\"Not all changes have been saved. Please review and save again.\",\n\t\t\"Changes have been saved\": \"Changes have been saved\",\n\t\t\"Did not complete operation\": \"Did not complete operation\",\n\t\t\"The operation was lost before it was completed\": \"The operation was lost before it was completed\",\n\t\t\"Updated scheduled\": \"Updated scheduled\",\n\t},\n\tdutch: {\n\t\t\"Modifications detected, do you want to discard and close?\":\n\t\t\t\"Er zijn aanpassingen gemaakt, wilt u deze ongedaan maken en het scherm sluiten?\",\n\t\t\"Delete template\": \"Verwijder template\",\n\t\t\"of type\": \"van type\",\n\t\t\"Discard your changes?\": \"Wijzigingen ongedaan maken?\",\n\t\t'Replace \"{0}\"?': 'Vervang \"{0}\"?',\n\t\t\"An error occurred\": \"Er is iets fout gegaan\",\n\t\t\"Could not open view.\": \"Kon het scherm niet openen.\",\n\t\t\"Performing maintenance, please wait…\": \"Onderhoud wordt uitgevoerd. Even geduld…\",\n\t\t\"Your browser is not supported. Proceed with caution.\":\n\t\t\t\"Uw browser wordt niet ondersteund. Ga verder op eigen risico.\",\n\t\tUsername: \"Gebruikersnaam\",\n\t\tPassword: \"Wachtwoord\",\n\t\t\"Change password\": \"Wachtwoord wijzigen\",\n\t\t\"Remember me\": \"Onthoud mij\",\n\t\t\"Log in anonymously\": \"Anoniem inloggen\",\n\t\t\"Log in\": \"Log in\",\n\t\t\"Login failed: username and/or password is incorrect.\":\n\t\t\t\"Inloggen mislukt: gebruikersnaam en/of wachtwoord is niet correct.\",\n\t\t\"Unexpected error\": \"Onverwachte fout\",\n\t\t\"The error has been reported. Refresh your browser before continuing.\":\n\t\t\t\"De fout is gerapporteerd. Ververs je browser voordat je verder gaat.\",\n\t\t\"Check your internet connection.\": \"Controleer je internetverbinding.\",\n\t\t\"Not all subcollections duplicated\": \"Niet alle subcollecties zijn gedupliceerd\",\n\t\t\"{0} have not been duplicated because it contains too many items.\":\n\t\t\t\"{0} is niet gedupliceerd omdat het te veel items bevat.\",\n\t\t\"{0} have not been duplicated because its items could not be retrieved.\":\n\t\t\t\"{0} zijn niet gedupliceerd omdat de items niet konden worden opgehaald.\",\n\t\t\"Invalid context {0}\": \"Ongeldige context {0}\",\n\t\t\"The view does not exist {0} {1}\": \"De weergave bestaat niet {0} {1}\",\n\t\t\"The view doest not match the type of the id.\": \"De weergave komt niet overeen met het type id.\",\n\t\t\"The URL might be wrong. {0}\": \"De URL is mogelijk onjuist. {0}\",\n\t\t\"Cannot requery\": \"Kan gegevens niet ophalen\",\n\t\t\"Download failed\": \"Download mislukt\",\n\t\t\"Entry does not exist (anymore).\": \"Invoer bestaat niet (meer).\",\n\t\t\"Permission denied.\": \"Geen toestemming.\",\n\t\t\"Incomplete file name\": \"Onvolledige bestandsnaam\",\n\t\t\"Not all values of the file name could be retreived.\":\n\t\t\t\"Niet alle waarden van de bestandsnaam kunnen worden achterhaald.\",\n\t\t\"Cannot initialize command\": \"Kan opdracht niet initialiseren\",\n\t\t\"Matrix '{0}' candidates could not be initialized. {1}\":\n\t\t\t\"Kandidaten voor matrix '{0}' konden niet worden geïnitialiseerd. {1}\",\n\t\t\"Could not reset password\": \"Kon wachtwoord niet opnieuw instellen\",\n\t\t\"No permission to reset password.\": \"Geen toestemming om het wachtwoord opnieuw in te stellen.\",\n\t\t\"Can not reset password.\": \"Kan wachtwoord niet opnieuw instellen.\",\n\t\t\"Username is unknown.\": \"Gebruikersnaam is onbekend.\",\n\t\t\"Can not send password\": \"Kan geen wachtwoord verzenden\",\n\t\t\"Reset the password.\": \"Stel het wachtwoord opnieuw in.\",\n\t\t\"Password reset link copied to clipboard\": \"Wachtwoord reset link gekopieerd naar klembord\",\n\t\t\"Can't copy password\": \"Kan wachtwoord niet kopiëren\",\n\t\t\"Clipboard is not supported.\": \"Klembord wordt niet ondersteund.\",\n\t\t\"Failed to write to the clipboard.\": \"Kan niet naar het klembord schrijven.\",\n\t\t\"Not all subcollections copied\": \"Niet alle subcollecties gekopieerd\",\n\t\t\"{0} have not been copied because it contains too many items.\":\n\t\t\t\"{0} zijn niet gekopieerd omdat het te veel items bevat.\",\n\t\t\"{0} have not been copied because its items could not be retrieved.\":\n\t\t\t\"{0} zijn niet gekopieerd omdat de items niet konden worden opgehaald.\",\n\t\t\"Cannot upload file\": \"Kan bestand niet uploaden\",\n\t\t\"The file can not be uploaded because the property is not editable.\":\n\t\t\t\"Het bestand kan niet worden geüpload omdat de eigenschap niet kan worden bewerkt.\",\n\t\t\"Window is not intialized.\": \"Venster is niet geïnitialiseerd.\",\n\t\t\"Window '{0}' is not initialized.\": \"Venster '{0}' is niet geïnitialiseerd.\",\n\t\t\"Cannot add entry\": \"Kan geen invoer toevoegen\",\n\t\t\"The reference is not resolved. Try again later\": \"De referentie is niet gevonden. Probeer het later opnieuw\",\n\t\t\"The link is not resolved. Try again later\": \"De link is niet gevonden. Probeer het later opnieuw\",\n\t\t\"Failed to import file\": \"Importeren van bestand mislukt\",\n\t\t\"Sucessfully imported CSV file\": \"CSV-bestand is succesvol geïmporteerd\",\n\t\t\"Cannot open new window\": \"Kan geen nieuw venster openen\",\n\t\t\"Save the entry, then try again.\": \"Sla het item op en probeer het opnieuw.\",\n\t\t\"Cannot copy link\": \"Kan link niet kopiëren\",\n\t\t\"Save the entry first, then try again\": \"Sla de invoer eerst op en probeer het opnieuw\",\n\t\t\"Item not removed\": \"Artikel niet verwijderd\",\n\t\t\"Cannot delete item\": \"Kan item niet verwijderen\",\n\t\t\"Something went wrong.\": \"Er is iets fout gegaan.\",\n\t\t\"Could not remove {0} from {1} because it has blocking dependencies.\":\n\t\t\t\"Kon {0} niet verwijderen uit {1} omdat het blokkerende afhankelijkheden heeft.\",\n\t\t\"Could not remove {0} from {1} because it does not exist in backend.\":\n\t\t\t\"Kon {0} niet verwijderen uit {1} omdat het niet bestaat op de server.\",\n\t\t\"Could not remove {0} from {1} because you're not allowed to read it.\":\n\t\t\t\"Kon {0} niet verwijderen uit {1} omdat u geen leesrechten heeft.\",\n\t\t\"Could not remove {0} from {1}. Cause: {2}\": \"Kon {0} niet verwijderen uit {1}. Oorzaak: {2}\",\n\t\t\"The key is unknown.\": \"De sleutel is onbekend.\",\n\t\t\"Cannot remove the root\": \"Kan de root niet verwijderen\",\n\t\t\"Duplication not allowed\": \"Duplicatie niet toegestaan\",\n\t\t\"Can not duplicate the root.\": \"Kan de root niet dupliceren.\",\n\t\t\"You do not have the sufficient rights to perform this operation.\":\n\t\t\t\"U hebt niet voldoende rechten om deze bewerking uit te voeren.\",\n\t\t\"Cannot duplicate this item.\": \"Kan dit item niet dupliceren.\",\n\t\t\"Parameter not set\": \"Parameter niet ingevoerd\",\n\t\t\"Unable to resolve\": \"Niet kunnen vinden\",\n\t\t\"This reference depends on another reference that is not yet set. Set that reference and try again.\":\n\t\t\t\"Deze referentie is afhankelijk van een andere referentie die nog niet is ingevoerd. Voer die referentie in en probeer het opnieuw.\",\n\t\t\"Unable to resolve this reference: {0}\": \"Kan deze referentie niet gevonden: {0}\",\n\t\t\"This link depends on another link that is not set.\":\n\t\t\t\"Deze link is afhankelijk van een andere link die niet is ingevoerd.\",\n\t\t\"Invalid parameters\": \"ongeldige parameters\",\n\t\t\"Check all fields and try again.\": \"Controleer alle velden en probeer het opnieuw.\",\n\t\t\"Item does not exist.\": \"Artikel bestaat niet.\",\n\t\t\"The reference {0} is not set.\": \"De referentie {0} is niet ingevoerd.\",\n\t\t\"The reference {0} is not readable.\": \"De referentie {0} is niet leesbaar.\",\n\t\t\"The reference {0} output {1} is not readable.\": \"De referentie {0} output {1} is niet leesbaar.\",\n\t\t\"The state constraint {0} is not readable.\": \"De state constraint {0} is niet leesbaar.\",\n\t\t\"The stategroup {0} output parameter {1} is not readable.\":\n\t\t\t\"De stategroup {0} output parameter {1} is niet leesbaar.\",\n\t\t\"Failed to duplicate entry\": \"Kan item niet dupliceren\",\n\t\t\"Entry doesnt exist anymore...\": \"Entry bestaat niet meer ...\",\n\t\t\"Failed to query entries.\": \"Zoeken naar items is mislukt.\",\n\t\t\"Failed to query entries for linked node mapping '{0}'.\":\n\t\t\t\"Zoeken naar items voor linked node mapping '{0}' is mislukt.\",\n\t\t\"Linked item not found\": \"Gekoppeld artikel niet gevonden\",\n\t\t\"Cannot open item\": \"Kan item niet openen\",\n\t\t\"The item cannot be found.\": \"Het artikel kan niet gevonden worden.\",\n\t\t\"Unable to find entry\": \"Kan vermelding niet vinden\",\n\t\t\"Text filter limit exceeded.\": \"Tekstfilterlimiet overschreden.\",\n\t\t\"Could not download report {0}\": \"Kan rapport {0} niet downloaden\",\n\t\t\"Reopen the view and try again.\": \"Open de weergave opnieuw en probeer het opnieuw.\",\n\t\t\"Cannot upload template\": \"Kan sjabloon niet uploaden\",\n\t\t\"Cannot read template\": \"Kan sjabloon niet lezen\",\n\t\t\"Upload the file again.\": \"Upload het bestand opnieuw.\",\n\t\t\"Changes not saved\": \"Wijzigingen niet opgeslagen\",\n\t\t\"There are invalid fields remaining. Check all fields and try again.\":\n\t\t\t\"Er zijn nog ongeldige velden. Controleer alle velden en probeer het opnieuw.\",\n\t\t\"Item not saved\": \"Item niet opgeslagen\",\n\t\t\"Parent item removed.\": \"Bovenliggend item verwijderd.\",\n\t\t\"Permission denied. Permissions may have changed while you were editing. Try saving again.\":\n\t\t\t\"Geen toestemming. Toestemmingen kunnen zijn gewijzigd tijdens het bewerken. Probeer opnieuw op te slaan.\",\n\t\t\"Item cannot be saved, the datastore did not accept your changes.\":\n\t\t\t\"Item kan niet worden opgeslagen, de datastore heeft uw wijzigingen niet geaccepteerd.\",\n\t\t\"Datastore update failed.\": \"Datastore-update mislukt.\",\n\t\t\"Can not rename the entry.\": \"Kan het item niet hernoemen.\",\n\t\t\"Breaks linear order.\": \"Breekt lineaire volgorde.\",\n\t\t\"Name is not valid or already in use.\": \"Naam is niet geldig of is al in gebruik.\",\n\t\t\"Cannot select reference\": \"Referentie kan niet worden geselecteerd\",\n\t\t\"Cannot reset password.\": \"Kan wachtwoord niet opnieuw instellen.\",\n\t\t\"The username changed.\": \"De gebruikersnaam is gewijzigd.\",\n\t\t\"Could not determine inline view\": \"Kan inline weergave niet bepalen\",\n\t\t\"hour (short)\": \"u\",\n\t\t\"minutes (short)\": \"m\",\n\t\t\"seconds (short)\": \"s\",\n\t\t\"out of range\": \"buiten bereik\",\n\t\t\"Add entry not allowed\": \"Invoer toevoegen niet toegestaan\",\n\t\t\"The application is updated\": \"De applicatie is bijgewerkt\",\n\t\t\"Can't download report because the parameters are invalid\":\n\t\t\t\"Het rapport kan niet worden gedownload. De parameters zijn niet valide.\",\n\t\t\"Unable to put item in order\": \"Kan het item niet op volgorde zetten\",\n\t\t\"Unable to reorder items.\": \"Kan items niet opnieuw ordenen\",\n\t\t\"The CSV file is not valid. Refer to the error report and try again.\":\n\t\t\t\"Het CSV-bestand is niet valide. Raadpleeg het foutenrapport en probeer het opnieuw.\",\n\t\t\"Something went wrong. Please try again.\": \"Er is een fout opgetreden. Probeer het opnieuw.\",\n\t\t\"The file name '{0}' is invalid.\": \"De bestandsnaam '{0}' is niet valide.\",\n\t\t\"The file '{0}' already exists.\": \"Het bestand met de naam '{0}' bestaat al.\",\n\t\t\"Server announcement\": \"Servermelding\",\n\t\t\"There are unsaved changes which might be overwritten. Are you sure you want to continue?\":\n\t\t\t\"Er zijn niet-opgeslagen wijzigingen die kunnen worden overschreven. Weet je zeker dat je door wilt gaan?\",\n\t\t\"Imported CSV file\": \"CSV-bestand is geïmporteerd\",\n\t\t\"Not all changes have been saved. Please review and save again.\":\n\t\t\t\"Niet alle aanpassingen zijn opgeslagen. Controleer en sla opnieuw op.\",\n\t\t\"Changes have been saved\": \"De wijzigingen zijn opgeslagen\",\n\t\t\"Did not complete operation\": \"Bewerking is niet voltooid\",\n\t\t\"The operation was lost before it was completed\": \"De bewerking ging verloren voordat deze was voltooid.\",\n\t\t\"Updated scheduled\": \"Update gepland\",\n\t},\n};\n\nlet active_translation: Translation;\nexport function setLanguage(language: Languages): void {\n\tactive_translation = translations[language];\n}\nsetLanguage(\"english\");\n\nexport type FormatString = { phrase: TranslationKey; vars: string[] };\n\nexport function translate(text: TranslationKey | FormatString, language?: Languages): string {\n\tconst selected_translation = language === undefined ? active_translation : translations[language];\n\tif (typeof text === \"string\") {\n\t\treturn selected_translation[text];\n\t} else {\n\t\tlet phrase = selected_translation[text.phrase];\n\t\tfor (const v in text.vars) {\n\t\t\tphrase = phrase.replace(\"{\" + v + \"}\", text.vars[v]);\n\t\t}\n\t\treturn phrase;\n\t}\n}\n","import { api_configuration } from \"common\";\nimport { addMessage } from \"../front/messages\";\nimport openViewOnNode from \"../front/openViewOnNode\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport { main } from \"../state/ClientState\";\nimport * as hash from \"../widgets/dom/hash\";\nimport { FormatString, TranslationKey } from \"./translate\";\nimport gui_definition_types = api_configuration.libraries.gui_definition_lib.types;\nimport { entryExists } from \"../state 2 interface/entryExists\";\n\nfunction asyncWarning(title: TranslationKey, body: TranslationKey | FormatString) {\n\t// warn async because the message container can be uninitialized at application start.\n\tsetTimeout(function () {\n\t\taddMessage(\"warning\", title, { body: body });\n\t}, 0);\n}\n\nfunction idPathOfView(\n\tstep: gui_definition_types.views.alan_api.Cgui_node_type_path_step,\n\tkeys: string[],\n\tbuilder: IdPathBuilder\n): IdPathBuilder | undefined {\n\tswitch (step.properties.has_steps.state.name) {\n\t\tcase \"no\": {\n\t\t\treturn builder;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst yes = step.properties.has_steps.state.node;\n\t\t\tconst tail = yes.properties.tail;\n\t\t\tconst attribute = yes.properties.attribute;\n\t\t\tswitch (yes.properties.type.state.name) {\n\t\t\t\tcase \"node\": {\n\t\t\t\t\tswitch (attribute.ref.properties.type.state.name) {\n\t\t\t\t\t\tcase \"action\":\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\tcase \"command\":\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\tcase \"property\": {\n\t\t\t\t\t\t\tconst property = attribute.ref.properties.type.state.node;\n\t\t\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\t\t\tconst key = keys[0];\n\t\t\t\t\t\t\t\t\tif (key === undefined) {\n\t\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn idPathOfView(tail, keys.slice(1), builder.collectionEntry(attribute.entry, key));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\t\t\t\treturn idPathOfView(tail, keys, builder.group(attribute.entry));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn unexpectedState(property.properties.type.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"reference set\":\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn unexpectedState(attribute.ref.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"state\": {\n\t\t\t\t\tconst $ = yes.properties.type.state.node;\n\t\t\t\t\treturn idPathOfView(tail, keys, builder.state(attribute.entry, $.properties.state.entry));\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(yes.properties.type.state);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(step.properties.has_steps.state);\n\t}\n}\n\nexport default async function (target_window: gui_definition_types.settings.alan_api.Cwindows): Promise {\n\tlet deeplink: { views: string; view: string; context: string } | undefined;\n\ttry {\n\t\tdeeplink = hash.getDeepLink();\n\t} catch (e) {\n\t\tasyncWarning(\"Could not open view.\", { phrase: \"The URL might be wrong. {0}\", vars: [e] });\n\t}\n\tif (deeplink !== undefined) {\n\t\tconst views_name = deeplink.views;\n\t\tconst view_name = deeplink.view;\n\t\tconst context = deeplink.context;\n\n\t\tlet keys: string[] = [];\n\t\tIdPathBuilder.parse(\n\t\t\tcontext,\n\t\t\t(builder) => {\n\t\t\t\t// Parse the context in the old deeplink format and convert it to the new format.\n\t\t\t\tconst app_id = api_configuration.types.application_identifier.alan_api.Capplication_identifier.create({\n\t\t\t\t\tpath: builder.build(),\n\t\t\t\t}).properties.path;\n\t\t\t\tconst walkId = (\n\t\t\t\t\tid: api_configuration.types.application_identifier.alan_api.Cid_path,\n\t\t\t\t\tsteps: string[]\n\t\t\t\t): string[] => {\n\t\t\t\t\tswitch (id.properties.has_steps.state.name) {\n\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\treturn steps;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst has_step = id.properties.has_steps.state.node;\n\t\t\t\t\t\t\tswitch (has_step.properties.type.state.name) {\n\t\t\t\t\t\t\t\tcase \"collection entry\": {\n\t\t\t\t\t\t\t\t\tconst $ = has_step.properties.type.state.node;\n\t\t\t\t\t\t\t\t\tsteps.push($.properties.id);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"state\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(has_step.properties.type.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn walkId(has_step.properties.tail, steps);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(id.properties.has_steps.state);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tkeys = walkId(app_id, []);\n\t\t\t\t// Rewrite the hash using the new format.\n\t\t\t\thash.deepLinkTo(views_name, view_name, builder);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tkeys = hash.parseKeys(context);\n\t\t\t}\n\t\t);\n\n\t\tconst c_views = main.input.views[views_name];\n\t\tconst c_view = c_views?.properties.views.get(view_name);\n\t\tif (c_view !== undefined) {\n\t\t\tconst id = idPathOfView(c_view.properties.node_type.properties.steps, keys, IdPathBuilder.create());\n\t\t\tif (id !== undefined && (await entryExists(id))) {\n\t\t\t\topenViewOnNode(id, c_view, target_window);\n\t\t\t} else {\n\t\t\t\tasyncWarning(\"Could not open view.\", { phrase: \"Invalid context {0}\", vars: [keys.join(\"/\")] });\n\t\t\t}\n\t\t} else {\n\t\t\tasyncWarning(\"Could not open view.\", {\n\t\t\t\tphrase: \"The view does not exist {0} {1}\",\n\t\t\t\tvars: [views_name, view_name],\n\t\t\t});\n\t\t}\n\t}\n}\n","import { api_configuration } from \"../common\";\nimport application_api = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\n\nfunction orderAttribute(attribute: application_api.Cattributes): application_api.Cattributes[] {\n\tswitch (attribute.properties.has_successor.state.name) {\n\t\tcase \"no\": {\n\t\t\treturn [attribute];\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = attribute.properties.has_successor.state.node;\n\t\t\treturn [attribute].concat(orderAttribute($.properties.attribute.ref));\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(attribute.properties.has_successor.state);\n\t}\n}\n\nexport function orderedAttributes(node: application_api.Cnode__application): application_api.Cattributes[] {\n\tswitch (node.properties.has_attributes.state.name) {\n\t\tcase \"no\": {\n\t\t\treturn [];\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = node.properties.has_attributes.state.node;\n\t\t\treturn orderAttribute($.properties.first.ref);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(node.properties.has_attributes.state);\n\t}\n}\n","import { api_configuration } from \"../common\";\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_gui = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport { gui_model } from \"./state/ClientState\";\n\nexport function getGuiNode(node_type: api_app.Cnode__application): api_gui.Cgui_node | undefined {\n\tconst location = node_type.input.location();\n\tswitch (location.variant.name) {\n\t\tcase \"root\": {\n\t\t\tconst $ = location.variant.definition;\n\t\t\tswitch ($.variant.name) {\n\t\t\t\tcase \"operation\": {\n\t\t\t\t\tconst operation = $.variant.definition;\n\t\t\t\t\tswitch (operation.variant.name) {\n\t\t\t\t\t\tcase \"command\": {\n\t\t\t\t\t\t\tconst command = operation.variant.definition;\n\t\t\t\t\t\t\tswitch (command.properties.type.state.name) {\n\t\t\t\t\t\t\t\tcase \"global\": {\n\t\t\t\t\t\t\t\t\tconst global = command.properties.type.state.node;\n\t\t\t\t\t\t\t\t\treturn getGuiCommand(global)?.properties.parameters;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"component\":\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(command.properties.type.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"action\": {\n\t\t\t\t\t\t\tconst action = operation.variant.definition;\n\t\t\t\t\t\t\treturn getGuiAction(action)?.properties.parameters;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(operation.variant);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"dataset\":\n\t\t\t\t\treturn gui_model.root.properties.root;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($.variant);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"group\": {\n\t\t\tconst $ = location.variant.definition;\n\t\t\treturn getGuiGroup($)?.properties.gui_node;\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst $ = location.variant.definition;\n\t\t\treturn getGuiStategroup($.parent)?.properties.states.get($.key)!.properties.gui_node;\n\t\t}\n\t\tcase \"collection\": {\n\t\t\tconst $ = location.variant.definition;\n\t\t\treturn getGuiCollection($)?.properties.node;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(location.variant);\n\t}\n}\nexport function getGuiAttribute(attribute_type: api_app.Cattributes): api_gui.Cattributes | undefined {\n\treturn getGuiNode(attribute_type.parent)?.properties.attributes.get(attribute_type.key);\n}\nexport function getGuiCommand(command_type: api_app.Cglobal): api_gui.Cglobal | undefined {\n\treturn getGuiAttribute(command_type.parent.parent)?.properties.type.cast(\"command\").properties.type.cast(\"global\");\n}\nexport function getGuiAction(action_type: api_app.Caction): api_gui.Caction__type | undefined {\n\treturn getGuiAttribute(action_type.parent)?.properties.type.cast(\"action\");\n}\nexport function getGuiText(\n\ttext_type: api_app.Ctext__type__property\n): api_gui.Ctext__type__property__type__attributes | undefined {\n\treturn getGuiAttribute(text_type.parent.parent)?.properties.type.cast(\"property\").properties.type.cast(\"text\");\n}\nexport function getNavigableGuiText(text_type: api_app.Ctext__type__property): api_gui.Cyes__navigable | undefined {\n\tconst gui_text = getGuiText(text_type);\n\tif (gui_text !== undefined) {\n\t\tswitch (gui_text.properties.navigable.state.name) {\n\t\t\tcase \"yes\": {\n\t\t\t\treturn gui_text.properties.navigable.state.node;\n\t\t\t}\n\t\t\tcase \"no\": {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport function getGuiRule(rule: api_app.Crules): api_gui.Crules | undefined {\n\tconst definer = rule.parent.input.definer();\n\tswitch (definer.variant.name) {\n\t\tcase \"state\": {\n\t\t\tconst app_state = definer.variant.definition;\n\t\t\treturn getGuiStategroup(app_state.parent)\n\t\t\t\t?.properties.states.get(app_state.key_value)\n\t\t\t\t?.properties.rules.properties.rules.get(rule.key_value);\n\t\t}\n\t\tcase \"text\": {\n\t\t\tconst app_text = definer.variant.definition;\n\t\t\tconst gui_reference = getNavigableGuiText(app_text.parent);\n\t\t\tif (gui_reference) {\n\t\t\t\treturn gui_reference.properties.rules.properties.rules.get(rule.key_value);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn undefined;\n}\nexport function getGuiNumber(\n\tnumber_type: api_app.Cnumber__type__property\n): api_gui.Cnumber__type__property__type__attributes | undefined {\n\treturn getGuiAttribute(number_type.parent.parent)?.properties.type.cast(\"property\").properties.type.cast(\"number\");\n}\nexport function getGuiFile(file_type: api_app.Cfile): api_gui.Cfile__type__property | undefined {\n\treturn getGuiAttribute(file_type.parent.parent)?.properties.type.cast(\"property\").properties.type.cast(\"file\");\n}\nexport function getGuiGroup(group_type: api_app.Cgroup__type__property): api_gui.Cgroup__type__property | undefined {\n\treturn getGuiAttribute(group_type.parent.parent)?.properties.type.cast(\"property\").properties.type.cast(\"group\");\n}\nexport function getGuiStategroup(\n\tstategroup_type: api_app.Cstate_group\n): api_gui.Cstate_group__type__property__type__attributes | undefined {\n\treturn getGuiAttribute(stategroup_type.parent.parent)\n\t\t?.properties.type.cast(\"property\")\n\t\t.properties.type.cast(\"state group\");\n}\nexport function getGuiCollection(\n\tcollection_type: api_app.Ccollection__type__property\n): api_gui.Ccollection__type__property | undefined {\n\treturn getGuiAttribute(collection_type.parent.parent)\n\t\t?.properties.type.cast(\"property\")\n\t\t.properties.type.cast(\"collection\");\n}\n","import { api_configuration } from \"../../common\";\nimport api_model = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types;\nimport api_client_protocol_reply = api_model.client_protocol_reply.alan_api;\nimport api_client_protocol_request = api_model.client_protocol_request.alan_api;\nimport api_client_reply = api_model.client_reply.alan_api;\nimport api_client_request = api_model.client_request.alan_api;\nimport client_request_serializer = api_model.client_request.serializer_json;\nimport client_protocol_request_serializer = api_model.client_protocol_request.serializer_json;\nimport read_api_client_reply = api_model.client_reply.alan_api;\n\nexport class DataStoreProtocolError extends Error {}\nexport class InvalidTokenError extends DataStoreProtocolError {}\n\ninterface QueueState {\n\tstart?: () => void;\n\tstop?: () => void;\n\tsend: (item: () => void) => void;\n}\nclass Buffered_Queue {\n\tprivate item_queue: (() => void)[] = [];\n\tprivate started_state: QueueState = {\n\t\tstop: () => {\n\t\t\tthis.queue_state = this.stopped_state;\n\t\t},\n\t\tsend: (item) => {\n\t\t\titem();\n\t\t},\n\t};\n\tprivate stopped_state: QueueState = {\n\t\tstart: () => {\n\t\t\tthis.item_queue.forEach(this.started_state.send);\n\t\t\tthis.item_queue = [];\n\t\t\tthis.queue_state = this.started_state;\n\t\t},\n\t\tsend: (item) => {\n\t\t\tthis.item_queue.push(item);\n\t\t},\n\t};\n\tprivate queue_state = this.stopped_state;\n\tsend(item: () => void) {\n\t\tthis.queue_state.send(item);\n\t}\n\n\tstart() {\n\t\tthis.queue_state.start?.();\n\t}\n\n\tstop() {\n\t\tthis.queue_state.stop?.();\n\t}\n}\n\ntype ResultHandlers = {\n\thandleSuccess: (result: T) => void;\n\thandleFailure: (error_message: string) => void;\n};\ntype SubscriptionInfo = {\n\tsubscription: api_client_request.Cclient_request;\n\tsubscribed_handler: (subscriptionResult: read_api_client_reply.Csubscription) => void;\n\tnotification_handler: (notification: read_api_client_reply.Cnotification) => void;\n\terror_handler?: () => void;\n\tunsubscribe: () => void;\n};\n\nexport class DatastoreConnection {\n\ton_announcement(handler: (announcement: string) => void): void {\n\t\tthis.announcement_handler = handler;\n\t}\n\ttoken: string | undefined;\n\tnotification_handler?: (notification: api_client_protocol_reply.Cnotification) => void;\n\tprivate ws: WebSocket;\n\tprivate ws_id: number;\n\tprivate queue: Buffered_Queue;\n\tprivate reconnect_delay = 100;\n\tprivate connected = true;\n\tprivate first_time_connection = true;\n\tprivate onHandlers = {\n\t\t\"invalid token\": [] as (() => void)[],\n\t\tdisconnect: [] as (() => void)[],\n\t\treconnect: [] as (() => void)[],\n\t\tconnect: [] as (() => void)[],\n\t};\n\tprivate last_client_token = 0;\n\tprivate protocol_requests = new Map void>();\n\tprivate announcement_handler: ((message: string) => void) | undefined;\n\n\tconstructor(token: string | undefined) {\n\t\tthis.token = token;\n\t\tthis.queue = new Buffered_Queue();\n\t\tthis.connectWebSocket();\n\t}\n\n\tdisconnectWebSocket(): void {\n\t\tthis.token = undefined;\n\t\tthis.queue.stop();\n\t\tif (this.ws) {\n\t\t\t//the WebSocket could be uninitialized.\n\t\t\tthis.ws.onclose = noop;\n\t\t\tthis.ws.close();\n\t\t}\n\t\tthis.connected = true;\n\t}\n\n\tasync getServerTime(): Promise {\n\t\tconst result = await this.queueProtocolRequest(\"server time\");\n\t\tswitch (result.properties.result.state.name) {\n\t\t\tcase \"invalid subscription id\":\n\t\t\t\tthrow new Error(\"unexpected state\");\n\t\t\tcase \"invalid token\":\n\t\t\t\tthrow new InvalidTokenError();\n\t\t\tcase \"server error\": {\n\t\t\t\tthrow new DataStoreProtocolError(\"server error\");\n\t\t\t}\n\t\t\tcase \"success\": {\n\t\t\t\tconst $ = result.properties.result.state.node;\n\t\t\t\treturn $.properties.type.cast(\"server time\").properties.julian_time.value;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(result.properties.result.state);\n\t\t}\n\t}\n\n\tasync getAuthenticationUri(): Promise {\n\t\tconst reply = await this.queueProtocolRequest(\"authentication uri\");\n\t\tswitch (reply.properties.result.state.name) {\n\t\t\tcase \"invalid subscription id\":\n\t\t\t\tthrow new Error(\"unexpected state\");\n\t\t\tcase \"invalid token\":\n\t\t\t\tthrow new InvalidTokenError();\n\t\t\tcase \"server error\": {\n\t\t\t\tthrow new DataStoreProtocolError(\"server error\");\n\t\t\t}\n\t\t\tcase \"success\": {\n\t\t\t\tconst $ = reply.properties.result.state.node;\n\t\t\t\treturn $.properties.type.cast(\"authentication uri\").properties.uri;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(reply.properties.result.state);\n\t\t}\n\t}\n\n\tasync validateToken(token: string): Promise {\n\t\tconst reply = await this.queueProtocolRequest(\"server time\", token);\n\t\tswitch (reply.properties.result.state.name) {\n\t\t\tcase \"invalid subscription id\":\n\t\t\t\tthrow new Error(\"unexpected state\");\n\t\t\tcase \"invalid token\":\n\t\t\t\treturn false;\n\t\t\tcase \"server error\": {\n\t\t\t\tthrow new DataStoreProtocolError(\"server error\");\n\t\t\t}\n\t\t\tcase \"success\":\n\t\t\t\treturn true;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(reply.properties.result.state);\n\t\t}\n\t}\n\n\tisWebSocketOpen(): boolean {\n\t\tconst OPEN = 1;\n\t\treturn this.ws !== undefined && this.ws.readyState === OPEN;\n\t}\n\n\ton(handler: keyof DatastoreConnection[\"onHandlers\"], callback: () => void): this {\n\t\tthis.onHandlers[handler].push(callback);\n\t\treturn this;\n\t}\n\n\tasync queueProtocolRequest(\n\t\tprotocol_request: api_model.client_protocol_request.alan_api.Trequest[\"type\"],\n\t\talternative_token?: string\n\t): Promise {\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.queue.send(async () => {\n\t\t\t\tconst reply = await this.sendProtocolRequest(protocol_request, alternative_token);\n\t\t\t\tresolve(reply);\n\t\t\t});\n\t\t});\n\t}\n\n\tsendUnSubscribeMessage(key: string): void {\n\t\tthis.queue.send(() => {\n\t\t\tconst message = api_client_protocol_request.Cclient_protocol_request.create({\n\t\t\t\t\"access type\": this.token\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t\"authenticated\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttoken: this.token,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [\"anonymous\", {}],\n\t\t\t\ttype: [\n\t\t\t\t\t\"unsubscribe\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"subscription id\": key,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t});\n\t\t\tthis.ws.send(JSON.stringify(client_protocol_request_serializer.serialize(message)));\n\t\t});\n\t}\n\n\tprivate connectWebSocket() {\n\t\tif (this.isWebSocketOpenOrConnecting()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\ttypeof window !== \"undefined\" &&\n\t\t\t(typeof window[\"WebSocket\"] === \"function\" || typeof window[\"WebSocket\"] === \"object\")\n\t\t) {\n\t\t\tconst protocol = window.location.protocol === \"https:\" ? \"wss\" : \"ws\";\n\t\t\tconst target = protocol + \"://\" + window.location.host + window.location.pathname + \"websocket\";\n\t\t\tthis.ws = new WebSocket(target);\n\t\t\tthis.ws.onopen = () => {\n\t\t\t\tthis.ws_id = Date.now();\n\t\t\t\tthis.queue.start();\n\t\t\t\tif (this.first_time_connection) {\n\t\t\t\t\tthis.first_time_connection = false;\n\t\t\t\t\tthis.notify(\"connect\");\n\t\t\t\t}\n\t\t\t\tthis.reconnect_delay = 100;\n\t\t\t\tif (!this.connected) {\n\t\t\t\t\tthis.connected = true;\n\t\t\t\t\tthis.notify(\"reconnect\");\n\t\t\t\t}\n\t\t\t};\n\t\t\tthis.ws.onmessage = (msg) => {\n\t\t\t\tthis.handleMessage(api_client_protocol_reply.Cclient_protocol_reply.create(JSON.parse(msg.data)));\n\t\t\t};\n\t\t\tthis.ws.onclose = (e) => {\n\t\t\t\tthis.queue.stop();\n\t\t\t\tif (e.code !== 1000) {\n\t\t\t\t\tthis.reconnect();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate async sendProtocolRequest(\n\t\tprotocol_request: api_model.client_protocol_request.alan_api.Trequest[\"type\"],\n\t\talternative_token?: string\n\t): Promise {\n\t\tconst new_client_token = this.nextClientToken();\n\t\tconst request_ws_id = this.ws_id;\n\t\tconst token = alternative_token ?? this.token;\n\t\tconst serialized_request = JSON.stringify(\n\t\t\tclient_protocol_request_serializer.serialize(\n\t\t\t\tapi_client_protocol_request.Cclient_protocol_request.create({\n\t\t\t\t\t\"access type\": token\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\"authenticated\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttoken: token,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: [\"anonymous\", {}],\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"request\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"client token\": new_client_token,\n\t\t\t\t\t\t\ttype: protocol_request,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t})\n\t\t\t)\n\t\t);\n\t\tthis.ws.send(serialized_request);\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.protocol_requests.set(new_client_token, (protocol_reply) => {\n\t\t\t\tif (this.ws_id !== request_ws_id) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tresolve(protocol_reply);\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate reconnect() {\n\t\tthis.reconnect_delay = this.reconnect_delay > 3000 ? 3000 : this.reconnect_delay + 100;\n\t\tif (this.connected) {\n\t\t\tthis.connected = false;\n\t\t\tthis.notify(\"disconnect\");\n\t\t}\n\t\tsetTimeout(() => {\n\t\t\tthis.connectWebSocket();\n\t\t}, this.reconnect_delay);\n\t}\n\n\tprivate handleMessage(message: api_client_protocol_reply.Cclient_protocol_reply) {\n\t\tswitch (message.properties.type.state.name) {\n\t\t\tcase \"notification\": {\n\t\t\t\tconst notification_result = message.properties.type.state.node;\n\t\t\t\tthis.notification_handler?.(notification_result);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"reply\": {\n\t\t\t\tconst reply = message.properties.type.state.node;\n\t\t\t\tthis.protocol_requests.get(reply.properties.client_token.value)?.(reply);\n\t\t\t\tthis.protocol_requests.delete(reply.properties.client_token.value);\n\n\t\t\t\tswitch (reply.properties.result.state.name) {\n\t\t\t\t\tcase \"invalid subscription id\":\n\t\t\t\t\t\tbreak; //handled in the request handler.\n\t\t\t\t\tcase \"invalid token\": {\n\t\t\t\t\t\tthis.token = undefined;\n\t\t\t\t\t\tthis.notify(\"invalid token\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"server error\":\n\t\t\t\t\t\tbreak; //handled in the request handler.\n\t\t\t\t\tcase \"success\":\n\t\t\t\t\t\tbreak; //handled in the request handler.\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(reply.properties.result.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"unsubscribe\": {\n\t\t\t\t//FIXME: maybe resubscribe?\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"announcement\": {\n\t\t\t\tconst announcement = message.properties.type.state.node;\n\t\t\t\tthis.announcement_handler?.(announcement.properties.announcement);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(message.properties.type.state);\n\t\t}\n\t}\n\n\tprivate notify(handlers: keyof DatastoreConnection[\"onHandlers\"]) {\n\t\tthis.onHandlers[handlers].forEach((handler) => {\n\t\t\thandler();\n\t\t});\n\t}\n\n\tprivate nextClientToken() {\n\t\tif (this.last_client_token === Number.MAX_SAFE_INTEGER) {\n\t\t\treturn (this.last_client_token = 0);\n\t\t}\n\t\treturn ++this.last_client_token;\n\t}\n\n\tprivate isWebSocketOpenOrConnecting() {\n\t\tconst CONNECTING = 0;\n\t\tconst OPEN = 1;\n\t\treturn this.ws !== undefined && (this.ws.readyState === CONNECTING || this.ws.readyState === OPEN);\n\t}\n}\n\nexport class DatastoreProxy {\n\tstatic instance: DatastoreProxy;\n\tapplication_model: api_model.application.alan_api.Capplication;\n\treadonly connection: DatastoreConnection;\n\tprivate subscriptions = new Map();\n\tprivate last_subscription_id = Date.now();\n\tsubscription_counter = 0;\n\tquery_counter = 0;\n\tsubscribeOnce_counter = 0;\n\n\tconstructor(application_model: api_model.application.alan_api.Capplication, connection: DatastoreConnection) {\n\t\tthis.application_model = application_model;\n\t\tthis.connection = connection;\n\n\t\tthis.connection.notification_handler = (notification_result) => {\n\t\t\tconst sub_id = notification_result.properties.subscription_id;\n\t\t\tconst subscription_context = this.subscriptions.get(sub_id);\n\t\t\tif (subscription_context !== undefined) {\n\t\t\t\tconst notification: read_api_client_reply.Cclient_reply = api_client_reply.Cclient_reply.create(\n\t\t\t\t\tJSON.parse(notification_result.properties.notification),\n\t\t\t\t\t{\n\t\t\t\t\t\tapplication: this.application_model,\n\t\t\t\t\t\trequest: subscription_context[\"subscription\"],\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tsubscription_context.notification_handler(notification.properties.type.cast(\"notification\"));\n\t\t\t\tnotification.properties.type.cast(\"notification\").properties.context.switch({\n\t\t\t\t\texists: undefined,\n\t\t\t\t\t\"does not exist\": () => {\n\t\t\t\t\t\tthis.subscriptions.delete(sub_id);\n\t\t\t\t\t},\n\t\t\t\t\t\"permission denied\": () => {\n\t\t\t\t\t\tthis.subscriptions.delete(sub_id);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t\tthis.connection.on(\"reconnect\", () => {\n\t\t\tthis.reSubscribeAll();\n\t\t});\n\t}\n\n\tasync execute(command: api_client_request.Tcommand_execution): Promise {\n\t\tconst decorated_request = this.decorateClientRequest({\n\t\t\ttype: [\"command execution\", command],\n\t\t});\n\t\tconst reply = await this.connection.queueProtocolRequest([\n\t\t\t\"mutation\",\n\t\t\t{\n\t\t\t\trequest: JSON.stringify(client_request_serializer.serialize(decorated_request)),\n\t\t\t},\n\t\t]);\n\t\treturn this.handleApplicationReply(reply, decorated_request).properties.type.cast(\"command execution\");\n\t}\n\n\tasync changePassword(old_password: string, new_password: string): Promise {\n\t\tconst decorated_request = this.decorateClientRequest({\n\t\t\ttype: [\n\t\t\t\t\"password mutation\",\n\t\t\t\t{\n\t\t\t\t\t\"new password\": new_password,\n\t\t\t\t\t\"old password\": old_password,\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t\tconst reply = await this.connection.queueProtocolRequest([\n\t\t\t\"mutation\",\n\t\t\t{\n\t\t\t\trequest: JSON.stringify(client_request_serializer.serialize(decorated_request)),\n\t\t\t},\n\t\t]);\n\t\treturn this.handleApplicationReply(reply, decorated_request).properties.type.cast(\"password mutation\");\n\t}\n\n\tasync resetPassword(username: string): Promise {\n\t\tconst decorated_request = this.decorateClientRequest({\n\t\t\ttype: [\n\t\t\t\t\"password reset\",\n\t\t\t\t{\n\t\t\t\t\tusername: username,\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t\tconst reply = await this.connection.queueProtocolRequest([\n\t\t\t\"mutation\",\n\t\t\t{\n\t\t\t\trequest: JSON.stringify(client_request_serializer.serialize(decorated_request)),\n\t\t\t},\n\t\t]);\n\t\treturn this.handleApplicationReply(reply, decorated_request).properties.type.cast(\"password reset\");\n\t}\n\n\tasync collectionQuery(\n\t\tcollection_query: api_model.client_request.alan_api.Tcollection_query,\n\t\tresult_handlers?: ResultHandlers,\n\t\tquery_type: \"client query\" | \"report query\" = \"client query\"\n\t): Promise {\n\t\tthis.query_counter++;\n\t\tconst decorated_request = this.decorateClientRequest({\n\t\t\ttype: [\"collection query\", collection_query],\n\t\t});\n\t\tconst reply = await this.connection.queueProtocolRequest([\n\t\t\tquery_type,\n\t\t\t{\n\t\t\t\trequest: JSON.stringify(client_request_serializer.serialize(decorated_request)),\n\t\t\t},\n\t\t]);\n\n\t\tconst client_reply = this.handleApplicationReply(\n\t\t\treply,\n\t\t\tdecorated_request,\n\t\t\tresult_handlers?.handleFailure\n\t\t).properties.type.cast(\"collection query\");\n\t\tif (result_handlers) {\n\t\t\tresult_handlers.handleSuccess(client_reply);\n\t\t}\n\t\treturn client_reply;\n\t}\n\n\tasync reportQuery(\n\t\tcollection_query: api_model.client_request.alan_api.Tcollection_query,\n\t\tresult_handlers: ResultHandlers\n\t): Promise {\n\t\treturn this.collectionQuery(collection_query, result_handlers, \"report query\");\n\t}\n\n\tasync update(\n\t\tmutation: api_model.client_request.alan_api.Tmutation\n\t): Promise {\n\t\tconst decorated_request = this.decorateClientRequest({\n\t\t\ttype: [\"mutation\", mutation],\n\t\t});\n\t\tconst reply = await this.connection.queueProtocolRequest([\n\t\t\t\"mutation\",\n\t\t\t{\n\t\t\t\trequest: JSON.stringify(client_request_serializer.serialize(decorated_request)),\n\t\t\t},\n\t\t]);\n\t\treturn this.handleApplicationReply(reply, decorated_request).properties.type.cast(\"mutation\");\n\t}\n\n\tsubscribeOnce(\n\t\tsubscription: api_model.client_request.alan_api.Tsubscription,\n\t\tonSubscribed: (subscriptionResult: read_api_client_reply.Csubscription) => void,\n\t\tonError?: () => void\n\t): void;\n\tsubscribeOnce(\n\t\tsubscription: api_model.client_request.alan_api.Tsubscription\n\t): Promise;\n\tsubscribeOnce(\n\t\tsubscription: api_model.client_request.alan_api.Tsubscription,\n\t\tonSubscribed?: (subscriptionResult: read_api_client_reply.Csubscription) => void,\n\t\tonError?: () => void\n\t): void | Promise {\n\t\tthis.subscription_counter--;\n\t\tthis.subscribeOnce_counter++;\n\t\tif (onSubscribed !== undefined) {\n\t\t\tconst datastore_subscription = this.subscribe(\n\t\t\t\tsubscription,\n\t\t\t\t(result) => {\n\t\t\t\t\tdatastore_subscription.unsubscribe();\n\t\t\t\t\tonSubscribed(result);\n\t\t\t\t},\n\t\t\t\tnoop,\n\t\t\t\tonError\n\t\t\t);\n\t\t} else {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tconst datastore_subscription = this.subscribe(\n\t\t\t\t\tsubscription,\n\t\t\t\t\t(result) => {\n\t\t\t\t\t\tdatastore_subscription.unsubscribe();\n\t\t\t\t\t\tresolve(result);\n\t\t\t\t\t},\n\t\t\t\t\tnoop,\n\t\t\t\t\t() => {\n\t\t\t\t\t\treject();\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t}\n\n\tsubscribe(\n\t\tsubscription: api_model.client_request.alan_api.Tsubscription,\n\t\tonSubscribed: (subscriptionResult: read_api_client_reply.Csubscription) => void,\n\t\tonNotification: (notification: read_api_client_reply.Cnotification) => void,\n\t\tonError?: () => void\n\t): { unsubscribe: () => void } {\n\t\tthis.subscription_counter++;\n\t\tconst key = this.generateSubscriptionId();\n\t\tconst decorated_subscription = api_client_request.Cclient_request.create(\n\t\t\t{ type: [\"subscription\", subscription] },\n\t\t\t{\n\t\t\t\tapplication: this.application_model,\n\t\t\t}\n\t\t);\n\t\tconst subscription_info: SubscriptionInfo = {\n\t\t\tunsubscribe: () => {\n\t\t\t\tthis.subscriptions.delete(key);\n\t\t\t\tsubscription_info.unsubscribe = noop;\n\t\t\t\tsubscription_info.subscribed_handler = () => {\n\t\t\t\t\tthis.connection.sendUnSubscribeMessage(key);\n\t\t\t\t};\n\t\t\t},\n\t\t\tsubscription: decorated_subscription,\n\t\t\tsubscribed_handler: (result) => {\n\t\t\t\tsubscription_info.unsubscribe = () => {\n\t\t\t\t\tthis.subscriptions.delete(key);\n\t\t\t\t\tsubscription_info.unsubscribe = noop;\n\t\t\t\t\tthis.connection.sendUnSubscribeMessage(key);\n\t\t\t\t};\n\t\t\t\tonSubscribed(result);\n\t\t\t},\n\t\t\tnotification_handler: onNotification,\n\t\t\terror_handler: onError,\n\t\t};\n\t\tthis.subscriptions.set(key, subscription_info);\n\t\tthis.sendSubscriptionMessage(key, subscription_info);\n\t\treturn {\n\t\t\tunsubscribe: () => {\n\t\t\t\tsubscription_info.unsubscribe();\n\t\t\t},\n\t\t};\n\t}\n\n\treSubscribeAll(): void {\n\t\tfor (const subscription_info of this.subscriptions) {\n\t\t\tthis.sendSubscriptionMessage(subscription_info[0], subscription_info[1]);\n\t\t}\n\t}\n\n\tunSubscribeAll(): void {\n\t\tfor (const subscription_info of this.subscriptions) {\n\t\t\tsubscription_info[1].unsubscribe();\n\t\t}\n\t}\n\n\ton(handler: keyof DatastoreConnection[\"onHandlers\"], callback: () => void): this {\n\t\tthis.connection.on(handler, callback);\n\t\tif (handler === \"connect\" && this.connection.isWebSocketOpen()) {\n\t\t\tcallback();\n\t\t}\n\t\treturn this;\n\t}\n\n\ton_announcement(handler: (announcement: string) => void): void {\n\t\tthis.connection.on_announcement(handler);\n\t}\n\n\tprivate handleApplicationReply(\n\t\treply: api_client_protocol_reply.Creply,\n\t\trequest: api_client_request.Cclient_request,\n\t\ton_error?: (message: string) => void\n\t): api_client_reply.Cclient_reply {\n\t\tswitch (reply.properties.result.state.name) {\n\t\t\tcase \"invalid subscription id\":\n\t\t\t\tthrow new Error(\"unexpected state\");\n\t\t\tcase \"invalid token\":\n\t\t\t\tthrow new InvalidTokenError();\n\t\t\tcase \"server error\": {\n\t\t\t\ton_error?.(\"server error\");\n\t\t\t\tthrow new DataStoreProtocolError(\"server error\");\n\t\t\t}\n\t\t\tcase \"success\": {\n\t\t\t\tconst $ = reply.properties.result.state.node;\n\t\t\t\tconst client_reply = api_client_reply.Cclient_reply.create(\n\t\t\t\t\tJSON.parse($.properties.type.cast(\"application\").properties.result),\n\t\t\t\t\t{\n\t\t\t\t\t\tapplication: this.application_model,\n\t\t\t\t\t\trequest: request,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\treturn client_reply;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(reply.properties.result.state);\n\t\t}\n\t}\n\n\tprivate async sendSubscriptionMessage(sub_id: string, subscription_info: SubscriptionInfo) {\n\t\tconst reply = await this.connection.queueProtocolRequest([\n\t\t\t\"subscribe\",\n\t\t\t{\n\t\t\t\t\"subscription id\": sub_id,\n\t\t\t\tsubscription: JSON.stringify(client_request_serializer.serialize(subscription_info.subscription)),\n\t\t\t},\n\t\t]);\n\t\tif (!this.subscriptions.has(sub_id)) {\n\t\t\treturn;\n\t\t}\n\t\tswitch (reply.properties.result.state.name) {\n\t\t\tcase \"invalid subscription id\": {\n\t\t\t\tthis.subscriptions.delete(sub_id);\n\t\t\t\tsubscription_info.error_handler?.();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"invalid token\":\n\t\t\t\tbreak;\n\t\t\tcase \"server error\": {\n\t\t\t\tthis.subscriptions.delete(sub_id);\n\t\t\t\tsubscription_info.error_handler?.();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"success\": {\n\t\t\t\tconst $ = reply.properties.result.state.node.properties.type.cast(\"subscribe\");\n\t\t\t\tconst subscription_result: read_api_client_reply.Cclient_reply = api_client_reply.Cclient_reply.create(\n\t\t\t\t\tJSON.parse($.properties.initial_state),\n\t\t\t\t\t{\n\t\t\t\t\t\tapplication: this.application_model,\n\t\t\t\t\t\trequest: subscription_info.subscription,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tsubscription_info.subscribed_handler(subscription_result.properties.type.cast(\"subscription\"));\n\t\t\t\tsubscription_result.properties.type.cast(\"subscription\").properties.context.switch({\n\t\t\t\t\texists: undefined,\n\t\t\t\t\t\"does not exist\": () => {\n\t\t\t\t\t\tthis.subscriptions.delete(sub_id);\n\t\t\t\t\t},\n\t\t\t\t\t\"permission denied\": () => {\n\t\t\t\t\t\tthis.subscriptions.delete(sub_id);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(reply.properties.result.state);\n\t\t}\n\t}\n\n\tprivate generateSubscriptionId() {\n\t\treturn \"\" + this.last_subscription_id++;\n\t}\n\n\tprivate decorateClientRequest(request: api_model.client_request.alan_api.Tclient_request) {\n\t\treturn api_client_request.Cclient_request.create(request, { application: this.application_model });\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nfunction noop(): void {}\n\n// For debugging. In DatastoreProxy.subscribe insert the line:\n// console.log(log_subscription(subscription));\n/*\nimport { Raw_Id_Path_Head } from \"../navigation/IdPathBuilder\";\nfunction log_subscription(subscription: api_model.client_request.alan_api.Tsubscription): string {\n\treturn (\n\t\t(function step(path: Raw_Id_Path_Head): string {\n\t\t\tswitch (path[\"has steps\"][0]) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\treturn \"\";\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst type = path[\"has steps\"][1].type;\n\t\t\t\t\tconst tail = path[\"has steps\"][1].tail;\n\t\t\t\t\tswitch (type[0]) {\n\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\treturn \".'\" + type[1][\"group\"] + \"'\" + step(tail);\n\t\t\t\t\t\tcase \"state\":\n\t\t\t\t\t\t\treturn \".'\" + type[1][\"state group\"] + \"'?'\" + type[1][\"state\"] + \"'\" + step(tail);\n\t\t\t\t\t\tcase \"collection entry\":\n\t\t\t\t\t\t\treturn \".'\" + type[1][\"collection\"] + \"'['\" + type[1][\"id\"] + \"']\" + step(tail);\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow new Error(\"unexpected step\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"unexpected step\");\n\t\t\t}\n\t\t})(subscription[\"context node\"] as any as Raw_Id_Path_Head) +\n\t\t\" \" +\n\t\t(function step(properties: api_model.client_request.alan_api.Tsubscribed_properties, base_indent: string): string {\n\t\t\tlet result = \"{\\n\";\n\t\t\tfor (const key in properties[\"properties\"]) {\n\t\t\t\tconst indent = base_indent + \" \";\n\t\t\t\tconst property = properties[\"properties\"][key];\n\t\t\t\tlet prop_res = \".'\" + key + \"'\";\n\t\t\t\tswitch (property[\"type\"][0]) {\n\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\tconst collection = (\n\t\t\t\t\t\t\tproperty[\"type\"][1]\n\t\t\t\t\t\t);\n\t\t\t\t\t\tprop_res = prop_res + \"[] \";\n\t\t\t\t\t\tswitch (collection[\"subscribe on\"][0]) {\n\t\t\t\t\t\t\tcase \"entries\":\n\t\t\t\t\t\t\t\tprop_res =\n\t\t\t\t\t\t\t\t\tprop_res +\n\t\t\t\t\t\t\t\t\tstep(\n\t\t\t\t\t\t\t\t\t\t(collection[\"subscribe on\"][1])[\n\t\t\t\t\t\t\t\t\t\t\t\"subscribed properties\"\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\tindent + \" \"\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"updates\":\n\t\t\t\t\t\t\t\tprop_res = prop_res + \"\";\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst group = (\n\t\t\t\t\t\t\tproperty[\"type\"][1]\n\t\t\t\t\t\t);\n\t\t\t\t\t\tprop_res = prop_res + \" \" + step(group[\"subscribed properties\"], indent + \" \");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst stategroup = <\n\t\t\t\t\t\t\tapi_model.client_request.alan_api.Tstate_group__type__properties__subscribed_properties\n\t\t\t\t\t\t>property[\"type\"][1];\n\t\t\t\t\t\tprop_res = prop_res + \" (\\n\";\n\t\t\t\t\t\tfor (const key in stategroup[\"states\"]) {\n\t\t\t\t\t\t\tconst state = stategroup[\"states\"][key];\n\t\t\t\t\t\t\tprop_res =\n\t\t\t\t\t\t\t\tprop_res + indent + \" \" + key + \" \" + step(state[\"subscribed properties\"], indent + \" \") + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprop_res = prop_res + indent + \")\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error(\"unexpected step\");\n\t\t\t\t}\n\t\t\t\tresult = result + indent + prop_res + \"\\n\";\n\t\t\t}\n\t\t\tresult = result + base_indent + \"}\";\n\t\t\treturn result;\n\t\t})(subscription[\"subscribed properties\"], \"\")\n\t);\n}\n*/\n","import messages = require(\"../front/messages\");\n\nfunction performInBrowserHttpRequest(\n\trequest: XMLHttpRequest,\n\turl: string,\n\tmethod: \"POST\" | \"GET\" | \"DELETE\",\n\tlistener: (request: XMLHttpRequest) => void,\n\tdata?: File\n) {\n\trequest.onload = function () {\n\t\tif (request.status >= 200 && request.status < 300) {\n\t\t\tlistener(request);\n\t\t} else {\n\t\t\twarningMessage(\"Bad status code: \" + request.status);\n\t\t}\n\t};\n\trequest.onabort = function () {\n\t\twarningMessage(\"Request aborted.\");\n\t};\n\trequest.onerror = function () {\n\t\twarningMessage(\"Request error.\");\n\t};\n\trequest.open(method, window.location.origin + window.location.pathname + global.file_storage_url + url);\n\trequest.send(data);\n}\n\nfunction warningMessage(error: string) {\n\tconsole.warn(error);\n\tmessages.addMessage(\"warning\", \"Something went wrong. Please try again.\");\n}\n\nexport function download_from_files_resource(token: string): Promise {\n\tconst request = new XMLHttpRequest();\n\trequest.responseType = \"blob\";\n\treturn new Promise((resolve) => {\n\t\tperformInBrowserHttpRequest(request, \"/\" + token, \"GET\", function (request) {\n\t\t\tif (request.responseType === \"blob\") {\n\t\t\t\tresolve(request.response);\n\t\t\t} else {\n\t\t\t\tresolve(request.responseText);\n\t\t\t}\n\t\t});\n\t});\n}\n\nexport async function uploadToFilesResource(file: File): Promise {\n\treturn new Promise((resolve, reject) => {\n\t\tperformInBrowserHttpRequest(\n\t\t\tnew XMLHttpRequest(),\n\t\t\t\"\",\n\t\t\t\"POST\",\n\t\t\tfunction (request) {\n\t\t\t\tconst response = JSON.parse(request.responseText)[\"reply type\"];\n\t\t\t\tif (response[0] === \"upload\" && response[1].result[0] === \"success\") {\n\t\t\t\t\tresolve(response[1].result[1].token);\n\t\t\t\t} else {\n\t\t\t\t\twarningMessage(\"File could not be uploaded. The files resource did not accept the file.\");\n\t\t\t\t\treject(\"File could not be uploaded. The files resource did not accept the file.\");\n\t\t\t\t}\n\t\t\t},\n\t\t\tfile\n\t\t);\n\t});\n}\n\nexport function deleteFromFilesResource(token: string): Promise {\n\treturn new Promise((resolve) => {\n\t\tperformInBrowserHttpRequest(new XMLHttpRequest(), \"/\" + token, \"DELETE\", function (request) {\n\t\t\tconst response = JSON.parse(request.responseText)[\"reply type\"];\n\t\t\tif (response[0] === \"delete\" && response[1].result[0] === \"success\") {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\twarningMessage(\"File could not be deleted. The files resource did not accept the request.\");\n\t\t\t}\n\t\t});\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_report = api_configuration.report_protocol_types;\nimport messages = require(\"../front/messages\");\n\nconst REPORT_MANAGE_URL = \"report-manage\"; // FIXME: configure the report manage URL.\nconst REPORT_DOWNLOAD_URL = \"report-download\"; // FIXME: configure the report download URL\n\nfunction performInBrowserHttpRequest(\n\tbrowser_specific_http_request: XMLHttpRequest,\n\turl: string,\n\tpost_data: string,\n\tlistener: { handleSuccess: any; handleFailure: any }\n) {\n\tbrowser_specific_http_request.onload = function () {\n\t\tif (this.status >= 200 && this.status < 300) {\n\t\t\tif (browser_specific_http_request.responseType === \"blob\") {\n\t\t\t\tlistener.handleSuccess(browser_specific_http_request.response);\n\t\t\t} else {\n\t\t\t\tlistener.handleSuccess(browser_specific_http_request.responseText);\n\t\t\t}\n\t\t} else {\n\t\t\tlistener.handleFailure(\"Bad status code: \" + this.status);\n\t\t}\n\t};\n\tbrowser_specific_http_request.onabort = function () {\n\t\tlistener.handleFailure(\"Request aborted.\");\n\t};\n\tbrowser_specific_http_request.onerror = function () {\n\t\tlistener.handleFailure(\"Request error.\");\n\t};\n\tbrowser_specific_http_request.open(\"POST\", url);\n\tbrowser_specific_http_request.setRequestHeader(\"Content-Type\", \"application/json\");\n\tbrowser_specific_http_request.send(post_data);\n}\n\nexport function post_to_report_resource(\n\treport_request: api_report.report_protocol_request.alan_api.Creport_protocol_request,\n\tresponse_handler?: (response: api_report.report_protocol_reply.alan_api.Creport_protocol_reply) => void\n): void {\n\tperformInBrowserHttpRequest(\n\t\tnew XMLHttpRequest(),\n\t\tREPORT_MANAGE_URL,\n\t\tJSON.stringify(api_report.report_protocol_request.serializer_json.serialize(report_request)),\n\t\t{\n\t\t\thandleSuccess: function (file_content: string) {\n\t\t\t\tif (response_handler) {\n\t\t\t\t\tresponse_handler(\n\t\t\t\t\t\tapi_report.report_protocol_reply.alan_api.Creport_protocol_reply.create(JSON.parse(file_content))\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleFailure: function (error: string) {\n\t\t\t\tconsole.warn(error);\n\t\t\t\tmessages.addMessage(\"warning\", \"Something went wrong. Please try again.\");\n\t\t\t},\n\t\t}\n\t);\n}\n\nexport function download_from_report_resource(\n\treport_request: api_report.report_protocol_download_request.alan_api.Creport_protocol_download_request,\n\tresponse_handler: (report: any) => void\n): void {\n\tconst req = new XMLHttpRequest();\n\treq.responseType = \"blob\";\n\tperformInBrowserHttpRequest(\n\t\treq,\n\t\tREPORT_DOWNLOAD_URL,\n\t\tJSON.stringify(api_report.report_protocol_download_request.serializer_json.serialize(report_request)),\n\t\t{\n\t\t\thandleSuccess: function (file_content: any) {\n\t\t\t\tresponse_handler(file_content);\n\t\t\t},\n\t\t\thandleFailure: function (error: string) {\n\t\t\t\tconsole.warn(error);\n\t\t\t\tmessages.addMessage(\"warning\", \"Something went wrong. Please try again.\");\n\t\t\t},\n\t\t}\n\t);\n}\n","const queue = new Set<() => void>();\nconst observers = new Set<() => void>();\n\nexport function add(task: () => void): () => void {\n\tqueue.add(task);\n\tif (queue.size === 1) {\n\t\tqueueMicrotask(() => {\n\t\t\tfor (const task of queue) {\n\t\t\t\ttask();\n\t\t\t}\n\t\t\tqueue.clear();\n\t\t\tfor (const observer of observers) {\n\t\t\t\tobserver();\n\t\t\t}\n\t\t\tobservers.clear();\n\t\t});\n\t}\n\treturn task;\n}\n\nexport function remove(task: () => void): void {\n\tqueue.delete(task);\n}\n\nexport function subscribe(observer: () => void): () => void {\n\tobservers.add(observer);\n\treturn observer;\n}\n\nexport function done(): Promise {\n\tif (queue.size === 0) return Promise.resolve();\n\treturn new Promise((resolve) => subscribe(() => resolve()));\n}\n\nexport function size(): number {\n\treturn queue.size;\n}\n","import escape = require(\"../state 2 interface/createEscapedCsvHeader\");\n\nexport class CsvColumnPathBuilder {\n\tconstructor(private build_steps: ((tail: string) => string)[] = []) {}\n\n\tstatic create(): CsvColumnPathBuilder {\n\t\treturn new CsvColumnPathBuilder();\n\t}\n\n\tcopyBuildSteps(): ((tail: string) => string)[] {\n\t\treturn this.build_steps.slice();\n\t}\n\tnewBuilder(build_function: (tail: string) => string): CsvColumnPathBuilder {\n\t\treturn new CsvColumnPathBuilder([...this.build_steps, build_function]);\n\t}\n\tclone(): CsvColumnPathBuilder {\n\t\treturn new CsvColumnPathBuilder(this.copyBuildSteps());\n\t}\n\tremoveTail(): CsvColumnPathBuilder {\n\t\treturn new CsvColumnPathBuilder(this.build_steps.slice(0, -1));\n\t}\n\n\tgroup(group: string): CsvColumnPathBuilder {\n\t\treturn this.newBuilder((tail) => escape(group) + \"+\" + tail);\n\t}\n\n\tstate(state_group: string, state: string): CsvColumnPathBuilder {\n\t\treturn this.newBuilder((tail) => escape(state) + \"*\" + escape(state_group) + \"?\" + tail);\n\t}\n\n\tstate_group(state_group: string): CsvColumnPathBuilder {\n\t\treturn this.newBuilder((tail) => escape(state_group) + \"?\" + tail);\n\t}\n\n\tstate_group_operation(state_group: string): CsvColumnPathBuilder {\n\t\treturn this.newBuilder((tail) => escape(state_group) + \"_operation\" + \"?\" + tail);\n\t}\n\n\ttext(text: string): CsvColumnPathBuilder {\n\t\treturn this.newBuilder((tail) => escape(text) + \":\" + tail);\n\t}\n\n\tnumber(number: string): CsvColumnPathBuilder {\n\t\treturn this.newBuilder((tail) => escape(number) + \"#\" + tail);\n\t}\n\n\tbuild(): string {\n\t\treturn this.build_steps.reduce((tail, build_step) => build_step(tail), \"\");\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_application_identifier = api_configuration.types.application_identifier;\n\nexport type Raw_Id_Path_Head = {\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\t\"has steps\": [\"no\", {}] | [\"yes\", RawIdPathStep];\n};\ntype RawIdPathStep = {\n\ttype:\n\t\t| [\"group\", { group: string }]\n\t\t| [\n\t\t\t\t\"state\",\n\t\t\t\t{\n\t\t\t\t\t\"state group\": string;\n\t\t\t\t\tstate: string;\n\t\t\t\t}\n\t\t ]\n\t\t| [\n\t\t\t\t\"collection entry\",\n\t\t\t\t{\n\t\t\t\t\tcollection: string;\n\t\t\t\t\tid: string;\n\t\t\t\t}\n\t\t ];\n\ttail: Raw_Id_Path_Head;\n};\n\ntype BuildStep = (tail: Raw_Id_Path_Head) => Raw_Id_Path_Head;\nexport class IdPathBuilder {\n\tbuild_steps: BuildStep[];\n\tconstructor(build_steps: BuildStep[] = []) {\n\t\tthis.build_steps = build_steps;\n\t}\n\n\tstatic serialize(id_path_builder: IdPathBuilder): string {\n\t\treturn (function step(path: Raw_Id_Path_Head): string {\n\t\t\tswitch (path[\"has steps\"][0]) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\treturn \"\";\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst type = path[\"has steps\"][1].type;\n\t\t\t\t\tconst tail = path[\"has steps\"][1].tail;\n\t\t\t\t\tswitch (type[0]) {\n\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\treturn \"+'\" + type[1][\"group\"] + \"'\" + step(tail);\n\t\t\t\t\t\tcase \"state\":\n\t\t\t\t\t\t\treturn \"?'\" + type[1][\"state group\"] + \"'*'\" + type[1][\"state\"] + \"'\" + step(tail);\n\t\t\t\t\t\tcase \"collection entry\":\n\t\t\t\t\t\t\treturn \".'\" + type[1][\"collection\"] + \"':'\" + type[1][\"id\"] + \"'\" + step(tail);\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow new Error(\"unexpected step\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"unexpected step\");\n\t\t\t}\n\t\t})(id_path_builder.build());\n\t}\n\n\tstatic parse(\n\t\tpath: string,\n\t\tonSuccess: (id_path_builder: IdPathBuilder) => void,\n\t\tonError: (message: string) => void\n\t): void {\n\t\tfunction assert(assertion: boolean) {\n\t\t\tif (assertion === false) {\n\t\t\t\tthrow \"\";\n\t\t\t}\n\t\t}\n\t\tfunction parseLiteral(char_stream: string): string {\n\t\t\tassert(char_stream.charAt(0) === \"'\");\n\t\t\tlet done = false;\n\t\t\tlet i = 1;\n\t\t\twhile (!done) {\n\t\t\t\tif (char_stream.charAt(i) === \"\\\\\") {\n\t\t\t\t\ti = i + 2;\n\t\t\t\t} else if (char_stream.charAt(i) === \"'\") {\n\t\t\t\t\tdone = true;\n\t\t\t\t} else if (char_stream.charAt(i) === \"\") {\n\t\t\t\t\tthrow \"\";\n\t\t\t\t} else {\n\t\t\t\t\ti = i + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn char_stream.substring(1, i);\n\t\t}\n\n\t\tlet id_path_builder = IdPathBuilder.create();\n\t\tlet error: string | undefined = undefined;\n\t\ttry {\n\t\t\tlet char_stream = path.slice();\n\t\t\twhile (char_stream !== \"\") {\n\t\t\t\tswitch (char_stream.charAt(0)) {\n\t\t\t\t\tcase \"+\": {\n\t\t\t\t\t\tchar_stream = char_stream.substring(1);\n\t\t\t\t\t\tconst group = parseLiteral(char_stream);\n\t\t\t\t\t\tchar_stream = char_stream.substring(group.length + 2);\n\t\t\t\t\t\tid_path_builder = id_path_builder.group(group);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"?\": {\n\t\t\t\t\t\tchar_stream = char_stream.substring(1);\n\t\t\t\t\t\tconst state_group = parseLiteral(char_stream);\n\t\t\t\t\t\tchar_stream = char_stream.substring(state_group.length + 2);\n\t\t\t\t\t\tassert(char_stream.charAt(0) === \"*\");\n\t\t\t\t\t\tchar_stream = char_stream.substring(1);\n\t\t\t\t\t\tconst state = parseLiteral(char_stream);\n\t\t\t\t\t\tchar_stream = char_stream.substring(state.length + 2);\n\t\t\t\t\t\tid_path_builder = id_path_builder.state(state_group, state);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \".\": {\n\t\t\t\t\t\tchar_stream = char_stream.substring(1);\n\t\t\t\t\t\tconst collection = parseLiteral(char_stream);\n\t\t\t\t\t\tchar_stream = char_stream.substring(collection.length + 2);\n\t\t\t\t\t\tassert(char_stream.charAt(0) === \":\");\n\t\t\t\t\t\tchar_stream = char_stream.substring(1);\n\t\t\t\t\t\tconst key = parseLiteral(char_stream);\n\t\t\t\t\t\tchar_stream = char_stream.substring(key.length + 2);\n\t\t\t\t\t\tid_path_builder = id_path_builder.collectionEntry(collection, key);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\terror = e;\n\t\t}\n\t\tif (error !== undefined) {\n\t\t\tonError(error);\n\t\t} else {\n\t\t\tonSuccess(id_path_builder);\n\t\t}\n\t}\n\n\tstatic create(): IdPathBuilder {\n\t\treturn new IdPathBuilder();\n\t}\n\n\tequals(that: IdPathBuilder): boolean {\n\t\treturn IdPathBuilder.serialize(this) === IdPathBuilder.serialize(that);\n\t}\n\n\tcopyBuildSteps(): BuildStep[] {\n\t\treturn this.build_steps.slice(0);\n\t}\n\taddToBuildStepArray(element: BuildStep): BuildStep[] {\n\t\tconst copy = this.copyBuildSteps();\n\t\tcopy.push(element);\n\t\treturn copy;\n\t}\n\tnewBuilder(build_function: BuildStep): IdPathBuilder {\n\t\treturn new IdPathBuilder(this.addToBuildStepArray(build_function));\n\t}\n\tclone(): IdPathBuilder {\n\t\treturn new IdPathBuilder(this.copyBuildSteps());\n\t}\n\tremoveTail(): IdPathBuilder {\n\t\treturn new IdPathBuilder(this.build_steps.slice(0, this.build_steps.length - 1));\n\t}\n\n\tgroup(group: string): IdPathBuilder {\n\t\treturn this.newBuilder(function (tail: Raw_Id_Path_Head) {\n\t\t\treturn {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: [\"group\", { group: group }],\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t});\n\t}\n\n\tstate(state_group: string, state: string): IdPathBuilder {\n\t\treturn this.newBuilder(function (tail: Raw_Id_Path_Head) {\n\t\t\treturn {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"state\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"state group\": state_group,\n\t\t\t\t\t\t\t\tstate: state,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t});\n\t}\n\n\tcollectionEntry(collection: string, key: string): IdPathBuilder {\n\t\treturn this.newBuilder(function (tail: Raw_Id_Path_Head) {\n\t\t\treturn {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"collection entry\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcollection: collection,\n\t\t\t\t\t\t\t\tid: key,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t});\n\t}\n\n\tbuild(): Raw_Id_Path_Head {\n\t\treturn this.copyBuildSteps()\n\t\t\t.reverse()\n\t\t\t.reduce(\n\t\t\t\tfunction (tail, build_step) {\n\t\t\t\t\treturn build_step(tail);\n\t\t\t\t},\n\t\t\t\t{ \"has steps\": [\"no\", {}] }\n\t\t\t);\n\t}\n}\n\nexport function entityBuilderOf(builder: IdPathBuilder): IdPathBuilder {\n\treturn entityIdPathBuilder(\n\t\tapi_application_identifier.alan_api.Capplication_identifier.create({\n\t\t\tpath: builder.build(),\n\t\t}).properties.path,\n\t\t{\n\t\t\tentity_builder: IdPathBuilder.create(),\n\t\t\tcurrent_builder: IdPathBuilder.create(),\n\t\t}\n\t);\n}\n\nfunction entityIdPathBuilder(\n\tid_path: api_application_identifier.alan_api.Cid_path,\n\tbuilder: { entity_builder: IdPathBuilder; current_builder: IdPathBuilder }\n): IdPathBuilder {\n\treturn id_path.properties.has_steps.switch({\n\t\tno: builder.entity_builder,\n\t\tyes: function ($) {\n\t\t\tfunction singularStep(step: IdPathBuilder) {\n\t\t\t\treturn {\n\t\t\t\t\tentity_builder: builder.entity_builder,\n\t\t\t\t\tcurrent_builder: step,\n\t\t\t\t};\n\t\t\t}\n\t\t\tfunction entityStep(step: IdPathBuilder) {\n\t\t\t\treturn {\n\t\t\t\t\tentity_builder: step,\n\t\t\t\t\tcurrent_builder: step,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn entityIdPathBuilder(\n\t\t\t\t$.properties.tail,\n\t\t\t\t$.properties.type.switch({\n\t\t\t\t\t\"collection entry\": function ($) {\n\t\t\t\t\t\treturn entityStep(builder.current_builder.collectionEntry($.properties.collection, $.properties.id));\n\t\t\t\t\t},\n\t\t\t\t\tgroup: function ($) {\n\t\t\t\t\t\treturn singularStep(builder.current_builder.group($.properties.group));\n\t\t\t\t\t},\n\t\t\t\t\tstate: function ($) {\n\t\t\t\t\t\treturn singularStep(builder.current_builder.state($.properties.state_group, $.properties.state));\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t);\n\t\t},\n\t});\n}\n\nexport function stepsAreEqual(step_a: RawIdPathStep, step_b: RawIdPathStep): boolean {\n\tif (step_a.type[0] !== step_b.type[0]) {\n\t\treturn false;\n\t}\n\tswitch (step_a.type[0]) {\n\t\tcase \"group\":\n\t\t\treturn step_a.type[0] === step_b.type[0] && step_a.type[1].group === step_b.type[1].group;\n\t\tcase \"state\":\n\t\t\treturn (\n\t\t\t\tstep_a.type[0] === step_b.type[0] &&\n\t\t\t\tstep_a.type[1][\"state group\"] === step_b.type[1][\"state group\"] &&\n\t\t\t\tstep_a.type[1].state === step_b.type[1].state\n\t\t\t);\n\n\t\tcase \"collection entry\":\n\t\t\treturn (\n\t\t\t\tstep_a.type[0] === step_b.type[0] &&\n\t\t\t\tstep_a.type[1].collection === step_b.type[1].collection &&\n\t\t\t\tstep_a.type[1].id === step_b.type[1].id\n\t\t\t);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_cr = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\n\ntype BuildStep = (tail: api_cr.Tnode_path) => api_cr.Tnode_path;\n\nexport default class NodePathBuilder {\n\tbuild_steps: BuildStep[];\n\n\tconstructor(build_steps: BuildStep[] = []) {\n\t\tthis.build_steps = build_steps;\n\t}\n\n\tcopyBuildSteps(): BuildStep[] {\n\t\treturn this.build_steps.slice(0);\n\t}\n\n\taddToBuildStepArray(element: BuildStep): BuildStep[] {\n\t\tconst copy = this.copyBuildSteps();\n\t\tcopy.push(element);\n\t\treturn copy;\n\t}\n\n\tnewBuilder(build_function: BuildStep): NodePathBuilder {\n\t\treturn new NodePathBuilder(this.addToBuildStepArray(build_function));\n\t}\n\n\tclone(): NodePathBuilder {\n\t\treturn new NodePathBuilder(this.copyBuildSteps());\n\t}\n\n\tbuild(): api_cr.Tnode_path {\n\t\treturn this.copyBuildSteps()\n\t\t\t.reverse()\n\t\t\t.reduce((tail, build_step) => build_step(tail), { \"has steps\": [\"no\", {}] });\n\t}\n\n\tparent(): NodePathBuilder {\n\t\treturn this.newBuilder((tail: api_cr.Tnode_path) => {\n\t\t\treturn {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: [\"parent\", {}],\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t});\n\t}\n\n\tstate_rule(rule_name: string): NodePathBuilder {\n\t\treturn this.newBuilder((tail: api_cr.Tnode_path) => ({\n\t\t\t\"has steps\": [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"state rule\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trule: rule_name,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\ttail: tail,\n\t\t\t\t},\n\t\t\t],\n\t\t}));\n\t}\n\n\treference_rule(reference_name: string, rule_name: string): NodePathBuilder {\n\t\treturn this.newBuilder((tail: api_cr.Tnode_path) => ({\n\t\t\t\"has steps\": [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"reference rule\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tproperty: reference_name,\n\t\t\t\t\t\t\trule: rule_name,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\ttail: tail,\n\t\t\t\t},\n\t\t\t],\n\t\t}));\n\t}\n\n\treference(reference_name: string): NodePathBuilder {\n\t\treturn this.newBuilder((tail: api_cr.Tnode_path) => ({\n\t\t\t\"has steps\": [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"reference\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: reference_name,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\ttail: tail,\n\t\t\t\t},\n\t\t\t],\n\t\t}));\n\t}\n\n\tgroup(group_name: string): NodePathBuilder {\n\t\treturn this.newBuilder((tail: api_cr.Tnode_path) => ({\n\t\t\t\"has steps\": [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"group\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgroup: group_name,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\ttail: tail,\n\t\t\t\t},\n\t\t\t],\n\t\t}));\n\t}\n\n\tstate(stategroup_name: string, state_name: string): NodePathBuilder {\n\t\treturn this.newBuilder((tail: api_cr.Tnode_path) => ({\n\t\t\t\"has steps\": [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"state\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"state group\": stategroup_name,\n\t\t\t\t\t\t\tstate: state_name,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\ttail: tail,\n\t\t\t\t},\n\t\t\t],\n\t\t}));\n\t}\n\n\tcollection_entry(collection_name: string, entry_key: string): NodePathBuilder {\n\t\treturn this.newBuilder((tail: api_cr.Tnode_path) => ({\n\t\t\t\"has steps\": [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"collection entry\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcollection: collection_name,\n\t\t\t\t\t\t\t\"entry key\": entry_key,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\ttail: tail,\n\t\t\t\t},\n\t\t\t],\n\t\t}));\n\t}\n}\n\nexport function createNodePathFromObjectPathTail(path: api_app.Cobject_path_tail): NodePathBuilder {\n\tlet node_path = new NodePathBuilder();\n\tlet property: string | undefined;\n\twhile (path.properties.has_steps.state.name === \"yes\") {\n\t\tconst has_steps = path.properties.has_steps.state.node;\n\t\tswitch (has_steps.properties.type.state.name) {\n\t\t\tcase \"property value\": {\n\t\t\t\tconst $ = has_steps.properties.type.state.node;\n\t\t\t\tproperty = $.properties.property.properties.property.entry;\n\t\t\t\tswitch ($.properties.property.properties.property.ref.properties.type.state.name) {\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tnode_path = node_path.group(property);\n\t\t\t\t\t\tproperty = undefined;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.property.properties.property.ref.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state\":\n\t\t\t\tif (property !== undefined) {\n\t\t\t\t\tconst state = has_steps.properties.type.state.node.properties.state.entry;\n\t\t\t\t\tnode_path = node_path.state(property, state);\n\t\t\t\t\tproperty = undefined;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"parent\":\n\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\tcase \"dependency\":\n\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\tcase \"reference set\":\n\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\tdefault:\n\t\t\t\tunexpectedState(has_steps.properties.type.state);\n\t\t}\n\t\tpath = has_steps.properties.tail;\n\t}\n\treturn node_path;\n}\n","import { api_configuration } from \"../../common\";\nimport csr = api_configuration.types.client_state.alan_api;\nimport csd = api_configuration.types.client_state.alan_api;\n\nexport default function (node: csr.Cnode): csd.Tclient_id_path {\n\treturn createClientIdPath(node, { \"has steps\": [\"no\", {}] });\n}\n\nfunction createClientIdPath(node: csr.Cnode, raw_path: csd.Tclient_id_path): csd.Tclient_id_path {\n\treturn node.input.position().switch({\n\t\troot: ($) =>\n\t\t\t$.switch({\n\t\t\t\troot: () => raw_path,\n\t\t\t\toperation: ($) =>\n\t\t\t\t\tcreateClientIdPath($.parent.parent.parent, {\n\t\t\t\t\t\t\"has steps\": [\n\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\"operation\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\toperation: $.parent.parent.key.entry,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\ttail: raw_path,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t}),\n\t\tentity: ($) =>\n\t\t\t$.switch({\n\t\t\t\troot: () => raw_path,\n\t\t\t\tentry: function ($) {\n\t\t\t\t\tconst entry_key = $.key;\n\t\t\t\t\tconst collection_name = $.parent.parent.parent.key.entry;\n\t\t\t\t\treturn createClientIdPath($.parent.parent.parent.parent, {\n\t\t\t\t\t\t\"has steps\": [\n\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\"collection entry\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcollection: collection_name,\n\t\t\t\t\t\t\t\t\t\tentry: entry_key,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\ttail: raw_path,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\tgroup: ($) => {\n\t\t\tconst group_name = $.parent.parent.key.entry;\n\t\t\treturn createClientIdPath($.parent.parent.parent, {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"group\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tgroup: group_name,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttail: raw_path,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t});\n\t\t},\n\t\tstate: ($) => {\n\t\t\tconst state_name = $.key.entry;\n\t\t\tconst state_group_name = $.parent.parent.parent.key.entry;\n\t\t\treturn createClientIdPath($.parent.parent.parent.parent, {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"state\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"state group\": state_group_name,\n\t\t\t\t\t\t\t\tstate: state_name,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttail: raw_path,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t});\n\t\t},\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport client_request_decorator = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport ConditionalChildPathBuilder = require(\"./createConditionalChildPathBuilder\");\n\ntype Builder = (\n\thead: client_request_decorator.Tconditional_child_path,\n\ttail: client_request_decorator.Tcollection_query_path\n) => client_request_decorator.Tcollection_query_path;\n\nexport class CollectionPathBuilder {\n\tbuild_steps: { builder: Builder; head: ConditionalChildPathBuilder }[];\n\thead: ConditionalChildPathBuilder;\n\n\tconstructor(\n\t\tbuild_steps: { builder: Builder; head: ConditionalChildPathBuilder }[] = [],\n\t\thead_builder = new ConditionalChildPathBuilder()\n\t) {\n\t\tthis.build_steps = build_steps;\n\t\tthis.head = head_builder;\n\t}\n\n\tstatic create(): CollectionPathBuilder {\n\t\treturn new CollectionPathBuilder();\n\t}\n\n\taddConditionalStep(new_head_builder: ConditionalChildPathBuilder): CollectionPathBuilder {\n\t\treturn new CollectionPathBuilder(this.build_steps, new_head_builder);\n\t}\n\n\tnewBuilder(build_function: Builder): CollectionPathBuilder {\n\t\treturn new CollectionPathBuilder(\n\t\t\tthis.build_steps.slice(0).concat({\n\t\t\t\tbuilder: build_function,\n\t\t\t\thead: this.head,\n\t\t\t})\n\t\t);\n\t}\n\n\tgroup(group: string): CollectionPathBuilder {\n\t\treturn this.addConditionalStep(this.head.group(group));\n\t}\n\n\tstate(state_group: string, state: string): CollectionPathBuilder {\n\t\treturn this.addConditionalStep(this.head.state(state_group, state));\n\t}\n\n\tcollection(collection: string): CollectionPathBuilder {\n\t\treturn this.newBuilder(function (head, tail) {\n\t\t\treturn {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\thead: head,\n\t\t\t\t\t\tcollection: collection,\n\t\t\t\t\t\ttype: [\"existing entries\", {}],\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t});\n\t}\n\n\tcandidates(collection: string): CollectionPathBuilder {\n\t\treturn this.newBuilder(function (head, tail) {\n\t\t\treturn {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\thead: head,\n\t\t\t\t\t\tcollection: collection,\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"candidates\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdelink: {\n\t\t\t\t\t\t\t\t\tdelink: [\"yes\", {}],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"include reference\": [\"yes\", {}],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t});\n\t}\n\n\tbuild(): client_request_decorator.Tcollection_query_path {\n\t\treturn this.build_steps\n\t\t\t.slice()\n\t\t\t.reverse()\n\t\t\t.reduce(\n\t\t\t\tfunction (tail, build_step) {\n\t\t\t\t\treturn build_step.builder(build_step.head.build(), tail);\n\t\t\t\t},\n\t\t\t\t{ \"has steps\": [\"no\", {}] }\n\t\t\t);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport client_request_decorator = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\n\ntype Builder = (\n\ttail: client_request_decorator.Tconditional_child_path\n) => client_request_decorator.Tconditional_child_path;\n\nclass ConditionalChildPathBuilder {\n\tbuild_steps: Builder[];\n\n\tconstructor(build_steps: Builder[] = []) {\n\t\tthis.build_steps = build_steps;\n\t}\n\n\tnewBuilder(build_function: Builder): ConditionalChildPathBuilder {\n\t\treturn new ConditionalChildPathBuilder(this.build_steps.slice(0).concat(build_function));\n\t}\n\n\tbuild(): client_request_decorator.Tconditional_child_path {\n\t\treturn this.build_steps\n\t\t\t.slice(0)\n\t\t\t.reverse()\n\t\t\t.reduce(\n\t\t\t\tfunction (tail, build_step) {\n\t\t\t\t\treturn build_step(tail);\n\t\t\t\t},\n\t\t\t\t{ \"has steps\": [\"no\", {}] }\n\t\t\t);\n\t}\n\textendPath(\n\t\tstep: client_request_decorator.Tyes__has_steps__conditional_child_path[\"type\"]\n\t): ConditionalChildPathBuilder {\n\t\treturn this.newBuilder(function (tail: client_request_decorator.Tconditional_child_path) {\n\t\t\treturn {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: step,\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t});\n\t}\n\tgroup(group: string): ConditionalChildPathBuilder {\n\t\treturn this.extendPath([\"group\", { group: group }]);\n\t}\n\tstate(state_group: string, state: string): ConditionalChildPathBuilder {\n\t\treturn this.extendPath([\n\t\t\t\"state\",\n\t\t\t{\n\t\t\t\t\"state group\": state_group,\n\t\t\t\tstate: state,\n\t\t\t},\n\t\t]);\n\t}\n}\n\nexport = ConditionalChildPathBuilder;\n","import { api_configuration } from \"../../common\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport { IdPathBuilder } from \"./IdPathBuilder\";\n\nexport default function (id_path: api_client_state.Cid_path): IdPathBuilder {\n\treturn buildIdPath(id_path, IdPathBuilder.create());\n}\n\nfunction buildIdPath(id_path: api_client_state.Cid_path, current_builder: IdPathBuilder): IdPathBuilder {\n\treturn id_path.properties.has_steps.switch({\n\t\tno: current_builder,\n\t\tyes: ($) =>\n\t\t\tbuildIdPath(\n\t\t\t\t$.properties.tail,\n\t\t\t\t$.properties.type.switch({\n\t\t\t\t\t\"collection entry\": ($) => current_builder.collectionEntry($.properties.collection.entry, $.properties.id),\n\t\t\t\t\tgroup: ($) => current_builder.group($.properties.group.entry),\n\t\t\t\t\tstate: ($) => current_builder.state($.properties.state_group.entry, $.properties.state.entry),\n\t\t\t\t})\n\t\t\t),\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_client_reply = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_reply.alan_api;\nimport { IdPathBuilder } from \"./IdPathBuilder\";\n\nexport default function (id_path: api_client_reply.Cid_path__client_reply): IdPathBuilder {\n\treturn buildIdPath(id_path, IdPathBuilder.create());\n}\n\nfunction buildIdPath(id_path: api_client_reply.Cid_path__client_reply, current_builder: IdPathBuilder): IdPathBuilder {\n\treturn id_path.properties.has_steps.switch({\n\t\tno: current_builder,\n\t\tyes: ($) =>\n\t\t\tbuildIdPath(\n\t\t\t\t$.properties.tail,\n\t\t\t\t$.properties.type.switch({\n\t\t\t\t\t\"collection entry\": ($) => current_builder.collectionEntry($.properties.collection.entry, $.properties.id),\n\t\t\t\t\tgroup: ($) => current_builder.group($.properties.group.entry),\n\t\t\t\t\tstate: ($) => current_builder.state($.properties.state_group.entry, $.properties.state.entry),\n\t\t\t\t})\n\t\t\t),\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport { IdPathBuilder, Raw_Id_Path_Head } from \"../navigation/IdPathBuilder\";\nimport read_api = api_configuration.types.client_state.alan_api;\n\nfunction walkNodeLocation(\n\tnode: read_api.Cnode,\n\tonTail: (parent_context: IdPathBuilder) => IdPathBuilder\n): IdPathBuilder {\n\tconst position = node.input.position();\n\tswitch (position.variant.name) {\n\t\tcase \"entity\": {\n\t\t\tconst entity = position.variant.definition;\n\t\t\tswitch (entity.variant.name) {\n\t\t\t\tcase \"root\":\n\t\t\t\t\treturn onTail(IdPathBuilder.create());\n\t\t\t\tcase \"entry\": {\n\t\t\t\t\tconst entry = entity.variant.definition;\n\t\t\t\t\tconst key_property = entry.properties.key.ref;\n\n\t\t\t\t\tconst backend_value = key_property.properties.backend_known.switch({\n\t\t\t\t\t\tno: () => undefined,\n\t\t\t\t\t\tyes: ($) => $.properties.value,\n\t\t\t\t\t});\n\t\t\t\t\tconst set_value = key_property.properties.is_set.switch({\n\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\tyes: ($) => $.properties.text,\n\t\t\t\t\t});\n\t\t\t\t\tlet key_value = backend_value ?? set_value;\n\t\t\t\t\t// If the key property is being saved but has not yet received an update from the backend\n\t\t\t\t\t// use the modified value as if it is the backend value to prevent timing issues\n\t\t\t\t\tswitch (key_property.properties.is_editable.state.name) {\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst editable = key_property.properties.is_editable.state.node;\n\t\t\t\t\t\t\tswitch (editable.properties.modified.state.name) {\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\tconst modified = editable.properties.modified.state.node;\n\t\t\t\t\t\t\t\t\tswitch (modified.properties.saving.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\tkey_value = set_value;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState(modified.properties.saving.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(editable.properties.modified.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(key_property.properties.is_editable.state);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn walkNodeLocation(entry.parent.parent.parent.parent, (parent) =>\n\t\t\t\t\t\tonTail(parent.collectionEntry(entry.parent.parent.parent.key.entry, key_value))\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(entity.variant);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"group\": {\n\t\t\tconst group = position.variant.definition;\n\t\t\treturn walkNodeLocation(group.parent.parent.parent, (parent) =>\n\t\t\t\tonTail(parent.group(group.parent.parent.key.entry))\n\t\t\t);\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst state = position.variant.definition;\n\t\t\treturn walkNodeLocation(state.parent.parent.parent.parent, (parent) =>\n\t\t\t\tonTail(parent.state(state.parent.parent.parent.key.entry, state.key.entry))\n\t\t\t);\n\t\t}\n\t\tcase \"root\":\n\t\t\treturn onTail(IdPathBuilder.create());\n\t\tdefault:\n\t\t\tunexpectedState(position.variant);\n\t}\n}\n\nexport function createIdPathBuilderToEntity(node: read_api.Cnode): IdPathBuilder {\n\treturn walkNodeLocation(node.input.entity().input.node(), function ($) {\n\t\treturn $;\n\t});\n}\nexport function createIdPathBuilderFromNode(node: read_api.Cnode): IdPathBuilder {\n\treturn walkNodeLocation(node, function ($) {\n\t\treturn $;\n\t});\n}\nexport function createIdPathFromNode(node: read_api.Cnode): Raw_Id_Path_Head {\n\treturn createIdPathBuilderFromNode(node).build();\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport { getReferencedNode } from \"../state/ResolveStatus\";\nimport { findEntryWithKey } from \"../state/Collection\";\n\nexport default function walkNodePath(\n\t$: api_views.Cnode_path,\n\tnode: api_cs.Cnode,\n\tonResult: (node: api_cs.Cnode) => api_cs.Cnode = (node: api_cs.Cnode) => node,\n\tonNoResult: () => undefined = () => undefined\n): api_cs.Cnode | undefined {\n\tswitch ($.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\treturn onResult(node);\n\t\tcase \"yes\": {\n\t\t\tconst has_steps = $.properties.has_steps.state.node;\n\t\t\tswitch (has_steps.properties.type.state.name) {\n\t\t\t\tcase \"parent\":\n\t\t\t\t\treturn walkNodePath(\n\t\t\t\t\t\thas_steps.properties.tail,\n\t\t\t\t\t\tnode.input.position().output.parent().cast(\"node\"),\n\t\t\t\t\t\tonResult,\n\t\t\t\t\t\tonNoResult\n\t\t\t\t\t);\n\t\t\t\tcase \"group\": {\n\t\t\t\t\tconst $ = has_steps.properties.type.cast(\"group\");\n\t\t\t\t\tif (node.properties.attributes.has($.properties.group.entry)) {\n\t\t\t\t\t\tconst group = node.properties.attributes\n\t\t\t\t\t\t\t.get($.properties.group.entry)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"group\");\n\t\t\t\t\t\treturn walkNodePath(has_steps.properties.tail, group.properties.node, onResult, onNoResult);\n\t\t\t\t\t}\n\t\t\t\t\treturn onNoResult();\n\t\t\t\t}\n\t\t\t\tcase \"reference\": {\n\t\t\t\t\tconst $ = has_steps.properties.type.state.node;\n\t\t\t\t\tconst reference = node.properties.attributes\n\t\t\t\t\t\t.get($.properties.text.entry)\n\t\t\t\t\t\t?.properties.type.cast(\"property\")\n\t\t\t\t\t\t.properties.type.cast(\"text\");\n\n\t\t\t\t\tif (reference !== undefined) {\n\t\t\t\t\t\tswitch (reference.properties.navigable.state.name) {\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst navigable_reference = reference.properties.navigable.state.node;\n\t\t\t\t\t\t\t\tswitch (navigable_reference.properties.resolve_status.properties.status.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"failed to resolve\": {\n\t\t\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"is busy resolving\": {\n\t\t\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"resolved\": {\n\t\t\t\t\t\t\t\t\t\tconst resolved = navigable_reference.properties.resolve_status.properties.status.state.node;\n\t\t\t\t\t\t\t\t\t\treturn walkNodePath(has_steps.properties.tail, getReferencedNode(resolved), onResult, onNoResult);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"unresolved\": {\n\t\t\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\treturn unexpectedState(navigable_reference.properties.resolve_status.properties.status.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn unexpectedState(reference.properties.navigable.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"reference rule\": {\n\t\t\t\t\tconst $ = has_steps.properties.type.state.node;\n\t\t\t\t\tconst reference = node.properties.attributes\n\t\t\t\t\t\t.get($.properties.property.entry)\n\t\t\t\t\t\t?.properties.type.cast(\"property\")\n\t\t\t\t\t\t.properties.type.cast(\"text\");\n\t\t\t\t\tif (reference !== undefined) {\n\t\t\t\t\t\tswitch (reference.properties.navigable.state.name) {\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst navigable = reference.properties.navigable.state.node;\n\t\t\t\t\t\t\t\tconst rule = navigable.properties.rules.properties.rules.get($.properties.rule.entry);\n\t\t\t\t\t\t\t\tif (rule !== undefined) {\n\t\t\t\t\t\t\t\t\tswitch (rule.properties.resolve_status.properties.status.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"failed to resolve\": {\n\t\t\t\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"is busy resolving\": {\n\t\t\t\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"resolved\": {\n\t\t\t\t\t\t\t\t\t\t\tconst resolved = rule.properties.resolve_status.properties.status.state.node;\n\t\t\t\t\t\t\t\t\t\t\treturn walkNodePath(has_steps.properties.tail, getReferencedNode(resolved), onResult, onNoResult);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"unresolved\": {\n\t\t\t\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\treturn unexpectedState(rule.properties.resolve_status.properties.status.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn unexpectedState(reference.properties.navigable.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"state rule\": {\n\t\t\t\t\tconst $ = has_steps.properties.type.state.node;\n\t\t\t\t\tconst state = node.input.position().cast(\"state\");\n\t\t\t\t\tconst rule = state.properties.rules.properties.rules.get($.properties.rule.entry);\n\t\t\t\t\tif (rule !== undefined) {\n\t\t\t\t\t\tswitch (rule.properties.resolve_status.properties.status.state.name) {\n\t\t\t\t\t\t\tcase \"failed to resolve\": {\n\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"is busy resolving\": {\n\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"resolved\": {\n\t\t\t\t\t\t\t\tconst resolved = rule.properties.resolve_status.properties.status.state.node;\n\t\t\t\t\t\t\t\treturn walkNodePath(has_steps.properties.tail, getReferencedNode(resolved), onResult, onNoResult);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"unresolved\": {\n\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn unexpectedState(rule.properties.resolve_status.properties.status.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"state\": {\n\t\t\t\t\tconst $ = has_steps.properties.type.state.node;\n\t\t\t\t\tif (node.properties.attributes.has($.properties.state_group.entry)) {\n\t\t\t\t\t\tconst state = node.properties.attributes\n\t\t\t\t\t\t\t.get($.properties.state_group.entry)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"state group\")\n\t\t\t\t\t\t\t.properties.states.get($.properties.state.entry)!;\n\t\t\t\t\t\tswitch (state.properties.is_selected.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\treturn walkNodePath(has_steps.properties.tail, state.properties.node, onResult, onNoResult);\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(state.properties.is_selected.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn onNoResult();\n\t\t\t\t}\n\t\t\t\tcase \"collection entry\": {\n\t\t\t\t\tconst $ = has_steps.properties.type.state.node;\n\t\t\t\t\tconst collection = node.properties.attributes\n\t\t\t\t\t\t.get($.properties.collection.entry)\n\t\t\t\t\t\t?.properties.type.cast(\"property\")\n\t\t\t\t\t\t.properties.type.cast(\"collection\");\n\t\t\t\t\tif (collection !== undefined) {\n\t\t\t\t\t\tconst entry = findEntryWithKey(collection, $.properties.entry_key);\n\t\t\t\t\t\tif (entry !== undefined) {\n\t\t\t\t\t\t\treturn walkNodePath(has_steps.properties.tail, entry.properties.node, onResult, onNoResult);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn onNoResult();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(has_steps.properties.type.state);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn unexpectedState($.properties.has_steps.state);\n\t}\n}\n","import { api_configuration } from \"../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\n\ntype ScalarObserver = (value: T, subscription: api_cs.Subscription) => void;\n\nexport class ObservableType {\n\tprotected val: T;\n\tprivate observers = new Map, api_cs.Subscription>();\n\tconstructor(val: T) {\n\t\tthis.val = val;\n\t}\n\tget value(): T {\n\t\treturn this.val;\n\t}\n\tget observerCount(): number {\n\t\treturn this.observers.size;\n\t}\n\tupdate(val: T): T {\n\t\tif (this.val !== val) {\n\t\t\tthis.val = val;\n\t\t\tfor (const [observer, subscription] of this.observers) {\n\t\t\t\tobserver(this.val, subscription);\n\t\t\t}\n\t\t}\n\t\treturn this.val;\n\t}\n\tsubscribe(observer: ScalarObserver, init = true): api_cs.Subscription {\n\t\tconst subscription: api_cs.Subscription = {\n\t\t\tunsubscribe: () => this.observers.delete(observer),\n\t\t};\n\t\tthis.observers.set(observer, subscription);\n\t\tif (init) observer(this.value, subscription);\n\t\treturn subscription;\n\t}\n\tsubscribeConditional(condition: (val: T) => boolean, observer: ScalarObserver): api_cs.Subscription {\n\t\tlet conditional = condition(this.value);\n\t\tconst subscription = this.subscribe((new_value, subscription) => {\n\t\t\tconst new_conditional = condition(new_value);\n\t\t\tif (conditional !== new_conditional) {\n\t\t\t\tobserver(new_conditional, subscription);\n\t\t\t\tconditional = new_conditional;\n\t\t\t}\n\t\t}, false);\n\t\tobserver(conditional, subscription);\n\t\treturn subscription;\n\t}\n\tasync await(condition: (val: T) => boolean): Promise {\n\t\tif (condition(this.value)) return;\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.subscribe((new_value, subscription) => {\n\t\t\t\tif (condition(new_value) === true) {\n\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n\nexport class ObservableNumber extends ObservableType {\n\tadd(n: number): void {\n\t\tthis.update(this.value + n);\n\t}\n\tsubtract(n: number): void {\n\t\tthis.update(this.value - n);\n\t}\n\tincrement(): void {\n\t\tthis.add(1);\n\t}\n\tdecrement(): void {\n\t\tthis.subtract(1);\n\t}\n}\n\nexport class ObservableSet {\n\tprivate set: Set;\n\tsize: ObservableType;\n\tconstructor(iterable?: Iterable | null | undefined) {\n\t\tthis.set = new Set(iterable);\n\t\tthis.size = new ObservableType(this.set.size);\n\t}\n\tadd(value: T): this {\n\t\tthis.set.add(value);\n\t\tthis.size.update(this.set.size);\n\t\treturn this;\n\t}\n\tdelete(value: T): boolean {\n\t\tconst result = this.set.delete(value);\n\t\tthis.size.update(this.set.size);\n\t\treturn result;\n\t}\n\thas(value: T): boolean {\n\t\treturn this.set.has(value);\n\t}\n\tclear(): void {\n\t\tthis.set.clear();\n\t\tthis.size.update(this.set.size);\n\t}\n\t[Symbol.iterator](): IterableIterator {\n\t\treturn this.set.values();\n\t}\n\tentries(): IterableIterator<[T, T]> {\n\t\treturn this.set.entries();\n\t}\n\tkeys(): IterableIterator {\n\t\treturn this.set.keys();\n\t}\n\tvalues(): IterableIterator {\n\t\treturn this.set.values();\n\t}\n\tforEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void {\n\t\treturn this.set.forEach(callbackfn, thisArg);\n\t}\n}\n\nexport class ObservableMap {\n\tprivate map: Map;\n\tsize: ObservableType;\n\tconstructor() {\n\t\tthis.map = new Map();\n\t\tthis.size = new ObservableType(this.map.size);\n\t}\n\tset(key: K, value: T): this {\n\t\tthis.map.set(key, value);\n\t\tthis.size.update(this.map.size);\n\t\treturn this;\n\t}\n\tdelete(key: K): boolean {\n\t\tconst result = this.map.delete(key);\n\t\tthis.size.update(this.map.size);\n\t\treturn result;\n\t}\n\thas(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\tclear(): void {\n\t\tthis.map.clear();\n\t\tthis.size.update(this.map.size);\n\t}\n\t[Symbol.iterator](): IterableIterator<[K, T]> {\n\t\treturn this.map.entries();\n\t}\n\tentries(): IterableIterator<[K, T]> {\n\t\treturn this.map.entries();\n\t}\n\tkeys(): IterableIterator {\n\t\treturn this.map.keys();\n\t}\n\tvalues(): IterableIterator {\n\t\treturn this.map.values();\n\t}\n\tforEach(callbackfn: (value: T, key: K, map: Map) => void, thisArg?: any): void {\n\t\treturn this.map.forEach(callbackfn, thisArg);\n\t}\n}\n","class PromiseSet {\n\tprivate readonly _set = new Set>();\n\tprivate set_empty: Promise = Promise.resolve();\n\tprivate on_done: () => void = () => void 0;\n\tadd(promise: Promise): typeof promise {\n\t\tif (this._set.size === 0) {\n\t\t\tthis.set_empty = new Promise((resolve) => {\n\t\t\t\tthis.on_done = resolve;\n\t\t\t});\n\t\t}\n\t\tthis._set.add(promise);\n\t\tpromise.finally(() => {\n\t\t\tthis._set.delete(promise);\n\t\t\tif (this._set.size === 0) {\n\t\t\t\tthis.on_done();\n\t\t\t\tthis.set_empty = Promise.resolve();\n\t\t\t}\n\t\t});\n\t\treturn promise;\n\t}\n\tempty(): Promise {\n\t\treturn this.set_empty;\n\t}\n\tget size() {\n\t\treturn this._set.size;\n\t}\n}\n\nconst query_queue = new PromiseSet();\n\nexport function add(promise: Promise): typeof promise {\n\treturn query_queue.add(promise);\n}\n\nexport function done(): Promise {\n\treturn query_queue.empty();\n}\n\nexport function size(): number {\n\treturn query_queue.size;\n}\n","const queue = new Set<() => void>();\n\nexport function add(task: () => void): () => void {\n\tqueue.add(task);\n\tif (queue.size === 1) {\n\t\trequestAnimationFrame(() => {\n\t\t\tfor (const task of queue) {\n\t\t\t\ttask();\n\t\t\t}\n\t\t\tqueue.clear();\n\t\t});\n\t}\n\treturn task;\n}\n\nexport function remove(task: () => void): void {\n\tqueue.delete(task);\n}\n","import { api_configuration } from \"../../common\";\nimport api_client_request = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\n\nexport class UpdateMutationBuilder {\n\tconstructor(public node: api_client_request.Tnode_update) {}\n\n\tpublic static create(): UpdateMutationBuilder {\n\t\treturn new UpdateMutationBuilder({\n\t\t\tproperties: {},\n\t\t});\n\t}\n\n\tpublic file(name: string, token: string, extension: string): UpdateMutationBuilder {\n\t\tthis.node.properties[name] = {\n\t\t\ttype: [\n\t\t\t\t\"file\",\n\t\t\t\t{\n\t\t\t\t\t\"new token\": token,\n\t\t\t\t\t\"new extension\": extension,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\treturn this;\n\t}\n\n\tpublic addCollectionEntry(name: string, key: string): InitializeMutationBuilder {\n\t\tconst collection_property = this.getCollection(name);\n\t\tconst entry = collection_property.entries[key];\n\t\tlet create_entry: { type: [\"create\", api_client_request.Tcreate] };\n\t\tif (entry === undefined || entry.type[0] !== \"create\") {\n\t\t\tcreate_entry = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"create\",\n\t\t\t\t\t{\n\t\t\t\t\t\tinitialization: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tcollection_property.entries[key] = create_entry;\n\t\t} else {\n\t\t\tcreate_entry = collection_property.entries[key] as typeof create_entry;\n\t\t}\n\t\treturn new InitializeMutationBuilder(create_entry.type[1].initialization);\n\t}\n\n\tpublic updateCollectionEntry(name: string, key: string): UpdateMutationBuilder {\n\t\tconst collection_property = this.getCollection(name);\n\t\tconst entry = collection_property.entries[key];\n\t\tlet update_entry: { type: [\"update\", api_client_request.Tupdate__type__entries] };\n\t\tif (entry === undefined || entry.type[0] !== \"update\") {\n\t\t\tupdate_entry = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"update\",\n\t\t\t\t\t{\n\t\t\t\t\t\tupdate: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tcollection_property.entries[key] = update_entry;\n\t\t} else {\n\t\t\tupdate_entry = collection_property.entries[key] as typeof update_entry;\n\t\t}\n\t\treturn new UpdateMutationBuilder(update_entry.type[1][\"update\"]);\n\t}\n\n\tpublic deleteCollectionEntry(name: string, key: string): UpdateMutationBuilder {\n\t\tconst collection_property = this.getCollection(name);\n\t\tconst entry = collection_property.entries[key];\n\t\tlet remove_entry: { type: [\"remove\", api_client_request.Tremove] };\n\t\tif (entry === undefined || entry.type[0] !== \"remove\") {\n\t\t\tremove_entry = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"remove\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"delete node\": {},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tcollection_property.entries[key] = remove_entry;\n\t\t} else {\n\t\t\tremove_entry = collection_property.entries[key] as typeof remove_entry;\n\t\t}\n\t\treturn this;\n\t}\n\n\tpublic group(name: string): UpdateMutationBuilder {\n\t\tconst group_property = this.node.properties[name];\n\t\tif (group_property?.type[0] === \"group\") {\n\t\t\treturn new UpdateMutationBuilder(group_property.type[1][\"update\"]);\n\t\t} else {\n\t\t\tconst new_group: { type: [\"group\", api_client_request.Tgroup__type__properties__node_update] } = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"group\",\n\t\t\t\t\t{\n\t\t\t\t\t\tupdate: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tthis.node.properties[name] = new_group;\n\t\t\treturn new UpdateMutationBuilder(new_group.type[1][\"update\"]);\n\t\t}\n\t}\n\n\tpublic number(name: string, value: number): UpdateMutationBuilder {\n\t\tthis.node.properties[name] = {\n\t\t\ttype: [\n\t\t\t\t\"number\",\n\t\t\t\t{\n\t\t\t\t\t\"new value\": value,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\treturn this;\n\t}\n\n\tpublic text(name: string, value: string): UpdateMutationBuilder {\n\t\tthis.node.properties[name] = {\n\t\t\ttype: [\n\t\t\t\t\"text\",\n\t\t\t\t{\n\t\t\t\t\t\"new value\": value,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\treturn this;\n\t}\n\n\tpublic update_state(state_group: string, state: string): UpdateMutationBuilder {\n\t\tconst state_property = this.node.properties[state_group];\n\t\tif (\n\t\t\tstate_property?.type[0] === \"state group\" &&\n\t\t\tstate_property?.type[1].state === state &&\n\t\t\tstate_property?.type[1].type[0] === \"update\"\n\t\t) {\n\t\t\treturn new UpdateMutationBuilder(state_property.type[1].type[1][\"update\"]);\n\t\t} else {\n\t\t\tconst update_node = {\n\t\t\t\tproperties: {},\n\t\t\t};\n\t\t\tthis.node.properties[state_group] = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"state group\",\n\t\t\t\t\t{\n\t\t\t\t\t\tstate: state,\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"update\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tupdate: update_node,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\treturn new UpdateMutationBuilder(update_node);\n\t\t}\n\t}\n\n\tpublic set_state(state_group: string, state: string): InitializeMutationBuilder {\n\t\tconst state_property = this.node.properties[state_group];\n\t\tif (\n\t\t\tstate_property?.type[0] === \"state group\" &&\n\t\t\tstate_property?.type[1].state === state &&\n\t\t\tstate_property?.type[1].type[0] === \"set\"\n\t\t) {\n\t\t\treturn new InitializeMutationBuilder(state_property.type[1].type[1][\"initialization\"]);\n\t\t} else {\n\t\t\tconst init_node = {\n\t\t\t\tproperties: {},\n\t\t\t};\n\t\t\tthis.node.properties[state_group] = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"state group\",\n\t\t\t\t\t{\n\t\t\t\t\t\tstate: state,\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"set\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinitialization: init_node,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\treturn new InitializeMutationBuilder(init_node);\n\t\t}\n\t}\n\n\tpublic mergeWith(other: UpdateMutationBuilder): UpdateMutationBuilder {\n\t\tfor (const [name, property] of Object.entries(other.node.properties)) {\n\t\t\tswitch (property.type[0]) {\n\t\t\t\tcase \"text\":\n\t\t\t\t\tthis.text(name, property.type[1][\"new value\"]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"number\":\n\t\t\t\t\tthis.number(name, property.type[1][\"new value\"]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"file\":\n\t\t\t\t\tthis.file(name, property.type[1][\"new token\"], property.type[1][\"new extension\"]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"group\":\n\t\t\t\t\tthis.group(name).mergeWith(new UpdateMutationBuilder(property.type[1].update));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"state group\": {\n\t\t\t\t\tconst stategroup = property.type[1];\n\t\t\t\t\tswitch (stategroup.type[0]) {\n\t\t\t\t\t\tcase \"set\":\n\t\t\t\t\t\t\tthis.set_state(name, stategroup.state);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"update\":\n\t\t\t\t\t\t\tthis.update_state(name, stategroup.state).mergeWith(new UpdateMutationBuilder(stategroup.type[1].update));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"collection\": {\n\t\t\t\t\tconst collection = other.getCollection(name);\n\t\t\t\t\tfor (const [key, entry] of Object.entries(collection.entries)) {\n\t\t\t\t\t\tif (entry.type === \"remove\") {\n\t\t\t\t\t\t\tthis.deleteCollectionEntry(name, key);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tswitch (entry.type[0]) {\n\t\t\t\t\t\t\tcase \"create\":\n\t\t\t\t\t\t\t\tthis.addCollectionEntry(name, key);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"remove\":\n\t\t\t\t\t\t\t\tthis.deleteCollectionEntry(name, key);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"update\":\n\t\t\t\t\t\t\t\tthis.updateCollectionEntry(name, key).mergeWith(new UpdateMutationBuilder(entry.type[1].update));\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\tprivate getCollection(name: string): api_client_request.Tcollection__type__properties__node_update {\n\t\tconst collection = this.node.properties[name];\n\t\tlet collection_type: { type: [\"collection\", api_client_request.Tcollection__type__properties__node_update] };\n\t\tif (collection === undefined || collection.type[0] !== \"collection\") {\n\t\t\tcollection_type = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"collection\",\n\t\t\t\t\t{\n\t\t\t\t\t\tentries: {},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tthis.node.properties[name] = collection_type;\n\t\t} else {\n\t\t\tcollection_type = this.node.properties[name] as typeof collection_type;\n\t\t}\n\t\treturn collection_type.type[1];\n\t}\n}\n\nexport class InitializeMutationBuilder {\n\tconstructor(public node: api_client_request.Tnode_initialization) {}\n\n\tpublic static create(): InitializeMutationBuilder {\n\t\treturn new InitializeMutationBuilder({\n\t\t\tproperties: {},\n\t\t});\n\t}\n\n\tpublic state(state_group: string, state: string): InitializeMutationBuilder {\n\t\tconst state_group_property = this.node.properties[state_group];\n\t\tif (state_group_property?.type[0] === \"state group\" && state_group_property?.type[1].state === state) {\n\t\t\treturn new InitializeMutationBuilder(state_group_property.type[1].initialization);\n\t\t} else {\n\t\t\tconst set_state: NodeInitialization<\"state group\"> = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"state group\",\n\t\t\t\t\t{\n\t\t\t\t\t\tstate: state,\n\t\t\t\t\t\tinitialization: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tthis.node.properties[state_group] = set_state;\n\t\t\treturn new InitializeMutationBuilder(set_state.type[1][\"initialization\"]);\n\t\t}\n\t}\n\n\tpublic collection(name: string): InitializeMutationBuilder {\n\t\tthis.getCollection(name);\n\t\treturn this;\n\t}\n\n\tpublic collectionEntry(name: string, key: string): InitializeMutationBuilder {\n\t\tconst collection = this.getCollection(name);\n\t\tif (collection.entries[key] === undefined) {\n\t\t\tcollection.entries[key] = {\n\t\t\t\tinitialization: {\n\t\t\t\t\tproperties: {},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn new InitializeMutationBuilder(collection.entries[key].initialization);\n\t}\n\n\tpublic group(name: string): InitializeMutationBuilder {\n\t\tconst group_property = this.node.properties[name];\n\t\tif (group_property?.type[0] === \"group\") {\n\t\t\treturn new InitializeMutationBuilder(group_property.type[1][\"initialization\"]);\n\t\t} else {\n\t\t\tconst new_group: NodeInitialization<\"group\"> = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"group\",\n\t\t\t\t\t{\n\t\t\t\t\t\tinitialization: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tthis.node.properties[name] = new_group;\n\t\t\treturn new InitializeMutationBuilder(new_group.type[1][\"initialization\"]);\n\t\t}\n\t}\n\n\tpublic number(name: string, value: number): InitializeMutationBuilder {\n\t\tthis.node.properties[name] = {\n\t\t\ttype: [\n\t\t\t\t\"number\",\n\t\t\t\t{\n\t\t\t\t\tvalue: value,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\treturn this;\n\t}\n\n\tpublic text(name: string, value: string): InitializeMutationBuilder {\n\t\tthis.node.properties[name] = {\n\t\t\ttype: [\n\t\t\t\t\"text\",\n\t\t\t\t{\n\t\t\t\t\tvalue: value,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\treturn this;\n\t}\n\n\tpublic file(name: string, token: string, extension: string): InitializeMutationBuilder {\n\t\tthis.node.properties[name] = {\n\t\t\ttype: [\n\t\t\t\t\"file\",\n\t\t\t\t{\n\t\t\t\t\ttoken: token,\n\t\t\t\t\textension: extension,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\treturn this;\n\t}\n\n\tprivate getCollection(name: string): api_client_request.Tcollection__type__properties__node_initialization {\n\t\tconst collection = this.node.properties[name];\n\t\tlet collection_type: NodeInitialization<\"collection\">;\n\t\tif (collection === undefined || collection.type[0] !== \"collection\") {\n\t\t\tcollection_type = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"collection\",\n\t\t\t\t\t{\n\t\t\t\t\t\tentries: {},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tthis.node.properties[name] = collection_type;\n\t\t} else {\n\t\t\tcollection_type = this.node.properties[name] as typeof collection_type;\n\t\t}\n\t\treturn collection_type.type[1];\n\t}\n}\n\ntype NodeInitialization = {\n\ttype: Extract;\n} & api_client_request.Tproperties__node_initialization;\n","import { api_configuration } from \"../../common\";\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_cr = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\n\nexport default class SubscriptionBuilder {\n\tprivate _parent: SubscriptionBuilder | undefined;\n\tconstructor(public properties: api_cr.Tnode_subscription[\"attributes\"], parent: SubscriptionBuilder | undefined) {\n\t\tthis._parent = parent;\n\t}\n\tstatic create(): SubscriptionBuilder {\n\t\treturn new SubscriptionBuilder({}, undefined);\n\t}\n\ttext(text: string): this {\n\t\tthis.properties[text] = this.property([\"text\", { \"include reference\": [\"no\", {}] }]);\n\t\treturn this;\n\t}\n\tfile(file: string): this {\n\t\tthis.properties[file] = this.property(\"file\");\n\t\treturn this;\n\t}\n\tnumber(value: string): this {\n\t\tthis.properties[value] = this.property(\"number\");\n\t\treturn this;\n\t}\n\tcommand(command: string): this {\n\t\tthis.properties[command] = {\n\t\t\ttype: \"command\",\n\t\t};\n\t\treturn this;\n\t}\n\tcollection_updates(value: string, include_graph_endpoints: \"yes\" | \"no\" = \"no\"): this {\n\t\tconst collection = this.properties[value];\n\t\tif (collection === undefined) {\n\t\t\tthis.properties[value] = this.property([\n\t\t\t\t\"collection\",\n\t\t\t\t{\n\t\t\t\t\t\"subscribe on\": [\"updates\", {}],\n\t\t\t\t\t\"include graph endpoints\": [include_graph_endpoints, {}],\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\t\treturn this;\n\t}\n\n\tcollection_entries(\n\t\tcollection: string,\n\t\tkey_filters: string[] = [],\n\t\tinclude_graph_endpoints: \"yes\" | \"no\" = \"no\"\n\t): SubscriptionBuilder {\n\t\tconst collection_property = this.getProperty(collection, \"collection\");\n\t\tif (\n\t\t\tcollection_property !== undefined &&\n\t\t\tcollection_property.type[1].type[1][\"subscribe on\"] instanceof Array &&\n\t\t\tcollection_property.type[1].type[1][\"subscribe on\"][0] === \"entries\"\n\t\t) {\n\t\t\treturn new SubscriptionBuilder(\n\t\t\t\tcollection_property.type[1].type[1][\"subscribe on\"][1].subscription.attributes,\n\t\t\t\tthis\n\t\t\t);\n\t\t} else {\n\t\t\tconst collection_property = this.property([\n\t\t\t\t\"collection\",\n\t\t\t\t{\n\t\t\t\t\t\"subscribe on\": [\n\t\t\t\t\t\t\"entries\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"key filter\":\n\t\t\t\t\t\t\t\tkey_filters.length > 0\n\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tkeys: key_filters.reduce>>((o, k) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\to[k] = {};\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn o;\n\t\t\t\t\t\t\t\t\t\t\t\t}, {}),\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t: \"no\",\n\t\t\t\t\t\t\tsubscription: { attributes: {} },\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t\"include graph endpoints\": [include_graph_endpoints, {}],\n\t\t\t\t},\n\t\t\t]);\n\t\t\tthis.properties[collection] = collection_property;\n\t\t\tconst entry_subscription = collection_property.type[1].type[1][\"subscribe on\"][1];\n\t\t\treturn new SubscriptionBuilder(entry_subscription.subscription.attributes, this);\n\t\t}\n\t}\n\n\tconstrained_text(text: string): this {\n\t\tthis.properties[text] = this.property([\n\t\t\t\"text\",\n\t\t\t{\n\t\t\t\t\"include reference\": [\"yes\", {}],\n\t\t\t},\n\t\t]);\n\t\treturn this;\n\t}\n\tstate_group(state_group: string, state_group_node: api_app.Cstate_group): this {\n\t\tif (this.properties[state_group] === undefined) {\n\t\t\tthis.properties[state_group] = this.property([\n\t\t\t\t\"state group\",\n\t\t\t\t{\n\t\t\t\t\tstates: state_group_node.properties.states.map(() => ({\n\t\t\t\t\t\tsubscription: {\n\t\t\t\t\t\t\tattributes: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t})),\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\t\treturn this;\n\t}\n\tstate(state_group: string, state: string, state_group_node: api_app.Cstate_group): SubscriptionBuilder {\n\t\tconst state_group_property =\n\t\t\tthis.getProperty(state_group, \"state group\") ||\n\t\t\tthis.property([\n\t\t\t\t\"state group\",\n\t\t\t\t{\n\t\t\t\t\tstates: state_group_node.properties.states.map(() => ({\n\t\t\t\t\t\tsubscription: {\n\t\t\t\t\t\t\tattributes: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t})),\n\t\t\t\t},\n\t\t\t]);\n\t\tthis.properties[state_group] = state_group_property;\n\t\treturn new SubscriptionBuilder(state_group_property.type[1].type[1].states[state].subscription.attributes, this);\n\t}\n\tgroup(group: string): SubscriptionBuilder {\n\t\tconst group_property =\n\t\t\tthis.getProperty(group, \"group\") ||\n\t\t\tthis.property([\n\t\t\t\t\"group\",\n\t\t\t\t{\n\t\t\t\t\tsubscription: {\n\t\t\t\t\t\tattributes: {},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]);\n\t\tthis.properties[group] = group_property;\n\t\treturn new SubscriptionBuilder(group_property.type[1].type[1].subscription.attributes, this);\n\t}\n\n\tparent(): SubscriptionBuilder {\n\t\tif (this._parent === undefined) {\n\t\t\tthrow new Error(\"Parent is undefined\");\n\t\t}\n\t\treturn this._parent;\n\t}\n\n\tremove(property: string): void {\n\t\tdelete this.properties[property];\n\t}\n\n\tprivate property(\n\t\tproperty: T\n\t): {\n\t\ttype: [\n\t\t\t\"property\",\n\t\t\t{\n\t\t\t\ttype: T;\n\t\t\t}\n\t\t];\n\t} {\n\t\treturn {\n\t\t\ttype: [\n\t\t\t\t\"property\",\n\t\t\t\t{\n\t\t\t\t\ttype: property,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\tprivate getProperty[0]>(\n\t\tname: string,\n\t\tproperty_type: T\n\t):\n\t\t| {\n\t\t\t\ttype: [\n\t\t\t\t\t\"property\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: [T, Extract[1]];\n\t\t\t\t\t}\n\t\t\t\t];\n\t\t }\n\t\t| undefined {\n\t\tconst attribute = this.properties[name];\n\t\tif (attribute === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (attribute.type instanceof Array && attribute.type[0] === \"property\") {\n\t\t\tif (attribute.type[1].type instanceof Array && attribute.type[1].type[0] === property_type) {\n\t\t\t\treturn attribute as unknown as any;\n\t\t\t} else {\n\t\t\t\tthrow new Error(`expected a ${property_type} but got ${attribute.type[1].type}`);\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(\"expected a property \" + attribute.type);\n\t\t}\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { createIdPathFromNode } from \"../navigation/createIdPathFromNode\";\nimport {\n\tupdateNodeFromSubscriptionResult,\n\tupdateNodeFromNotificationData,\n\tsetPropertiesToNotReadable,\n} from \"../state 2 interface/updateNodeFromSubscriptionReply\";\nimport { updateEntityPermission } from \"../state 2 interface/permissions\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport SubscriptionBuilder from \"../state 2 interface/SubscriptionBuilder\";\nimport {\n\tSubscribableObject,\n\tCollectionKeyRegistration,\n\tasRegisterable,\n\tgetCollectionRegistrations,\n\tneedsToBeSubscribed,\n\tEntriesRegistrationNode,\n} from \"../state/registerClientState\";\nimport * as microtaskQueue from \"../microtaskQueue\";\nimport DestructorTree from \"../DestructorTree\";\nimport { setNodeContextToLocal } from \"../state/setLocation\";\nimport { createVariable, awaitCondition } from \"../../../../../stream\";\nimport { iCollection } from \"../state/Collection\";\n\nexport const pendingSubscriptions = createVariable(0, true);\n\nfunction subscriptionsInitialized() {\n\treturn awaitCondition(pendingSubscriptions, (queue) => queue === 0);\n}\n\nclass Subscription {\n\tprivate subscribed_properties = 0;\n\tprivate destructor = new DestructorTree();\n\tprivate queued = false;\n\treadonly builder = SubscriptionBuilder.create();\n\n\tconstructor(private _node: api_cs.Cnode) {\n\t\tthis._node.onDestroy(() => this.destroy());\n\t}\n\tget node(): api_cs.Cnode {\n\t\treturn this._node;\n\t}\n\tget empty(): boolean {\n\t\treturn this.subscribed_properties <= 0;\n\t}\n\tadd_dependency(object: SubscribableObject) {\n\t\tconst registration = asRegisterable(object);\n\t\tregistration.__needs_subscription = false;\n\t\tthis.subscribed_properties += 1;\n\t\tregistration.__subscriptions?.onDestroy(() => {\n\t\t\tthis.subscribed_properties -= 1;\n\t\t\tif (this.empty) {\n\t\t\t\tthis.destroy();\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate datastore_subscription: { unsubscribe: () => void } | undefined;\n\tsubscribe() {\n\t\tif (this.datastore_subscription) {\n\t\t\treturn;\n\t\t}\n\t\tthis.queue();\n\n\t\tthis.datastore_subscription = DatastoreProxy.instance.subscribe(\n\t\t\t{\n\t\t\t\t\"context node\": createIdPathFromNode(this.node),\n\t\t\t\t\"mutation permissions\": [\"include\", {}],\n\t\t\t\t\"node subscription\": { attributes: this.builder.properties },\n\t\t\t},\n\t\t\t(subscription_result) => {\n\t\t\t\tmicrotaskQueue.add(() => {\n\t\t\t\t\tif (this.node.destroyed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsubscription_result.properties.context.switch({\n\t\t\t\t\t\t\"does not exist\": () => {\n\t\t\t\t\t\t\tsetNodeContextToLocal(this.node);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"permission denied\": () => {\n\t\t\t\t\t\t\tsetPropertiesToNotReadable(this.node);\n\t\t\t\t\t\t},\n\t\t\t\t\t\texists: ($) => {\n\t\t\t\t\t\t\tupdateNodeFromSubscriptionResult(this.node, $, this.destructor);\n\t\t\t\t\t\t\tupdateEntityPermission(this.node);\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tthis.dequeue();\n\t\t\t\t});\n\t\t\t},\n\t\t\t(notification) => {\n\t\t\t\tmicrotaskQueue.add(() => {\n\t\t\t\t\tif (this.node.destroyed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tnotification.properties.context.switch({\n\t\t\t\t\t\t\"does not exist\": () => {\n\t\t\t\t\t\t\tconst position = this.node.input.position().variant;\n\t\t\t\t\t\t\tswitch (position.name) {\n\t\t\t\t\t\t\t\tcase \"root\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"state\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"entity\":\n\t\t\t\t\t\t\t\t\tswitch (position.definition.variant.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"root\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\t\t\t\t\t\tconst entry = position.definition.variant.definition;\n\t\t\t\t\t\t\t\t\t\t\tiCollection(entry.parent).deleteServerEntry(entry);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"permission denied\": () => {\n\t\t\t\t\t\t\tsetPropertiesToNotReadable(this.node);\n\t\t\t\t\t\t},\n\t\t\t\t\t\texists: ($) => {\n\t\t\t\t\t\t\tupdateNodeFromNotificationData(this.node, $.properties.notification_data, this.destructor);\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis.destroy();\n\t\t\t}\n\t\t);\n\t}\n\tqueue(): void {\n\t\tif (!this.queued) {\n\t\t\tpendingSubscriptions.set(pendingSubscriptions.value + 1);\n\t\t\tthis.queued = true;\n\t\t}\n\t}\n\tdequeue(): void {\n\t\tif (this.queued) {\n\t\t\tpendingSubscriptions.set(pendingSubscriptions.value - 1);\n\t\t\tthis.queued = false;\n\t\t}\n\t}\n\tdestroy(): void {\n\t\tthis.datastore_subscription?.unsubscribe();\n\t\tthis.datastore_subscription = undefined;\n\t\tthis.dequeue();\n\t\tthis.destructor.destroy();\n\t}\n}\n\nfunction walkAttributes(node: api_cs.Cnode, subscription: Subscription, subscription_builder: SubscriptionBuilder) {\n\tfor (const [attribute_name, attribute] of node.properties.attributes) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"operation\": {\n\t\t\t\tconst operation = attribute.properties.type.state.node;\n\t\t\t\tswitch (operation.properties.type.state.name) {\n\t\t\t\t\tcase \"command\": {\n\t\t\t\t\t\tconst command = operation.properties.type.state.node;\n\t\t\t\t\t\tif (needsToBeSubscribed(command)) {\n\t\t\t\t\t\t\tsubscription.add_dependency(command);\n\t\t\t\t\t\t\tsubscription_builder.command(attribute_name);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"action\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(operation.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst text = property.properties.type.state.node;\n\t\t\t\t\t\tif (needsToBeSubscribed(text)) {\n\t\t\t\t\t\t\tsubscription.add_dependency(text);\n\t\t\t\t\t\t\tconst text_def = text.inferences.text_type();\n\t\t\t\t\t\t\tswitch (text_def.properties.has_reference.state.name) {\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\tsubscription_builder.constrained_text(attribute_name);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tsubscription_builder.text(attribute_name);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(text_def.properties.has_reference.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\tconst file = property.properties.type.state.node;\n\t\t\t\t\t\tif (needsToBeSubscribed(file)) {\n\t\t\t\t\t\t\tsubscription.add_dependency(file);\n\t\t\t\t\t\t\tsubscription_builder.file(attribute_name);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst number = property.properties.type.state.node;\n\t\t\t\t\t\tif (needsToBeSubscribed(number)) {\n\t\t\t\t\t\t\tsubscription.add_dependency(number);\n\t\t\t\t\t\t\tsubscription_builder.number(attribute_name);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst group = property.properties.type.state.node;\n\t\t\t\t\t\tif (needsToBeSubscribed(group)) {\n\t\t\t\t\t\t\tsubscription.add_dependency(group);\n\t\t\t\t\t\t}\n\t\t\t\t\t\twalkAttributes(group.properties.node, subscription, subscription_builder.group(attribute_name));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst stategroup = property.properties.type.state.node;\n\t\t\t\t\t\tconst def = stategroup.inferences.state_group_type();\n\t\t\t\t\t\tif (needsToBeSubscribed(stategroup)) {\n\t\t\t\t\t\t\tsubscription.add_dependency(stategroup);\n\t\t\t\t\t\t\tsubscription_builder.state_group(attribute_name, def);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (const [state_name, state] of stategroup.properties.states) {\n\t\t\t\t\t\t\tswitch (state.properties.location.state.name) {\n\t\t\t\t\t\t\t\tcase \"remote\":\n\t\t\t\t\t\t\t\t\twalkAttributes(\n\t\t\t\t\t\t\t\t\t\tstate.properties.node,\n\t\t\t\t\t\t\t\t\t\tsubscription,\n\t\t\t\t\t\t\t\t\t\tsubscription_builder.state(attribute_name, state_name, def)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(state.properties.location.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\tconst collection = property.properties.type.state.node;\n\t\t\t\t\t\tconst collection_registrations = getCollectionRegistrations(collection);\n\n\t\t\t\t\t\t// Find out if entries need to be subscribed\n\t\t\t\t\t\tconst unsubscribed_key_registrations = new Set();\n\t\t\t\t\t\tconst unsubscribed_keys: string[] = [];\n\t\t\t\t\t\tfor (const [key, key_registration] of collection_registrations.keys) {\n\t\t\t\t\t\t\tif (needsToBeSubscribed(key_registration)) {\n\t\t\t\t\t\t\t\tunsubscribed_key_registrations.add(key_registration);\n\t\t\t\t\t\t\t\tunsubscribed_keys.push(key);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst include_graph_endpoints = includeGraphEndpoints(collection);\n\n\t\t\t\t\t\tconst entries_subscription_builder = subscription_builder.collection_entries(\n\t\t\t\t\t\t\tattribute_name,\n\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\tinclude_graph_endpoints\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst needs_entries_subscription =\n\t\t\t\t\t\t\twalkEntriesRegistrationNode(\n\t\t\t\t\t\t\t\tcollection_registrations.entries.node,\n\t\t\t\t\t\t\t\tsubscription,\n\t\t\t\t\t\t\t\tentries_subscription_builder\n\t\t\t\t\t\t\t) || needsToBeSubscribed(collection_registrations.entries);\n\t\t\t\t\t\tif (needs_entries_subscription) {\n\t\t\t\t\t\t\tsubscription.add_dependency(collection_registrations.entries);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsubscription_builder.remove(attribute_name);\n\t\t\t\t\t\t\tif (unsubscribed_key_registrations.size > 0) {\n\t\t\t\t\t\t\t\tsubscription_builder.collection_entries(attribute_name, unsubscribed_keys, include_graph_endpoints);\n\t\t\t\t\t\t\t\tfor (const entry_registration of unsubscribed_key_registrations) {\n\t\t\t\t\t\t\t\t\tsubscription.add_dependency(entry_registration);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (needsToBeSubscribed(collection_registrations.updates)) {\n\t\t\t\t\t\t\t\tsubscription.add_dependency(collection_registrations.updates);\n\t\t\t\t\t\t\t\tsubscription_builder.collection_updates(attribute_name, include_graph_endpoints);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t}\n\t}\n}\n\nexport const GraphEndpointsSubscribed = new WeakMap();\nfunction includeGraphEndpoints(collection: api_cs.Ccollection) {\n\tswitch (collection.properties.has_ordered_graphs.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst is_subscribed = GraphEndpointsSubscribed.get(collection) ?? false;\n\t\t\tif (!is_subscribed) {\n\t\t\t\tGraphEndpointsSubscribed.set(collection, true);\n\t\t\t}\n\t\t\treturn is_subscribed ? \"no\" : \"yes\";\n\t\t}\n\t\tcase \"no\":\n\t\t\treturn \"no\";\n\t}\n}\n\nfunction walkEntriesRegistrationNode(\n\tnode: EntriesRegistrationNode,\n\tsubscription: Subscription,\n\tsubscription_builder: SubscriptionBuilder\n): boolean {\n\tlet needs_subscription = false;\n\tfor (const [name, att] of node) {\n\t\tswitch (att[0]) {\n\t\t\tcase \"command\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tif (needsToBeSubscribed($)) {\n\t\t\t\t\tsubscription.add_dependency($);\n\t\t\t\t\tsubscription_builder.command(name);\n\t\t\t\t\tneeds_subscription = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"text\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tif (needsToBeSubscribed($)) {\n\t\t\t\t\tsubscription.add_dependency($);\n\t\t\t\t\tif (att[1].reference) {\n\t\t\t\t\t\tsubscription_builder.constrained_text(name);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsubscription_builder.text(name);\n\t\t\t\t\t}\n\t\t\t\t\tneeds_subscription = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"number\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tif (needsToBeSubscribed($)) {\n\t\t\t\t\tsubscription.add_dependency($);\n\t\t\t\t\tsubscription_builder.number(name);\n\t\t\t\t\tneeds_subscription = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"file\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tif (needsToBeSubscribed($)) {\n\t\t\t\t\tsubscription.add_dependency($);\n\t\t\t\t\tsubscription_builder.file(name);\n\t\t\t\t\tneeds_subscription = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"group\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tif (needsToBeSubscribed($)) {\n\t\t\t\t\tsubscription.add_dependency($);\n\t\t\t\t\tneeds_subscription = true;\n\t\t\t\t}\n\t\t\t\tconst group_needs_subscription = walkEntriesRegistrationNode(\n\t\t\t\t\t$.node,\n\t\t\t\t\tsubscription,\n\t\t\t\t\tsubscription_builder.group(name)\n\t\t\t\t);\n\t\t\t\tneeds_subscription = needs_subscription || group_needs_subscription;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"stategroup\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tif (needsToBeSubscribed($)) {\n\t\t\t\t\tsubscription.add_dependency($);\n\t\t\t\t\tsubscription_builder.state_group(name, $.def);\n\t\t\t\t\tneeds_subscription = true;\n\t\t\t\t}\n\t\t\t\tfor (const [state_name, state_tree] of $.states) {\n\t\t\t\t\tconst state_needs_subscription = walkEntriesRegistrationNode(\n\t\t\t\t\t\tstate_tree,\n\t\t\t\t\t\tsubscription,\n\t\t\t\t\t\tsubscription_builder.state(name, state_name, $.def)\n\t\t\t\t\t);\n\t\t\t\t\tneeds_subscription = needs_subscription || state_needs_subscription;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"collection\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tif (needsToBeSubscribed($.updates)) {\n\t\t\t\t\tsubscription.add_dependency($.updates);\n\t\t\t\t\tsubscription_builder.collection_updates(name);\n\t\t\t\t\tneeds_subscription = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(att[0]);\n\t\t}\n\t}\n\treturn needs_subscription;\n}\n\nconst nodeUpdateQueue = new Set();\n\nfunction createNodeSubscriptions() {\n\tfor (const node of nodeUpdateQueue) {\n\t\tif (!node.destroyed) {\n\t\t\tconst subscription = new Subscription(node);\n\t\t\twalkAttributes(node, subscription, subscription.builder);\n\t\t\tif (!subscription.empty) {\n\t\t\t\tsubscription.subscribe();\n\t\t\t} else {\n\t\t\t\tsubscription.destroy();\n\t\t\t}\n\t\t}\n\t}\n\tnodeUpdateQueue.clear();\n}\n\nexport function queue(object: SubscribableObject) {\n\tconst node = object.component_root.input.entity().output.node();\n\tswitch (node.input.position().output.root().variant.name) {\n\t\tcase \"operation\":\n\t\t\t// Do not subscribe entries of operations\n\t\t\tbreak;\n\t\tcase \"root\":\n\t\t\tnodeUpdateQueue.add(node);\n\t\t\tif (nodeUpdateQueue.size === 1) {\n\t\t\t\tmicrotaskQueue.add(() => createNodeSubscriptions());\n\t\t\t}\n\t\t\tbreak;\n\t}\n}\n\nexport async function finishedAndInitialized(): Promise {\n\tawait microtaskQueue.done();\n\tawait subscriptionsInitialized();\n}\n\nexport function size(): number {\n\treturn nodeUpdateQueue.size + pendingSubscriptions.value;\n}\n","import { api_configuration } from \"../../common\";\nimport hash = require(\"../widgets/dom/hash\");\nimport api_settings_decorator = api_configuration.libraries.gui_definition_lib.types.settings.alan_api;\nimport { DatastoreConnection, InvalidTokenError } from \"../interface/DatastoreProxy\";\nimport { getFileFromWebServer } from \"./webserver\";\n\nexport type AuthenticationData = {\n\ttoken: string;\n\tusername: string;\n};\nexport async function authenticate(\n\tapplication_name: string,\n\tconnection: DatastoreConnection\n): Promise {\n\tconst authentication_data =\n\t\treadTokenFromHash() ?? (await getKauth(connection)) ?? (await readTokenFromSession(connection));\n\tif (authentication_data !== undefined) {\n\t\treturn authentication_data;\n\t}\n\tconst gui_settings: api_settings_decorator.Tsettings = await getFileFromWebServer(\n\t\t\"gui_definition/package/settings.alan.json\",\n\t\tJSON.parse\n\t);\n\tconst state = gui_settings.settings[\"allow anonymous user\"] as Extract<\n\t\ttypeof gui_settings.settings[\"allow anonymous user\"],\n\t\tArray\n\t>;\n\tswitch (state[0]) {\n\t\tcase \"yes\":\n\t\t\treturn undefined;\n\t\tcase \"no\":\n\t\t\treturn login(application_name, connection);\n\t\tdefault:\n\t\t\treturn unexpectedState(state[0]);\n\t}\n}\n\nconst AUTH_USER_KEY = \"auth-user\";\nconst AUTH_TOKEN_KEY = \"auth-token\";\nfunction readTokenFromHash(): AuthenticationData | undefined {\n\tconst token = hash.getToken();\n\tconst username = hash.getUserName();\n\thash.clearToken();\n\thash.clearUsername();\n\tif (token !== null && username !== null) {\n\t\twindow.sessionStorage.setItem(AUTH_USER_KEY, username);\n\t\twindow.sessionStorage.setItem(AUTH_TOKEN_KEY, token);\n\t\treturn {\n\t\t\tusername: username,\n\t\t\ttoken: token,\n\t\t};\n\t} else {\n\t\treturn undefined;\n\t}\n}\n\nasync function readTokenFromSession(connection: DatastoreConnection): Promise {\n\tconst token = window.sessionStorage.getItem(AUTH_TOKEN_KEY);\n\tconst username = window.sessionStorage.getItem(AUTH_USER_KEY);\n\tif (token !== null && username !== null) {\n\t\tconst token_is_valid = await connection.validateToken(token);\n\t\tif (token_is_valid) {\n\t\t\treturn {\n\t\t\t\tusername: username,\n\t\t\t\ttoken: token,\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn undefined;\n}\n\nasync function getKauth(connection: DatastoreConnection): Promise {\n\tconst kauth_text = window.localStorage.getItem(\"KAUTH\");\n\tif (kauth_text !== null) {\n\t\tlet kauth:\n\t\t\t| {\n\t\t\t\t\t\"has session\":\n\t\t\t\t\t\t| [\"no\", any]\n\t\t\t\t\t\t| [\n\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttoken: string;\n\t\t\t\t\t\t\t\t\tuname: string;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t ];\n\t\t\t }\n\t\t\t| undefined;\n\t\ttry {\n\t\t\tkauth = JSON.parse(kauth_text);\n\t\t} catch (e) {\n\t\t\treturn Promise.resolve(undefined);\n\t\t}\n\t\tif (kauth !== undefined && kauth[\"has session\"]?.[0] === \"yes\") {\n\t\t\tconst username = kauth[\"has session\"][1].uname;\n\t\t\tconst kauth_token = kauth[\"has session\"][1].token;\n\t\t\tconst token_is_valid = await connection.validateToken(kauth_token);\n\t\t\tif (token_is_valid) {\n\t\t\t\treturn {\n\t\t\t\t\tusername: username,\n\t\t\t\t\ttoken: kauth_token,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\treturn Promise.resolve(undefined);\n\t\t}\n\t}\n\treturn Promise.resolve(undefined);\n}\n\nexport async function login(application_name: string, connection: DatastoreConnection): Promise {\n\ttry {\n\t\tconst uri = await connection.getAuthenticationUri();\n\t\tconst params = new URLSearchParams({\n\t\t\tsource: redirectURL(),\n\t\t\taction: \"login\",\n\t\t\tsymnam: application_name,\n\t\t});\n\t\tconst url = new URL(uri);\n\t\turl.hash = params.toString();\n\t\twindow.location.href = url.toString();\n\t\treturn undefined;\n\t} catch (e) {\n\t\tif (e instanceof InvalidTokenError) {\n\t\t\twindow.localStorage.removeItem(\"KAUTH\");\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport async function logout(application_name: string, connection: DatastoreConnection): Promise {\n\tconst uri = await connection.getAuthenticationUri();\n\tconst params = new URLSearchParams({\n\t\tsource: redirectURL(),\n\t\taction: \"logout\",\n\t\tsymnam: application_name,\n\t});\n\tconst url = new URL(uri);\n\turl.hash = params.toString();\n\twindow.location.href = url.toString();\n}\n\nfunction redirectURL() {\n\tconst url = new URL(window.location.href);\n\tconst serialize_params = btoa(url.hash.slice(1));\n\tconst params = new URLSearchParams({\n\t\tparameters: serialize_params,\n\t});\n\turl.hash = params.toString();\n\treturn url.toString();\n}\n","import { api_configuration } from \"../../common\";\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport { CollectionPathBuilder } from \"../navigation/createCollectionPathBuilder\";\n\nfunction walkQueryPathStep(\n\tquery_path_step: api_views.Cquery_path_step,\n\tpath_builder: CollectionPathBuilder\n): CollectionPathBuilder {\n\treturn query_path_step.properties.has_steps.switch({\n\t\tno: function () {\n\t\t\treturn path_builder;\n\t\t},\n\t\tyes: function (has_steps) {\n\t\t\treturn has_steps.properties.type.switch({\n\t\t\t\tstate: function (type_state) {\n\t\t\t\t\treturn walkQueryPathStep(\n\t\t\t\t\t\thas_steps.properties.tail,\n\t\t\t\t\t\tpath_builder.state(\n\t\t\t\t\t\t\ttype_state.properties.state_group.ref.parent.parent.key.ref.key,\n\t\t\t\t\t\t\ttype_state.properties.state.ref.key.ref.key\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tgroup: function (type_group) {\n\t\t\t\t\treturn walkQueryPathStep(\n\t\t\t\t\t\thas_steps.properties.tail,\n\t\t\t\t\t\tpath_builder.group(type_group.properties.group.ref.parent.parent.key.ref.key)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n}\n\nexport function create(path: api_views.Cquery_path, path_builder: CollectionPathBuilder): CollectionPathBuilder {\n\treturn path.properties.has_steps.switch({\n\t\tno: () => path_builder,\n\t\tyes: function (has_steps) {\n\t\t\tconst collection_builder = walkQueryPathStep(has_steps.properties.head, path_builder).collection(\n\t\t\t\thas_steps.properties.collection.entry\n\t\t\t);\n\t\t\treturn create(has_steps.properties.tail, collection_builder);\n\t\t},\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_gui = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_cr = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport * as createCollectionPathBuilderFromCollectionPath from \"./createCollectionPathBuilderFromCollectionPath\";\nimport {\n\tmapNodePath,\n\tcreatePropertiesDictionaryFromColumns,\n\tcreateNodeExistanceFilter,\n\tcreateNodeContainmentFilter,\n\tcreateFiltersFromColumns,\n} from \"./createPropertiesDictionaryFromColumns\";\nimport { CollectionPathBuilder } from \"../navigation/createCollectionPathBuilder\";\nimport NodePathBuilder from \"../navigation/NodePathBuilder\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { where_rule_object_path } from \"../state/expressions\";\nimport { Pending, Unknown, Failed, Result } from \"../Status\";\nimport { scalarValue } from \"../../../../../stream\";\n\nfunction walkGuiEntityPathTail(\n\tpath: api_gui.Cgui_node_type_path_step,\n\tbuilder: CollectionPathBuilder\n): CollectionPathBuilder {\n\tswitch (path.properties.has_steps.state.name) {\n\t\tcase \"no\": {\n\t\t\treturn builder;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst has_step = path.properties.has_steps.state.node;\n\t\t\tlet new_builder = builder;\n\t\t\tswitch (has_step.properties.attribute.ref.properties.type.state.name) {\n\t\t\t\tcase \"action\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"command\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"property\": {\n\t\t\t\t\tconst property = has_step.properties.attribute.ref.properties.type.state.node;\n\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\tnew_builder = CollectionPathBuilder.create().collection(has_step.properties.attribute.entry);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"reference set\":\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(has_step.properties.attribute.ref.properties.type.state);\n\t\t\t}\n\t\t\treturn walkGuiEntityPathTail(has_step.properties.tail, new_builder);\n\t\t}\n\t\tdefault:\n\t\t\treturn unexpectedState(path.properties.has_steps.state);\n\t}\n}\n\nfunction createCollectionPathFromGuiEntityPath(path: api_gui.Cgui_node_type_path): CollectionPathBuilder {\n\treturn walkGuiEntityPathTail(path.properties.steps, CollectionPathBuilder.create());\n}\n\nfunction object_path_tail(\n\troot: api_app.Cobject_path_tail,\n\tpath_builder: NodePathBuilder | undefined = undefined,\n\tstategroup_name: string | undefined = undefined\n): NodePathBuilder | undefined {\n\tconst $has_steps = root.properties.has_steps.state;\n\tswitch ($has_steps.name) {\n\t\tcase \"no\":\n\t\t\treturn path_builder;\n\t\tcase \"yes\": {\n\t\t\tconst $type = $has_steps.node.properties.type.state;\n\t\t\tconst tail = $has_steps.node.properties.tail;\n\t\t\tswitch ($type.name) {\n\t\t\t\tcase \"parent\":\n\t\t\t\t\treturn object_path_tail(tail, (path_builder ?? new NodePathBuilder()).parent());\n\t\t\t\tcase \"property value\": {\n\t\t\t\t\tconst property_name = $type.node.properties.property.properties.property.entry;\n\t\t\t\t\tswitch ($type.node.properties.property.properties.property.ref.properties.type.state.name) {\n\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\treturn object_path_tail(tail, (path_builder ?? new NodePathBuilder()).group(property_name));\n\t\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\t\treturn object_path_tail(tail, path_builder, property_name);\n\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"dependency\": {\n\t\t\t\t\tconst dependency = $type.node.properties.dependency.properties.type.state;\n\t\t\t\t\tswitch (dependency.name) {\n\t\t\t\t\t\tcase \"reference\":\n\t\t\t\t\t\t\treturn object_path_tail(\n\t\t\t\t\t\t\t\ttail,\n\t\t\t\t\t\t\t\t(path_builder ?? new NodePathBuilder()).reference(\n\t\t\t\t\t\t\t\t\tdependency.node.properties.property.properties.property.entry\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tcase \"reference rule\":\n\t\t\t\t\t\t\treturn object_path_tail(\n\t\t\t\t\t\t\t\ttail,\n\t\t\t\t\t\t\t\t(path_builder ?? new NodePathBuilder()).reference_rule(\n\t\t\t\t\t\t\t\t\tdependency.node.properties.property.properties.property.entry,\n\t\t\t\t\t\t\t\t\tdependency.node.properties.rule.properties.rule.entry\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tcase \"state context rule\":\n\t\t\t\t\t\t\treturn object_path_tail(\n\t\t\t\t\t\t\t\ttail,\n\t\t\t\t\t\t\t\t(path_builder ?? new NodePathBuilder()).state_rule(\n\t\t\t\t\t\t\t\t\tdependency.node.properties.rule.properties.rule.entry\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcase \"reference set\":\n\t\t\t\t\treturn;\n\t\t\t\tcase \"state\":\n\t\t\t\t\treturn object_path_tail(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\t(path_builder ?? new NodePathBuilder()).state(stategroup_name!, $type.node.properties.state.entry)\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction createIdPathForWhereRuleObjectPath(\n\trule: api_cs.Crules,\n\tpath: api_app.Cwhere_rule_object_path\n): IdPathBuilder | undefined {\n\tconst stream = where_rule_object_path(path)(rule);\n\tconst node = scalarValue(stream) as Result;\n\tswitch (node) {\n\t\tcase Pending:\n\t\t\treturn undefined;\n\t\tcase Unknown:\n\t\t\treturn undefined;\n\t\tcase Failed:\n\t\t\treturn undefined;\n\t\tdefault:\n\t\t\treturn createIdPathBuilderFromNode(node);\n\t}\n}\n\nfunction createNodePathForWhereRuleObjectPath(\n\tpath: api_app.Cwhere_rule_object_path,\n\tcontext_path: NodePathBuilder\n): NodePathBuilder | undefined {\n\tconst $context = path.properties.context.state;\n\tswitch ($context.name) {\n\t\tcase \"this\": {\n\t\t\tconst $step = $context.node.properties.head;\n\t\t\tswitch ($step.properties.context.state.name) {\n\t\t\t\tcase \"this\":\n\t\t\t\t\treturn undefined;\n\t\t\t\tcase \"variable\":\n\t\t\t\t\treturn object_path_tail(path.properties.path, context_path);\n\t\t\t\tcase \"dynamic user\":\n\t\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"sibling rule\": {\n\t\t\tconst sibling_path = createNodePathForRule($context.node.properties.rule.ref, context_path);\n\t\t\tif (sibling_path !== undefined) {\n\t\t\t\treturn object_path_tail(path.properties.path, sibling_path);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n\nfunction createNodePathForRule(rule: api_app.Crules, context_path: NodePathBuilder): NodePathBuilder | undefined {\n\tconst type = rule.properties.type.state;\n\tswitch (type.name) {\n\t\tcase \"entry reference\":\n\t\t\treturn undefined;\n\t\tcase \"node reference\": {\n\t\t\tconst $type = type.node.properties.type.state;\n\t\t\tswitch ($type.name) {\n\t\t\t\tcase \"existence\":\n\t\t\t\t\treturn createNodePathForWhereRuleObjectPath(type.node.properties.object_path, context_path);\n\t\t\t\tcase \"equality\": {\n\t\t\t\t\tconst left = createNodePathForWhereRuleObjectPath(type.node.properties.object_path, context_path);\n\t\t\t\t\tconst right = createNodePathForWhereRuleObjectPath($type.node.properties.node_path, context_path);\n\t\t\t\t\treturn left ?? right;\n\t\t\t\t}\n\t\t\t\tcase \"containment\":\n\t\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nfunction createFiltersForRules(reference: api_cs.Cyes__navigable, filters: Record) {\n\tfor (const rule of reference.properties.rules.properties.rules.values()) {\n\t\tconst def = rule.key.ref;\n\t\tif (\n\t\t\t!def.properties.behaviour.properties.type.switch({\n\t\t\t\tmandatory: () => true,\n\t\t\t\toptional: () =>\n\t\t\t\t\tdef.properties.ui.properties.has_validation.switch({\n\t\t\t\t\t\tyes: () => true,\n\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t}),\n\t\t\t})\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst type = def.properties.type.state;\n\t\tswitch (type.name) {\n\t\t\tcase \"entry reference\":\n\t\t\t\t//TODO\n\t\t\t\tbreak;\n\t\t\tcase \"node reference\": {\n\t\t\t\tconst $type = type.node.properties.type.state;\n\t\t\t\tconst reference_tail_context_path = object_path_tail(\n\t\t\t\t\treference.inferences.is_navigable().properties.expression.properties.tail.properties.path\n\t\t\t\t)!;\n\t\t\t\tconst context_path = createNodePathForWhereRuleObjectPath(\n\t\t\t\t\ttype.node.properties.object_path,\n\t\t\t\t\treference_tail_context_path\n\t\t\t\t);\n\t\t\t\tswitch ($type.name) {\n\t\t\t\t\tcase \"existence\":\n\t\t\t\t\t\tif (context_path !== undefined) {\n\t\t\t\t\t\t\tfilters[`__rule: ${rule.key_value}`] = createNodeExistanceFilter(context_path.build());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"equality\": {\n\t\t\t\t\t\tlet node_path: NodePathBuilder | undefined = undefined;\n\t\t\t\t\t\tlet id_path: IdPathBuilder | undefined = undefined;\n\t\t\t\t\t\tif (context_path !== undefined) {\n\t\t\t\t\t\t\tnode_path = context_path;\n\t\t\t\t\t\t\tid_path = createIdPathForWhereRuleObjectPath(rule, $type.node.properties.node_path);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode_path = createNodePathForWhereRuleObjectPath(\n\t\t\t\t\t\t\t\t$type.node.properties.node_path,\n\t\t\t\t\t\t\t\treference_tail_context_path\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tid_path = createIdPathForWhereRuleObjectPath(rule, type.node.properties.object_path);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node_path !== undefined && id_path !== undefined) {\n\t\t\t\t\t\t\tfilters[`__rule: ${rule.key_value}`] = createNodeContainmentFilter(node_path.build(), id_path);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"containment\":\n\t\t\t\t\t\t// TODO\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default function (\n\tcontext: IdPathBuilder,\n\tquery: api_cs.Cquery__client_state,\n\tmaximum_amount_of_entries: number,\n\tforce_query_instead_of_candidates_query = false\n): api_cr.Tcollection_query {\n\tconst properties = createPropertiesDictionaryFromColumns(query);\n\n\tconst filters = createFiltersFromColumns(query);\n\n\tquery.properties.use_for.switch({\n\t\tcandidates: ($) => {\n\t\t\tcreateFiltersForRules($.inferences.reference_property().parent, filters);\n\t\t},\n\t\tquery: undefined,\n\t});\n\n\treturn {\n\t\t\"context node path\": context.build(),\n\t\t\"select entries\": [\n\t\t\t\"yes\",\n\t\t\t{\n\t\t\t\t\"limit number of entries\": maximum_amount_of_entries,\n\t\t\t\tproperties: { properties: properties },\n\t\t\t},\n\t\t],\n\t\t\"collection path\": query.properties.use_for\n\t\t\t.switch({\n\t\t\t\tquery: ($) =>\n\t\t\t\t\tcreateCollectionPathBuilderFromCollectionPath.create(\n\t\t\t\t\t\t$.inferences.node_context().properties.path,\n\t\t\t\t\t\tCollectionPathBuilder.create()\n\t\t\t\t\t),\n\t\t\t\tcandidates: (candidates$) =>\n\t\t\t\t\tcandidates$.inferences.reference_property().parent.parent.properties.is_key.switch({\n\t\t\t\t\t\tno: () =>\n\t\t\t\t\t\t\tcreateCollectionPathFromGuiEntityPath(\n\t\t\t\t\t\t\t\tcandidates$.inferences.candidates_context().properties.property.ref.properties.referenced_node\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\tif (force_query_instead_of_candidates_query) {\n\t\t\t\t\t\t\t\treturn createCollectionPathFromGuiEntityPath(\n\t\t\t\t\t\t\t\t\tcandidates$.inferences.candidates_context().properties.property.ref.properties.referenced_node\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn CollectionPathBuilder.create().candidates($.inferences.entry().parent.parent.parent.key.entry);\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t})\n\t\t\t.build(),\n\t\tfilters: {\n\t\t\t\"todo filter\": query.properties.definition.ref.properties.filters.properties.todo_filter.switch<\n\t\t\t\tapi_cr.Tfilters[\"todo filter\"]\n\t\t\t>({\n\t\t\t\tno: [\"no\", {}],\n\t\t\t\tyes: ($) => [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: mapNodePath($.properties.path).build(),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t\t\"value filters\": filters,\n\t\t},\n\t\taggregates: {},\n\t};\n}\n","const escape_escape_regex = /\\\\/g;\nconst escape_escape_replace = \"\\\\\\\\\";\nconst escape_quote_regex = /'/g;\nconst escape_quote_replace = \"\\\\'\";\n\nexport = function escape(str: string): string {\n\treturn /\\?|\\*|:|#|\\.|%|\\+~>|(_type$)|(^item operation$)/g.test(str)\n\t\t? \"'\" +\n\t\t\t\tstr.replace(escape_escape_regex, escape_escape_replace).replace(escape_quote_regex, escape_quote_replace) +\n\t\t\t\t\"'\"\n\t\t: str;\n};\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_cr = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport { isPasswordProperty } from \"../state/password\";\nimport { UpdateMutationBuilder, InitializeMutationBuilder } from \"./MutationBuilder\";\nimport * as Entry from \"../state/Entry\";\nimport { iReference } from \"../state/Reference\";\nimport { isResolved } from \"../Status\";\nimport { setEntryLocationToRemote } from \"../state/setLocation\";\nimport resetModifiedState from \"../state/resetModifiedState\";\nimport { client_state } from \"../state/ClientState\";\nimport { setToSaving } from \"../state/SaveModifiedStatus\";\nimport { iCollection } from \"../state/Collection\";\nimport { updatePermissions } from \"../state 2 interface/permissions\";\n\nexport type MutationObject = {\n\tmutation: api_cr.Tmutation;\n\tonSucces: () => void;\n\tonFailed: (permission_denied: boolean) => void;\n};\n\nfunction createInitializeNode(node: api_cs.Cnode, builder: InitializeMutationBuilder): api_cr.Tnode_initialization {\n\tfor (const [attribute_name, attribute] of node.input.node_type().properties.attributes) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"property\": {\n\t\t\t\tconst property_type = attribute.properties.type.state.node;\n\t\t\t\tconst value_source = property_type.properties.type.state.node.output.value_source();\n\t\t\t\tswitch (value_source.variant.name) {\n\t\t\t\t\tcase \"base\": {\n\t\t\t\t\t\tconst base_type = value_source.variant.definition;\n\t\t\t\t\t\tswitch (base_type.variant.name) {\n\t\t\t\t\t\t\tcase \"external\": {\n\t\t\t\t\t\t\t\tconst $property = node.properties.attributes.get(attribute_name)?.properties.type.cast(\"property\");\n\t\t\t\t\t\t\t\tif ($property === undefined) {\n\t\t\t\t\t\t\t\t\tthrow new Error(`Missing property '${attribute_name}' in client state. In: ${node.path}`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tswitch (property_type.properties.type.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\t\t\t\tbuilder.collection(attribute_name);\n\t\t\t\t\t\t\t\t\t\tconst collection = $property.properties.type.cast(\"collection\");\n\t\t\t\t\t\t\t\t\t\tfor (const entry of collection.properties.entries) {\n\t\t\t\t\t\t\t\t\t\t\tcreateInitializeNode(\n\t\t\t\t\t\t\t\t\t\t\t\tentry[1].properties.node,\n\t\t\t\t\t\t\t\t\t\t\t\tbuilder.collectionEntry(\n\t\t\t\t\t\t\t\t\t\t\t\t\tattribute_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry[1].properties.key.ref.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: ($) => $.properties.text,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: () => \"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tentry[1].properties.node.properties.is_busy_saving.ensure(\"yes\", {});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\t\t\t\t\tconst file = $property.properties.type.cast(\"file\");\n\t\t\t\t\t\t\t\t\t\tswitch (file.properties.is_set.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error(`file ${attribute_name} is not set. In: ${node.path}`);\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst is_set = file.properties.is_set.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (file.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst yes_is_editable = file.properties.is_editable.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (yes_is_editable.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst yes_modified = yes_is_editable.properties.modified.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetToSaving(yes_modified);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbuilder.file(attribute_name, is_set.properties.token, is_set.properties.extension);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\t\t\t\tcreateInitializeNode(\n\t\t\t\t\t\t\t\t\t\t\t$property.properties.type.cast(\"group\").properties.node,\n\t\t\t\t\t\t\t\t\t\t\tbuilder.group(attribute_name)\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\t\t\tconst $number = $property.properties.type.cast(\"number\");\n\t\t\t\t\t\t\t\t\t\tconst value = $number.properties.is_valid.switch({\n\t\t\t\t\t\t\t\t\t\t\tno: function (): number {\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error(`number ${attribute_name} is not valid. In: ${node.path}`);\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tyes: function () {\n\t\t\t\t\t\t\t\t\t\t\t\treturn $number.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tyes: function ($) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn $.properties.number.value;\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tno: function (): number {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error(`number ${attribute_name} is not set. In: ${node.path}`);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tswitch ($number.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst yes_is_editable = $number.properties.is_editable.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (yes_is_editable.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst yes_modified = yes_is_editable.properties.modified.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetToSaving(yes_modified);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbuilder.number(attribute_name, value);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\t\t\tconst state_group_property = $property.properties.type.cast(\"state group\");\n\t\t\t\t\t\t\t\t\t\tswitch (state_group_property.properties.is_modified.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst yes_is_modified = state_group_property.properties.is_modified.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\tsetToSaving(yes_is_modified);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tswitch (state_group_property.properties.is_set.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error(`state group ${attribute_name} is not set. In: ${node.path}`);\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst $ = state_group_property.properties.is_set.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\tcreateInitializeNode(\n\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.state.ref.properties.node,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbuilder.state(attribute_name, $.properties.state.entry)\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\t\t\tconst $text = property_type.properties.type.state.node;\n\t\t\t\t\t\t\t\t\t\tconst text_property = $property.properties.type.cast(\"text\");\n\t\t\t\t\t\t\t\t\t\tlet text_value = text_property.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\t\tno: () => \"\",\n\t\t\t\t\t\t\t\t\t\t\tyes: (is_set) => is_set.properties.text,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tif (isPasswordProperty($text)) {\n\t\t\t\t\t\t\t\t\t\t\t// password properties must be set by the client protocol.\n\t\t\t\t\t\t\t\t\t\t\ttext_value = \"\";\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tswitch (text_property.properties.is_valid.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error(`text ${attribute_name} is not valid. In: ${node.path}`);\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\tbuilder.text(attribute_name, text_value);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tswitch (text_property.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst yes_is_editable = text_property.properties.is_editable.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (yes_is_editable.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst yes_modified = yes_is_editable.properties.modified.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetToSaving(yes_modified);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"internal\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"action\":\n\t\t\t\tbreak;\n\t\t\tcase \"command\":\n\t\t\t\tbreak;\n\t\t\tcase \"reference set\":\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn builder.node;\n}\n\nfunction createUpdateNode(node: api_cs.Cnode, builder: UpdateMutationBuilder): UpdateMutationBuilder {\n\tfor (const [name, attribute] of node.properties.attributes) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"operation\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property_type = attribute.properties.type.state.node.properties.type.state;\n\t\t\t\tswitch (property_type.name) {\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst text = property_type.node;\n\t\t\t\t\t\tswitch (text.properties.is_valid.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tswitch (text.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tconst modified = text.properties.is_editable.state.node.properties.modified.state;\n\t\t\t\t\t\t\t\t\t\tswitch (modified.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst is_set = text.properties.is_set.state;\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (is_set.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// password properties must be set by the client protocol.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (!isPasswordProperty(text.inferences.text_type())) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetToSaving(modified.node);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmodified.node.properties.saving.ensure(\"yes\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbuilder.text(name, is_set.node.properties.text);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst number = property_type.node;\n\t\t\t\t\t\tconst number_type = number.inferences.number_type().properties.type.state;\n\t\t\t\t\t\tswitch (number_type.name) {\n\t\t\t\t\t\t\tcase \"base\": {\n\t\t\t\t\t\t\t\tswitch (number_type.node.properties.type.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"simple\":\n\t\t\t\t\t\t\t\t\t\tswitch (number.properties.is_valid.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (number.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst modified = number.properties.is_editable.state.node.properties.modified.state;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (modified.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetToSaving(modified.node);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbuilder.number(name, modified.node.properties.number.value);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"causal\":\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\tconst file = property_type.node;\n\t\t\t\t\t\tswitch (file.properties.is_valid.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tswitch (file.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tconst modified = file.properties.is_editable.state.node.properties.modified.state;\n\t\t\t\t\t\t\t\t\t\tswitch (modified.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (modified.node.properties.upload_status.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"not uploaded\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"uploading\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"done\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst done = modified.node.properties.upload_status.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetToSaving(modified.node);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbuilder.file(name, done.properties.token, done.parent.properties.extension);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst node = property_type.node.properties.node;\n\t\t\t\t\t\tswitch (node.properties.modified.state.name) {\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tcreateUpdateNode(node, builder.group(name));\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst stategroup = property_type.node;\n\t\t\t\t\t\tconst is_set = stategroup.properties.is_set.state;\n\t\t\t\t\t\tswitch (stategroup.properties.is_modified.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst yes_is_modified = stategroup.properties.is_modified.state.node;\n\t\t\t\t\t\t\t\tsetToSaving(yes_is_modified);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tswitch (is_set.name) {\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst state = is_set.node.properties.state.ref;\n\t\t\t\t\t\t\t\tswitch (state.properties.location.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"remote\":\n\t\t\t\t\t\t\t\t\t\tswitch (state.properties.node.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\tcreateUpdateNode(state.properties.node, builder.update_state(name, state.key_value));\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t\t\t\tswitch (stategroup.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\tcreateInitializeNode(state.properties.node, builder.set_state(name, state.key_value));\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn builder;\n}\n\nexport function forNode(node: api_cs.Cnode, save_all: boolean): MutationObject {\n\tconst mutation = createMutation(findEntriesToInclude(node, save_all));\n\tcreateUpdateNode(\n\t\tnode,\n\t\tcreateMutationContextForNode(node, new UpdateMutationBuilder(mutation.mutation[\"node update\"]))\n\t);\n\treturn mutation;\n}\n\nexport function forCollection(collection: api_cs.Ccollection, save_all: boolean): MutationObject {\n\treturn createMutation(findEntriesToIncludeForCollection(collection, save_all));\n}\n\nexport function forEntry(entry: api_cs.Centries__collection, save_all: boolean): MutationObject {\n\treturn createMutation(findEntriesToIncludeFromEntry(entry, save_all));\n}\n\nexport function createMutation(entries: Set) {\n\tconst root_mutation = UpdateMutationBuilder.create();\n\tconst entry_mutations = new Map();\n\tfor (const entry of entries) {\n\t\tconst collection_name = entry.parent.parent.parent.key.entry;\n\t\tconst mutation = createMutationContextForNode(entry.component_root, root_mutation);\n\t\tswitch (entry.properties.location.state.name) {\n\t\t\tcase \"remote\": {\n\t\t\t\tconst remote_entry = entry.properties.location.state.node;\n\t\t\t\tconst key = Entry.getKeyBackendValue(entry) ?? \"\";\n\t\t\t\tswitch (remote_entry.properties.marked_for_deletion.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tswitch (entry.properties.node.properties.modified.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tentry_mutations.set(entry, \"update\");\n\t\t\t\t\t\t\t\tcreateUpdateNode(entry.properties.node, mutation.updateCollectionEntry(collection_name, key));\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\tentry_mutations.set(entry, \"delete\");\n\t\t\t\t\t\tmutation.deleteCollectionEntry(collection_name, key);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"local\": {\n\t\t\t\tentry_mutations.set(entry, \"add\");\n\t\t\t\tentry.properties.node.properties.is_busy_saving.set(\"yes\", {});\n\t\t\t\tconst key = Entry.getKeyValue(entry) ?? \"\";\n\t\t\t\tcreateInitializeNode(entry.properties.node, mutation.addCollectionEntry(collection_name, key));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tmutation: {\n\t\t\t\"context node\": new IdPathBuilder().build(),\n\t\t\t\"node update\": root_mutation.node,\n\t\t},\n\t\tonSucces: () => {\n\t\t\tclient_state.root.transact(() => {\n\t\t\t\tfor (const [entry, operation] of entry_mutations) {\n\t\t\t\t\tif (entry.destroyed) continue;\n\t\t\t\t\tswitch (operation) {\n\t\t\t\t\t\tcase \"add\":\n\t\t\t\t\t\tcase \"update\":\n\t\t\t\t\t\t\tupdatePermissions(entry.properties.node);\n\t\t\t\t\t\t\tsetEntryLocationToRemote(entry);\n\t\t\t\t\t\t\tresetModifiedState(entry.properties.node, true);\n\t\t\t\t\t\t\tentry.properties.node.properties.is_busy_saving.set(\"no\", {});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"delete\":\n\t\t\t\t\t\t\tiCollection(entry.parent).deleteServerEntry(entry);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tonFailed: (permission_denied: boolean) => {\n\t\t\tfor (const [entry, operation] of entry_mutations) {\n\t\t\t\tif (entry.destroyed) continue;\n\t\t\t\tif (permission_denied) {\n\t\t\t\t\tupdatePermissions(entry.properties.node);\n\t\t\t\t}\n\t\t\t\tentry.properties.node.properties.is_busy_saving.set(\"no\", {});\n\t\t\t\tswitch (operation) {\n\t\t\t\t\tcase \"add\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"update\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"delete\":\n\t\t\t\t\t\tentry.properties.location.cast(\"remote\").properties.marked_for_deletion.ensure(\"no\", {});\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction findEntriesToInclude(node: api_cs.Cnode, save_all: boolean) {\n\treturn _findEntriesToInclude(node, save_all, new Set(), new Set());\n}\nfunction _findEntriesToInclude(\n\tnode: api_cs.Cnode,\n\tsave_all: boolean,\n\tentries: Set,\n\tvisited_entries: Set\n) {\n\tfor (const attribute of node.properties.attributes.values()) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tconst value_source = property.inferences.property_type().properties.type.state.node.output.value_source();\n\t\t\t\tswitch (value_source.variant.name) {\n\t\t\t\t\tcase \"base\": {\n\t\t\t\t\t\tconst base_type = value_source.variant.definition;\n\t\t\t\t\t\tswitch (base_type.variant.name) {\n\t\t\t\t\t\t\tcase \"internal\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"external\":\n\t\t\t\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\t\t\tconst navigable = property.properties.type.state.node.properties.navigable.state;\n\t\t\t\t\t\t\t\t\t\tswitch (navigable.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst referenced_node = iReference(navigable.node).referencedNode.value;\n\t\t\t\t\t\t\t\t\t\t\t\tif (isResolved(referenced_node)) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (referenced_node.properties.location.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"remote\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (referenced_node.properties.is_valid.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t_findEntriesToIncludeFromEntry(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treferenced_node.input.entity().cast(\"entry\"),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsave_all,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tentries,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvisited_entries\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\t\t\t\t_findEntriesToInclude(\n\t\t\t\t\t\t\t\t\t\t\tproperty.properties.type.state.node.properties.node,\n\t\t\t\t\t\t\t\t\t\t\tsave_all,\n\t\t\t\t\t\t\t\t\t\t\tentries,\n\t\t\t\t\t\t\t\t\t\t\tvisited_entries\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\t\t\tconst is_set = property.properties.type.state.node.properties.is_set.state;\n\t\t\t\t\t\t\t\t\t\tswitch (is_set.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst state = is_set.node.properties.state.ref;\n\t\t\t\t\t\t\t\t\t\t\t\t_findEntriesToInclude(state.properties.node, save_all, entries, visited_entries);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\t\t\t\tconst collection = property.properties.type.state.node;\n\t\t\t\t\t\t\t\t\t\tswitch (collection.inferences.collection_type().properties.ui.properties.size.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"large\":\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (node.properties.location.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t_findEntriesToIncludeForCollection(collection, save_all, entries, visited_entries);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"remote\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (save_all) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t_findEntriesToIncludeForCollection(collection, save_all, entries, visited_entries);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"small\":\n\t\t\t\t\t\t\t\t\t\t\t\t_findEntriesToIncludeForCollection(collection, save_all, entries, visited_entries);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"operation\":\n\t\t}\n\t}\n\treturn entries;\n}\n\nfunction findEntriesToIncludeForCollection(collection: api_cs.Ccollection, save_all: boolean) {\n\treturn _findEntriesToIncludeForCollection(collection, save_all, new Set(), new Set());\n}\nfunction _findEntriesToIncludeForCollection(\n\tcollection: api_cs.Ccollection,\n\tsave_all: boolean,\n\tentries: Set,\n\tvisited_entries: Set\n) {\n\tfor (const entry of collection.properties.entries.values()) {\n\t\t_findEntriesToIncludeFromEntry(entry, save_all, entries, visited_entries);\n\t}\n\treturn entries;\n}\n\nfunction findEntriesToIncludeFromEntry(entry: api_cs.Centries__collection, save_all: boolean) {\n\treturn _findEntriesToIncludeFromEntry(entry, save_all, new Set(), new Set());\n}\nfunction _findEntriesToIncludeFromEntry(\n\tentry: api_cs.Centries__collection,\n\tsave_all: boolean,\n\tentries: Set,\n\tvisited_entries: Set\n) {\n\tif (visited_entries.has(entry)) return entries;\n\tvisited_entries.add(entry);\n\tswitch (entry.component_root.properties.location.state.name) {\n\t\tcase \"remote\":\n\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\tcase \"remote\":\n\t\t\t\t\tswitch (entry.properties.location.state.node.properties.marked_for_deletion.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tswitch (entry.properties.node.properties.modified.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tif (save_all) {\n\t\t\t\t\t\t\t\t\t\tentries.add(entry);\n\t\t\t\t\t\t\t\t\t\t_findEntriesToInclude(entry.properties.node, save_all, entries, visited_entries);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\tentries.add(entry);\n\t\t\t\t\t\t\t\t\t_findEntriesToInclude(entry.properties.node, save_all, entries, visited_entries);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\tentries.add(entry);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"local\":\n\t\t\t\t\tentries.add(entry);\n\t\t\t\t\t_findEntriesToInclude(entry.properties.node, save_all, entries, visited_entries);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"local\":\n\t\t\t_findEntriesToInclude(entry.properties.node, save_all, entries, visited_entries);\n\t\t\tbreak;\n\t}\n\treturn entries;\n}\n\nfunction createMutationContextForNode(node: api_cs.Cnode, mutation: UpdateMutationBuilder): UpdateMutationBuilder {\n\tconst position = node.input.position();\n\tswitch (position.variant.name) {\n\t\tcase \"root\":\n\t\t\treturn mutation;\n\t\tcase \"group\": {\n\t\t\tconst group = position.variant.definition;\n\t\t\tconst name = group.parent.parent.key_value;\n\t\t\treturn createMutationContextForNode(group.component_root, mutation).group(name);\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst state = position.variant.definition;\n\t\t\tconst state_name = state.key_value;\n\t\t\tconst attribute_name = state.parent.parent.parent.key_value;\n\t\t\treturn createMutationContextForNode(state.component_root, mutation).update_state(attribute_name, state_name);\n\t\t}\n\t\tcase \"entity\": {\n\t\t\tconst entity = position.variant.definition;\n\t\t\tswitch (entity.variant.name) {\n\t\t\t\tcase \"root\":\n\t\t\t\t\treturn mutation;\n\t\t\t\tcase \"entry\": {\n\t\t\t\t\tconst entry = entity.variant.definition;\n\t\t\t\t\tconst attribute_name = entry.parent.parent.parent.key_value;\n\t\t\t\t\tconst key = Entry.getKeyBackendValue(entry) ?? \"\";\n\t\t\t\t\treturn createMutationContextForNode(entry.component_root, mutation).updateCollectionEntry(\n\t\t\t\t\t\tattribute_name,\n\t\t\t\t\t\tkey\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_cr = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport api_collation_table = api_configuration.libraries.gui_definition_lib.types.collation_table.alan_api;\nimport NodePathBuilder from \"../navigation/NodePathBuilder\";\nimport { hasStyle } from \"./style\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\n\nfunction createCharacterAlternatives(primary_character: api_collation_table.Cprimary) {\n\treturn global.collation_table_inverse[primary_character.parent.key];\n}\n\nexport function mapNodePath($: api_views.Cnode_path): NodePathBuilder {\n\treturn buildNodePath($, new NodePathBuilder());\n}\n\nfunction buildNodePath(path: api_views.Cnode_path, builder: NodePathBuilder): NodePathBuilder {\n\tconst $has_steps = path.properties.has_steps.state;\n\tswitch ($has_steps.name) {\n\t\tcase \"no\":\n\t\t\treturn builder;\n\t\tcase \"yes\": {\n\t\t\tconst $type = $has_steps.node.properties.type.state;\n\t\t\tswitch ($type.name) {\n\t\t\t\tcase \"parent\":\n\t\t\t\t\treturn buildNodePath($has_steps.node.properties.tail, builder.parent());\n\t\t\t\tcase \"state rule\":\n\t\t\t\t\treturn buildNodePath($has_steps.node.properties.tail, builder.state_rule($type.node.properties.rule.entry));\n\t\t\t\tcase \"reference rule\":\n\t\t\t\t\treturn buildNodePath(\n\t\t\t\t\t\t$has_steps.node.properties.tail,\n\t\t\t\t\t\tbuilder.reference_rule($type.node.properties.property.entry, $type.node.properties.rule.entry)\n\t\t\t\t\t);\n\t\t\t\tcase \"reference\":\n\t\t\t\t\treturn buildNodePath($has_steps.node.properties.tail, builder.reference($type.node.properties.text.entry));\n\t\t\t\tcase \"group\":\n\t\t\t\t\treturn buildNodePath($has_steps.node.properties.tail, builder.group($type.node.properties.group.entry));\n\t\t\t\tcase \"state\":\n\t\t\t\t\treturn buildNodePath(\n\t\t\t\t\t\t$has_steps.node.properties.tail,\n\t\t\t\t\t\tbuilder.state($type.node.properties.state_group.entry, $type.node.properties.state.entry)\n\t\t\t\t\t);\n\t\t\t\tcase \"collection entry\":\n\t\t\t\t\treturn buildNodePath(\n\t\t\t\t\t\t$has_steps.node.properties.tail,\n\t\t\t\t\t\tbuilder.collection_entry($type.node.properties.collection.entry, $type.node.properties.entry_key)\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($type);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState($has_steps);\n\t}\n}\n\ntype PropertiesCollection = api_cr.Tnode_query[\"properties\"];\ntype Filters = NonNullable;\n\nfunction buildTextExpressionFromString(\n\tcriterium: string,\n\thead: api_cr.Tfilter_expression | undefined = undefined,\n\ttail: api_cr.Tfilter_expression[\"has more steps\"] = [\"no\", {}]\n): [api_cr.Tfilter_expression | undefined, api_cr.Tfilter_expression[\"has more steps\"]] {\n\tconst string_left: string = criterium;\n\tconst length = string_left.length;\n\tif (length === 0) {\n\t\treturn [head, tail];\n\t}\n\tfor (let i = string_left.length - 1; i >= 0; i--) {\n\t\tconst character = string_left[i];\n\t\tif (character === \"*\") {\n\t\t\thead = {\n\t\t\t\ttype: [\"wildcard\", {}],\n\t\t\t\t\"has more steps\": tail,\n\t\t\t};\n\t\t\ttail = [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttail: head,\n\t\t\t\t},\n\t\t\t];\n\t\t} else {\n\t\t\tconst entry: api_collation_table.Ccharacters = global.collation_table.properties.characters.get(character);\n\t\t\t// eslint-disable-next-line @typescript-eslint/ban-types\n\t\t\tlet alternatives: Record = {};\n\t\t\tif (entry !== undefined) {\n\t\t\t\tswitch (entry.properties.type.state.name) {\n\t\t\t\t\tcase \"alternative\": {\n\t\t\t\t\t\tconst $ = entry.properties.type.state.node;\n\t\t\t\t\t\talternatives = createCharacterAlternatives($.properties.for_.inferences.for_());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"primary\": {\n\t\t\t\t\t\tconst $ = entry.properties.type.state.node;\n\t\t\t\t\t\talternatives = createCharacterAlternatives($);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(entry.properties.type.state);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\talternatives = {\n\t\t\t\t\t[character]: {},\n\t\t\t\t};\n\t\t\t}\n\t\t\thead = {\n\t\t\t\ttype: [\n\t\t\t\t\t\"alternatives\",\n\t\t\t\t\t{\n\t\t\t\t\t\talternatives: alternatives,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t\"has more steps\": tail,\n\t\t\t};\n\t\t\ttail = [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttail: head,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t}\n\treturn [head, tail];\n}\n\nexport function buildTextExpression(operation: api_cs.Cyes__has_filter__text): api_cr.Tfilter_expression {\n\t//create a tail based on the operation\n\tconst string_left: string = operation.properties.value;\n\tlet head: api_cr.Tfilter_expression | undefined;\n\tlet tail: api_cr.Tfilter_expression[\"has more steps\"] = [\"no\", {}];\n\tswitch (operation.properties.operation.state.name) {\n\t\tcase \"contains\": {\n\t\t\ttail = [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttail: {\n\t\t\t\t\t\ttype: \"wildcard\",\n\t\t\t\t\t\t\"has more steps\": \"no\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t];\n\t\t\tbreak;\n\t\t}\n\t\tcase \"ends with\": {\n\t\t\tbreak;\n\t\t}\n\t\tcase \"equals\": {\n\t\t\tbreak;\n\t\t}\n\t\tcase \"starts with\": {\n\t\t\ttail = [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttail: {\n\t\t\t\t\t\ttype: \"wildcard\",\n\t\t\t\t\t\t\"has more steps\": \"no\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t];\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(operation.properties.operation.state);\n\t}\n\t[head, tail] = buildTextExpressionFromString(string_left, head, tail);\n\tif (head === undefined) {\n\t\thead = {\n\t\t\ttype: [\n\t\t\t\t\"alternatives\",\n\t\t\t\t{\n\t\t\t\t\talternatives: {\n\t\t\t\t\t\t\"\": {},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\t\"has more steps\": tail,\n\t\t};\n\t}\n\tswitch (operation.properties.operation.state.name) {\n\t\tcase \"contains\": {\n\t\t\thead = {\n\t\t\t\ttype: \"wildcard\",\n\t\t\t\t\"has more steps\": tail,\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase \"ends with\": {\n\t\t\thead = {\n\t\t\t\ttype: \"wildcard\",\n\t\t\t\t\"has more steps\": tail,\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase \"equals\": {\n\t\t\tbreak;\n\t\t}\n\t\tcase \"starts with\": {\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(operation.properties.operation.state);\n\t}\n\treturn head!;\n}\n\nexport function createPropertiesDictionaryFromColumns(client_query: api_cs.Cquery__client_state): PropertiesCollection {\n\tconst new_properties = client_query.properties.columns.toArray().reduce((res, val) => {\n\t\tconst key = val[0];\n\t\tconst $ = val[1];\n\t\tconst property_path = $.key.ref.properties.path;\n\t\t$.properties.type.switch({\n\t\t\tnumber: ($) => {\n\t\t\t\tconst node_path = mapNodePath(property_path).build();\n\t\t\t\tif (\n\t\t\t\t\t$.inferences.number_type().properties.number.ref.inferences.number().properties.ui.properties\n\t\t\t\t\t\t.dynamic_numerical_type.state.name === \"yes\"\n\t\t\t\t) {\n\t\t\t\t\tres[key + \"idpath\"] = {\n\t\t\t\t\t\tpath: node_path,\n\t\t\t\t\t\ttype: [\"id path\", {}],\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tres[key] = {\n\t\t\t\t\tpath: node_path,\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\"number property\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"signed number property\": {\n\t\t\t\t\t\t\t\t\t\t\tpath: new NodePathBuilder().build(),\n\t\t\t\t\t\t\t\t\t\t\tsign: [\"positive\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\"property name\": $.inferences.number_type().properties.number.entry,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t},\n\t\t\ttext: ($) => {\n\t\t\t\tres[key] = {\n\t\t\t\t\tpath: mapNodePath(property_path).build(),\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\"singular\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\"dynamic\",\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tpath: new NodePathBuilder().build(),\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext: $.inferences.text_type().properties.text.entry,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t},\n\t\t\tfile: ($) => {\n\t\t\t\tres[key] = {\n\t\t\t\t\tpath: mapNodePath(property_path).build(),\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"file\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfile: $.inferences.file_type().properties.file.entry,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t},\n\t\t\t\"state group\": ($) => {\n\t\t\t\tconst node_path = mapNodePath(property_path).build();\n\t\t\t\tif (hasStyle($.inferences.state_group_type().properties.state_group.ref.inferences.state_group())) {\n\t\t\t\t\tres[key + \"idpath\"] = {\n\t\t\t\t\t\tpath: node_path,\n\t\t\t\t\t\ttype: [\"id path\", {}],\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tres[key] = {\n\t\t\t\t\tpath: node_path,\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"state group\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"state group\": $.inferences.state_group_type().properties.state_group.entry,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t},\n\t\t\twidget: undefined,\n\t\t});\n\t\treturn res;\n\t}, {});\n\n\treturn new_properties;\n}\n\nexport function createNodeExistanceFilter(path: api_cr.Tnode_path): api_cr.Tvalue_filters {\n\treturn {\n\t\tpath: path,\n\t\ttype: [\n\t\t\t\"node\",\n\t\t\t{\n\t\t\t\ttype: [\n\t\t\t\t\t\"existence\",\n\t\t\t\t\t{\n\t\t\t\t\t\toperator: [\"exists\", {}],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n}\n\nexport function createNodeContainmentFilter(\n\tnode_path: api_cr.Tnode_path,\n\tid_path: IdPathBuilder\n): api_cr.Tvalue_filters {\n\treturn {\n\t\tpath: node_path,\n\t\ttype: [\n\t\t\t\"node\",\n\t\t\t{\n\t\t\t\ttype: [\n\t\t\t\t\t\"containment\",\n\t\t\t\t\t{\n\t\t\t\t\t\toperator: [\"in\", {}],\n\t\t\t\t\t\treferences: {\n\t\t\t\t\t\t\t\"referenced node\": id_path.build(),\n\t\t\t\t\t\t\t\"has alternative\": [\"no\", {}],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction createViewContextForQuery(query: api_cs.Cquery__client_state): IdPathBuilder {\n\tconst position = query.input.position();\n\tswitch (position.variant.name) {\n\t\tcase \"node\": {\n\t\t\tconst $ = position.variant.definition;\n\t\t\treturn createIdPathBuilderFromNode($.input.entity().output.node());\n\t\t}\n\t\tcase \"navigable text property\":\n\t\t\treturn IdPathBuilder.create(); //FIXME is it possible to create an id path?\n\t\tdefault:\n\t\t\tunexpectedState(position.variant);\n\t}\n}\n\nexport function createFiltersFromColumns(client_query: api_cs.Cquery__client_state): Filters {\n\tconst view_context = createViewContextForQuery(client_query);\n\tlet filters: api_cr.Tvalue_filters[] = [];\n\tclient_query.properties.columns.forEach(function ($) {\n\t\tconst node_path = mapNodePath($.key.ref.properties.path);\n\t\t$.properties.type.switch({\n\t\t\tnumber: function (n) {\n\t\t\t\tn.properties.has_filter.switch({\n\t\t\t\t\tno: undefined,\n\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\t$.properties.criteria_is_valid.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: (valid_criteria) =>\n\t\t\t\t\t\t\t\t$.properties.operator_selected.switch({\n\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\tyes: (operatord_selected) => {\n\t\t\t\t\t\t\t\t\t\tfilters = filters.concat(createNodeExistanceFilter(node_path.build()));\n\t\t\t\t\t\t\t\t\t\tfilters.push({\n\t\t\t\t\t\t\t\t\t\t\tpath: node_path.build(),\n\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\"property\",\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tproperty: n.inferences.number_type().properties.number.entry,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toperator: operatord_selected.properties.operator.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"equal to\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"equals\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcriterium: valid_criteria.properties.criteria.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t] as api_cr.Tnumber_filter_expression[\"operator\"],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"range\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than\": [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcriterium: valid_criteria.properties.criteria.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"less than\": rangeCriteriaLessThan($),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t] as api_cr.Tnumber_filter_expression[\"operator\"],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than or equal to\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"range\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than\": [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcriterium: valid_criteria.properties.criteria.value - 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"less than\": rangeCriteriaLessThan($),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t] as api_cr.Tnumber_filter_expression[\"operator\"],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"smaller than\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"range\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than\": rangeCriteriaGreaterThan($),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"less than\": [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcriterium: valid_criteria.properties.criteria.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t] as api_cr.Tnumber_filter_expression[\"operator\"],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"smaller than or equal to\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"range\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than\": rangeCriteriaGreaterThan($),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"less than\": [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcriterium: valid_criteria.properties.criteria.value + 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t] as api_cr.Tnumber_filter_expression[\"operator\"],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t},\n\t\t\ttext: function (t) {\n\t\t\t\tt.properties.has_filter.switch({\n\t\t\t\t\tno: undefined,\n\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t$.properties.filter_set.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\tfilters = filters.concat(createNodeExistanceFilter(node_path.build()));\n\t\t\t\t\t\t\t\tfilters.push({\n\t\t\t\t\t\t\t\t\tpath: node_path.build(),\n\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\"property\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tproperty: t.inferences.text_type().properties.text.entry,\n\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\texpression: buildTextExpression($.parent),\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tswitch (t.properties.filter_on_current_id_path.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tfilters.push({\n\t\t\t\t\t\t\tpath: node_path.reference(t.inferences.text_type().properties.text.entry).build(),\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"node\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\"containment\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\toperator: \"in\",\n\t\t\t\t\t\t\t\t\t\t\treferences: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"referenced node\": view_context.build(),\n\t\t\t\t\t\t\t\t\t\t\t\t\"has alternative\": \"no\",\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(t.properties.filter_on_current_id_path.state);\n\t\t\t\t}\n\t\t\t},\n\t\t\tfile: undefined, //no file filters\n\t\t\t\"state group\": function (sg) {\n\t\t\t\tsg.properties.has_filter.switch({\n\t\t\t\t\tno: undefined,\n\t\t\t\t\tyes: function ($) {\n\t\t\t\t\t\t$.properties.filter_enabled.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: function () {\n\t\t\t\t\t\t\t\tconst states_to_include: { [key: string]: api_cr.Tstates_to_include } = {};\n\t\t\t\t\t\t\t\t$.properties.states.forEach(function ($) {\n\t\t\t\t\t\t\t\t\t$.properties.is_selected.switch({\n\t\t\t\t\t\t\t\t\t\tyes: function () {\n\t\t\t\t\t\t\t\t\t\t\tstates_to_include[$.key] = {};\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tfilters = filters.concat(createNodeExistanceFilter(node_path.build()));\n\n\t\t\t\t\t\t\t\tconst any_state_selected = Object.keys(states_to_include).length > 0;\n\t\t\t\t\t\t\t\tif (any_state_selected) {\n\t\t\t\t\t\t\t\t\tfilters.push({\n\t\t\t\t\t\t\t\t\t\tpath: node_path.build(),\n\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\"property\",\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tproperty: sg.inferences.state_group_type().properties.state_group.ref.parent.parent.key.ref.key,\n\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"state group\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"states to include\": states_to_include,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t\twidget: undefined,\n\t\t});\n\t});\n\n\tfor (const [, filter] of client_query.properties.filters) {\n\t\tswitch (filter.properties.active.state.name) {\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tcase \"yes\": {\n\t\t\t\tconst filter_definition = filter.key.ref;\n\t\t\t\tconst node_path = mapNodePath(filter_definition.properties.path);\n\t\t\t\tfilters.push({\n\t\t\t\t\tpath: node_path.build(),\n\t\t\t\t\ttype: filter_definition.properties.type.switch({\n\t\t\t\t\t\tnode: ($) => [\n\t\t\t\t\t\t\t\"node\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: $.properties.type.switch({\n\t\t\t\t\t\t\t\t\texistence: ($) => {\n\t\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\t\"existence\",\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\toperator: $.properties.operator.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\texists: \"exists\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"not exists\": \"not exists\",\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"view context\": (): api_cr.Tnode[\"type\"] => [\n\t\t\t\t\t\t\t\t\t\t\"containment\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\toperator: \"in\",\n\t\t\t\t\t\t\t\t\t\t\treferences: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"referenced node\": view_context.build() as api_cr.Tid_path__client_request,\n\t\t\t\t\t\t\t\t\t\t\t\t\"has alternative\": \"no\",\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tproperty: ($) => [\n\t\t\t\t\t\t\t\"property\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tproperty: $.properties.property.entry,\n\t\t\t\t\t\t\t\ttype: $.properties.type.switch({\n\t\t\t\t\t\t\t\t\tcollection: ($) => [\n\t\t\t\t\t\t\t\t\t\t\"collection\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\toperator: $.properties.operator.switch({\n\t\t\t\t\t\t\t\t\t\t\t\tin: \"in\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"not in\": \"not in\",\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\tkeys: $.properties.keys.map(() => ({})),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\tnumber: ($) => {\n\t\t\t\t\t\t\t\t\t\tconst number_expression = $.properties.expression;\n\t\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\t\t\toperator: number_expression.properties.operator.switch<\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tapi_cr.Tnumber_filter_expression[\"operator\"]\n\t\t\t\t\t\t\t\t\t\t\t\t\t>({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tequals: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"equals\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcriterium: $.properties.criterium.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trange: ($) => [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"range\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than\": $.properties.greater_than.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: \"no\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: ($) => [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcriterium: $.properties.criterium.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"less than\": $.properties.less_than.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: \"no\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: ($) => [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcriterium: $.properties.criterium.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"state group\": ($) => [\n\t\t\t\t\t\t\t\t\t\t\"state group\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\"states to include\": $.properties.states_to_include.map(() => ({})),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\ttext: ($) => {\n\t\t\t\t\t\t\t\t\t\tconst [head] = buildTextExpressionFromString($.properties.text);\n\t\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\texpression: head!,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(filter.properties.active.state);\n\t\t}\n\t}\n\n\treturn filters.reduce((p, c, i) => ((p[\"\" + i] = c), p), {});\n}\n\nfunction rangeCriteriaLessThan(number: api_cs.Cyes__has_filter__number): api_cr.Trange[\"less than\"] {\n\tswitch (number.properties.filter_range.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst range_filter = number.properties.filter_range.state.node;\n\t\t\tswitch (range_filter.properties.criteria_is_valid.state.name) {\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tswitch (range_filter.properties.operator.state.name) {\n\t\t\t\t\t\tcase \"smaller than\": {\n\t\t\t\t\t\t\tconst smaller_than = range_filter.properties.operator.state.node;\n\t\t\t\t\t\t\tconst criterium = range_filter.properties.criteria_is_valid.state.node.properties.criteria.value;\n\t\t\t\t\t\t\tswitch (smaller_than.properties.or_equal_to.state.name) {\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcriterium: criterium + 1,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcriterium: criterium,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"greater than\": {\n\t\t\t\t\t\t\treturn \"no\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"no\": {\n\t\t\t\t\treturn \"no\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\": {\n\t\t\treturn \"no\";\n\t\t}\n\t\tcase \"not available\": {\n\t\t\treturn \"no\";\n\t\t}\n\t}\n}\n\nfunction rangeCriteriaGreaterThan(number: api_cs.Cyes__has_filter__number): api_cr.Trange[\"greater than\"] {\n\tswitch (number.properties.filter_range.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst range_filter = number.properties.filter_range.state.node;\n\t\t\tswitch (range_filter.properties.criteria_is_valid.state.name) {\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tswitch (range_filter.properties.operator.state.name) {\n\t\t\t\t\t\tcase \"greater than\": {\n\t\t\t\t\t\t\tconst greater_than = range_filter.properties.operator.state.node;\n\t\t\t\t\t\t\tconst criterium = range_filter.properties.criteria_is_valid.state.node.properties.criteria.value;\n\t\t\t\t\t\t\tswitch (greater_than.properties.or_equal_to.state.name) {\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcriterium: criterium - 1,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcriterium: criterium,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"smaller than\": {\n\t\t\t\t\t\t\treturn \"no\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"no\": {\n\t\t\t\t\treturn \"no\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\": {\n\t\t\treturn \"no\";\n\t\t}\n\t\tcase \"not available\": {\n\t\t\treturn \"no\";\n\t\t}\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_report = api_configuration.report_protocol_types;\nimport api_gui_model = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_client_request = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request;\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport client_request_decorator = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport client_query_to_excel_transformation = api_configuration.report_protocol_types.collection_query_to_table;\nimport api_download_request = api_report.report_protocol_download_request;\nimport createCollectionQueryFromQuery from \"./createCollectionQueryFromQuery\";\nimport { CollectionPathBuilder } from \"../navigation/createCollectionPathBuilder\";\nimport escape = require(\"./createEscapedCsvHeader\");\nimport { settings, client_state } from \"../state/ClientState\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport NodePathBuilder from \"../navigation/NodePathBuilder\";\nimport { mapNodePath, createFiltersFromColumns } from \"./createPropertiesDictionaryFromColumns\";\nimport * as createCollectionPathBuilderFromCollectionPath from \"./createCollectionPathBuilderFromCollectionPath\";\nimport { identity, select } from \"../validation\";\nimport { isKeyProperty } from \"../state/isKey\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport { CsvColumnPathBuilder } from \"../navigation/CsvColumnPathBuilder\";\nimport { orderedAttributes } from \"../graphIterators\";\nimport { getStaticDecimalsFromNumericalType } from \"./serializeNumber\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\n\nfunction textExpression(static_text: string): api_client_request.alan_api.Tproperties__node_query {\n\treturn {\n\t\tpath: {\n\t\t\t\"has steps\": [\"no\", {}],\n\t\t},\n\t\ttype: [\n\t\t\t\"text\",\n\t\t\t{\n\t\t\t\texpression: { type: [\"singular\", { expression: { type: [\"static\", { string: static_text }] } }] },\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction createSimpleColumnNameFromNodePath(\n\tnode_path: api_views.Cnode_path,\n\tonText?: () => string,\n\tonReference?: (reference: api_gui_model.Cyes__navigable) => string\n): string {\n\treturn node_path.properties.has_steps.switch({\n\t\tno: function () {\n\t\t\treturn onText ? onText() : \"\";\n\t\t},\n\t\tyes: function (yes) {\n\t\t\tconst tail = createSimpleColumnNameFromNodePath(yes.properties.tail, onText, onReference);\n\t\t\treturn yes.properties.type.switch({\n\t\t\t\tparent: tail,\n\t\t\t\t\"state rule\": tail,\n\t\t\t\t\"reference rule\": function (reference) {\n\t\t\t\t\tif (onReference) {\n\t\t\t\t\t\treturn onReference(reference.properties.property.inferences.navigable()) + \".\" + tail;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn tail;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\treference: function (reference) {\n\t\t\t\t\tif (onReference) {\n\t\t\t\t\t\treturn onReference(reference.properties.text.inferences.navigable()) + \".\" + tail;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn tail;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tgroup: tail,\n\t\t\t\tstate: tail,\n\t\t\t\t\"collection entry\": tail,\n\t\t\t});\n\t\t},\n\t});\n}\n\nfunction clientQueryToExcelTransformation(\n\tquery_definition: api_views.Cqueries\n): client_query_to_excel_transformation.alan_api.Tcollection_query_to_table {\n\tconst columns_block_builders: Array<\n\t\t(\n\t\t\ttail: client_query_to_excel_transformation.alan_api.Tcollection_block\n\t\t) => client_query_to_excel_transformation.alan_api.Tcollection_block\n\t> = [];\n\n\tquery_definition.properties.columns.forEach(function (column) {\n\t\tcolumn.properties.type.switch({\n\t\t\ttext: function (text) {\n\t\t\t\ttext.parent.properties.column_type.switch({\n\t\t\t\t\tid: undefined,\n\t\t\t\t\tcontent: function () {\n\t\t\t\t\t\tcolumns_block_builders.push(function (tail) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\"has columns\": [\n\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\theader: createSimpleColumnNameFromNodePath(\n\t\t\t\t\t\t\t\t\t\t\ttext.parent.properties.path,\n\t\t\t\t\t\t\t\t\t\t\t() => escape(text.properties.text.entry),\n\t\t\t\t\t\t\t\t\t\t\t(reference) => escape(reference.parent.parent.parent.key.entry)\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\tproperty: {\n\t\t\t\t\t\t\t\t\t\t\tproperty: text.parent.key,\n\t\t\t\t\t\t\t\t\t\t\ttype: [\"text\", {}],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tnext: tail,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t\tnumber: function (number) {\n\t\t\t\tcolumns_block_builders.push(function (tail) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t\"has columns\": [\n\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\theader: escape(number.properties.number.ref.inferences.number().parent.parent.key),\n\t\t\t\t\t\t\t\tproperty: {\n\t\t\t\t\t\t\t\t\tproperty: number.parent.key,\n\t\t\t\t\t\t\t\t\ttype: number.properties.number.ref.properties.numerical_type.ref.properties.representation_type.switch<\n\t\t\t\t\t\t\t\t\t\tclient_query_to_excel_transformation.alan_api.Tproperty_selection[\"type\"]\n\t\t\t\t\t\t\t\t\t>({\n\t\t\t\t\t\t\t\t\t\tmodel: [\n\t\t\t\t\t\t\t\t\t\t\t\"decimal\",\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tshift: -getStaticDecimalsFromNumericalType(\n\t\t\t\t\t\t\t\t\t\t\t\t\t//notice the minus sign, because it is a negative shift\n\t\t\t\t\t\t\t\t\t\t\t\t\tnumber.properties.number.ref.inferences.number().properties.numerical_type.ref\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\tdate: [\"date\", {}],\n\t\t\t\t\t\t\t\t\t\t\"date and time\": [\"datetime\", {}],\n\t\t\t\t\t\t\t\t\t\t\"HTML date and time\": [\"datetime\", {}],\n\t\t\t\t\t\t\t\t\t\tduration: [\"number\", {}],\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tnext: tail,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t},\n\t\t\tfile: undefined, // files are not supported\n\t\t\t\"state group\": function (state_group) {\n\t\t\t\tcolumns_block_builders.push(function (tail): client_query_to_excel_transformation.alan_api.Tcollection_block {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t\"has columns\": [\n\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\theader: escape(state_group.properties.state_group.entry),\n\t\t\t\t\t\t\t\tproperty: {\n\t\t\t\t\t\t\t\t\tproperty: state_group.parent.key,\n\t\t\t\t\t\t\t\t\ttype: [\"state\", {}],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tnext: tail,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t},\n\t\t\twidget: undefined,\n\t\t});\n\t});\n\treturn {\n\t\ttype: [\n\t\t\t\"collection query\",\n\t\t\t{\n\t\t\t\tcolumns: columns_block_builders\n\t\t\t\t\t.reverse()\n\t\t\t\t\t.reduce(\n\t\t\t\t\t\t(previous_step, current_builder) => current_builder(previous_step),\n\t\t\t\t\t\t{ \"has columns\": [\"no\", {}] }\n\t\t\t\t\t),\n\t\t\t},\n\t\t],\n\t};\n}\n\ntype ImportTemplateColumn = {\n\tcolumn_name: string;\n\tquery_property: client_request_decorator.Tproperties__node_query;\n\ttransformation: (\n\t\ttail: client_query_to_excel_transformation.alan_api.Tcollection_block\n\t) => client_query_to_excel_transformation.alan_api.Tcollection_block;\n};\n\nfunction createImportTemplateQueryColumns(\n\tnode: api_gui_model.Cgui_node,\n\tpath_builder: NodePathBuilder,\n\tcolumn_path_builder: CsvColumnPathBuilder,\n\tstate_group_operation: \"update\" | \"set|update\",\n\tcollection_key_name: string\n): ImportTemplateColumn[] {\n\treturn orderedAttributes(node.input.application_node())\n\t\t.map((application_attribute) => {\n\t\t\tconst attribute = node.properties.attributes.get(application_attribute.key)!;\n\t\t\treturn attribute.properties.type.switch({\n\t\t\t\tcommand: [],\n\t\t\t\taction: [],\n\t\t\t\tproperty: ($) =>\n\t\t\t\t\t$.properties.type.switch({\n\t\t\t\t\t\tcollection: () => [],\n\t\t\t\t\t\tfile: () => [],\n\t\t\t\t\t\tgroup: ($) =>\n\t\t\t\t\t\t\tcreateImportTemplateQueryColumns(\n\t\t\t\t\t\t\t\t$.properties.gui_node,\n\t\t\t\t\t\t\t\tpath_builder.group(attribute.key.entry),\n\t\t\t\t\t\t\t\tcolumn_path_builder.group(attribute.key.entry),\n\t\t\t\t\t\t\t\tstate_group_operation,\n\t\t\t\t\t\t\t\tcollection_key_name\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\tnumber: ($) =>\n\t\t\t\t\t\t\t$.inferences.number().properties.type.switch({\n\t\t\t\t\t\t\t\tderived: [],\n\t\t\t\t\t\t\t\tbase: (elementary_number) =>\n\t\t\t\t\t\t\t\t\telementary_number.properties.type.switch({\n\t\t\t\t\t\t\t\t\t\tcausal: [],\n\t\t\t\t\t\t\t\t\t\tsimple: () => {\n\t\t\t\t\t\t\t\t\t\t\tconst number_header = column_path_builder.number(attribute.key.entry).build();\n\t\t\t\t\t\t\t\t\t\t\tconst number_properties: ImportTemplateColumn[] = [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn_name: number_header,\n\t\t\t\t\t\t\t\t\t\t\t\t\tquery_property: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpath: path_builder.build(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"number property\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"signed number property\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpath: new NodePathBuilder().build(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsign: [\"positive\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"property name\": attribute.key.entry,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransformation: (tail) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/* The number conversion is done using client transformations. So the\n\t\t\t\t\t\t\t\t\t\t\t \"type\" is always \"number\". */\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"has columns\": [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\theader: number_header,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperty: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperty: number_header,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\"number\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnext: tail,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t\t\treturn number_properties;\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\"state group\": ($) =>\n\t\t\t\t\t\t\t$.inferences.state_group().properties.type.switch({\n\t\t\t\t\t\t\t\tderived: [],\n\t\t\t\t\t\t\t\tbase: () => {\n\t\t\t\t\t\t\t\t\tconst state_group_operation_header = column_path_builder\n\t\t\t\t\t\t\t\t\t\t.state_group_operation(attribute.key.entry)\n\t\t\t\t\t\t\t\t\t\t.build();\n\t\t\t\t\t\t\t\t\tconst state_group_header = column_path_builder.state_group(attribute.key.entry).build();\n\t\t\t\t\t\t\t\t\tconst state_group_properties: ImportTemplateColumn[] = [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcolumn_name: state_group_header,\n\t\t\t\t\t\t\t\t\t\t\tquery_property: {\n\t\t\t\t\t\t\t\t\t\t\t\tpath: path_builder.build(),\n\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"state group\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"state group\": attribute.key.entry,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\ttransformation: (tail) => ({\n\t\t\t\t\t\t\t\t\t\t\t\t\"has columns\": [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\theader: state_group_header,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperty: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperty: state_group_header,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\"state\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnext: tail,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcolumn_name: state_group_operation_header,\n\t\t\t\t\t\t\t\t\t\t\tquery_property: textExpression(state_group_operation),\n\t\t\t\t\t\t\t\t\t\t\ttransformation: (tail) => ({\n\t\t\t\t\t\t\t\t\t\t\t\t\"has columns\": [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\theader: state_group_operation_header,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperty: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperty: state_group_operation_header,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\"text\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnext: tail,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\tfunction orderState(\n\t\t\t\t\t\t\t\t\t\tstate: api_gui_model.Cstates__state_group__type__property__type__attributes\n\t\t\t\t\t\t\t\t\t): api_gui_model.Cstates__state_group__type__property__type__attributes[] {\n\t\t\t\t\t\t\t\t\t\tswitch (state.properties.has_successor.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\t\treturn [state];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst $ = state.properties.has_successor.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\treturn [state].concat(orderState($.properties.successor.ref));\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(state.properties.has_successor.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tswitch ($.properties.has_states.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\treturn state_group_properties;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\tconst yes = $.properties.has_states.state.node;\n\n\t\t\t\t\t\t\t\t\t\t\treturn state_group_properties.concat(\n\t\t\t\t\t\t\t\t\t\t\t\torderState(yes.properties.first.ref)\n\t\t\t\t\t\t\t\t\t\t\t\t\t.map((state) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreateImportTemplateQueryColumns(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstate.properties.gui_node,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpath_builder.state(attribute.key.entry, state.key.entry),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn_path_builder.state(attribute.key.entry, state.key.entry),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"set|update\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcollection_key_name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t.reduce((p, c) => p.concat(c), [])\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState($.properties.has_states.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\ttext: ($) =>\n\t\t\t\t\t\t\t$.inferences.text().properties.type.switch({\n\t\t\t\t\t\t\t\tderived: [],\n\t\t\t\t\t\t\t\tbase: () => {\n\t\t\t\t\t\t\t\t\tfunction createTextColum() {\n\t\t\t\t\t\t\t\t\t\tconst text_header = select(isKeyProperty($.inferences.text()), collection_key_name, () =>\n\t\t\t\t\t\t\t\t\t\t\tcolumn_path_builder.text(attribute.key.entry).build()\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\treturn identity([\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tcolumn_name: text_header,\n\t\t\t\t\t\t\t\t\t\t\t\ttransformation: (tail) => ({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"has columns\": [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\theader: text_header,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperty: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperty: text_header,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\"text\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnext: tail,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\tquery_property: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tpath: path_builder.build(),\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"singular\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"dynamic\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpath: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"has steps\": [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttext: attribute.key.entry,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn $.properties.navigable.switch({\n\t\t\t\t\t\t\t\t\t\tno: ($) =>\n\t\t\t\t\t\t\t\t\t\t\t$.properties.password_property.switch({\n\t\t\t\t\t\t\t\t\t\t\t\tno: () => createTextColum(),\n\t\t\t\t\t\t\t\t\t\t\t\tyes: [],\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tyes: () => createTextColum(),\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t}),\n\t\t\t\t\"reference set\": [],\n\t\t\t});\n\t\t})\n\t\t.reduce((p, c) => p.concat(c), []);\n}\n\nfunction createHeaderFields(collection_path: api_views.Cquery_path): string[] {\n\treturn collection_path.properties.has_steps.switch({\n\t\tno: [],\n\t\tyes: ($) => [$.properties.collection.entry].concat(createHeaderFields($.properties.tail)),\n\t});\n}\n\nexport function forImportTemplate(query: api_client_state.Cquery__use_for__query): {\n\tquery: client_request_decorator.Tcollection_query;\n\ttransformation: client_query_to_excel_transformation.alan_api.Ccollection_query_to_table;\n} {\n\tconst item_operation: ImportTemplateColumn[] = [\n\t\t{\n\t\t\tcolumn_name: \"item_operation\",\n\t\t\tquery_property: textExpression(\"update\"),\n\t\t\ttransformation: (tail) => ({\n\t\t\t\t\"has columns\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\theader: \"item_operation\",\n\t\t\t\t\t\tproperty: {\n\t\t\t\t\t\t\tproperty: \"item_operation\",\n\t\t\t\t\t\t\ttype: [\"text\", {}],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnext: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t},\n\t];\n\tconst collection_key_name = createHeaderFields(query.inferences.node_context().properties.path).join(\".\");\n\tconst import_template_columns = item_operation.concat(\n\t\tcreateImportTemplateQueryColumns(\n\t\t\tquery.inferences.node_context().properties.path.output.result_node().output.gui_entity(),\n\t\t\tnew NodePathBuilder(),\n\t\t\tCsvColumnPathBuilder.create(),\n\t\t\t\"update\",\n\t\t\tcollection_key_name\n\t\t)\n\t);\n\tconst query_properties = import_template_columns.reduce<\n\t\tNonNullable\n\t>((p, c) => ((p[c.column_name] = c.query_property), p), {});\n\tconst query_filters = createFiltersFromColumns(query.parent);\n\tconst transformation_columns = import_template_columns\n\t\t.slice(0)\n\t\t.reverse()\n\t\t.reduce(\n\t\t\t(tail, import_template_column) => import_template_column.transformation(tail),\n\t\t\t{ \"has columns\": [\"no\", {}] }\n\t\t);\n\tconst raw_client_request_incl_template: client_request_decorator.Tcollection_query = {\n\t\t\"context node path\": createIdPathBuilderFromNode(query.inferences.node()).build(),\n\t\t\"collection path\": createCollectionPathBuilderFromCollectionPath\n\t\t\t.create(query.inferences.node_context().properties.path, CollectionPathBuilder.create())\n\t\t\t.build(),\n\t\t\"select entries\": [\n\t\t\t\"yes\",\n\t\t\t{\n\t\t\t\t\"limit number of entries\": settings.properties.settings.properties.report_limit.value,\n\t\t\t\tproperties: {\n\t\t\t\t\tproperties: query_properties,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tfilters: {\n\t\t\t\"todo filter\": query.parent.properties.definition.ref.properties.filters.properties.todo_filter.switch<\n\t\t\t\tclient_request_decorator.Tfilters[\"todo filter\"]\n\t\t\t>({\n\t\t\t\tno: [\"no\", {}],\n\t\t\t\tyes: ($) => [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: mapNodePath($.properties.path).build(),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t\t\"value filters\": query_filters,\n\t\t},\n\t\taggregates: {},\n\t};\n\n\treturn {\n\t\tquery: raw_client_request_incl_template,\n\t\ttransformation: client_query_to_excel_transformation.alan_api.Ccollection_query_to_table.create(\n\t\t\t{\n\t\t\t\ttype: [\n\t\t\t\t\t\"collection query\",\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns: transformation_columns,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\trequest: api_client_request.alan_api.Cclient_request.create(\n\t\t\t\t\t{ type: [\"collection query\", raw_client_request_incl_template] },\n\t\t\t\t\t{\n\t\t\t\t\t\tapplication: DatastoreProxy.instance.application_model,\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t}\n\t\t),\n\t};\n}\n\nexport function determineAccessType(): api_download_request.alan_api.Treport_protocol_download_request[\"access type\"] {\n\treturn client_state.properties.session.properties.status.switch<\n\t\tapi_download_request.alan_api.Treport_protocol_download_request[\"access type\"]\n\t>({\n\t\t\"not authenticated\": \"anonymous\",\n\t\tauthenticated: ($) =>\n\t\t\t$.properties.anonymous_session.switch<\n\t\t\t\tapi_download_request.alan_api.Treport_protocol_download_request[\"access type\"]\n\t\t\t>({\n\t\t\t\tyes: \"anonymous\",\n\t\t\t\tno: [\n\t\t\t\t\t\"authenticated\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttoken: $.properties.token,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t});\n}\n\nexport function fromQuery(\n\tquery: api_client_state.Cquery__use_for__query\n): api_download_request.alan_api.Creport_protocol_download_request {\n\tconst collection_query = client_request_decorator.Cclient_request.create(\n\t\t{\n\t\t\ttype: [\n\t\t\t\t\"collection query\",\n\t\t\t\tcreateCollectionQueryFromQuery(\n\t\t\t\t\tquery.inferences.node_context().properties.switch_.switch({\n\t\t\t\t\t\tcurrent: () => createIdPathBuilderFromNode(query.inferences.node()),\n\t\t\t\t\t\troot: () => IdPathBuilder.create(),\n\t\t\t\t\t}),\n\t\t\t\t\tquery.parent,\n\t\t\t\t\tsettings.properties.settings.properties.report_limit.value\n\t\t\t\t),\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tapplication: DatastoreProxy.instance.application_model,\n\t\t}\n\t);\n\tconst transformation = client_query_to_excel_transformation.alan_api.Ccollection_query_to_table.create(\n\t\tclientQueryToExcelTransformation(query.parent.properties.definition.ref),\n\t\t{\n\t\t\trequest: collection_query,\n\t\t}\n\t);\n\treturn api_download_request.alan_api.Creport_protocol_download_request.create({\n\t\t\"access type\": determineAccessType(),\n\t\ttype: [\n\t\t\t\"ad hoc\",\n\t\t\t{\n\t\t\t\tquery: JSON.stringify(api_client_request.serializer_json.serialize(collection_query)),\n\t\t\t\tmapping: JSON.stringify(client_query_to_excel_transformation.serializer_json.serialize(transformation)),\n\t\t\t},\n\t\t],\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_gui_model = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport client_request_decorator = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport SubscriptionBuilder from \"./SubscriptionBuilder\";\n\nfunction createProperties(mapping: api_gui_model.Cduplication_node_mapping, builder: SubscriptionBuilder): void {\n\tmapping.properties.properties.forEach(function ($) {\n\t\tconst property_name = $.key.entry;\n\t\t$.properties.type.switch({\n\t\t\tcollection: function (collection_type) {\n\t\t\t\tconst gui_collection = collection_type.inferences.collection();\n\t\t\t\tconst collection_builder = builder.collection_entries(property_name);\n\n\t\t\t\tswitch (gui_collection.properties.duplication_mapping.state.name) {\n\t\t\t\t\tcase \"from current context\": {\n\t\t\t\t\t\tconst from_current_context_duplication_mapping = gui_collection.properties.duplication_mapping.state.node;\n\t\t\t\t\t\tcreateProperties(from_current_context_duplication_mapping.properties.mapping, collection_builder);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"none\": {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tfile: function () {\n\t\t\t\tbuilder.file(property_name);\n\t\t\t},\n\t\t\tgroup: function ($) {\n\t\t\t\tcreateProperties($.properties.mapping, builder.group(property_name));\n\t\t\t},\n\t\t\tnumber: function () {\n\t\t\t\tbuilder.number(property_name);\n\t\t\t},\n\t\t\t\"state group\": function ($) {\n\t\t\t\t$.properties.states.forEach(function ($) {\n\t\t\t\t\tcreateProperties(\n\t\t\t\t\t\t$.properties.mapping,\n\t\t\t\t\t\tbuilder.state(\n\t\t\t\t\t\t\tproperty_name,\n\t\t\t\t\t\t\t$.key.ref.key.ref.key,\n\t\t\t\t\t\t\t$.parent.inferences.state_group().inferences.state_group()\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t},\n\t\t\ttext: function () {\n\t\t\t\tbuilder.text(property_name);\n\t\t\t},\n\t\t});\n\t});\n}\nexport default function (\n\tmapping: api_gui_model.Cduplication_node_mapping,\n\tid_path: client_request_decorator.Tid_path__client_request\n): client_request_decorator.Tsubscription {\n\tconst builder = SubscriptionBuilder.create();\n\tcreateProperties(mapping, builder);\n\treturn {\n\t\t\"context node\": id_path,\n\t\t\"mutation permissions\": [\"ignore\", {}],\n\t\t\"node subscription\": { attributes: builder.properties },\n\t};\n}\n","import { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\n\nexport async function entryExists(id: IdPathBuilder): Promise {\n\tconst result = await DatastoreProxy.instance.collectionQuery({\n\t\t\"context node path\": id.build(),\n\t\t\"select entries\": \"no\",\n\t\t\"collection path\": {\n\t\t\t\"has steps\": \"no\",\n\t\t},\n\t\taggregates: {},\n\t\tfilters: {\n\t\t\t\"value filters\": {},\n\t\t\t\"todo filter\": \"no\",\n\t\t},\n\t});\n\tswitch (result.properties.context.state.name) {\n\t\tcase \"does not exist\":\n\t\t\treturn false;\n\t\tcase \"exists\":\n\t\t\treturn true;\n\t\tcase \"permission denied\":\n\t\t\treturn false;\n\t\tdefault:\n\t\t\tunexpectedState(result.properties.context.state);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport csr = api_configuration.types.client_state.alan_api;\nimport datastore_interface_read_api = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_reply.alan_api;\nimport api_gui_model = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport * as update from \"../widgets/instructions/update\";\nimport { iState } from \"../state/Stategroup\";\nimport { iCollection } from \"../state/Collection\";\nimport * as Entry from \"../state/Entry\";\n\nexport default function initializeNewNodeFromSubscriptionResult(\n\tnode: csr.Cnode,\n\tduplication_mapping: api_gui_model.Cduplication_node_mapping,\n\tsubscription_result_data: datastore_interface_read_api.Csubscription_result_data\n): void {\n\tsubscription_result_data.properties.read_permitted.switch({\n\t\tno: undefined,\n\t\tyes: (readable) => {\n\t\t\tduplication_mapping.properties.properties.forEach(function (property) {\n\t\t\t\tconst property_name = property.key.entry;\n\t\t\t\tproperty.properties.type.switch({\n\t\t\t\t\tnumber: function () {\n\t\t\t\t\t\tconst number_stage = node.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"number\");\n\t\t\t\t\t\tconst value = readable.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"number\").properties.value.value;\n\t\t\t\t\t\tupdate.number(number_stage, value, \"user\");\n\t\t\t\t\t},\n\t\t\t\t\ttext: function () {\n\t\t\t\t\t\tconst text_stage = node.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"text\");\n\t\t\t\t\t\tconst value = readable.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"text\").properties.value;\n\t\t\t\t\t\tconst mutable_text = text_stage;\n\t\t\t\t\t\tmutable_text.properties.is_editable.set(\"yes\", {\n\t\t\t\t\t\t\tmodified: [\n\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\t\t\t\tsaving: [\"no\", {}],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tmutable_text.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\t\ttext: value,\n\t\t\t\t\t\t\tby: [\"user\", {}],\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tfile: function () {\n\t\t\t\t\t\tconst file_stage = node.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"file\");\n\t\t\t\t\t\tconst file_mutable = file_stage;\n\t\t\t\t\t\tconst file_value = readable.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"file\");\n\t\t\t\t\t\tfile_mutable.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\t\ttoken: file_value.properties.token,\n\t\t\t\t\t\t\textension: file_value.properties.extension,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfile_mutable.properties.is_valid.set(\"yes\", {});\n\t\t\t\t\t},\n\t\t\t\t\tgroup: function (group_type) {\n\t\t\t\t\t\tconst group_stage = node.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"group\");\n\t\t\t\t\t\tconst group_node = readable.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"group\");\n\t\t\t\t\t\tinitializeNewNodeFromSubscriptionResult(\n\t\t\t\t\t\t\tgroup_stage.properties.node,\n\t\t\t\t\t\t\tgroup_type.properties.mapping,\n\t\t\t\t\t\t\tgroup_node.properties.node_data\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\t\"state group\": function (state_group_type) {\n\t\t\t\t\t\tconst state_group_stage = node.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"state group\");\n\t\t\t\t\t\tconst state_group_data = readable.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"state group\");\n\t\t\t\t\t\tconst state_name = state_group_data.properties.state.entry;\n\t\t\t\t\t\tconst state = state_group_stage.properties.states.get(state_group_data.properties.state.entry)!;\n\t\t\t\t\t\tiState(state).__select(\"user\");\n\t\t\t\t\t\tinitializeNewNodeFromSubscriptionResult(\n\t\t\t\t\t\t\tstate.properties.node,\n\t\t\t\t\t\t\tstate_group_type.properties.states.get(state_name)!.properties.mapping,\n\t\t\t\t\t\t\tstate_group_data.properties.node_data\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\tcollection: function (collection_type) {\n\t\t\t\t\t\tconst gui_collection = collection_type.inferences.collection();\n\n\t\t\t\t\t\tconst collection_value = readable.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"collection\");\n\t\t\t\t\t\tconst collection = node.properties.attributes\n\t\t\t\t\t\t\t.get(property_name)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"collection\");\n\n\t\t\t\t\t\tswitch (collection_value.properties.result.state.name) {\n\t\t\t\t\t\t\tcase \"update\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"entries\": {\n\t\t\t\t\t\t\t\tconst entries_result = collection_value.properties.result.state.node;\n\t\t\t\t\t\t\t\tfor (const [key, entry] of entries_result.properties.entries) {\n\t\t\t\t\t\t\t\t\tconst entry_new_node = iCollection(collection).__addEntry(\"user\", key);\n\t\t\t\t\t\t\t\t\tswitch (gui_collection.properties.duplication_mapping.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"from current context\": {\n\t\t\t\t\t\t\t\t\t\t\tconst from_current_context_duplication_mapping =\n\t\t\t\t\t\t\t\t\t\t\t\tgui_collection.properties.duplication_mapping.state.node;\n\t\t\t\t\t\t\t\t\t\t\tinitializeNewNodeFromSubscriptionResult(\n\t\t\t\t\t\t\t\t\t\t\t\tentry_new_node.properties.node,\n\t\t\t\t\t\t\t\t\t\t\t\tfrom_current_context_duplication_mapping.properties.mapping,\n\t\t\t\t\t\t\t\t\t\t\t\tentry.properties.node_data\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"none\": {\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tEntry.keyInitialized(entry_new_node);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfor (const graph of iCollection(collection).graphs) {\n\t\t\t\t\t\t\t\t\tgraph.reset(false);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t});\n\t\t},\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { client_state } from \"../state/ClientState\";\nimport { node_path, ui_scalar_value_expression, StringLike } from \"../state/expressions\";\nimport { variable_assignment, Variable } from \"../state/Variable\";\nimport { Scalar, onScalarValue, createExpressionBuilder, createVariable } from \"../../../../../stream\";\nimport { Pending, Failed, Unknown, isResolved, Result } from \"../Status\";\nimport { translate } from \"../state/phrases\";\n\nexport function initializedNumericalTypeProperties(\n\tnumerical_type_properties: api_cs.Cnumerical_type_properties\n): api_cs.Cyes__initialized__numerical_type_properties {\n\treturn numerical_type_properties.properties.initialized.ensure(\"yes\", {\n\t\tdecimals: 0,\n\t\tunit: \"\",\n\t});\n}\n\ntype Initialized = {\n\t__initialized: boolean;\n};\n\nexport function evaluateNumericalTypeProperty(\n\tnumerical_type_properties: api_cs.Cyes__initialized__numerical_type_properties,\n\tnumber_property: api_app.Cnumber__type__property,\n\tthis_node: api_cs.Cnode\n): void {\n\tconst initialized_properties = numerical_type_properties as unknown as Initialized;\n\tif (initialized_properties.__initialized) {\n\t\treturn;\n\t}\n\tinitialized_properties.__initialized = true;\n\tconst numerical_type = number_property.properties.numerical_type.ref;\n\tlet path: api_app.Cnode_path | null = null;\n\tswitch (number_property.properties.ui.properties.dynamic_numerical_type.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst bind_to_numerical_type = number_property.properties.ui.properties.dynamic_numerical_type.state.node;\n\t\t\tpath = bind_to_numerical_type.properties.binding_path;\n\t\t\tbreak;\n\t\t}\n\t}\n\tevaluateNumericalType(path, numerical_type_properties, numerical_type, this_node);\n}\n\nexport function evaluateNumericalTypeFilter(\n\tnumerical_type_properties: api_cs.Cyes__initialized__numerical_type_properties,\n\tnumber_filter: api_cs.Cyes__has_filter__number\n): void {\n\tconst initialized_properties = numerical_type_properties as unknown as Initialized;\n\tif (initialized_properties.__initialized) {\n\t\treturn;\n\t}\n\tinitialized_properties.__initialized = true;\n\tconst number_property = number_filter.parent.inferences.number_type().properties.number.ref.inferences.number();\n\tconst numerical_type = number_property.properties.numerical_type.ref;\n\n\tswitch (number_property.properties.ui.properties.dynamic_numerical_type.state.name) {\n\t\tcase \"no\":\n\t\t\tevaluateNumericalType(null, numerical_type_properties, numerical_type, null);\n\t\t\tbreak;\n\t\tcase \"yes\":\n\t\t\treturn; //Dynamical numerical types not supported for filters\n\t}\n}\n\nfunction setUnit(\n\tinput: Scalar,\n\tnumerical_type_properties: api_cs.Cyes__initialized__numerical_type_properties\n) {\n\tonScalarValue(\n\t\tinput,\n\t\t(value) => {\n\t\t\tnumerical_type_properties.set_unit(value);\n\t\t},\n\t\t(scalar, subscription) => numerical_type_properties.onDestroy(() => scalar.unsubscribe(subscription))\n\t);\n}\n\nfunction setDecimals(\n\tinput: Scalar>,\n\tnumerical_type_properties: api_cs.Cyes__initialized__numerical_type_properties\n) {\n\tonScalarValue(\n\t\tinput,\n\t\t(value) => {\n\t\t\tswitch (value) {\n\t\t\t\tcase Pending:\n\t\t\t\t\tbreak;\n\t\t\t\tcase Unknown:\n\t\t\t\tcase Failed:\n\t\t\t\t\tnumerical_type_properties.set_decimals(0);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tnumerical_type_properties.set_decimals(value);\n\t\t\t}\n\t\t},\n\t\t(scalar, subscription) => numerical_type_properties.onDestroy(() => scalar.unsubscribe(subscription))\n\t);\n}\n\nfunction evaluateNumericalType(\n\tbinding_path: api_app.Cnode_path | null,\n\tnumerical_type_properties: api_cs.Cyes__initialized__numerical_type_properties,\n\tnumerical_type: api_app.Cnumerical_types,\n\tthis_node: api_cs.Cnode | null\n) {\n\tswitch (numerical_type.properties.ui.properties.represent_as.state.name) {\n\t\tcase \"model\":\n\t\t\tsetUnit(translate(numerical_type.key), numerical_type_properties);\n\t\t\tbreak;\n\t\tcase \"date\":\n\t\t\tsetUnit(translate(numerical_type.key), numerical_type_properties);\n\t\t\tbreak;\n\t\tcase \"date and time\":\n\t\t\tsetUnit(translate(numerical_type.key), numerical_type_properties);\n\t\t\tbreak;\n\t\tcase \"duration\":\n\t\t\tsetUnit(translate(numerical_type.key), numerical_type_properties);\n\t\t\tbreak;\n\t\tcase \"custom type\": {\n\t\t\tconst $ = numerical_type.properties.ui.properties.represent_as.state.node;\n\t\t\tconst root_context = client_state.properties.root;\n\t\t\tconst variable_context = createVariable(\n\t\t\t\t$.properties.binding.switch({\n\t\t\t\t\tdynamic: ($dynamic) => {\n\t\t\t\t\t\tif (binding_path === null || this_node === null) {\n\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn node_path(binding_path).pipe((context) =>\n\t\t\t\t\t\t\t\tisResolved(context) ? variable_assignment($dynamic.properties.assignment, null, context) : Failed\n\t\t\t\t\t\t\t)([this_node, null]);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\troot: () => null,\n\t\t\t\t}),\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tsetUnit(\n\t\t\t\tcreateExpressionBuilder(variable_context).pipe((variable) => {\n\t\t\t\t\tif (variable === Failed) return numerical_type.key;\n\t\t\t\t\treturn ui_scalar_value_expression($.properties.properties.properties.label)\n\t\t\t\t\t\t.pipe((expression_result) =>\n\t\t\t\t\t\t\tisResolved(expression_result) ? expression_result.toString() : numerical_type.key\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.pipe(translate)([root_context, variable]);\n\t\t\t\t})(),\n\t\t\t\tnumerical_type_properties\n\t\t\t);\n\t\t\tswitch ($.properties.properties.properties.conversion.state.name) {\n\t\t\t\tcase \"none\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"point translation\": {\n\t\t\t\t\tconst point_translation = $.properties.properties.properties.conversion.state.node;\n\t\t\t\t\tsetDecimals(\n\t\t\t\t\t\tcreateExpressionBuilder(variable_context).pipe((variable) => {\n\t\t\t\t\t\t\tif (variable === Failed) return 0;\n\t\t\t\t\t\t\treturn ui_scalar_value_expression(point_translation.properties.decimals)([\n\t\t\t\t\t\t\t\troot_context,\n\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t})(),\n\t\t\t\t\t\tnumerical_type_properties\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport resetModifiedState from \"../state/resetModifiedState\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport { iCollection } from \"../state/Collection\";\nimport * as mapToIdPathBuilder from \"../state/mapToIdPathBuilder\";\n\nif (window.requestIdleCallback === undefined) {\n\twindow.requestIdleCallback = (callback, options) => {\n\t\treturn setTimeout(callback, options?.timeout ?? 500);\n\t};\n\n\twindow.cancelIdleCallback = (handle) => {\n\t\tclearTimeout(handle);\n\t};\n}\n\nexport function hasMutationPermission(id_path: IdPathBuilder, callback: (has_permission: boolean) => void): void {\n\tDatastoreProxy.instance.subscribeOnce(\n\t\t{\n\t\t\t\"context node\": id_path.build(),\n\t\t\t\"mutation permissions\": [\"include\", {}],\n\t\t\t\"node subscription\": {\n\t\t\t\tattributes: {},\n\t\t\t},\n\t\t},\n\t\t(result) => {\n\t\t\tresult.properties.context.switch({\n\t\t\t\t\"does not exist\": () => undefined,\n\t\t\t\texists: ($) =>\n\t\t\t\t\t$.properties.subscription_result_data.properties.update_permitted.properties.permitted.switch({\n\t\t\t\t\t\tno: () => callback(false),\n\t\t\t\t\t\tyes: () => callback(true),\n\t\t\t\t\t}),\n\t\t\t\t\"permission denied\": () => callback(false),\n\t\t\t});\n\t\t}\n\t);\n}\n\nexport function hasDeletePermission(id_path: IdPathBuilder, callback: (has_permission: boolean) => void): void {\n\tDatastoreProxy.instance.subscribeOnce(\n\t\t{\n\t\t\t\"context node\": id_path.build(),\n\t\t\t\"mutation permissions\": [\"include\", {}],\n\t\t\t\"node subscription\": {\n\t\t\t\tattributes: {},\n\t\t\t},\n\t\t},\n\t\t(result) => {\n\t\t\tcallback(\n\t\t\t\tresult.properties.context.switch({\n\t\t\t\t\t\"does not exist\": () => false,\n\t\t\t\t\texists: ($) =>\n\t\t\t\t\t\t$.properties.delete_permitted.properties.permitted.switch({\n\t\t\t\t\t\t\tno: false,\n\t\t\t\t\t\t\tyes: true,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\"permission denied\": false,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t);\n}\n\nexport function hasNodeMutationPermission(node: api_cs.Cnode, callback: (has_permission: boolean) => void): void {\n\tnode.input\n\t\t.node_type()\n\t\t.input.value_source()\n\t\t.switch({\n\t\t\tderived: () => callback(false),\n\t\t\tbase: () => hasMutationPermission(createIdPathBuilderFromNode(node), callback),\n\t\t});\n}\n\nexport function hasCollectionCreationPermission(\n\tid_path: IdPathBuilder,\n\tcollection_name: string,\n\tcallback: (has_permission: boolean) => void\n): void {\n\tDatastoreProxy.instance.subscribeOnce(\n\t\t{\n\t\t\t\"context node\": id_path.build(),\n\t\t\t\"mutation permissions\": [\"include\", {}],\n\t\t\t\"node subscription\": {\n\t\t\t\tattributes: {\n\t\t\t\t\t[collection_name]: {\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"property\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\"collection\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"subscribe on\": [\"updates\", {}],\n\t\t\t\t\t\t\t\t\t\t\"include graph endpoints\": [\"no\", {}],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t(results) => {\n\t\t\tcallback(\n\t\t\t\tresults.properties.context.switch({\n\t\t\t\t\t\"does not exist\": false,\n\t\t\t\t\texists: ($) =>\n\t\t\t\t\t\t$.properties.subscription_result_data.properties.read_permitted.switch({\n\t\t\t\t\t\t\tno: false,\n\t\t\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\t\t\t$.properties.attributes.get(collection_name)!.properties.type.switch({\n\t\t\t\t\t\t\t\t\tcommand: false,\n\t\t\t\t\t\t\t\t\tproperty: ($) =>\n\t\t\t\t\t\t\t\t\t\t$.properties.type.switch({\n\t\t\t\t\t\t\t\t\t\t\tcollection: ($) =>\n\t\t\t\t\t\t\t\t\t\t\t\t$.properties.create_permitted.properties.permitted.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tno: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\tyes: true,\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\tfile: false,\n\t\t\t\t\t\t\t\t\t\t\tgroup: false,\n\t\t\t\t\t\t\t\t\t\t\tnumber: false,\n\t\t\t\t\t\t\t\t\t\t\t\"state group\": false,\n\t\t\t\t\t\t\t\t\t\t\ttext: false,\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t}),\n\t\t\t\t\t\"permission denied\": false,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t);\n}\n\nexport function updateEntityPermission(node: api_cs.Cnode): void {\n\tnode.input.entity().switch({\n\t\troot: undefined,\n\t\tentry: ($) => {\n\t\t\tiCollection($.parent).updateMutationPermissions();\n\t\t},\n\t});\n}\n\nconst nodes_to_update = new Set();\nexport function updatePermissions(node: api_cs.Cnode): void {\n\tif (nodes_to_update.has(node)) return;\n\tnodes_to_update.add(node);\n\trequestIdleCallback(() => {\n\t\tnodes_to_update.delete(node);\n\t\tif (node.destroyed) return;\n\t\tdoUpdatePermissions(node);\n\t});\n}\n\nfunction doUpdatePermissions(node: api_cs.Cnode): void {\n\tif (node.destroyed) {\n\t\treturn;\n\t}\n\tnode.properties.location.switch({\n\t\tremote: () => {\n\t\t\thasNodeMutationPermission(node, (has_permission) => {\n\t\t\t\tif (node.destroyed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tnode.properties.location.switch({\n\t\t\t\t\tremote: () => {\n\t\t\t\t\t\tif (!has_permission) {\n\t\t\t\t\t\t\tresetModifiedState(node, false);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnode.properties.attributes.forEach(($) => {\n\t\t\t\t\t\t\t$.properties.type.switch({\n\t\t\t\t\t\t\t\toperation: undefined,\n\t\t\t\t\t\t\t\tproperty: ($) =>\n\t\t\t\t\t\t\t\t\t$.inferences\n\t\t\t\t\t\t\t\t\t\t.property_type()\n\t\t\t\t\t\t\t\t\t\t.properties.type.state.node.output.value_source()\n\t\t\t\t\t\t\t\t\t\t.switch({\n\t\t\t\t\t\t\t\t\t\t\tderived: undefined,\n\t\t\t\t\t\t\t\t\t\t\tbase: () =>\n\t\t\t\t\t\t\t\t\t\t\t\t$.properties.type.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tcollection: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst collection_name = $.parent.parent.key.entry;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst id_path = createIdPathBuilderFromNode($.parent.parent.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasCollectionCreationPermission(id_path, collection_name, (has_create_permission) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ($.destroyed) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst mutable_collection = $;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (has_create_permission) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmutable_collection.properties.is_editable.ensure(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmutable_collection.properties.can_create_entry.ensure(\"yes\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_editable.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.entries.forEach(($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatePermissions($.properties.node);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tfile: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (has_permission) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_editable.ensure(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_editable.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tgroup: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatePermissions($.properties.node);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tnumber: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (has_permission) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// this cast to elementary is safe becase the property type is already switched to elementary.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.inferences\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.number_type()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.properties.type.cast(\"base\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.properties.type.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcausal: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsimple: () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_editable.ensure(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_editable.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"state group\": ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: ($) => updatePermissions($.properties.state.ref.properties.node),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (has_permission) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitch ($.properties.is_key.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst collection = $.parent.parent.parent.input\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.position()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.cast(\"entity\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.cast(\"entry\").parent;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcollection.properties.is_editable.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_editable.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thasDeletePermission(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreateIdPathBuilderFromNode(node),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(has_delete_permissions) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ($.destroyed) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (has_delete_permissions) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_editable.ensure(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_editable.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_editable.ensure(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState($.properties.is_key.state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_editable.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tlocal: undefined,\n\t\t\t\t});\n\t\t\t});\n\t\t},\n\t\tlocal: undefined,\n\t});\n}\n\nconst permissions_checked_on_entries = new WeakSet();\nexport function entryPermissionChecked(entry: api_cs.Centries__yes__has_result) {\n\tpermissions_checked_on_entries.add(entry);\n}\nexport async function checkEntryPermission(entry: api_cs.Centries__yes__has_result) {\n\tif (permissions_checked_on_entries.has(entry)) return;\n\tentryPermissionChecked(entry);\n\tlet id_path: IdPathBuilder | undefined;\n\tconst initialized = entry.properties.entry_status.properties.initialized.state;\n\tswitch (initialized.name) {\n\t\tcase \"no\":\n\t\t\tid_path = mapToIdPathBuilder.fromClientState(initialized.node.properties.referenced_node);\n\t\t\tbreak;\n\t\tcase \"yes\":\n\t\t\tid_path = createIdPathBuilderFromNode(initialized.node.properties.referenced_node.output.result_node());\n\t\t\tbreak;\n\t\tcase \"unknown\":\n\t\t\tbreak;\n\t}\n\tif (id_path === undefined) return;\n\tconst result = await DatastoreProxy.instance.subscribeOnce({\n\t\t\"context node\": id_path.build(),\n\t\t\"node subscription\": {\n\t\t\tattributes: {},\n\t\t},\n\t\t\"mutation permissions\": [\"include\", {}],\n\t});\n\tif (entry.destroyed) return;\n\tswitch (result.properties.context.state.name) {\n\t\tcase \"does not exist\": {\n\t\t\tentry.properties.is_editable.set(\"no\", {});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"exists\": {\n\t\t\tconst exists_context = result.properties.context.state.node;\n\t\t\tswitch (exists_context.properties.delete_permitted.properties.permitted.state.name) {\n\t\t\t\tcase \"no\": {\n\t\t\t\t\tentry.properties.is_editable.set(\"no\", {});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tentry.properties.is_editable.set(\"yes\", {});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"permission denied\": {\n\t\t\tentry.properties.is_editable.set(\"no\", {});\n\t\t\tbreak;\n\t\t}\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport createCollectionQueryFromQuery from \"./createCollectionQueryFromQuery\";\nimport updateQueryFromCollectionQueryResult from \"./updateQueryFromCollectionQueryResult\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { hasCollectionCreationPermission } from \"./permissions\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport updateQueryFromCollection from \"../state/updateQueryFromCollection\";\nimport { client_state } from \"../state/ClientState\";\nimport { iReference } from \"../state/Reference\";\nimport {\n\tTcollection_query,\n\tTyes__select_entries,\n} from \"../../../../../common/api_configuration-state/lib/libraries/gui_definition_lib/libraries/model_lib/types/client_request/alan_api\";\nimport { Centries__collection } from \"../../../../../common/api_configuration-state/lib/types/client_state/alan_api\";\nimport * as ClientState from \"../state/ClientState\";\nimport * as Status from \"../Status\";\nimport { awaitCondition } from \"../../../../../stream\";\n\nasync function sendQueryToDataStoreTillCorrectAmountOfEntries(\n\tquery: api_client_state.Cquery__client_state,\n\tcollection_query: Tcollection_query,\n\tcheck_limits: boolean\n): Promise {\n\tconst collection_query_result = await DatastoreProxy.instance.collectionQuery(collection_query);\n\tif (query.destroyed || queue.has(query) || throttle_queries.has(query)) {\n\t\treturn;\n\t}\n\tswitch (collection_query_result.properties.context.state.name) {\n\t\tcase \"does not exist\":\n\t\t\tquery.properties.has_result.set(\"no\", {});\n\t\t\tbreak;\n\t\tcase \"permission denied\":\n\t\t\tquery.properties.has_result.set(\"no\", {});\n\t\t\tbreak;\n\t\tcase \"exists\": {\n\t\t\tconst result = collection_query_result.properties.context.state.node;\n\t\t\tif (check_limits) {\n\t\t\t\tswitch (result.properties.entries.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tupdateQueryFromCollectionQueryResult(result, query);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst query_limits = query.properties.definition.ref.properties.query_limits;\n\t\t\t\t\t\tconst number_of_entries_limit = collection_query[\"select entries\"][1] as Tyes__select_entries;\n\t\t\t\t\t\tconst has_entries = result.properties.entries.state.node;\n\t\t\t\t\t\tswitch (has_entries.properties.limit_exceeded.state.name) {\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tif (result.properties.amount_of_entries.value > query_limits.properties.absolute_maximum.value) {\n\t\t\t\t\t\t\t\t\tnumber_of_entries_limit[\"limit number of entries\"] = query_limits.properties.sample_size.value;\n\t\t\t\t\t\t\t\t\tawait sendQueryToDataStoreTillCorrectAmountOfEntries(query, collection_query, false);\n\t\t\t\t\t\t\t\t} else if (result.properties.amount_of_entries.value <= query_limits.properties.show_all_limit.value) {\n\t\t\t\t\t\t\t\t\tnumber_of_entries_limit[\"limit number of entries\"] = query_limits.properties.show_all_limit.value;\n\t\t\t\t\t\t\t\t\tawait sendQueryToDataStoreTillCorrectAmountOfEntries(query, collection_query, false);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tupdateQueryFromCollectionQueryResult(result, query);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tupdateQueryFromCollectionQueryResult(result, query);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tupdateQueryFromCollectionQueryResult(result, query);\n\t\t\t}\n\t\t}\n\t}\n}\n\nasync function sendQueryToDataStore(\n\tquery: api_client_state.Cquery__client_state,\n\tcollection_query: Tcollection_query\n): Promise {\n\ttry {\n\t\tawait sendQueryToDataStoreTillCorrectAmountOfEntries(query, collection_query, true);\n\t\tif (!query.destroyed) {\n\t\t\tquery.properties.is_busy_querying.set(\"no\", {\n\t\t\t\t\"request status\": [\"success\", {}],\n\t\t\t});\n\t\t}\n\t} catch (reason) {\n\t\tif (!query.destroyed) {\n\t\t\tquery.properties.is_busy_querying.set(\"no\", {\n\t\t\t\t\"request status\": [\"failure\", {}],\n\t\t\t});\n\t\t}\n\t\tthrow reason;\n\t}\n}\n\nasync function sendQuery(querying: api_client_state.Cyes__is_busy_querying): Promise {\n\tconst query = querying.parent;\n\tif (querying.destroyed) {\n\t\tquery.properties.is_busy_querying.set(\"no\", {\n\t\t\t\"request status\": [\"failure\", {}],\n\t\t});\n\t\treturn;\n\t}\n\tquerying.properties.requery_needed.set(\"no\", {});\n\n\tlet context_node: api_client_state.Cnode | undefined = undefined;\n\tlet force_normal_query_instead_of_candidates_query = false;\n\tswitch (query.properties.use_for.state.name) {\n\t\tcase \"query\": {\n\t\t\tconst $ = query.properties.use_for.state.node;\n\t\t\tcontext_node = $.inferences.node_context().properties.switch_.switch({\n\t\t\t\tcurrent: () => $.inferences.node(),\n\t\t\t\troot: () => client_state.properties.root,\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"candidates\": {\n\t\t\tconst $ = query.properties.use_for.state.node;\n\t\t\tconst reference = $.inferences.reference_property().parent;\n\t\t\tconst entry = reference.parent.properties.is_key.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: ($) => $.inferences.entry(),\n\t\t\t});\n\t\t\tconst collection = await awaitCondition(iReference(reference).collectionContext, Status.valueOrFailed);\n\t\t\tif (collection !== Status.Failed) {\n\t\t\t\tentriesAreEditable($, collection);\n\t\t\t\tif (entry && entry.destroyed === false) {\n\t\t\t\t\tswitch (entry.component_root.properties.location.state.name) {\n\t\t\t\t\t\tcase \"local\": {\n\t\t\t\t\t\t\tforce_normal_query_instead_of_candidates_query = true;\n\t\t\t\t\t\t\tcontext_node = collection.parent.parent.parent;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"remote\": {\n\t\t\t\t\t\t\tcontext_node = entry.parent.parent.parent.parent;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcontext_node = collection.parent.parent.parent;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (query.destroyed) return;\n\tif (querying.destroyed) {\n\t\tquery.properties.is_busy_querying.set(\"no\", {\n\t\t\t\"request status\": [\"failure\", {}],\n\t\t});\n\t\treturn;\n\t}\n\tif (context_node && context_node.destroyed === false) {\n\t\tawait context_node.properties.location.switch({\n\t\t\tremote: async () =>\n\t\t\t\tawait sendQueryToDataStore(\n\t\t\t\t\tquery,\n\t\t\t\t\tcreateCollectionQueryFromQuery(\n\t\t\t\t\t\tcreateIdPathBuilderFromNode(context_node!),\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\tqueryLimit(query),\n\t\t\t\t\t\tforce_normal_query_instead_of_candidates_query\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\tlocal: async () => {\n\t\t\t\tquery.properties.is_busy_querying.set(\"no\", {\n\t\t\t\t\t\"request status\": [\"success\", {}],\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t\tif (query.destroyed) return;\n\t\tupdateQueryFromCollection(query);\n\t} else {\n\t\tquery.properties.has_result.set(\"no\", {});\n\t\tquery.properties.is_busy_querying.set(\"no\", {\n\t\t\t\"request status\": [\"failure\", {}],\n\t\t});\n\t}\n}\n\nconst queue = new Set();\nasync function queueQuery(query: api_client_state.Cquery__client_state): Promise {\n\tif (!queue.has(query)) {\n\t\tqueue.add(query);\n\t\tawait new Promise((resolve) => {\n\t\t\tClientState.onTransactionEnds(() => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t\tqueue.delete(query);\n\t\tif (query.destroyed) return;\n\t\tconst busy = query.properties.is_busy_querying.set(\"yes\", {\n\t\t\t\"requery needed\": \"no\",\n\t\t});\n\t\tawait sendQuery(busy);\n\t}\n}\n\nfunction isBusy(query: api_client_state.Cquery__client_state): boolean {\n\tswitch (query.properties.is_busy_querying.state.name) {\n\t\tcase \"no\":\n\t\t\treturn false;\n\t\tcase \"yes\":\n\t\t\treturn true;\n\t}\n}\n\nasync function waitForQuery(query: api_client_state.Cquery__client_state): Promise {\n\tif (query.destroyed === false && isBusy(query)) {\n\t\treturn new Promise((resolve) => {\n\t\t\tquery.properties.is_busy_querying.subscribe({\n\t\t\t\ton_update: (_, subscription) => {\n\t\t\t\t\tif (!isBusy(query)) {\n\t\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t} else {\n\t\treturn Promise.resolve();\n\t}\n}\n\nexport function query(query: api_client_state.Cquery__client_state): void {\n\tqueueQuery(query);\n}\n\nconst throttle_queries = new Set();\nexport function execute(query: api_client_state.Cquery__client_state): void {\n\tif (query.destroyed || throttle_queries.has(query)) {\n\t\treturn;\n\t}\n\tswitch (query.properties.is_busy_querying.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst busy = query.properties.is_busy_querying.state.node;\n\t\t\tswitch (busy.properties.requery_needed.state.name) {\n\t\t\t\tcase \"no\": {\n\t\t\t\t\tbusy.properties.requery_needed.set(\"yes\", {});\n\t\t\t\t\tthrottle_queries.add(query);\n\t\t\t\t\tsetTimeout(async () => {\n\t\t\t\t\t\tawait waitForQuery(query);\n\t\t\t\t\t\tthrottle_queries.delete(query);\n\t\t\t\t\t\texecute(query);\n\t\t\t\t\t}, 200);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"yes\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\": {\n\t\t\tqueueQuery(query);\n\t\t}\n\t}\n}\n\nfunction setEntriesAreEditable(query: api_client_state.Cquery__client_state) {\n\tquery.properties.entries_are_editable.set(\"yes\", {\n\t\t\"is importing\": [\"no\", {}],\n\t\t\"can create entry\": [\n\t\t\t\"yes\",\n\t\t\t{\n\t\t\t\tin: [\"candidates\", {}],\n\t\t\t},\n\t\t],\n\t});\n}\n\nfunction setEntriesAreNotEditable(query: api_client_state.Cquery__client_state) {\n\tquery.properties.entries_are_editable.set(\"no\", {});\n}\n\nfunction entriesAreEditable(\n\tcandidates_query: api_client_state.Ccandidates__use_for__query,\n\tcollection: api_client_state.Ccollection\n) {\n\tconst query = candidates_query.parent;\n\tquery.properties.definition.ref.properties.context.state.node.output\n\t\t.selected_context()\n\t\t.input.application_node()\n\t\t.input.value_source()\n\t\t.switch({\n\t\t\tderived: () => setEntriesAreNotEditable(query),\n\t\t\tbase: () => {\n\t\t\t\tconst collection_name = collection.parent.parent.key.entry;\n\t\t\t\tconst node = collection.parent.parent.parent;\n\t\t\t\tnode.properties.location.switch({\n\t\t\t\t\tremote: () =>\n\t\t\t\t\t\thasCollectionCreationPermission(createIdPathBuilderFromNode(node), collection_name, (editable) => {\n\t\t\t\t\t\t\tif (query.destroyed) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (editable) {\n\t\t\t\t\t\t\t\tsetEntriesAreEditable(query);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsetEntriesAreNotEditable(query);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\tlocal: () => setEntriesAreEditable(query),\n\t\t\t\t});\n\t\t\t},\n\t\t});\n}\n\nfunction walkQueries(node: api_client_state.Cnode, on_query: (query: api_client_state.Cquery__client_state) => void) {\n\tnode.properties.queries.forEach(($query) => on_query($query.properties.query));\n\tnode.properties.attributes.forEach(($attribute) => {\n\t\t$attribute.properties.type.switch({\n\t\t\toperation: undefined,\n\t\t\tproperty: ($property) => {\n\t\t\t\t$property.properties.type.switch({\n\t\t\t\t\tfile: undefined,\n\t\t\t\t\tnumber: undefined,\n\t\t\t\t\ttext: undefined,\n\t\t\t\t\tgroup: ($) => walkQueries($.properties.node, on_query),\n\t\t\t\t\t\"state group\": ($) => {\n\t\t\t\t\t\t$.properties.states.forEach(($) => walkQueries($.properties.node, on_query));\n\t\t\t\t\t},\n\t\t\t\t\tcollection: ($) => {\n\t\t\t\t\t\t$.properties.entries.forEach(($) => walkQueries($.properties.node, on_query));\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t});\n}\n\nexport function queriesForCollection($entry: api_client_state.Centries__collection): void {\n\twalkQueries(client_state.properties.root, ($query) => {\n\t\tconst selected_context = $query.properties.definition.ref.properties.context.state.node.output\n\t\t\t.selected_context()\n\t\t\t.input.application_node();\n\t\tconst entry_context = $entry.properties.node.input.node_type();\n\t\tif (selected_context === entry_context) {\n\t\t\texecute($query);\n\t\t}\n\t});\n}\n\nexport function candidates(reference: api_client_state.Cyes__navigable): void {\n\tfor (const query of reference.properties.queries.values()) {\n\t\tswitch (query.properties.query.properties.delay_query.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\texecute(query.properties.query);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"yes\":\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\nfunction queryLimit(query: api_client_state.Cquery__client_state) {\n\tconst query_limits = query.properties.definition.ref.properties.query_limits;\n\treturn query.properties.show_all.switch({\n\t\tno: query_limits.properties.sample_size.value,\n\t\tyes: query_limits.properties.absolute_maximum.value,\n\t});\n}\n\nexport function queriesForCollectionFromNode(\n\tnode: api_client_state.Cnode,\n\tcollection: api_client_state.Ccollection\n): void {\n\tArray.from(node.properties.queries).map((query) => {\n\t\tif (\n\t\t\tquery[1].properties.query.properties.definition.ref.properties.context.state.node.output\n\t\t\t\t.selected_context()\n\t\t\t\t.input.application_node() === collection.inferences.collection_type().properties.node\n\t\t) {\n\t\t\texecute(query[1].properties.query);\n\t\t}\n\t});\n}\n\nexport function stopDelayingQuery(query: api_client_state.Cquery__client_state): void {\n\tswitch (query.properties.delay_query.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tquery.properties.delay_query.set(\"no\", {});\n\t\t\texecute(query);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(query.properties.delay_query.state);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { ObservableSet } from \"../observableTypes\";\nimport * as ResolveStatus from \"../state/ResolveStatus\";\n\nexport const resolvingReferences = new ObservableSet();\nexport async function referencesResolved(): Promise {\n\treturn resolvingReferences.size.await((value) => value <= 0);\n}\n\nexport function subscribeToReference(reference: api_cs.Cresolve_status): void {\n\tconst subscription = reference.properties.status.subscribe({\n\t\ton_update: () => {\n\t\t\tif (ResolveStatus.isBusyResolving(reference)) {\n\t\t\t\tresolvingReferences.add(reference);\n\t\t\t} else {\n\t\t\t\tresolvingReferences.delete(reference);\n\t\t\t}\n\t\t},\n\t});\n\treference.onDestroy(() => {\n\t\tresolvingReferences.delete(reference);\n\t\tsubscription.unsubscribe();\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport api_application = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport {\n\tjulian_datetime_2_gregorian_datetime,\n\tjulian_datetime_2_js_date,\n\tjulian_date_2_gregorian_date,\n\tjulian_date_2_js_date,\n} from \"../calendar/conversion\";\nimport { Languages, translate } from \"../front/translate\";\nimport { applyToConversion } from \"../widgets/number_converter\";\nimport { numberToLocaleString } from \"../utils\";\nimport { gui_model } from \"../state/ClientState\";\n\nconst number_of_second_per_minute = 60;\nconst number_of_minutes_per_hour = 60;\nconst number_of_seconds_per_hour = number_of_second_per_minute * number_of_minutes_per_hour;\n\nfunction pad(str: string, width: number) {\n\tconst len = Math.max(0, width - str.length);\n\tlet i: number;\n\tlet padded_string = str;\n\tfor (i = 0; i < len; i += 1) {\n\t\tpadded_string = \"0\" + padded_string;\n\t}\n\treturn padded_string;\n}\nfunction mod(x: number, n: number) {\n\treturn x % n;\n}\nfunction nr_of_digits(value: number) {\n\tconst value_parts = value.toString().split(\".\");\n\tlet digits = 0;\n\tif (value_parts.length > 1) {\n\t\tdigits = value_parts[1].length;\n\t}\n\treturn digits;\n}\nexport function serializeHours(hours: number, language?: Languages): string {\n\tlet text_hours = \"\";\n\tconst negative_parity = hours < 0;\n\tif (negative_parity) {\n\t\ttext_hours += \"-\";\n\t}\n\tconst digits = nr_of_digits(hours);\n\tconst nr_of_hours = Number(hours.toFixed(digits));\n\ttext_hours += nr_of_hours + translate(\"hour (short)\", language);\n\n\treturn text_hours;\n}\nexport function serializeMinutes(minutes: number, language?: Languages): string {\n\tlet text_minutes = \"\";\n\tconst negative_parity = minutes < 0;\n\tif (negative_parity) {\n\t\ttext_minutes += \"-\";\n\t}\n\tconst abs_minutes = Math.abs(minutes);\n\tlet has_previous_part = false;\n\tconst digits = nr_of_digits(minutes);\n\n\tconst nr_of_hours = Math.floor(abs_minutes / number_of_minutes_per_hour);\n\tconst minutes_left = mod(abs_minutes, number_of_minutes_per_hour);\n\tconst nr_of_minutes = Number(minutes_left.toFixed(digits));\n\tif (nr_of_hours !== 0) {\n\t\ttext_minutes += nr_of_hours + translate(\"hour (short)\", language);\n\t\thas_previous_part = true;\n\t}\n\tif (has_previous_part) {\n\t\ttext_minutes += pad(\"\" + nr_of_minutes, 2) + translate(\"minutes (short)\", language);\n\t} else {\n\t\ttext_minutes += nr_of_minutes + translate(\"minutes (short)\", language);\n\t}\n\n\treturn text_minutes;\n}\nexport function serializeSeconds(seconds: number, language?: Languages): string {\n\tlet text_seconds = \"\";\n\tconst negative_parity = seconds < 0;\n\tif (negative_parity) {\n\t\ttext_seconds += \"-\";\n\t}\n\tconst digits = nr_of_digits(seconds);\n\tconst abs_seconds = Math.abs(seconds);\n\tlet has_previous_part = false;\n\n\tconst nr_of_hours = Math.floor(abs_seconds / number_of_seconds_per_hour);\n\tlet seconds_left = mod(abs_seconds, number_of_seconds_per_hour);\n\tconst nr_of_minutes = Math.floor(seconds_left / number_of_second_per_minute);\n\tseconds_left = mod(seconds_left, number_of_second_per_minute);\n\tconst nr_of_seconds = Number(seconds_left.toFixed(digits));\n\tif (nr_of_hours !== 0) {\n\t\ttext_seconds += nr_of_hours + translate(\"hour (short)\", language);\n\t\thas_previous_part = true;\n\t}\n\tif (has_previous_part) {\n\t\ttext_seconds += pad(\"\" + nr_of_minutes, 2) + translate(\"minutes (short)\", language);\n\t} else {\n\t\tif (nr_of_minutes !== 0) {\n\t\t\ttext_seconds += nr_of_minutes + translate(\"minutes (short)\", language);\n\t\t\thas_previous_part = true;\n\t\t}\n\t}\n\tif (has_previous_part) {\n\t\ttext_seconds += pad(\"\" + nr_of_seconds, 2) + translate(\"seconds (short)\", language);\n\t} else {\n\t\ttext_seconds += \"\" + nr_of_seconds + translate(\"seconds (short)\", language);\n\t}\n\n\treturn text_seconds;\n}\n\nexport function getDecimalsFromNumericalTypeProperties(\n\tnumerical_type_properties: api_client_state.Cnumerical_type_properties\n): number {\n\tswitch (numerical_type_properties.properties.initialized.state.name) {\n\t\tcase \"no\": {\n\t\t\treturn 0;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = numerical_type_properties.properties.initialized.state.node;\n\t\t\treturn $.properties.decimals.value;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(numerical_type_properties.properties.initialized.state);\n\t}\n}\n\nexport function getStaticDecimalsFromNumericalType(numerical_type: api_application.Cnumerical_types): number {\n\tswitch (numerical_type.properties.ui.properties.represent_as.state.name) {\n\t\tcase \"custom type\": {\n\t\t\tconst custom = numerical_type.properties.ui.properties.represent_as.state.node;\n\t\t\tswitch (custom.properties.properties.properties.conversion.state.name) {\n\t\t\t\tcase \"none\": {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tcase \"point translation\": {\n\t\t\t\t\tconst point_translation = custom.properties.properties.properties.conversion.state.node;\n\t\t\t\t\tswitch (point_translation.properties.decimals.properties.type.state.name) {\n\t\t\t\t\t\tcase \"dynamic\": {\n\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\tconst number = point_translation.properties.decimals.properties.type.state.node;\n\t\t\t\t\t\t\tswitch (number.properties.type.state.name) {\n\t\t\t\t\t\t\t\tcase \"binary expression\": {\n\t\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"constant\": {\n\t\t\t\t\t\t\t\t\tconst $ = number.properties.type.state.node;\n\t\t\t\t\t\t\t\t\treturn $.properties.value.properties.value.value;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"list expression\": {\n\t\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"now in seconds\": {\n\t\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"unary expression\": {\n\t\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn unexpectedState(number.properties.type.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"state\": {\n\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"sticky\": {\n\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"style\": {\n\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn unexpectedState(point_translation.properties.decimals.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(custom.properties.properties.properties.conversion.state);\n\t\t\t}\n\t\t}\n\t\tcase \"date\": {\n\t\t\treturn 0;\n\t\t}\n\t\tcase \"date and time\": {\n\t\t\treturn 0;\n\t\t}\n\t\tcase \"duration\": {\n\t\t\treturn 0;\n\t\t}\n\t\tcase \"model\": {\n\t\t\treturn 0;\n\t\t}\n\t\tdefault:\n\t\t\treturn unexpectedState(numerical_type.properties.ui.properties.represent_as.state);\n\t}\n}\n\nexport function serializeNumber(\n\tnum: number,\n\tdecimals: number,\n\tnumerical_type: api_application.Cnumerical_types,\n\tlanguage?: Languages,\n\tno_locale = false\n): string {\n\tconst gui_numerical_type = gui_model.root.properties.numerical_types.get(numerical_type.key);\n\tif (gui_numerical_type) {\n\t\tswitch (gui_numerical_type.properties.representation_type.state.name) {\n\t\t\tcase \"model\": {\n\t\t\t\tif (no_locale) {\n\t\t\t\t\treturn applyToConversion(num, decimals).toString();\n\t\t\t\t} else {\n\t\t\t\t\treturn numberToLocaleString(applyToConversion(num, decimals));\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase \"date and time\": {\n\t\t\t\tconst max_serializable_julian_time = 8850866716800;\n\t\t\t\tconst min_serializable_julian_time = -8429133283200;\n\t\t\t\tif (num <= max_serializable_julian_time && num >= min_serializable_julian_time) {\n\t\t\t\t\tif (no_locale) {\n\t\t\t\t\t\treturn julian_datetime_2_gregorian_datetime(num).canonicalformat();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn julian_datetime_2_js_date(num).toLocaleString();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn translate(\"out of range\");\n\t\t\t}\n\t\t\tcase \"HTML date and time\": {\n\t\t\t\tconst max_serializable_julian_time = 8850866716800;\n\t\t\t\tconst min_serializable_julian_time = -8429133283200;\n\t\t\t\tif (num <= max_serializable_julian_time && num >= min_serializable_julian_time) {\n\t\t\t\t\treturn julian_datetime_2_gregorian_datetime(num).htmlformat();\n\t\t\t\t}\n\t\t\t\treturn translate(\"out of range\");\n\t\t\t}\n\t\t\tcase \"date\": {\n\t\t\t\tconst max_serializable_julian_date = 102440587;\n\t\t\t\tconst min_serializable_julian_date = -97559413;\n\t\t\t\tif (num <= max_serializable_julian_date && num >= min_serializable_julian_date) {\n\t\t\t\t\tif (no_locale) {\n\t\t\t\t\t\treturn julian_date_2_gregorian_date(num).canonicalformat();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn julian_date_2_js_date(num).toLocaleDateString();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn translate(\"out of range\");\n\t\t\t}\n\t\t\tcase \"duration\": {\n\t\t\t\tconst duration = gui_numerical_type.properties.representation_type.state.node;\n\t\t\t\tswitch (duration.properties.unit.state.name) {\n\t\t\t\t\tcase \"seconds\": {\n\t\t\t\t\t\treturn serializeSeconds(num, language);\n\t\t\t\t\t}\n\t\t\t\t\tcase \"minutes\": {\n\t\t\t\t\t\treturn serializeMinutes(num, language);\n\t\t\t\t\t}\n\t\t\t\t\tcase \"hours\": {\n\t\t\t\t\t\treturn serializeHours(num, language);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (no_locale) {\n\t\t\treturn applyToConversion(num, decimals).toString();\n\t\t} else {\n\t\t\treturn numberToLocaleString(applyToConversion(num, decimals));\n\t\t}\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport * as expressions from \"../state/expressions\";\nimport * as Status from \"../Status\";\nimport { onScalarValue } from \"../../../../../stream\";\n\nexport function initializedStyle(style: api_cs.Cstyle): api_cs.Cyes__initialized__style {\n\tswitch (style.properties.initialized.state.name) {\n\t\tcase \"no\": {\n\t\t\tstyle.properties.initialized.set(\"yes\", {\n\t\t\t\t\"has style\": \"no\",\n\t\t\t});\n\t\t\treturn style.properties.initialized.cast(\"yes\");\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = style.properties.initialized.state.node;\n\t\t\treturn $;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(style.properties.initialized.state);\n\t}\n}\n\ntype SubscribedStyle = {\n\t__style_subscribed: boolean;\n};\nexport function evaluateStyle(\n\tstyle: api_cs.Cyes__initialized__style,\n\texpression: api_app.Cui_expression,\n\tthis_node: api_cs.Cnode\n): void {\n\tconst subscribed_style = style as unknown as SubscribedStyle;\n\tif (subscribed_style.__style_subscribed) {\n\t\treturn;\n\t}\n\tsubscribed_style.__style_subscribed = true;\n\tonScalarValue(\n\t\texpressions.ui_expression(expression)([this_node, null]),\n\t\t(value) => {\n\t\t\tif (style.destroyed) return;\n\t\t\tif (Status.isResolved(value)) {\n\t\t\t\tstyle.properties.has_style.set(\"yes\", {\n\t\t\t\t\ttype: value,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tstyle.properties.has_style.ensure(\"no\", {});\n\t\t\t}\n\t\t},\n\t\t(scalar, subscription) => style.properties.has_style.onDestroy(() => scalar.unsubscribe(subscription))\n\t);\n}\n\nexport function unsetStyle(style: api_cs.Cyes__initialized__style): void {\n\tconst subscribed_style = style as unknown as SubscribedStyle;\n\tsubscribed_style.__style_subscribed = false;\n\tstyle.properties.has_style.ensure(\"no\", {});\n}\n\nexport function hasStyle(state_group: api_app.Cstate_group): boolean {\n\tlet has_state_styles = false;\n\tstate_group.properties.states.forEach((state) => {\n\t\thas_state_styles = has_state_styles || state.properties.ui.properties.has_style.state.name === \"yes\";\n\t});\n\treturn has_state_styles;\n}\n","import { api_configuration } from \"../../common\";\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\n\nfunction onlyEqualityTodo(user_requirement: api_app.Cuser_requirement): boolean {\n\treturn (\n\t\tuser_requirement.properties.expression.properties.type.switch({\n\t\t\tequality: true,\n\t\t\texistence: false,\n\t\t\tcontainment: false,\n\t\t}) &&\n\t\tuser_requirement.properties.has_alternative.switch({\n\t\t\tno: true,\n\t\t\tyes: ($) => onlyEqualityTodo($.properties.alternative),\n\t\t})\n\t);\n}\n\nfunction determineAndTodo(user_requirement: api_app.Cuser_requirement): api_cs.Tcurrent_user[\"and\"] {\n\treturn onlyEqualityTodo(user_requirement) ? [\"no one else\", {}] : [\"others\", {}];\n}\n\nexport function updateTodo(todo: api_cs.Cyes__todo): void {\n\tDatastoreProxy.instance\n\t\t.collectionQuery({\n\t\t\t\"context node path\": createIdPathBuilderFromNode(todo.parent).build(),\n\t\t\tfilters: {\n\t\t\t\t\"todo filter\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: {\n\t\t\t\t\t\t\t\"has steps\": [\"no\", {}],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t\"value filters\": {},\n\t\t\t},\n\t\t\t\"select entries\": \"no\",\n\t\t\t\"collection path\": { \"has steps\": [\"no\", {}] },\n\t\t\taggregates: {},\n\t\t})\n\t\t.then(($) => {\n\t\t\tif (todo.destroyed) return;\n\t\t\t$.properties.context.switch({\n\t\t\t\t\"does not exist\": undefined,\n\t\t\t\texists: ($) => {\n\t\t\t\t\tif ($.properties.amount_of_entries.value > 0) {\n\t\t\t\t\t\ttodo.properties.for_.set(\"current user\", {\n\t\t\t\t\t\t\tand: determineAndTodo(todo.inferences.has_todo().properties.requirement),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"permission denied\": undefined,\n\t\t\t});\n\t\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_client_reply = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_reply.alan_api;\nimport reQuery = require(\"./reQuery\");\nimport * as addClientState from \"../state/addClientState\";\nimport { number_toBackendValue } from \"../widgets/instructions/update\";\nimport * as Collection from \"../state/Collection\";\nimport { iText } from \"../state/Text\";\nimport { iReference } from \"../state/Reference\";\nimport {\n\tregisterSubscription,\n\tgetCollectionUpdatesRegistration,\n\tgetCollectionEntriesRegistration,\n\tgetCollectionKeyRegistration,\n\tgetCollectionRegistrations,\n\tinitializeKeySubscription,\n} from \"../state/registerClientState\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport createIdPathBuilderFromReplyIdPath from \"../navigation/createIdPathBuilderFromReplyIdPath\";\nimport DestructorTree from \"../DestructorTree\";\nimport { nodeEditMode } from \"../state/editMode\";\nimport { Failed, Result } from \"../Status\";\nimport { Sink } from \"../Symbols\";\nimport { iGraph } from \"../state/Graph\";\nimport { iCollection } from \"../state/Collection\";\nimport { iStategroup, iState } from \"../state/Stategroup\";\n\nfunction requeryNodeQueries(node: api_cs.Cnode) {\n\tfor (const $ of node.properties.queries.values()) {\n\t\treQuery.query($.properties.query);\n\t}\n\tfor (const $ of node.properties.attributes.values()) {\n\t\tswitch ($.properties.type.state.name) {\n\t\t\tcase \"operation\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = $.properties.type.state.node;\n\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\trequeryNodeQueries(property.properties.type.state.node.properties.node);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst state_group = property.properties.type.state.node;\n\t\t\t\t\t\tfor (const state of state_group.properties.states.values()) {\n\t\t\t\t\t\t\tswitch (state.properties.is_selected.state.name) {\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\trequeryNodeQueries(state.properties.node);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(state.properties.is_selected.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState($.properties.type.state);\n\t\t}\n\t}\n}\n\nexport function setPropertiesToNotReadable(node: api_cs.Cnode) {\n\tnode.properties.read_permitted.ensure(\"no\", {});\n\tfor (const attribute of node.properties.attributes.values()) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"operation\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t$.properties.is_set.set(\"no\", {});\n\t\t\t\t\t\tconst backend_known = $.properties.backend_known.ensure(\"yes\", {\n\t\t\t\t\t\t\t\"is readable\": [\"no\", {}],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbackend_known.properties.is_readable.ensure(\"no\", {});\n\t\t\t\t\t\t$.properties.is_valid.ensure(\"yes\", {});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\tsetPropertiesToNotReadable($.properties.node);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\tconst backend_known = $.properties.backend_known.ensure(\"yes\", {\n\t\t\t\t\t\t\t\"is readable\": [\"no\", {}],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbackend_known.properties.is_readable.ensure(\"no\", {});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t$.properties.initialized.ensure(\"no\", {});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst text = property.properties.type.state.node;\n\t\t\t\t\t\ttext.properties.backend_known.ensure(\"no\", {});\n\t\t\t\t\t\tswitch (text.properties.navigable.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst $ = text.properties.navigable.state.node;\n\t\t\t\t\t\t\t\t$.properties.resolve_status.properties.status.ensure(\"failed to resolve\", {});\n\t\t\t\t\t\t\t\tfor (const [, rule] of $.properties.rules.properties.rules) {\n\t\t\t\t\t\t\t\t\trule.properties.resolve_status.properties.status.ensure(\"failed to resolve\", {});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(text.properties.navigable.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t}\n\t}\n}\n\nfunction set_number_backend(\n\tnumber: api_cs.Cnumber__type__property,\n\tbackend_value: number,\n\tpermissions?: api_client_reply.Cpermission_data\n) {\n\tnumber.properties.backend_known.set(\"yes\", {\n\t\t\"is readable\": [\n\t\t\t\"yes\",\n\t\t\t{\n\t\t\t\tnumber: backend_value,\n\t\t\t},\n\t\t],\n\t});\n\tswitch (number.properties.is_set.state.name) {\n\t\tcase \"yes\":\n\t\t\tswitch (number.properties.is_editable.state.name) {\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst editable = number.properties.is_editable.state.node;\n\t\t\t\t\tswitch (editable.properties.modified.state.name) {\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst modified = editable.properties.modified.state.node;\n\t\t\t\t\t\t\tif (modified.properties.number.value === backend_value) {\n\t\t\t\t\t\t\t\tnumber_toBackendValue(number);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tnumber_toBackendValue(number);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(editable.properties.modified.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"no\":\n\t\t\t\t\tnumber_toBackendValue(number);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(number.properties.is_editable.state);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"no\":\n\t\t\tnumber_toBackendValue(number);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(number.properties.is_set.state);\n\t}\n\tif (permissions) {\n\t\tconst number_definition = number.inferences.number_type();\n\t\tswitch (number_definition.properties.type.state.name) {\n\t\t\tcase \"derived\":\n\t\t\t\tbreak;\n\t\t\tcase \"base\": {\n\t\t\t\tconst base = number_definition.properties.type.state.node;\n\t\t\t\tswitch (base.properties.type.state.name) {\n\t\t\t\t\tcase \"causal\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"simple\":\n\t\t\t\t\t\tswitch (permissions.properties.permitted.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tnumber.properties.is_editable.ensure(\"no\", {});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tnumber.properties.is_editable.ensure(\"yes\", {\n\t\t\t\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\"edit mode\": nodeEditMode(number.parent.parent.parent),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(permissions.properties.permitted.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(base.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(number_definition.properties.type.state);\n\t\t}\n\t}\n}\n\nfunction set_file_backend(\n\tfile: api_cs.Cfile__type__property,\n\tbackend_value: { token: string; extension: string },\n\tpermissions?: api_client_reply.Cpermission_data\n) {\n\tfile.properties.is_set.set(\"yes\", {\n\t\ttoken: backend_value.token,\n\t\textension: backend_value.extension,\n\t});\n\tfile.properties.is_valid.set(\"yes\", {});\n\tfile.properties.backend_known.set(\"yes\", {\n\t\t\"is readable\": [\n\t\t\t\"yes\",\n\t\t\t{\n\t\t\t\ttoken: backend_value.token,\n\t\t\t\textension: backend_value.extension,\n\t\t\t},\n\t\t],\n\t});\n\tif (permissions) {\n\t\tconst file_definition = file.inferences.file_type();\n\t\tswitch (file_definition.properties.type.state.name) {\n\t\t\tcase \"derived\":\n\t\t\t\tbreak;\n\t\t\tcase \"base\":\n\t\t\t\tswitch (permissions.properties.permitted.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tfile.properties.is_editable.ensure(\"no\", {});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\tfile.properties.is_editable.ensure(\"yes\", {\n\t\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\t\t\"edit mode\": nodeEditMode(file.parent.parent.parent),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(permissions.properties.permitted.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(file_definition.properties.type.state);\n\t\t}\n\t}\n}\n\nexport function updateNodeFromNotificationData(\n\tnode: api_cs.Cnode,\n\tnotification_data: api_client_reply.Cnotification_data,\n\tdestructor: DestructorTree\n): void {\n\tfor (const $property of notification_data.properties.properties.values()) {\n\t\tconst property = node.properties.attributes.get($property.key.entry)?.properties.type.cast(\"property\");\n\t\tif (property) {\n\t\t\tswitch ($property.properties.type.state.name) {\n\t\t\t\tcase \"text\": {\n\t\t\t\t\tconst $text = $property.properties.type.state.node;\n\t\t\t\t\tconst text = property.properties.type.cast(\"text\");\n\t\t\t\t\tswitch ($text.properties.value_update.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\tiText(text).setServerValue($text.properties.value_update.state.node.properties.value);\n\t\t\t\t\t}\n\t\t\t\t\tswitch ($text.properties.reference_update.state.name) {\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst $ = $text.properties.reference_update.state.node;\n\t\t\t\t\t\t\tlet reference_update: Result;\n\t\t\t\t\t\t\tswitch ($.properties.result.state.name) {\n\t\t\t\t\t\t\t\tcase \"node\": {\n\t\t\t\t\t\t\t\t\tconst $$ = $.properties.result.state.node;\n\t\t\t\t\t\t\t\t\treference_update = createIdPathBuilderFromReplyIdPath($$.properties.id_path);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"disconnected\":\n\t\t\t\t\t\t\t\t\treference_update = Failed;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"permission denied\":\n\t\t\t\t\t\t\t\t\treference_update = Failed;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tiReference(text.properties.navigable.cast(\"yes\")).setServerValue(reference_update);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"number\": {\n\t\t\t\t\tconst $number = $property.properties.type.state.node;\n\t\t\t\t\tset_number_backend(property.properties.type.cast(\"number\"), $number.properties.value.value);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"file\": {\n\t\t\t\t\tconst $file = $property.properties.type.state.node;\n\t\t\t\t\tset_file_backend(property.properties.type.cast(\"file\"), {\n\t\t\t\t\t\ttoken: $file.properties.token,\n\t\t\t\t\t\textension: $file.properties.extension,\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"group\": {\n\t\t\t\t\tconst $group = $property.properties.type.state.node;\n\t\t\t\t\tupdateNodeFromNotificationData(\n\t\t\t\t\t\tproperty.properties.type.cast(\"group\").properties.node,\n\t\t\t\t\t\t$group.properties.notification_data,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state group\": {\n\t\t\t\t\tconst $stategroup = $property.properties.type.state.node;\n\t\t\t\t\tconst stategroup = property.properties.type.cast(\"state group\");\n\t\t\t\t\tconst backend_state_def = $stategroup.properties.state.ref.key.ref;\n\t\t\t\t\tconst backend_state = stategroup.properties.states.get(backend_state_def.key)!;\n\t\t\t\t\tswitch ($stategroup.properties.type.state.name) {\n\t\t\t\t\t\tcase \"set\": {\n\t\t\t\t\t\t\tconst $set = $stategroup.properties.type.state.node;\n\t\t\t\t\t\t\tconst new_backend_state = stategroup.properties.states.get(backend_state_def.key)!;\n\t\t\t\t\t\t\tiState(new_backend_state).setServerState();\n\t\t\t\t\t\t\tiStategroup(stategroup).updatePermissions(\n\t\t\t\t\t\t\t\t$set.properties.delete_permitted.properties.permitted.state.name\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tupdateNodeFromSubscriptionResultData(\n\t\t\t\t\t\t\t\tbackend_state.properties.node,\n\t\t\t\t\t\t\t\t$set.properties.initialization_data,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\trequeryNodeQueries(backend_state.properties.node);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"update\": {\n\t\t\t\t\t\t\tconst $update = $stategroup.properties.type.state.node;\n\t\t\t\t\t\t\tswitch (stategroup.properties.initialized.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tstategroup.root.transact(() => {\n\t\t\t\t\t\t\t\t\t\tiState(backend_state).__server_state();\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdateNodeFromNotificationData(\n\t\t\t\t\t\t\t\tbackend_state.properties.node,\n\t\t\t\t\t\t\t\t$update.properties.notification_data,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState($stategroup.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"collection\": {\n\t\t\t\t\tconst $collection = $property.properties.type.state.node;\n\t\t\t\t\tconst collection = property.properties.type.cast(\"collection\");\n\t\t\t\t\tswitch ($collection.properties.value_update.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"updated\":\n\t\t\t\t\t\t\treQuery.queriesForCollectionFromNode(node, collection);\n\t\t\t\t\t\t\t// Remove marked entries\n\t\t\t\t\t\t\tfor (const entry of collection.properties.entries.values()) {\n\t\t\t\t\t\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"remote\": {\n\t\t\t\t\t\t\t\t\t\tconst $ = entry.properties.location.state.node;\n\t\t\t\t\t\t\t\t\t\tswitch ($.properties.marked_for_deletion.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\tiCollection(entry.parent).deleteServerEntry(entry);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState($.properties.marked_for_deletion.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(entry.properties.location.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tiCollection(collection).updateAmountOfRemoteEntries();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"entries\": {\n\t\t\t\t\t\t\tconst $entries = $collection.properties.value_update.state.node;\n\t\t\t\t\t\t\treQuery.queriesForCollectionFromNode(node, collection);\n\n\t\t\t\t\t\t\tswitch ($collection.properties.graph_endpoints_update.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\tswitch ($collection.properties.graph_endpoints_update.state.node.properties.result.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"none\":\n\t\t\t\t\t\t\t\t\t\t\tfor (const ordered_graph of collection.properties.has_ordered_graphs\n\t\t\t\t\t\t\t\t\t\t\t\t.cast(\"yes\")\n\t\t\t\t\t\t\t\t\t\t\t\t.properties.ordered_graphs.values()) {\n\t\t\t\t\t\t\t\t\t\t\t\tiGraph(ordered_graph).setServerSourceValue(Sink);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"endpoints\":\n\t\t\t\t\t\t\t\t\t\t\tfor (const [name, ordered_graph] of collection.properties.has_ordered_graphs.cast(\"yes\")\n\t\t\t\t\t\t\t\t\t\t\t\t.properties.ordered_graphs) {\n\t\t\t\t\t\t\t\t\t\t\t\tiGraph(ordered_graph).setServerSourceValue(\n\t\t\t\t\t\t\t\t\t\t\t\t\t$collection.properties.graph_endpoints_update.state.node.properties.result.state.node.properties.graph_endpoints.get(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\t\t\t\t\t)?.properties.source ?? Sink\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor (const [key, $entry] of $entries.properties.entries) {\n\t\t\t\t\t\t\t\tlet entry = Collection.getInitializedEntryWithKey(collection, key);\n\t\t\t\t\t\t\t\tswitch ($entry.properties.type.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"create\": {\n\t\t\t\t\t\t\t\t\t\tconst $ = $entry.properties.type.state.node;\n\t\t\t\t\t\t\t\t\t\tentry = addClientState.addRemoteEntry(collection, key);\n\t\t\t\t\t\t\t\t\t\tinitializeKeySubscription(entry, key, destructor);\n\t\t\t\t\t\t\t\t\t\tswitch ($.properties.delete_permitted.properties.permitted.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tentry.properties.node.properties.can_be_deleted.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\tentry.properties.key.ref.properties.is_editable.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\tentry.properties.node.properties.can_be_deleted.set(\"yes\", {});\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tupdateNodeFromSubscriptionResultData(entry.properties.node, $.properties.node_data, destructor);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"remove\":\n\t\t\t\t\t\t\t\t\t\tif (entry !== undefined) {\n\t\t\t\t\t\t\t\t\t\t\tiCollection(entry.parent).deleteServerEntry(entry);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"update\": {\n\t\t\t\t\t\t\t\t\t\tconst $ = $entry.properties.type.state.node;\n\t\t\t\t\t\t\t\t\t\tif (entry !== undefined) {\n\t\t\t\t\t\t\t\t\t\t\tupdateNodeFromNotificationData(entry.properties.node, $.properties.node_data, destructor);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState($entry.properties.type.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tiCollection(collection).updateAmountOfRemoteEntries();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState($collection.properties.value_update.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($property.properties.type.state);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function updateNodeFromSubscriptionResultData(\n\tnode: api_cs.Cnode,\n\tsubscription_result_data: api_client_reply.Csubscription_result_data,\n\tdestructor: DestructorTree\n): void {\n\tconst update_permissions = subscription_result_data.properties.update_permitted;\n\tswitch (subscription_result_data.properties.read_permitted.state.name) {\n\t\tcase \"no\":\n\t\t\tsetPropertiesToNotReadable(node);\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst readable = subscription_result_data.properties.read_permitted.state.node;\n\t\t\tfor (const [attribute_name, $att] of readable.properties.attributes) {\n\t\t\t\tconst attribute = node.properties.attributes.get(attribute_name);\n\t\t\t\tif (attribute) {\n\t\t\t\t\tswitch ($att.properties.type.state.name) {\n\t\t\t\t\t\tcase \"command\": {\n\t\t\t\t\t\t\tconst $command = $att.properties.type.state.node;\n\t\t\t\t\t\t\tconst command = attribute.properties.type.cast(\"operation\").properties.type.cast(\"command\");\n\t\t\t\t\t\t\tswitch ($command.properties.execute_permitted.properties.permitted.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\tcommand.properties.execute_permitted.set(\"no\", {});\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\tcommand.properties.execute_permitted.set(\"yes\", {});\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState($command.properties.execute_permitted.properties.permitted.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tregisterSubscription(command, destructor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"property\": {\n\t\t\t\t\t\t\tconst $property = $att.properties.type.state.node;\n\t\t\t\t\t\t\tconst property = attribute.properties.type.cast(\"property\");\n\t\t\t\t\t\t\tswitch ($property.properties.type.state.name) {\n\t\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\t\tconst $text = $property.properties.type.state.node;\n\t\t\t\t\t\t\t\t\tconst text = property.properties.type.cast(\"text\");\n\t\t\t\t\t\t\t\t\tiText(text).setServerValue($text.properties.value);\n\t\t\t\t\t\t\t\t\tiText(text).updatePermissions(update_permissions.properties.permitted.state.name);\n\n\t\t\t\t\t\t\t\t\tswitch ($text.properties.reference_result.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\tlet backend_reference: Result;\n\t\t\t\t\t\t\t\t\t\t\tconst $ = $text.properties.reference_result.state.node;\n\t\t\t\t\t\t\t\t\t\t\tswitch ($.properties.result.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"node\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst $$ = $.properties.result.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackend_reference = createIdPathBuilderFromReplyIdPath($$.properties.id_path);\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"disconnected\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackend_reference = Failed;\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"permission denied\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackend_reference = Failed;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tiReference(text.properties.navigable.cast(\"yes\")).setServerValue(backend_reference);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tregisterSubscription(text, destructor);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\t\tconst $number = $property.properties.type.state.node;\n\t\t\t\t\t\t\t\t\tconst number = property.properties.type.cast(\"number\");\n\t\t\t\t\t\t\t\t\tset_number_backend(number, $number.properties.value.value, update_permissions);\n\t\t\t\t\t\t\t\t\tregisterSubscription(number, destructor);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\t\t\t\tconst $file = $property.properties.type.state.node;\n\t\t\t\t\t\t\t\t\tconst file = property.properties.type.cast(\"file\");\n\t\t\t\t\t\t\t\t\tset_file_backend(\n\t\t\t\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ttoken: $file.properties.token,\n\t\t\t\t\t\t\t\t\t\t\textension: $file.properties.extension,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tupdate_permissions\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tregisterSubscription(file, destructor);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\t\t\t\tconst $group = $property.properties.type.state.node;\n\t\t\t\t\t\t\t\t\tconst group = property.properties.type.cast(\"group\");\n\t\t\t\t\t\t\t\t\tregisterSubscription(group, destructor);\n\t\t\t\t\t\t\t\t\tupdateNodeFromSubscriptionResultData(group.properties.node, $group.properties.node_data, destructor);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\t\tconst $stategroup = $property.properties.type.state.node;\n\t\t\t\t\t\t\t\t\tconst stategroup = property.properties.type.cast(\"state group\");\n\t\t\t\t\t\t\t\t\tconst backend_state = stategroup.properties.states.get($stategroup.properties.state.entry)!;\n\t\t\t\t\t\t\t\t\tiState(backend_state).setServerState();\n\t\t\t\t\t\t\t\t\tiStategroup(stategroup).updatePermissions(\n\t\t\t\t\t\t\t\t\t\t$stategroup.properties.delete_permitted.properties.permitted.state.name\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfor (const [state_name, state] of backend_state.parent.properties.states) {\n\t\t\t\t\t\t\t\t\t\tif ($stategroup.properties.create_permitted.has(state_name)) {\n\t\t\t\t\t\t\t\t\t\t\tstate.properties.create_permitted.set(\"yes\", {});\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tstate.properties.create_permitted.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tregisterSubscription(stategroup, destructor);\n\t\t\t\t\t\t\t\t\tupdateNodeFromSubscriptionResultData(\n\t\t\t\t\t\t\t\t\t\tbackend_state.properties.node,\n\t\t\t\t\t\t\t\t\t\t$stategroup.properties.node_data,\n\t\t\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\t\t\tconst $collection = $property.properties.type.state.node;\n\t\t\t\t\t\t\t\t\tconst collection = property.properties.type.cast(\"collection\");\n\n\t\t\t\t\t\t\t\t\tswitch ($collection.properties.create_permitted.properties.permitted.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\tcollection.properties.can_create_entry.set(\"yes\", {});\n\t\t\t\t\t\t\t\t\t\t\tcollection.properties.is_editable.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\"edit mode\": nodeEditMode(collection.parent.parent.parent),\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\tcollection.properties.can_create_entry.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\tcollection.properties.is_editable.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState($collection.properties.create_permitted.properties.permitted.state);\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tswitch ($collection.properties.graph_endpoints_result.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\tswitch ($collection.properties.graph_endpoints_result.state.node.properties.result.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"none\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (const ordered_graph of collection.properties.has_ordered_graphs\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.cast(\"yes\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.properties.ordered_graphs.values()) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiGraph(ordered_graph).setServerSourceValue(Sink);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"endpoints\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (const [name, ordered_graph] of collection.properties.has_ordered_graphs.cast(\"yes\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.properties.ordered_graphs) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiGraph(ordered_graph).setServerSourceValue(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$collection.properties.graph_endpoints_result.state.node.properties.result.state.node.properties.graph_endpoints.get(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)?.properties.source ?? Sink\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tswitch ($collection.properties.result.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"update\":\n\t\t\t\t\t\t\t\t\t\t\tregisterSubscription(getCollectionUpdatesRegistration(collection), destructor);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"entries\": {\n\t\t\t\t\t\t\t\t\t\t\tconst $entries = $collection.properties.result.state.node;\n\t\t\t\t\t\t\t\t\t\t\tconst subscribe_on_entries = $entries.inferences.subscribe_on_entries();\n\n\t\t\t\t\t\t\t\t\t\t\tfor (const [key, $entry] of $entries.properties.entries) {\n\t\t\t\t\t\t\t\t\t\t\t\tconst entry = addClientState.addRemoteEntry(collection, key);\n\t\t\t\t\t\t\t\t\t\t\t\tconst entry_node = entry.properties.node;\n\t\t\t\t\t\t\t\t\t\t\t\tswitch ($entry.properties.delete_permitted.properties.permitted.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tentry_node.properties.can_be_deleted.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tentry.properties.key.ref.properties.is_editable.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tentry_node.properties.can_be_deleted.set(\"yes\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState($entry.properties.delete_permitted.properties.permitted.state);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tinitializeKeySubscription(entry, key, destructor);\n\t\t\t\t\t\t\t\t\t\t\t\tupdateNodeFromSubscriptionResultData(entry_node, $entry.properties.node_data, destructor);\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t// Collection updates are implicitly also subscribed to\n\t\t\t\t\t\t\t\t\t\t\tregisterSubscription(getCollectionUpdatesRegistration(collection), destructor);\n\t\t\t\t\t\t\t\t\t\t\t// Find entries that were expected in the result but did not exist\n\t\t\t\t\t\t\t\t\t\t\tswitch (subscribe_on_entries.properties.key_filter.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tregisterSubscription(getCollectionEntriesRegistration(collection), destructor);\n\t\t\t\t\t\t\t\t\t\t\t\t\t// walk all the keys in the registration\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst key_registrations = getCollectionRegistrations(collection).keys;\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (const key_registration of key_registrations.values()) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tregisterSubscription(key_registration, destructor);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst $ = subscribe_on_entries.properties.key_filter.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (const [key] of $.properties.keys) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tregisterSubscription(getCollectionKeyRegistration(collection, key), destructor);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(subscribe_on_entries.properties.key_filter.state);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState($collection.properties.result.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tiCollection(collection).updateAmountOfRemoteEntries();\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState($property.properties.type.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState($att.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(subscription_result_data.properties.read_permitted.state);\n\t}\n}\n\nexport function updateNodeFromSubscriptionResult(\n\tnode: api_cs.Cnode,\n\texisting_subscription_context: api_client_reply.Cexists__context__subscription,\n\tdestructor: DestructorTree\n): void {\n\tswitch (existing_subscription_context.properties.delete_permitted.properties.permitted.state.name) {\n\t\tcase \"no\": {\n\t\t\tnode.properties.can_be_deleted.set(\"no\", {});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tnode.properties.can_be_deleted.set(\"yes\", {});\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(existing_subscription_context.properties.delete_permitted.properties.permitted.state);\n\t}\n\tupdateNodeFromSubscriptionResultData(\n\t\tnode,\n\t\texisting_subscription_context.properties.subscription_result_data,\n\t\tdestructor\n\t);\n}\n","import { api_configuration } from \"../../common\";\nimport api_client_reply = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_reply.alan_api;\nimport api_client_request = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport * as mapToIdPathBuilder from \"../state/mapToIdPathBuilder\";\nimport { updateEntriesSelection } from \"../state/selection\";\nimport { getStaticDecimalsFromNumericalType, serializeNumber } from \"./serializeNumber\";\nimport {\n\thasResult,\n\tsubscribeToEntryStyle,\n\tsubscribeToCellNumericalTypeProperties,\n\tsubscribeToStategroupCellStyle,\n\tgetTotalAmountOfLocalEntries,\n\taddResultEntry,\n\tremoveResultEntry,\n\tgetIndexedResultEntries,\n\tremoteQueryEntry,\n\tisSubscribed,\n\tgetPropertyForCell,\n} from \"../state/Query\";\nimport * as Cell from \"../state/Cell\";\nimport { client_state } from \"../state/ClientState\";\nimport { registerIdPath } from \"../state/registerClientState\";\nimport DestructorTree, { addChild } from \"../DestructorTree\";\nimport { getTranslation, subscribeToTranslation } from \"../state/phrases\";\n\nfunction followConditionalChildPath(\n\tid_path: IdPathBuilder,\n\tconditional_child_path: api_client_request.Cconditional_child_path\n): IdPathBuilder {\n\tconst has_steps = conditional_child_path.properties.has_steps.state;\n\tswitch (has_steps.name) {\n\t\tcase \"no\":\n\t\t\treturn id_path;\n\t\tcase \"yes\": {\n\t\t\tconst type = has_steps.node.properties.type.state;\n\t\t\tswitch (type.name) {\n\t\t\t\tcase \"group\":\n\t\t\t\t\treturn followConditionalChildPath(\n\t\t\t\t\t\tid_path.group(type.node.properties.group.ref.parent.parent.key),\n\t\t\t\t\t\thas_steps.node.properties.tail\n\t\t\t\t\t);\n\t\t\t\tcase \"state\":\n\t\t\t\t\treturn followConditionalChildPath(\n\t\t\t\t\t\tid_path.state(type.node.properties.state_group.ref.parent.parent.key, type.node.properties.state.ref.key),\n\t\t\t\t\t\thas_steps.node.properties.tail\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction walkCollectionQueryEntries_impl(\n\tentries_type: api_client_reply.Ccollection_query_entries,\n\tpath_builder: IdPathBuilder,\n\tentry_name: string,\n\ton_entry: (\n\t\tname: string,\n\t\tid_path_builder: IdPathBuilder,\n\t\ttype: api_client_reply.Cno__has_steps__collection_query_entries\n\t) => void\n) {\n\tswitch (entries_type.properties.has_steps.state.name) {\n\t\tcase \"no\": {\n\t\t\ton_entry(entry_name, path_builder, entries_type.properties.has_steps.state.node);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = entries_type.properties.has_steps.state.node;\n\t\t\tconst collection_path = entries_type.input.collection_path().properties.has_steps.cast(\"yes\");\n\t\t\tconst new_path_builder = followConditionalChildPath(path_builder, collection_path.properties.head);\n\t\t\tfor (const [key, entry] of $.properties.entries) {\n\t\t\t\tlet entry_id_path = new_path_builder.collectionEntry(collection_path.properties.collection.entry, key);\n\t\t\t\tswitch (entry.properties.type.state.name) {\n\t\t\t\t\tcase \"candidate\": {\n\t\t\t\t\t\tconst $ = entry.properties.type.state.node;\n\t\t\t\t\t\tswitch ($.properties.reference_result.state.name) {\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tentry_id_path = mapToIdPathBuilder.fromClientReply(\n\t\t\t\t\t\t\t\t\t$.properties.reference_result.state.node.properties.id_path\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState($.properties.reference_result.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"existing entry\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(entry.properties.type.state);\n\t\t\t\t}\n\t\t\t\twalkCollectionQueryEntries_impl(\n\t\t\t\t\tentry.properties.tail,\n\t\t\t\t\tentry_id_path,\n\t\t\t\t\tentry_name.length > 0 ? entry_name + \".\" + key : key,\n\t\t\t\t\ton_entry\n\t\t\t\t);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(entries_type.properties.has_steps.state);\n\t}\n}\nfunction walkCollectionQueryEntries(\n\tcollection_reply: api_client_reply.Cexists__context__collection_query,\n\ton_entry: (\n\t\tname: string,\n\t\tid_path_builder: IdPathBuilder,\n\t\ttype: api_client_reply.Cno__has_steps__collection_query_entries\n\t) => void\n) {\n\tconst entries = collection_reply.properties.entries.state;\n\tswitch (entries.name) {\n\t\tcase \"yes\":\n\t\t\twalkCollectionQueryEntries_impl(\n\t\t\t\tentries.node.properties.entries,\n\t\t\t\tmapToIdPathBuilder.fromClientRequest(collection_reply.parent.inferences.source().properties.context_node_path),\n\t\t\t\t\"\",\n\t\t\t\ton_entry\n\t\t\t);\n\t\t\tbreak;\n\t\tcase \"no\":\n\t}\n}\n\nfunction createIdPathBuilderFromClientReplyIdPath(id_path: api_client_reply.Cid_path__client_reply): IdPathBuilder {\n\tlet builder = IdPathBuilder.create();\n\twhile (id_path.properties.has_steps.state.name === \"yes\") {\n\t\tconst $ = id_path.properties.has_steps.state.node;\n\t\tid_path = $.properties.tail;\n\t\tswitch ($.properties.type.state.name) {\n\t\t\tcase \"collection entry\": {\n\t\t\t\tconst ce = $.properties.type.state.node;\n\t\t\t\tbuilder = builder.collectionEntry(ce.properties.collection.entry, ce.properties.id);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"group\": {\n\t\t\t\tconst g = $.properties.type.state.node;\n\t\t\t\tbuilder = builder.group(g.properties.group.entry);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state\": {\n\t\t\t\tconst s = $.properties.type.state.node;\n\t\t\t\tbuilder = builder.state(s.properties.state_group.entry, s.properties.state.entry);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn builder;\n}\n\nfunction getIdPathFromQueryResult(\n\tsource: api_client_reply.Cno__has_steps__collection_query_entries,\n\tcolumn_name: string\n) {\n\tconst id_path_column = source.properties.properties.properties.properties.get(column_name + \"idpath\");\n\tif (\n\t\tid_path_column &&\n\t\tid_path_column.properties.result.state.name === \"exists\" &&\n\t\tid_path_column.properties.result.state.node.properties.type.state.name === \"id path\"\n\t) {\n\t\treturn createIdPathBuilderFromClientReplyIdPath(\n\t\t\tid_path_column.properties.result.state.node.properties.type.state.node.properties.id_path\n\t\t);\n\t}\n\treturn undefined;\n}\n\nfunction subscribeToEntryExpressions(\n\ttarget: api_cs.Centries__yes__has_result,\n\tsource: api_client_reply.Cno__has_steps__collection_query_entries\n) {\n\tconst destructor = addChild(target);\n\n\tsubscribeToEntryStyle(target, destructor);\n\n\ttarget.properties.cells.forEach((cell) => {\n\t\tconst cell_name = cell.key.entry;\n\t\tswitch (cell.properties.type.state.name) {\n\t\t\tcase \"number\": {\n\t\t\t\tconst number_cell = cell.properties.type.state.node;\n\t\t\t\tconst number_column = number_cell.inferences.column_type();\n\t\t\t\tconst app_number = number_column.inferences.number_type().properties.number.ref.inferences.number();\n\t\t\t\tswitch (app_number.properties.ui.properties.dynamic_numerical_type.state.name) {\n\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\tconst this_node = client_state.properties.root;\n\t\t\t\t\t\tsubscribeToCellNumericalTypeProperties(number_cell, this_node, destructor);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst id_path = getIdPathFromQueryResult(source, cell_name);\n\t\t\t\t\t\tif (id_path) {\n\t\t\t\t\t\t\tsubscribeToCellNumericalTypeProperties(number_cell, registerIdPath(id_path, destructor), destructor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(app_number.properties.ui.properties.dynamic_numerical_type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"file\":\n\t\t\t\tbreak;\n\t\t\tcase \"text\":\n\t\t\t\tbreak;\n\t\t\tcase \"widget\":\n\t\t\t\tbreak;\n\t\t\tcase \"state group\": {\n\t\t\t\tconst state_group_cell = cell.properties.type.state.node;\n\t\t\t\tconst id_path = getIdPathFromQueryResult(source, cell_name);\n\t\t\t\tif (id_path) {\n\t\t\t\t\tsubscribeToStategroupCellStyle(state_group_cell, id_path, destructor);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction updateEntryFromQueryResult(\n\ttarget: api_cs.Centries__yes__has_result,\n\tsource: api_client_reply.Cno__has_steps__collection_query_entries,\n\tentry?: api_cs.Centries__collection\n) {\n\tfor (const [key, target_cell] of target.properties.cells) {\n\t\tconst source_property = source.properties.properties.properties.properties.get(key);\n\t\tif (source_property === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tswitch (source_property.properties.result.state.name) {\n\t\t\tcase \"does not exist\":\n\t\t\t\tCell.unset(target_cell);\n\t\t\t\tbreak;\n\t\t\tcase \"permission denied\":\n\t\t\t\tCell.unset(target_cell);\n\t\t\t\tbreak;\n\t\t\tcase \"exists\": {\n\t\t\t\tconst exists = source_property.properties.result.state.node;\n\t\t\t\tswitch (target_cell.properties.type.state.name) {\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst target_type = target_cell.properties.type.state.node;\n\t\t\t\t\t\tif (entry && getPropertyForCell(entry, target_type)) break;\n\t\t\t\t\t\tconst source_type = exists.properties.type.cast(\"text\");\n\t\t\t\t\t\tconst source_text = source_type.properties.value;\n\t\t\t\t\t\tCell.updateText(target_type, source_text);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\tconst target_type = target_cell.properties.type.state.node;\n\t\t\t\t\t\tif (entry && getPropertyForCell(entry, target_type)) break;\n\t\t\t\t\t\tconst source_type = exists.properties.type.cast(\"file\");\n\t\t\t\t\t\tconst source_token = source_type.properties.token;\n\t\t\t\t\t\tconst source_extension = source_type.properties.extension;\n\t\t\t\t\t\tCell.updateFile(target_type, source_token, source_extension);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst target_type = target_cell.properties.type.state.node;\n\t\t\t\t\t\tif (entry && getPropertyForCell(entry, target_type)) break;\n\t\t\t\t\t\tconst source_type = exists.properties.type.cast(\"number\");\n\t\t\t\t\t\tconst source_number = source_type.properties.value.value;\n\t\t\t\t\t\tconst source_textual_representation = source_type.inferences\n\t\t\t\t\t\t\t.number()\n\t\t\t\t\t\t\t.properties.expression.properties.type.switch({\n\t\t\t\t\t\t\t\t\"number property\": (number_property_expresion) => {\n\t\t\t\t\t\t\t\t\tconst numerical_type =\n\t\t\t\t\t\t\t\t\t\tnumber_property_expresion.properties.signed_number_property.properties.property_name.ref.properties\n\t\t\t\t\t\t\t\t\t\t\t.numerical_type.ref;\n\t\t\t\t\t\t\t\t\treturn serializeNumber(\n\t\t\t\t\t\t\t\t\t\tsource_type.properties.value.value,\n\t\t\t\t\t\t\t\t\t\tgetStaticDecimalsFromNumericalType(numerical_type),\n\t\t\t\t\t\t\t\t\t\tnumerical_type\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcount: () => String(source_type.properties.value.value),\n\t\t\t\t\t\t\t\tdivision: () => String(source_type.properties.value.value),\n\t\t\t\t\t\t\t\tmaximum: () => String(source_type.properties.value.value),\n\t\t\t\t\t\t\t\tminimum: () => String(source_type.properties.value.value),\n\t\t\t\t\t\t\t\tproduct: () => String(source_type.properties.value.value),\n\t\t\t\t\t\t\t\tremainder: () => String(source_type.properties.value.value),\n\t\t\t\t\t\t\t\t\"state based\": () => String(source_type.properties.value.value),\n\t\t\t\t\t\t\t\tsum: () => String(source_type.properties.value.value),\n\t\t\t\t\t\t\t\t\"sum list\": () => String(source_type.properties.value.value),\n\t\t\t\t\t\t\t\tvalue: () => String(source_type.properties.value.value),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tCell.updateNumber(target_type, source_number, source_textual_representation);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst target_type = target_cell.properties.type.state.node;\n\t\t\t\t\t\tif (entry && getPropertyForCell(entry, target_type)) break;\n\t\t\t\t\t\tconst source_type = exists.properties.type.cast(\"state group\");\n\t\t\t\t\t\tconst source_state = source_type.properties.state.entry;\n\t\t\t\t\t\tCell.updateStategroup(target_type, getTranslation(source_state));\n\t\t\t\t\t\taddCellToTranslation(target_type, source_state);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"widget\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\nlet translation_destructor: DestructorTree | undefined;\nconst states_to_translate = new Map();\n\nfunction addCellToTranslation(cell: api_cs.Cstate_group__type__cells, state_name: string) {\n\tstates_to_translate.set(cell, state_name);\n\tcell.onDestroy(() => {\n\t\tstates_to_translate.delete(cell);\n\t});\n\tif (translation_destructor === undefined) {\n\t\ttranslation_destructor = new DestructorTree();\n\t\tsubscribeToTranslation(\n\t\t\t\"\",\n\t\t\ttranslation_destructor,\n\t\t\t() => {\n\t\t\t\tfor (const [cell, state_name] of states_to_translate) {\n\t\t\t\t\tCell.updateStategroup(cell, getTranslation(state_name));\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}\n}\n\nfunction updateTotalAmountOfEntries(\n\tresult: api_client_reply.Cexists__context__collection_query,\n\tquery: api_cs.Cquery__client_state,\n\ttotal_amount_of_entries: number\n) {\n\tquery.properties.has_result.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\t$.set_total_amount_of_entries(total_amount_of_entries);\n\t\t\tresult.properties.entries.switch({\n\t\t\t\tno: () => $.properties.has_more_entries_than_maximum.set(\"no\", {}),\n\t\t\t\tyes: (has_entries) =>\n\t\t\t\t\thas_entries.properties.limit_exceeded.switch({\n\t\t\t\t\t\tno: () => $.properties.has_more_entries_than_maximum.set(\"no\", {}),\n\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t$.properties.has_more_entries_than_maximum.set(\"yes\", {\n\t\t\t\t\t\t\t\t\"can show all\":\n\t\t\t\t\t\t\t\t\tresult.properties.amount_of_entries.value >\n\t\t\t\t\t\t\t\t\tquery.properties.definition.ref.properties.query_limits.properties.absolute_maximum.value\n\t\t\t\t\t\t\t\t\t\t? [\"no\", {}]\n\t\t\t\t\t\t\t\t\t\t: [\"yes\", {}],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t});\n\t\t},\n\t});\n}\n\nexport default function (\n\tresult: api_client_reply.Cexists__context__collection_query,\n\tquery: api_cs.Cquery__client_state\n): void {\n\tconst has_result = hasResult(query);\n\tconst total_amount_of_entries = result.properties.amount_of_entries.value + getTotalAmountOfLocalEntries(query);\n\tupdateTotalAmountOfEntries(result, query, total_amount_of_entries);\n\n\tconst keys = new Set();\n\tlet entries_indexed_on_key = getIndexedResultEntries(has_result);\n\twalkCollectionQueryEntries(result, (name, id_path, result_entry) => {\n\t\tlet entry: api_cs.Centries__yes__has_result;\n\t\tif (entries_indexed_on_key.has(name)) {\n\t\t\tentry = entries_indexed_on_key.get(name)!;\n\t\t} else {\n\t\t\tentry = addResultEntry(has_result, remoteQueryEntry(id_path));\n\t\t\tsubscribeToEntryExpressions(entry, result_entry);\n\t\t}\n\t\tif (isSubscribed(query)) {\n\t\t\tconst initialized = entry.properties.entry_status.properties.initialized.state;\n\t\t\tswitch (initialized.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\tupdateEntryFromQueryResult(entry, result_entry);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"yes\":\n\t\t\t\t\tupdateEntryFromQueryResult(\n\t\t\t\t\t\tentry,\n\t\t\t\t\t\tresult_entry,\n\t\t\t\t\t\tinitialized.node.properties.referenced_node.output.result_node().input.entity().cast(\"entry\")\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"unknown\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tupdateEntryFromQueryResult(entry, result_entry);\n\t\t}\n\t\tkeys.add(name);\n\t});\n\n\t// Cleanup entries that are not in the query result anymore\n\tentries_indexed_on_key = getIndexedResultEntries(has_result);\n\tfor (const [k, entry] of entries_indexed_on_key) {\n\t\tif (!keys.has(k)) {\n\t\t\tswitch (entry.properties.entry_status.properties.initialized.state.name) {\n\t\t\t\tcase \"unknown\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst initialized = entry.properties.entry_status.properties.initialized.state.node;\n\t\t\t\t\tconst referenced_node = initialized.properties.referenced_node.output.result_node();\n\t\t\t\t\tswitch (referenced_node.properties.location.state.name) {\n\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"remote\": {\n\t\t\t\t\t\t\tremoveResultEntry(entry);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(referenced_node.properties.location.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"no\":\n\t\t\t\t\tremoveResultEntry(entry);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(entry.properties.entry_status.properties.initialized.state);\n\t\t\t}\n\t\t}\n\t}\n\n\tupdateEntriesSelection(query);\n}\n","export async function getFileFromWebServer(\n\tfile: string,\n\ttransformation?: (content: string) => R\n): Promise {\n\tconst response = await fetch(file, {\n\t\theaders: {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t},\n\t});\n\tif (transformation === JSON.parse) {\n\t\tif (shouldProxyJSON(file)) {\n\t\t\treturn createViewsProxy(response);\n\t\t} else {\n\t\t\tconst json_value = await response.json();\n\t\t\treturn json_value;\n\t\t}\n\t} else {\n\t\treturn (await response.text()) as unknown as R;\n\t}\n}\n\nexport async function getFilesFromWebserver(\n\tfiles: string[],\n\ttransformation?: (content: string) => R\n): Promise> {\n\tconst result = await Promise.all(\n\t\tfiles.map((file) => getFileFromWebServer(file, transformation).then<[string, R]>((content) => [file, content]))\n\t);\n\treturn result.reduce((p, c) => ((p[c[0]] = c[1]), p), {} as Record);\n}\n\nfunction shouldProxyJSON(file: string) {\n\treturn file.endsWith(\"generated.alan.json\");\n}\n\nasync function createViewsProxy(response: Response): Promise {\n\tconst generated_view = {\n\t\tdependencies: {},\n\t\tviews: {},\n\t};\n\n\tconst reader = response.body!.pipeThrough(new TextDecoderStream());\n\tconst text_reader = reader.getReader();\n\tconst view_content = await parseViewContentLiterally(text_reader);\n\tconst initializedViews = new Map();\n\n\tfor (const key of Object.keys(view_content)) {\n\t\tObject.defineProperty(generated_view.views, key, {\n\t\t\tget: () => {\n\t\t\t\tif (initializedViews.has(key)) {\n\t\t\t\t\treturn initializedViews.get(key);\n\t\t\t\t} else {\n\t\t\t\t\tconst parsed_view = JSON.parse(view_content[key]());\n\t\t\t\t\tinitializedViews.set(key, parsed_view);\n\t\t\t\t\treturn parsed_view;\n\t\t\t\t}\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t}\n\treturn generated_view;\n}\n\nasync function parseViewContentLiterally(stream: ReadableStreamDefaultReader) {\n\t/* eslint-disable no-constant-condition */\n\tlet current_value = \"\";\n\tlet position = 0;\n\tconst views: Record string> = {};\n\n\tconst values: string[] = [];\n\twhile (true) {\n\t\tconst new_value = await stream.read();\n\t\tif (new_value.done) {\n\t\t\tbreak;\n\t\t} else {\n\t\t\tvalues.push(new_value.value);\n\t\t}\n\t}\n\n\tlet current_index = 0;\n\tlet current_value_length = 0;\n\tconst readValue = () => {\n\t\tposition = 0;\n\t\tcurrent_value = values[current_index++];\n\t\tcurrent_value_length = current_value.length;\n\t\treturn current_value;\n\t};\n\n\tconst assertEqual = (expected: string, actual: string) => {\n\t\tif (expected === actual) return;\n\t\tthrow new Error(`Expected value: ${expected} but got: ${actual}`);\n\t};\n\n\tconst nextChar = (): string => {\n\t\tif (position === current_value_length) readValue();\n\t\treturn current_value[position++];\n\t};\n\n\tconst readStringLiteral = () => {\n\t\t// Assume that the starting quotes have been read.\n\t\tconst value: string[] = [];\n\t\twhile (true) {\n\t\t\tch = nextChar();\n\t\t\tif (ch === \"\\\\\") {\n\t\t\t\tvalue.push(ch);\n\t\t\t\tch = nextChar();\n\t\t\t\tvalue.push(ch);\n\t\t\t} else if (ch === '\"') {\n\t\t\t\treturn value.join(\"\");\n\t\t\t} else {\n\t\t\t\tvalue.push(ch);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst readStringLiteralPositions = () => {\n\t\t// Assume that the starting quotes have been read.\n\t\tlet ch = \"\";\n\t\twhile (true) {\n\t\t\tch = nextChar();\n\t\t\tif (ch === \"\\\\\") {\n\t\t\t\tch = nextChar();\n\t\t\t} else if (ch === '\"') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n\n\tconst readObjectLiteral = () => {\n\t\tconst start_chunk = current_index - 1; // because current_index is looking at the next value\n\t\tconst start = position;\n\t\tlet ch = nextChar();\n\t\tlet level = 1;\n\t\tassertEqual(ch, \"{\");\n\t\twhile (true) {\n\t\t\tch = nextChar();\n\t\t\tif (ch === undefined) {\n\t\t\t\treadValue();\n\t\t\t\tch = nextChar();\n\t\t\t}\n\t\t\tswitch (ch) {\n\t\t\t\tcase '\"':\n\t\t\t\t\treadStringLiteralPositions();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"{\":\n\t\t\t\t\tlevel += 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"}\":\n\t\t\t\t\tlevel -= 1;\n\t\t\t\t\tif (level === 0) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstart_chunk: start_chunk,\n\t\t\t\t\t\t\tstart: start,\n\t\t\t\t\t\t\tend_chunk: current_index - 1,\n\t\t\t\t\t\t\tend: position,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t};\n\n\treadValue();\n\tconst header = '{\"dependencies\":{},\"views\":{';\n\tposition = header.length;\n\n\tconst getContent = (positions: { start_chunk: number; start: number; end_chunk: number; end: number }) => {\n\t\tlet content = \"\";\n\t\tlet pos = positions.start;\n\t\tfor (let chunk = positions.start_chunk; chunk <= positions.end_chunk; chunk += 1) {\n\t\t\tif (chunk === positions.end_chunk) {\n\t\t\t\tcontent += values[chunk].substring(pos, positions.end);\n\t\t\t} else {\n\t\t\t\tcontent += values[chunk].substring(pos);\n\t\t\t}\n\t\t\tpos = 0;\n\t\t}\n\t\treturn content;\n\t};\n\tlet ch = nextChar();\n\twhile (true) {\n\t\tif (ch === '\"') {\n\t\t\tconst view_name = readStringLiteral();\n\t\t\tch = nextChar();\n\t\t\tassertEqual(ch, \":\");\n\t\t\tconst positions = readObjectLiteral();\n\t\t\tviews[view_name] = () => getContent(positions);\n\t\t\tch = nextChar();\n\t\t} else if (ch === \",\") {\n\t\t\tch = nextChar();\n\t\t} else if (ch === undefined || ch === \"}\") {\n\t\t\treturn views;\n\t\t} else {\n\t\t\tch = nextChar();\n\t\t}\n\t}\n\t/* eslint-enable no-constant-condition */\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\n\nexport function unset(cell: api_cs.Ccells): void {\n\tswitch (cell.properties.type.state.name) {\n\t\tcase \"text\": {\n\t\t\tconst type = cell.properties.type.state.node;\n\t\t\ttype.properties.is_set.set(\"no\", {});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"file\": {\n\t\t\tconst type = cell.properties.type.state.node;\n\t\t\ttype.properties.is_set.set(\"no\", {});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"number\": {\n\t\t\tconst type = cell.properties.type.state.node;\n\t\t\ttype.properties.is_set.set(\"no\", {});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state group\": {\n\t\t\tconst type = cell.properties.type.state.node;\n\t\t\ttype.properties.is_set.set(\"no\", {});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"widget\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(cell.properties.type.state);\n\t}\n}\n\nexport function updateText(text_cell: api_cs.Ctext__type__cells, value: string): void {\n\tswitch (text_cell.properties.is_set.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst cell_is_set = text_cell.properties.is_set.state.node;\n\t\t\tif (cell_is_set.properties.text !== value) {\n\t\t\t\tcell_is_set.set_text(value);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\ttext_cell.properties.is_set.set(\"yes\", { text: value });\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(text_cell.properties.is_set.state);\n\t}\n}\n\nexport function updateNumber(\n\tnumber_cell: api_cs.Cnumber__type__cells,\n\tvalue: number,\n\ttextual_representation: string\n): void {\n\tswitch (number_cell.properties.is_set.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst cell_is_set = number_cell.properties.is_set.state.node;\n\t\t\tif (cell_is_set.properties.number.value !== value) {\n\t\t\t\tcell_is_set.set_number(value);\n\t\t\t\tcell_is_set.set_textual_representation(textual_representation);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tnumber_cell.properties.is_set.set(\"yes\", {\n\t\t\t\tnumber: value,\n\t\t\t\t\"textual representation\": textual_representation,\n\t\t\t});\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(number_cell.properties.is_set.state);\n\t}\n}\n\nexport function updateFile(file_cell: api_cs.Cfile__type__cells, token: string, extension: string): void {\n\tswitch (file_cell.properties.is_set.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst target_is_set = file_cell.properties.is_set.state.node;\n\t\t\tif (target_is_set.properties.token !== token) {\n\t\t\t\ttarget_is_set.set_token(token);\n\t\t\t}\n\t\t\tif (target_is_set.properties.extension !== extension) {\n\t\t\t\ttarget_is_set.set_extension(extension);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tfile_cell.properties.is_set.set(\"yes\", {\n\t\t\t\ttoken: token,\n\t\t\t\textension: extension,\n\t\t\t});\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(file_cell.properties.is_set.state);\n\t}\n}\n\nexport function updateStategroup(stategroup_cell: api_cs.Cstate_group__type__cells, state: string): void {\n\tswitch (stategroup_cell.properties.is_set.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst cell_is_set = stategroup_cell.properties.is_set.state.node;\n\t\t\tif (cell_is_set.properties.state !== state) {\n\t\t\t\tcell_is_set.set_state(state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tstategroup_cell.properties.is_set.set(\"yes\", {\n\t\t\t\tstate: state,\n\t\t\t\tstyle: { initialized: [\"no\", {}] },\n\t\t\t});\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(stategroup_cell.properties.is_set.state);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport Window = require(\"../widgets/dom/Window\");\nimport { removeQueryEntryDependencies } from \"./Entry\";\n\ntype EntryWithDependencies = {\n\t__id_path_dependencies?: Set;\n};\n\nfunction getDependencies(entry: api_client_state.Centries__collection): Set {\n\tconst entry_with_dependencies = entry as any as EntryWithDependencies;\n\tif (!entry_with_dependencies.__id_path_dependencies) {\n\t\tentry_with_dependencies.__id_path_dependencies = new Set();\n\t}\n\treturn entry_with_dependencies.__id_path_dependencies!;\n}\n\nexport function linkIdPath(id_path: api_client_state.Cclient_id_path): void {\n\tlet has_steps = id_path.properties.has_steps;\n\twhile (has_steps.state.name === \"yes\") {\n\t\tconst step = has_steps.state.node;\n\t\tswitch (step.properties.type.state.name) {\n\t\t\tcase \"group\":\n\t\t\t\tbreak;\n\t\t\tcase \"state\":\n\t\t\t\tbreak;\n\t\t\tcase \"operation\":\n\t\t\t\tbreak;\n\t\t\tcase \"collection entry\": {\n\t\t\t\tconst collection_entry = step.properties.type.state.node;\n\t\t\t\tconst dependencies = getDependencies(collection_entry.properties.entry.ref);\n\t\t\t\tdependencies.add(id_path);\n\t\t\t\tid_path.onDestroy(() => {\n\t\t\t\t\tdependencies.delete(id_path);\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\thas_steps = step.properties.tail.properties.has_steps;\n\t}\n}\n\nexport function handleEntryRemoval(entry: api_client_state.Centries__collection): void {\n\tconst entry_with_dependencies = entry as any as EntryWithDependencies;\n\tif (entry_with_dependencies.__id_path_dependencies !== undefined && !entry.destroyed) {\n\t\tfor (const id_path of entry_with_dependencies.__id_path_dependencies) {\n\t\t\tconst location = id_path.input.location();\n\t\t\tswitch (location.variant.name) {\n\t\t\t\tcase \"view\": {\n\t\t\t\t\tconst view = location.variant.definition;\n\t\t\t\t\tif (!view.destroyed) {\n\t\t\t\t\t\tconst window = view.parent;\n\t\t\t\t\t\tWindow.getWindowInstance(window.key.entry).close_view(view);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"join\": {\n\t\t\t\t\tconst join = location.variant.definition;\n\t\t\t\t\tif (!join.destroyed) {\n\t\t\t\t\t\tjoin.root.transact(() => {\n\t\t\t\t\t\t\tjoin.parent.properties.joined_collection.set(\"unresolved\", {});\n\t\t\t\t\t\t\tfor (const [, entry] of join.parent.properties.entries) {\n\t\t\t\t\t\t\t\tentry.properties.referenced_entry.ensure(\"none\", {});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"query entry\": {\n\t\t\t\t\tconst query_entry = location.variant.definition;\n\t\t\t\t\tif (!query_entry.destroyed) {\n\t\t\t\t\t\tconst requery_needed = entry.properties.location.switch({\n\t\t\t\t\t\t\tremote: ($) =>\n\t\t\t\t\t\t\t\t$.properties.marked_for_deletion.switch({\n\t\t\t\t\t\t\t\t\tyes: false,\n\t\t\t\t\t\t\t\t\tno: true,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tlocal: false,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tremoveQueryEntryDependencies(query_entry.parent, requery_needed);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport gui_definition_types = api_configuration.libraries.gui_definition_lib.types;\nimport { hasMutationPermission } from \"../state 2 interface/permissions\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport { setLanguage } from \"../front/translate\";\nimport { DecoratedSchemas } from \"./schema\";\nimport DestructorTree from \"../DestructorTree\";\nimport { createEmptyRemoteNode } from \"./addClientState\";\nimport { nodeValid } from \"../state/subscribeToNodePropertyValid\";\nimport { nodeModified /*, anyChangesOnNode*/ } from \"../state/subscribeToNodePropertyChange\";\nimport { asRegisterable, getCollectionRegistrations } from \"../state/registerClientState\";\nimport { applyDefaultsWithUpdates, applyingDefaults } from \"../state/defaults\";\nimport { resolvingReferences } from \"../state 2 interface/referenceResolver\";\nimport { loadControls } from \"../widgets/ControlLibrary\";\nimport { getQueryEntryIndex } from \"../state/Query\";\nimport { ObservableNumber } from \"../observableTypes\";\nimport { pendingSubscriptions } from \"../state 2 interface/SubscriptionManager\";\nimport { iText } from \"../state/Text\";\nimport { iStategroup } from \"../state/Stategroup\";\nimport { iCollection } from \"../state/Collection\";\nimport { createVariable } from \"../../../../../stream\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\n\nexport let client_state: api_configuration.types.client_state.alan_api.Cclient_state;\nexport let main: gui_definition_types.main.alan_api.Cmain;\nexport let gui_model: gui_definition_types.gui_model.alan_api.Cgui_model;\nexport let settings: gui_definition_types.settings.alan_api.Csettings;\nexport let client_schemas: DecoratedSchemas;\n\nexport const UNKNOWN_CLIENT_VERSION = \"not yet determined\";\n// eslint-disable-next-line prefer-const\nexport let engine_version = UNKNOWN_CLIENT_VERSION;\n\nexport function getApplicationName(): string {\n\tif (settings && client_state) {\n\t\tconst application_name_phrase = settings.properties.settings.properties.application_name.entry;\n\t\treturn client_state.properties.selected_language.ref.key.ref.properties.translations.get(application_name_phrase)!\n\t\t\t.properties.translation;\n\t}\n\treturn \"\";\n}\n\nexport function initialize(schemas: DecoratedSchemas): void {\n\tclient_schemas = schemas;\n\tmain = schemas.main;\n\tgui_model = schemas.gui_model;\n\tsettings = schemas.settings;\n\tloadControls(schemas.controls);\n\n\tclient_state = api_configuration.types.client_state.alan_api.Cclient_state.create(\n\t\t{\n\t\t\troot: createEmptyRemoteNode(gui_model.properties.root.input.application_node()),\n\t\t\t\"is editable\": [\"no\", {}],\n\t\t\tsession: {\n\t\t\t\tstatus: [\"not authenticated\", {}],\n\t\t\t},\n\t\t\tlanguages: Object.keys(schemas.translations).reduce>(function (l, t) {\n\t\t\t\tl[t] = {\n\t\t\t\t\tlabel: schemas.translations[t].properties.language,\n\t\t\t\t};\n\t\t\t\treturn l;\n\t\t\t}, {}),\n\t\t\t\"selected language\": main.input.settings.properties.settings.properties.default_language.entry,\n\t\t\tmessages: {},\n\t\t\t\"has landing page\": \"no\",\n\t\t\t\"server connection status\": [\"alive\", {}],\n\t\t\t\"network connection status\": [\"alive\", {}],\n\t\t\t\"platform family\": [\"undetermined\", {}],\n\t\t\t\"browser family\": [\"undetermined\", {}],\n\t\t\tversion: \"\",\n\t\t\t\"alt key pressed\": [\"no\", {}],\n\t\t\t\"ctrl key pressed\": [\"no\", {}],\n\t\t\t\"shift key pressed\": [\"no\", {}],\n\t\t\t\"meta key pressed\": [\"no\", {}],\n\t\t\t\"toggle key pressed\": [\"no\", {}],\n\t\t\t\"logo url\": \"engine/static/logo.png\",\n\t\t\t\"logo-sideways url\": \"engine/static/logo-sideways.png\",\n\t\t\t\"report types\": Object.keys(schemas.reports).reduce((types, report) => {\n\t\t\t\ttypes[report] = {};\n\t\t\t\treturn types;\n\t\t\t}, {}),\n\t\t\tmodules: {},\n\t\t\treports: {},\n\t\t\twindows: {},\n\t\t},\n\t\t{\n\t\t\tclient_bindings: schemas.client_bindings,\n\t\t\tgui_model: gui_model,\n\t\t\tapplication: gui_model.input.application,\n\t\t\tlanguages: schemas.translations,\n\t\t\tsettings: settings,\n\t\t\tviews: schemas.views,\n\t\t\twidget: schemas.widgets,\n\t\t\treports: schemas.reports,\n\t\t}\n\t);\n\tclient_state.subscribe_selected_language({\n\t\ton_update: () => {\n\t\t\tclient_state.properties.selected_language.ref.key.ref.properties.engine_language.switch({\n\t\t\t\tdutch: () => setLanguage(\"dutch\"),\n\t\t\t\tenglish: () => setLanguage(\"english\"),\n\t\t\t});\n\t\t},\n\t});\n\tclient_state.properties.session.properties.status.subscribe({\n\t\ton_update: function () {\n\t\t\tclient_state.properties.session.properties.status.switch({\n\t\t\t\tauthenticated: function () {\n\t\t\t\t\thasMutationPermission(IdPathBuilder.create(), (has_permission) => {\n\t\t\t\t\t\tif (has_permission) {\n\t\t\t\t\t\t\tclient_state.properties.is_editable.set(\"yes\", {});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclient_state.properties.is_editable.set(\"no\", {});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\t\"not authenticated\": undefined,\n\t\t\t});\n\t\t},\n\t});\n\tnodeValid(client_state.properties.root).subscribe({ update: () => undefined });\n\tnodeModified(client_state.properties.root).subscribe({ update: () => undefined });\n\t// anyChangesOnNode(client_state.properties.root).subscribe({\n\t// \tupdate: () => {\n\t// \t\t//TODO edg: add and update a client state property\n\t// \t},\n\t// });\n\tapplyDefaultsWithUpdates(client_state.properties.root, new DestructorTree());\n\tcallInitializedHandlers();\n}\nlet initialized = false;\nconst initializedCallbacks = new Set<() => void>();\nexport function onIntialize(callback: () => void): void {\n\tif (initialized) {\n\t\tcallback();\n\t} else {\n\t\tinitializedCallbacks.add(callback);\n\t}\n}\nfunction callInitializedHandlers() {\n\tinitialized = true;\n\tfor (const callback of initializedCallbacks) {\n\t\tcallback();\n\t}\n\tinitializedCallbacks.clear();\n}\n\nexport function getUserNameOrDefault(): string | undefined {\n\tswitch (client_state.properties.session.properties.status.state.name) {\n\t\tcase \"authenticated\": {\n\t\t\tconst $ = client_state.properties.session.properties.status.state.node;\n\t\t\tswitch ($.properties.anonymous_session.state.name) {\n\t\t\t\tcase \"no\": {\n\t\t\t\t\tconst not_anonymous = $.properties.anonymous_session.state.node;\n\t\t\t\t\treturn not_anonymous.properties.username;\n\t\t\t\t}\n\t\t\t\tcase \"yes\":\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($.properties.anonymous_session.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"not authenticated\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(client_state.properties.session.properties.status.state);\n\t}\n\treturn undefined;\n}\n\nconst transaction_requests = new ObservableNumber(0);\nexport function transact(): api_cs.Subscription {\n\ttransaction_requests.increment();\n\treturn {\n\t\tunsubscribe: () => transaction_requests.decrement(),\n\t};\n}\n\nexport function onTransactionEnds(callback: () => void) {\n\ttransaction_requests.subscribeConditional(\n\t\t(requests) => requests === 0,\n\t\t(ended, subscription) => {\n\t\t\tif (ended) {\n\t\t\t\tsubscription.unsubscribe();\n\t\t\t\tcallback();\n\t\t\t}\n\t\t}\n\t);\n}\n\nconst MAXINSTRUCTIONS = 10;\nlet next_instruction_idx = 0;\nconst last_instructions: {\n\tinstruction: string;\n\tdate: number;\n}[] = [];\nexport function logInstruction(context: api_cs.AlanObject, instruction_name: string): void {\n\tconst path = context.path;\n\tlast_instructions[next_instruction_idx] = {\n\t\tinstruction: `${path}:${instruction_name}()`,\n\t\tdate: Date.now(),\n\t};\n\tnext_instruction_idx = (next_instruction_idx + 1) % MAXINSTRUCTIONS;\n}\nexport function listLastInstructions(): string[] {\n\tconst res = [];\n\tfor (let i = 0; i < MAXINSTRUCTIONS; i++) {\n\t\tconst last_instruction = last_instructions[(i + next_instruction_idx) % MAXINSTRUCTIONS];\n\t\tif (last_instruction !== undefined) {\n\t\t\tres.push(new Date(last_instruction.date).toISOString() + \": \" + last_instruction.instruction);\n\t\t}\n\t}\n\treturn res;\n}\n\nexport const ignoreCollectionDefaults = createVariable(false, true);\n\n/// Debugging reports\nfunction nodeStatus(node: api_cs.Cnode): string {\n\tconst valid = node.properties.is_valid.switch({\n\t\tno: \"🔴\",\n\t\tyes: \"\",\n\t});\n\tconst modified = node.properties.modified.switch({\n\t\tyes: \"🔵\",\n\t\tno: \"\",\n\t});\n\treturn `${valid}${modified}`;\n}\n\nfunction generateNodeReport(node: api_cs.Cnode): any {\n\tconst report: any = {};\n\tconst attributes: any = {};\n\tlet has_attributes = false;\n\tlet has_queries = false;\n\tlet child_entries = 0;\n\tlet query_entries = 0;\n\tfor (const [attribute_name, attribute] of node.properties.attributes) {\n\t\thas_attributes = true;\n\t\tlet obj: any = {};\n\t\tlet status: any = [];\n\t\tlet icons = \"\";\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"operation\": {\n\t\t\t\tconst operation = attribute.properties.type.state.node;\n\t\t\t\tswitch (operation.properties.type.state.name) {\n\t\t\t\t\tcase \"action\": {\n\t\t\t\t\t\tconst action = operation.properties.type.state.node;\n\t\t\t\t\t\tconst registration = asRegisterable(action);\n\t\t\t\t\t\tconst refcount = registration.__references?.value ?? \"-\";\n\t\t\t\t\t\tstatus.push(refcount);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"command\": {\n\t\t\t\t\t\tconst command = operation.properties.type.state.node;\n\t\t\t\t\t\tconst registration = asRegisterable(command);\n\t\t\t\t\t\tconst refcount = registration.__references?.value ?? \"-\";\n\t\t\t\t\t\tconst subcount = registration.__subscriptions?.value ?? \"-\";\n\t\t\t\t\t\tstatus.push(`${refcount}/${subcount}`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\toperation.properties.started.switch({\n\t\t\t\t\tno: () => {\n\t\t\t\t\t\tstatus.push(\"not started\");\n\t\t\t\t\t},\n\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\ticons += nodeStatus($.properties.node);\n\t\t\t\t\t\tobj = generateNodeReport($.properties.node);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\ticons += $.properties.is_valid.switch({\n\t\t\t\t\t\t\tno: \"🔴\",\n\t\t\t\t\t\t\tyes: \"\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\ticons += $.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\t\t\t$.properties.modified.switch({\n\t\t\t\t\t\t\t\t\tyes: \"🔵\",\n\t\t\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst value = $.properties.is_set.switch({\n\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\tyes: ($) => '\"' + $.properties.text + '\"',\n\t\t\t\t\t\t});\n\t\t\t\t\t\tstatus.push(value);\n\n\t\t\t\t\t\tconst registration = asRegisterable($);\n\t\t\t\t\t\tconst refcount = registration.__references?.value ?? \"-\";\n\t\t\t\t\t\tconst subcount = registration.__subscriptions?.value ?? \"-\";\n\t\t\t\t\t\tstatus.push(`${refcount}/${subcount}`);\n\n\t\t\t\t\t\t$.properties.navigable.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\ticons += $.properties.resolve_status.properties.status.switch({\n\t\t\t\t\t\t\t\t\t\"failed to resolve\": \"❗️\",\n\t\t\t\t\t\t\t\t\t\"is busy resolving\": \"…\",\n\t\t\t\t\t\t\t\t\tresolved: \"\",\n\t\t\t\t\t\t\t\t\tunresolved: \"❕\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tstatus.push($.properties.resolve_status.properties.status.state.name);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tobj = iText($);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\ticons += $.properties.is_valid.switch({\n\t\t\t\t\t\t\tno: \"🔴\",\n\t\t\t\t\t\t\tyes: \"\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\ticons += $.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\t\t\t$.properties.modified.switch({\n\t\t\t\t\t\t\t\t\tyes: \"🔵\",\n\t\t\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst value = $.properties.is_set.switch({\n\t\t\t\t\t\t\tno: \"-\",\n\t\t\t\t\t\t\tyes: ($) => $.properties.number.value + \"\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\tstatus.push(value);\n\n\t\t\t\t\t\tconst registration = asRegisterable($);\n\t\t\t\t\t\tconst refcount = registration.__references?.value ?? \"-\";\n\t\t\t\t\t\tconst subcount = registration.__subscriptions?.value ?? \"-\";\n\t\t\t\t\t\tstatus.push(`${refcount}/${subcount}`);\n\n\t\t\t\t\t\tobj = $;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\ticons += $.properties.is_valid.switch({\n\t\t\t\t\t\t\tno: \"🔴\",\n\t\t\t\t\t\t\tyes: \"\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\ticons += $.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\t\t\t$.properties.modified.switch({\n\t\t\t\t\t\t\t\t\tyes: \"🔵\",\n\t\t\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst registration = asRegisterable($);\n\t\t\t\t\t\tconst refcount = registration.__references?.value ?? \"-\";\n\t\t\t\t\t\tconst subcount = registration.__subscriptions?.value ?? \"-\";\n\t\t\t\t\t\tstatus.push(`${refcount}/${subcount}`);\n\n\t\t\t\t\t\tobj = $;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\tconst node_status = nodeStatus($.properties.node);\n\t\t\t\t\t\ticons += node_status;\n\n\t\t\t\t\t\tconst registration = asRegisterable($);\n\t\t\t\t\t\tconst refcount = registration.__references?.value ?? \"-\";\n\t\t\t\t\t\tconst subcount = registration.__subscriptions?.value ?? \"-\";\n\t\t\t\t\t\tstatus.push(`${refcount}/${subcount}`);\n\n\t\t\t\t\t\tobj = generateNodeReport($.properties.node);\n\t\t\t\t\t\tchild_entries += obj[\"child entries\"] || 0;\n\t\t\t\t\t\tquery_entries += obj[\"query entries\"] || 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\ticons += $.properties.is_valid.switch({\n\t\t\t\t\t\t\tno: \"🔴\",\n\t\t\t\t\t\t\tyes: \"\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\ticons += $.properties.is_modified.switch({\n\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\tyes: \"🔵\",\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst value = $.properties.is_set.switch({\n\t\t\t\t\t\t\tno: \"-\",\n\t\t\t\t\t\t\tyes: ($) => \"'\" + $.properties.state.entry + \"'\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\tstatus.push(value);\n\n\t\t\t\t\t\tconst registration = asRegisterable($);\n\t\t\t\t\t\tconst refcount = registration.__references?.value ?? \"-\";\n\t\t\t\t\t\tconst subcount = registration.__subscriptions?.value ?? \"-\";\n\t\t\t\t\t\tstatus.push(`${refcount}/${subcount}`);\n\n\t\t\t\t\t\tconst states: any = {};\n\t\t\t\t\t\tfor (const [state_name, state] of $.properties.states) {\n\t\t\t\t\t\t\tconst state_location = state.properties.location.state.name;\n\t\t\t\t\t\t\tconst node_status = nodeStatus(state.properties.node);\n\t\t\t\t\t\t\tconst state_line = state.properties.is_selected.switch({\n\t\t\t\t\t\t\t\tno: `'${state_name}'`,\n\t\t\t\t\t\t\t\tyes: `🔘${node_status}'${state_name}' (${state_location})`,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tstates[state_line] = generateNodeReport(state.properties.node);\n\t\t\t\t\t\t\tchild_entries += state.properties.is_selected.switch({\n\t\t\t\t\t\t\t\tno: 0,\n\t\t\t\t\t\t\t\tyes: states[state_line][\"child entries\"] || 0,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tquery_entries += states[state_line][\"query entries\"] || 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobj[\"states\"] = states;\n\t\t\t\t\t\tobj[\"_$\"] = iStategroup($);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\ticons += $.properties.is_valid.switch({\n\t\t\t\t\t\t\tno: \"🔴\",\n\t\t\t\t\t\t\tyes: \"\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\ticons += $.properties.modified.switch({\n\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\tyes: \"🔵\",\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tlet col_children = 0;\n\t\t\t\t\t\tlet col_query_entries = 0;\n\n\t\t\t\t\t\tconst entries: any = {};\n\t\t\t\t\t\tfor (const [internal_key, entry] of $.properties.entries) {\n\t\t\t\t\t\t\tconst entry_location = entry.properties.location.state.name;\n\t\t\t\t\t\t\tconst entry_key = entry.properties.key.ref?.properties.is_set.switch({\n\t\t\t\t\t\t\t\tno: () => \"\",\n\t\t\t\t\t\t\t\tyes: ($) => $.properties.text,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tlet node_status = nodeStatus(entry.properties.node);\n\t\t\t\t\t\t\tconst deleted = entry.properties.location.switch({\n\t\t\t\t\t\t\t\tlocal: \"\",\n\t\t\t\t\t\t\t\tremote: ($) =>\n\t\t\t\t\t\t\t\t\t$.properties.marked_for_deletion.switch({\n\t\t\t\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\t\t\tnode_status += \"❌\";\n\t\t\t\t\t\t\t\t\t\t\treturn \", deleted\";\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst entry_line = `${node_status}\"${entry_key}\" (${entry_location}${deleted}, [${internal_key}])`;\n\t\t\t\t\t\t\tentries[entry_line] = generateNodeReport(entry.properties.node);\n\t\t\t\t\t\t\tcol_children += 1 + entries[entry_line][\"child entries\"] || 0;\n\t\t\t\t\t\t\tcol_query_entries += entries[entry_line][\"query entries\"] || 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobj[\"entries\"] = entries;\n\n\t\t\t\t\t\tconst registrations = getCollectionRegistrations($);\n\t\t\t\t\t\tconst entries_reg = asRegisterable(registrations.entries);\n\t\t\t\t\t\tconst entries_refcount = entries_reg.__references?.value ?? \"-\";\n\t\t\t\t\t\tconst entries_subcount = entries_reg.__subscriptions?.value ?? \"-\";\n\t\t\t\t\t\tconst updates_reg = asRegisterable(registrations.updates);\n\t\t\t\t\t\tconst updates_refcount = updates_reg.__references?.value ?? \"-\";\n\t\t\t\t\t\tconst updates_subcount = updates_reg.__subscriptions?.value ?? \"-\";\n\t\t\t\t\t\tconst key_regs: any = {};\n\t\t\t\t\t\tfor (const [key, reg] of registrations.keys) {\n\t\t\t\t\t\t\tconst key_reg = asRegisterable(reg);\n\t\t\t\t\t\t\tconst key_refcount = key_reg.__references?.value ?? \"-\";\n\t\t\t\t\t\t\tconst key_subcount = key_reg.__subscriptions?.value ?? \"-\";\n\t\t\t\t\t\t\tkey_regs[key] = `${key_refcount}/${key_subcount}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst reg_obj: any = {};\n\t\t\t\t\t\treg_obj[\"entries\"] = `${entries_refcount}/${entries_subcount}`;\n\t\t\t\t\t\treg_obj[\"updates\"] = `${updates_refcount}/${updates_subcount}`;\n\t\t\t\t\t\treg_obj[`keys (${registrations.keys.size})`] = key_regs;\n\t\t\t\t\t\tobj[`registrations`] = reg_obj;\n\t\t\t\t\t\tobj[\"child entries\"] = col_children;\n\t\t\t\t\t\tobj[\"query entries\"] = col_query_entries;\n\t\t\t\t\t\tchild_entries += col_children;\n\t\t\t\t\t\tquery_entries += col_query_entries;\n\n\t\t\t\t\t\tobj[\"_$\"] = iCollection($);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst kind = property.inferences.property_type().properties.type.state.node.output.value_source().switch({\n\t\t\t\t\tderived: \"derived\",\n\t\t\t\t\tbase: \"\",\n\t\t\t\t});\n\t\t\t\tstatus.push(kind);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Filter out all falsy values and join them\n\t\tstatus = status.filter(Boolean).join(\", \");\n\t\tif (status !== \"\") {\n\t\t\tstatus = \" (\" + status + \")\";\n\t\t}\n\t\tattributes[`${icons}'${attribute_name}'${status}`] = obj;\n\t}\n\tconst queries: any = {};\n\tfor (const [query_name, query] of node.properties.queries) {\n\t\thas_queries = true;\n\t\tconst query_obj: any = {};\n\t\tconst entries: any = {};\n\t\tswitch (query.properties.query.properties.has_result.state.name) {\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = query.properties.query.properties.has_result.state.node;\n\t\t\t\tfor (const [internal_key, entry] of $.properties.entries) {\n\t\t\t\t\tconst key = getQueryEntryIndex(entry.properties.entry_status);\n\t\t\t\t\tconst is_valid = entry.properties.is_valid.switch({\n\t\t\t\t\t\tno: \"🔴\",\n\t\t\t\t\t\tyes: \"\",\n\t\t\t\t\t});\n\t\t\t\t\tconst location = entry.properties.entry_status.properties.initialized.switch({\n\t\t\t\t\t\tno: \"remote\",\n\t\t\t\t\t\tyes: \"local\",\n\t\t\t\t\t\tunknown: \"unknown\",\n\t\t\t\t\t});\n\t\t\t\t\tconst line = `${is_valid}\"${key}\" (${location}, [${internal_key}])`;\n\t\t\t\t\tconst cells: any = {};\n\t\t\t\t\tfor (const [cell_name, cell] of entry.properties.cells) {\n\t\t\t\t\t\tlet value: any;\n\t\t\t\t\t\tswitch (cell.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\tconst $ = cell.properties.type.state.node;\n\t\t\t\t\t\t\t\tvalue = $.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\tyes: ($) => $.properties.text as any,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\tconst $ = cell.properties.type.state.node;\n\t\t\t\t\t\t\t\tvalue = {\n\t\t\t\t\t\t\t\t\tvalue: $.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\t\tyes: ($) => $.properties.number.value as any,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t$.properties.numerical_type_properties.properties.initialized.switch({\n\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t\t\tvalue.decimals = $.properties.decimals.value;\n\t\t\t\t\t\t\t\t\t\tvalue.unit = $.properties.unit;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\t\t\tconst $ = cell.properties.type.state.node;\n\t\t\t\t\t\t\t\tvalue = $.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\tyes: ($) => ($.properties.token + $.properties.extension) as any,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\tconst $ = cell.properties.type.state.node;\n\t\t\t\t\t\t\t\tvalue = $.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\tyes: ($) => $.properties.state as any,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"widget\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcells[\"'\" + cell_name + \"'\"] = value;\n\t\t\t\t\t}\n\t\t\t\t\tentries[line] = { cells: cells, _$: entry };\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t}\n\t\tconst amount_of_entries = Object.keys(entries).length;\n\t\tquery_entries += amount_of_entries;\n\t\tquery_obj[\"entries\"] = entries;\n\t\tquery_obj[\"size\"] = amount_of_entries;\n\t\tquery_obj[\"_$\"] = query.properties.query;\n\t\tqueries[query_name] = query_obj;\n\t}\n\tif (has_attributes) {\n\t\treport[\"attributes\"] = attributes;\n\t\treport[\"child entries\"] = child_entries;\n\t}\n\tif (has_queries) {\n\t\treport[\"queries\"] = queries;\n\t\treport[\"query entries\"] = query_entries;\n\t}\n\treport[\"_$\"] = node;\n\treturn report;\n}\n\nexport function generateClientStateReport(): any {\n\tconst report: any = {};\n\tconst node_status = nodeStatus(client_state.properties.root);\n\treport[` ${node_status} root`] = generateNodeReport(client_state.properties.root);\n\treport[\"applying defaults\"] = applyingDefaults;\n\treport[\"resolving references\"] = resolvingReferences;\n\treport[\"pending subscriptions\"] = pendingSubscriptions;\n\treport[\"subscription count\"] = DatastoreProxy.instance.subscription_counter;\n\treport[\"query count\"] = DatastoreProxy.instance.query_counter;\n\treport[\"permission query count\"] = DatastoreProxy.instance.subscribeOnce_counter;\n\treport[\"version\"] = client_state.properties.version;\n\treport[\"_$\"] = client_state;\n\treturn report;\n}\n\n(window).getClientStateReport = (node?: api_cs.Cnode) => {\n\tif (!node) {\n\t\treturn generateClientStateReport();\n\t} else {\n\t\treturn generateNodeReport(node);\n\t}\n};\n\n(window).shhht_supersecret_devserver_command_generator = () => {\n\tconst url = window.location.href.split(\"#\")[0];\n\tconst token = JSON.parse(window.localStorage.KAUTH)[\"has session\"][1].token;\n\tconst uname = client_state.properties.session.properties.status.switch({\n\t\tauthenticated: ($) =>\n\t\t\t$.properties.anonymous_session.switch({\n\t\t\t\tno: ($) => $.properties.username,\n\t\t\t\tyes: () => \"\",\n\t\t\t}),\n\t\t\"not authenticated\": () => \"\",\n\t});\n\treturn `node build/dev-server/index.js '${url}' --token '${token}' --uname '${uname}' --local-engine --open-browser`;\n};\n\n(window).readablePath = (\n\tthing:\n\t\t| api_cs.Ctext__type__property\n\t\t| api_cs.Cnumber__type__property\n\t\t| api_cs.Cfile__type__property\n\t\t| api_cs.Cgroup__type__property\n\t\t| api_cs.Cstate_group__type__property\n\t\t| api_cs.Ccollection\n\t\t| api_cs.Cnode\n): string => {\n\tlet path = \"\";\n\tif (!(thing instanceof api_cs.Cnode)) {\n\t\tpath = `.'${thing.parent.parent.key_value}'`;\n\t}\n\tlet node = thing.component_root;\n\tlet position: api_cs.Cnode_position | undefined = node.input.position();\n\twhile (position) {\n\t\tswitch (position.variant.name) {\n\t\t\tcase \"entity\": {\n\t\t\t\tconst entity = position.variant.definition.variant;\n\t\t\t\tswitch (entity.name) {\n\t\t\t\t\tcase \"root\":\n\t\t\t\t\t\treturn path;\n\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\tconst entry = entity.definition;\n\t\t\t\t\t\tconst key = entry.properties.key.ref.properties.is_set.switch({\n\t\t\t\t\t\t\tno: () => entry.key.split(\"-\")[0],\n\t\t\t\t\t\t\tyes: ($) => $.properties.text,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tnode = entry.component_root;\n\t\t\t\t\t\tpath = `.'${entry.parent.parent.parent.key_value}'['${key}']${path}`;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"group\": {\n\t\t\t\tconst group = position.variant.definition;\n\t\t\t\tnode = group.component_root;\n\t\t\t\tpath = `.'${group.parent.parent.key_value}'${path}`;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"root\":\n\t\t\t\treturn path;\n\t\t\tcase \"state\": {\n\t\t\t\tconst state = position.variant.definition;\n\t\t\t\tnode = state.component_root;\n\t\t\t\tpath = `'${state.parent.parent.parent.key_value}'?'${state.key_value}'${path}`;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tposition = node.input.position();\n\t}\n\treturn path;\n};\n","export default class ClientStateObjectProxy {}\n","import { api_configuration } from \"common\";\nimport api_collation_table_decorator = api_configuration.libraries.gui_definition_lib.types.collation_table.alan_api;\n\nexport function initializeCollectionTable(raw_collation_table: api_collation_table_decorator.Tcollation_table): void {\n\tconst collation_table = api_collation_table_decorator.Ccollation_table.create(raw_collation_table);\n\tglobal.collation_table = collation_table;\n\tconst collation_table_inverse: Record> = {};\n\tcollation_table.properties.characters.forEach(function ($) {\n\t\t$.properties.type.switch({\n\t\t\talternative: function ($) {\n\t\t\t\tconst primary_key = $.properties.for_.entry;\n\t\t\t\tconst alts = collation_table_inverse[primary_key] || {};\n\t\t\t\talts[$.parent.key] = {};\n\t\t\t\tcollation_table_inverse[primary_key] = alts;\n\t\t\t},\n\t\t\tprimary: function ($) {\n\t\t\t\tconst primary_key = $.parent.key;\n\t\t\t\tconst alts = collation_table_inverse[primary_key] || {};\n\t\t\t\talts[primary_key] = {};\n\t\t\t\tcollation_table_inverse[primary_key] = alts;\n\t\t\t},\n\t\t});\n\t});\n\tglobal.collation_table_inverse = collation_table_inverse;\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { CollectionPathBuilder } from \"../navigation/createCollectionPathBuilder\";\nimport * as Entry from \"./Entry\";\nimport * as Text from \"./Text\";\nimport {\n\tasRegisterable,\n\tgetCollectionEntriesRegistration,\n\tsubscriptionPending,\n\tgetCollectionKeyRegistration,\n} from \"../state/registerClientState\";\nimport { Destructable } from \"../../../../../destructables\";\nimport {\n\tNone,\n\tScalar,\n\tcreateVariable,\n\tcreateDictionary,\n\tcreateExpressionBuilder,\n\tcreateDictionaryExpressionBuilder,\n\tWeakCache,\n\tscalarValue,\n} from \"../../../../../stream\";\nimport { toStream, toVariable, synchronize } from \"../toStream\";\nimport { Pending, Unknown, Failed, Result, isResolved } from \"../Status\";\nimport * as expressions from \"../state/expressions\";\nimport { default as DestructorTree, addChild } from \"../DestructorTree\";\nimport { applyDefaultsWithUpdates } from \"./defaults\";\nimport { addLocalEntry } from \"../state/addClientState\";\nimport { handleEntryRemoval } from \"../state/ClientIdPath\";\nimport { removeAttribute } from \"../state/GarbageCollector\";\nimport { iGraph, ordered_graphs } from \"../state/Graph\";\nimport { iNode } from \"../state/Node\";\nimport { iEntry } from \"../state/Entry\";\nimport ClientStateObjectProxy from \"./ClientStateObjectProxy\";\nimport { hasCollectionCreationPermission } from \"../state 2 interface/permissions\";\nimport { nodeValid, reduceValid, Indirect } from \"../state/subscribeToNodePropertyValid\";\n\nexport const keyEntryMap = WeakCache((collection: api_cs.Ccollection) => {\n\tconst map = createDictionary(\n\t\ttoStream(collection.properties.entries)\n\t\t\t.map(([, entry]) =>\n\t\t\t\ttoStream(entry.properties.location).stateSwitch({\n\t\t\t\t\tremote: (remote) =>\n\t\t\t\t\t\ttoStream(remote.properties.marked_for_deletion).stateSwitch({\n\t\t\t\t\t\t\tyes: () => None as api_cs.Centries__collection | None,\n\t\t\t\t\t\t\tno: () => entry,\n\t\t\t\t\t\t})(),\n\t\t\t\t\tlocal: () => entry,\n\t\t\t\t})()\n\t\t\t)\n\t\t\t.filter()\n\t\t\t.groupBy(([, entry]) => {\n\t\t\t\treturn createExpressionBuilder(entry).pipe((entry) => {\n\t\t\t\t\tconst key_property = entry.properties.key.ref;\n\t\t\t\t\treturn createExpressionBuilder(Text.synchronized(key_property)).pipe((synchronized) => {\n\t\t\t\t\t\tswitch (synchronized) {\n\t\t\t\t\t\t\tcase \"pending\":\n\t\t\t\t\t\t\t\tswitch (key_property.properties.backend_known.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\treturn key_property.properties.backend_known.state.node.properties.value;\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\treturn Pending;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\treturn toStream(key_property.properties.backend_known).stateSwitch({\n\t\t\t\t\t\t\t\t\tyes: (backend_known) => toVariable(backend_known, \"value\"),\n\t\t\t\t\t\t\t\t\tno: () => Unknown as Result,\n\t\t\t\t\t\t\t\t})();\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\treturn toStream(key_property.properties.is_set).stateSwitch({\n\t\t\t\t\t\t\t\t\tyes: (is_set) => toVariable(is_set, \"text\"),\n\t\t\t\t\t\t\t\t\tno: () => \"\",\n\t\t\t\t\t\t\t\t})();\n\t\t\t\t\t\t}\n\t\t\t\t\t})();\n\t\t\t\t})();\n\t\t\t})()\n\t);\n\tconst subscription = map.subscribe({ add: () => undefined, remove: () => undefined });\n\tcollection.onDestroy(() => map.unsubscribe(subscription));\n\treturn map;\n});\n\nexport function getAmountOfLocalEntries(collection: api_cs.Ccollection): number {\n\tlet total = 0;\n\tfor (const entry of collection.properties.entries.values()) {\n\t\tconst location = entry.properties.location.state;\n\t\tswitch (location.name) {\n\t\t\tcase \"remote\":\n\t\t\t\tswitch (location.node.properties.marked_for_deletion.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\ttotal = total - 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"local\":\n\t\t\t\ttotal = total + 1;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn total;\n}\n\nconst initializedEntriesMap = WeakCache((collection: api_cs.Ccollection) => {\n\tconst stream = createDictionary(\n\t\ttoStream(collection.properties.entries)\n\t\t\t.map(([, entry]) =>\n\t\t\t\ttoStream(entry.properties.location).stateSwitch({\n\t\t\t\t\tremote: () => entry,\n\t\t\t\t\tlocal: () =>\n\t\t\t\t\t\ttoStream(entry.properties.node.properties.is_busy_saving).stateSwitch({\n\t\t\t\t\t\t\tno: () => None as api_cs.Centries__collection | None,\n\t\t\t\t\t\t\tyes: () => entry,\n\t\t\t\t\t\t})(),\n\t\t\t\t})()\n\t\t\t)\n\t\t\t.filter()\n\t\t\t.groupBy(([, entry]) =>\n\t\t\t\tcreateExpressionBuilder(entry).pipe((entry) =>\n\t\t\t\t\ttoStream(entry.properties.key.ref.properties.backend_known).stateSwitch({\n\t\t\t\t\t\tyes: (backend_known) => toVariable(backend_known, \"value\"),\n\t\t\t\t\t\tno: () =>\n\t\t\t\t\t\t\ttoStream(entry.properties.key.ref.properties.is_set).stateSwitch({\n\t\t\t\t\t\t\t\tno: () => \"\",\n\t\t\t\t\t\t\t\tyes: ($) => toVariable($, \"text\"),\n\t\t\t\t\t\t\t})(),\n\t\t\t\t\t})()\n\t\t\t\t)()\n\t\t\t)()\n\t);\n\tconst subscription = stream.subscribe({ add: () => undefined, remove: () => undefined });\n\tcollection.onDestroy(() => stream.unsubscribe(subscription));\n\treturn stream;\n});\n\nexport function getInitializedEntryWithKey(\n\tcollection: api_cs.Ccollection,\n\tkey: string\n): api_cs.Centries__collection | undefined {\n\tconst stream = createDictionaryExpressionBuilder(initializedEntriesMap(collection)).get(key)().value;\n\tif (stream === None) return undefined;\n\tconst [entry] = [...stream.entries.values()];\n\treturn scalarValue(entry);\n}\n\nexport function findEntryWithKey(collection: api_cs.Ccollection, key: string): api_cs.Centries__collection | undefined {\n\tfor (const entry of collection.properties.entries.values()) {\n\t\tif (Entry.getKeyValue(entry) === key) return entry;\n\t}\n\treturn undefined;\n}\n\nexport function getEntry(collection: api_cs.Ccollection, key: string): api_cs.Centries__collection | undefined {\n\tconst candidates = new Set();\n\tfor (const entry of collection.properties.entries.values()) {\n\t\tif (Entry.getKeyValue(entry) === key && !Entry.isMarkedForDeletion(entry)) {\n\t\t\tcandidates.add(entry);\n\t\t}\n\t}\n\tif (candidates.size === 1) {\n\t\tconst [candidate] = candidates;\n\t\treturn candidate;\n\t}\n\treturn undefined;\n}\n\nexport function entriesWithKey(collection: api_cs.Ccollection, key: string) {\n\treturn createDictionaryExpressionBuilder(keyEntryMap(collection)).get(key);\n}\n\nexport function isInitialized(collection: api_cs.Ccollection): boolean {\n\tconst node = collection.component_root;\n\tswitch (node.properties.location.state.name) {\n\t\tcase \"local\":\n\t\t\treturn true;\n\t\tcase \"remote\": {\n\t\t\tconst registration = asRegisterable(getCollectionEntriesRegistration(collection));\n\t\t\treturn registration.__subscriptions !== undefined && registration.__subscriptions.count > 0;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(node.properties.location.state);\n\t}\n}\n\nexport function resolveMatrixSourceCollection(\n\tcollection: api_cs.Ccollection,\n\texpression: api_app.Centry_reference_definition\n) {\n\tconst dummy_node = new api_cs.Centries__collection(\n\t\t\"dummy\",\n\t\t{\n\t\t\tlocation: [\n\t\t\t\t\"local\",\n\t\t\t\t{\n\t\t\t\t\t\"modified by\": [\"engine\", {}],\n\t\t\t\t},\n\t\t\t],\n\t\t\tkey: \"\",\n\t\t\tstyle: { initialized: \"no\" },\n\t\t\tnode: {\n\t\t\t\tlocation: [\n\t\t\t\t\t\"local\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"parent location\": \"local\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t\"can be deleted\": \"no\",\n\t\t\t\t\"is busy discarding\": \"no\",\n\t\t\t\t\"is busy saving\": \"no\",\n\t\t\t\t\"is valid\": \"yes\",\n\t\t\t\t\"read permitted\": \"yes\",\n\t\t\t\tattributes: {},\n\t\t\t\tmodified: \"no\",\n\t\t\t\tqueries: {},\n\t\t\t\ttodo: \"no\",\n\t\t\t\t\"report types\": {},\n\t\t\t},\n\t\t},\n\t\tcollection\n\t).properties.node;\n\tconst original_properties = dummy_node.properties;\n\tlet defaults_applied = false;\n\tconst attribute_property_name: keyof api_cs.Cnode[\"properties\"] = \"attributes\";\n\tconst proxy = new Proxy(original_properties, {\n\t\tget(target, p) {\n\t\t\tif (!defaults_applied && p === attribute_property_name) {\n\t\t\t\tdefaults_applied = true;\n\t\t\t\tapplyDefaultsWithUpdates(dummy_node, new DestructorTree());\n\t\t\t}\n\t\t\treturn (target as any)[p];\n\t\t},\n\t});\n\t(dummy_node as any).properties = proxy;\n\treturn createExpressionBuilder(dummy_node).pipe(expressions.entry_reference_definition(expression));\n}\n\nexport function openEntry(collection: api_cs.Ccollection, key: string, destructable: Destructable) {\n\t// Note: temporary solution while Destructables cannot be used to register objects\n\tconst destructor = new DestructorTree();\n\taddChild(destructable, destructor);\n\treturn subscriptionPending(getCollectionKeyRegistration(collection, key))\n\t\t.pipe((pending) => {\n\t\t\tswitch (pending) {\n\t\t\t\tcase true:\n\t\t\t\t\treturn Pending as Pending | api_cs.Centries__collection | Failed;\n\t\t\t\tcase false:\n\t\t\t\t\treturn entriesWithKey(collection, key).pipe((entries) => {\n\t\t\t\t\t\tif (entries === None) {\n\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn createDictionaryExpressionBuilder(entries)\n\t\t\t\t\t\t\t\t.get()\n\t\t\t\t\t\t\t\t.pipe((entry) => (entry === None ? Failed : entry))();\n\t\t\t\t\t\t}\n\t\t\t\t\t})();\n\t\t\t}\n\t\t})\n\t\t.pipe((entry) => {\n\t\t\tif (!isResolved(entry)) return entry;\n\t\t\tiEntry(entry).register(destructor);\n\t\t\treturn entry;\n\t\t});\n}\n\ntype Entry = api_cs.Centries__collection;\n\nclass CollectionInterface extends ClientStateObjectProxy {\n\tgraphs: Set;\n\n\treadonly name = this.collection.parent.parent.key_value;\n\treadonly value_source = this.collection.parent.inferences\n\t\t.property_type()\n\t\t.properties.type.state.node.output.value_source().variant.name;\n\n\tget id_path() {\n\t\treturn createIdPathBuilderFromNode(this.collection.parent.parent.parent);\n\t}\n\n\tconstructor(readonly collection: api_cs.Ccollection) {\n\t\tsuper();\n\t\tthis.graphs = new Set([...ordered_graphs(collection)]);\n\t}\n\n\tfind(key: string): Entry | undefined {\n\t\tconst matches: Entry[] = [];\n\t\tfor (const entry of this.collection.properties.entries.values()) {\n\t\t\tentry.properties.key.ref.properties.is_set.switch({\n\t\t\t\tno: () => undefined,\n\t\t\t\tyes: ($) => {\n\t\t\t\t\tif ($.properties.text === key) {\n\t\t\t\t\t\tmatches.push(entry);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tif (matches.length !== 1) return undefined;\n\t\treturn matches[0];\n\t}\n\n\tupdateServerKeyValue(entry: Entry, value: string) {\n\t\tfor (const graph of this.graphs) {\n\t\t\tgraph.updateServerKeyValue(entry, value);\n\t\t}\n\t}\n\n\taddServerEntry(entry: Entry) {\n\t\tfor (const graph of this.graphs) {\n\t\t\tgraph.addServerEntry(entry);\n\t\t}\n\t}\n\n\t__remove_entry(entry: Entry) {\n\t\thandleEntryRemoval(entry);\n\t\tconst last_created_entry = this.collection.properties.last_created_entry.state;\n\t\tswitch (last_created_entry.name) {\n\t\t\tcase \"entry\":\n\t\t\t\tif (entry.key_value === last_created_entry.node.properties.entry.entry) {\n\t\t\t\t\tthis.collection.properties.last_created_entry.set(\"none\", {});\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"none\":\n\t\t}\n\t\tentry.root.transact(() => {\n\t\t\tremoveAttribute(entry.properties.key.ref.parent.parent);\n\t\t\tentry.parent.properties.entries.delete(entry.key_value);\n\t\t});\n\t}\n\n\tremoveEntry(entry: Entry) {\n\t\tfor (const graph of this.graphs) {\n\t\t\tgraph.removeEntry(entry);\n\t\t}\n\t\tthis.__remove_entry(entry);\n\t\tfor (const graph of this.graphs) {\n\t\t\tgraph.updateSorting();\n\t\t}\n\t}\n\n\tdeleteServerEntry(entry: Entry) {\n\t\tfor (const graph of this.graphs) {\n\t\t\tgraph.deleteServerEntry(entry);\n\t\t}\n\t\tthis.__remove_entry(entry);\n\t\tfor (const graph of this.graphs) {\n\t\t\tgraph.updateSorting();\n\t\t}\n\t}\n\n\t__addEntry(by?: \"user\" | \"engine\", key?: string) {\n\t\treturn addLocalEntry(this.collection, by, key);\n\t}\n\n\taddEntry(by?: \"user\" | \"engine\", key?: string) {\n\t\tconst entry = this.__addEntry(by, key);\n\t\tfor (const graph of this.graphs) {\n\t\t\tgraph.addEntry(entry, by);\n\t\t}\n\t\treturn entry;\n\t}\n\n\tdeleteEntry(entry: Entry) {\n\t\tconst location = entry.properties.location.state;\n\t\tswitch (location.name) {\n\t\t\tcase \"remote\":\n\t\t\t\tlocation.node.properties.marked_for_deletion.ensure(\"yes\", {});\n\t\t\t\tfor (const graph of this.graphs) {\n\t\t\t\t\tgraph.deleteEntry(entry);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"local\":\n\t\t\t\tfor (const graph of this.graphs) {\n\t\t\t\t\tgraph.deleteEntry(entry);\n\t\t\t\t}\n\t\t\t\tthis.__remove_entry(entry);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tdiscard() {\n\t\tfor (const entry of this.collection.properties.entries.values()) {\n\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\tcase \"remote\":\n\t\t\t\t\tentry.properties.location.state.node.properties.marked_for_deletion.ensure(\"no\", {});\n\t\t\t\t\tiNode(entry.properties.node).discard();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"local\":\n\t\t\t\t\tthis.removeEntry(entry);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (const graph of this.graphs) {\n\t\t\tgraph.reset();\n\t\t}\n\t}\n\n\tgraphNodeIsModified(entry: Entry) {\n\t\treturn [...this.graphs].reduce((modified, graph) => modified || graph.getNode(entry)?.isModified(), false);\n\t}\n\n\tclearDefaultEntries() {\n\t\tfor (const entry of this.collection.properties.entries.values()) {\n\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\tcase \"remote\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"local\": {\n\t\t\t\t\tconst local_entry = entry.properties.location.state.node;\n\t\t\t\t\tswitch (local_entry.properties.modified_by.state.name) {\n\t\t\t\t\t\tcase \"user\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"engine\":\n\t\t\t\t\t\t\tfor (const graph of this.graphs) {\n\t\t\t\t\t\t\t\tgraph.deleteEntry(entry);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.__remove_entry(entry);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treadonly amountOflocalEntries = createVariable(\n\t\ttoStream(this.collection.properties.entries)\n\t\t\t.map(([, entry]) =>\n\t\t\t\ttoStream(entry.properties.location).stateSwitch({\n\t\t\t\t\tremote: (remote) =>\n\t\t\t\t\t\ttoStream(remote.properties.marked_for_deletion).stateSwitch({\n\t\t\t\t\t\t\tyes: () => -1,\n\t\t\t\t\t\t\tno: () => 0,\n\t\t\t\t\t\t})(),\n\t\t\t\t\tlocal: () => 1,\n\t\t\t\t})()\n\t\t\t)\n\t\t\t.reduce((total, value) => total + value, 0)(),\n\t\tfalse\n\t);\n\n\tprivate createAmountOfRemoteEntriesQuery() {\n\t\treturn DatastoreProxy.instance\n\t\t\t.collectionQuery({\n\t\t\t\tfilters: {\n\t\t\t\t\t\"todo filter\": [\"no\", {}],\n\t\t\t\t\t\"value filters\": {},\n\t\t\t\t},\n\t\t\t\t\"context node path\": this.id_path.build(),\n\t\t\t\t\"collection path\": CollectionPathBuilder.create().collection(this.name).build(),\n\t\t\t\t\"select entries\": [\"no\", {}],\n\t\t\t\taggregates: {},\n\t\t\t})\n\t\t\t.then((result) => {\n\t\t\t\tswitch (result.properties.context.state.name) {\n\t\t\t\t\tcase \"exists\":\n\t\t\t\t\t\treturn result.properties.context.state.node.properties.amount_of_entries.value;\n\t\t\t\t\tcase \"does not exist\":\n\t\t\t\t\tcase \"permission denied\":\n\t\t\t\t}\n\t\t\t\treturn Failed;\n\t\t\t});\n\t}\n\tprivate amountOfRemoteEntriesUpdater = createVariable<() => Promise>(\n\t\t() => this.createAmountOfRemoteEntriesQuery(),\n\t\ttrue\n\t);\n\tupdateAmountOfRemoteEntries() {\n\t\tthis.amountOfRemoteEntriesUpdater.set(() => this.createAmountOfRemoteEntriesQuery());\n\t}\n\n\treadonly amountOfRemoteEntries = createVariable(\n\t\ttoStream(this.collection.component_root.properties.location).stateSwitch({\n\t\t\tlocal: () => 0,\n\t\t\tremote: () =>\n\t\t\t\tcreateExpressionBuilder(\n\t\t\t\t\tsynchronize(createExpressionBuilder(this.amountOfRemoteEntriesUpdater).pipe((update) => update())())\n\t\t\t\t).pipe((value) => (typeof value === \"number\" ? value : 0))(),\n\t\t})(),\n\t\tfalse\n\t);\n\n\treadonly amountOfEntries = createVariable(\n\t\tcreateExpressionBuilder(this.amountOflocalEntries)\n\t\t\t.and(this.amountOfRemoteEntries)\n\t\t\t.pipe(([local, remote]) => {\n\t\t\t\tconst amount_of_entries = local + remote;\n\t\t\t\tthis.collection.set_amount_of_entries(amount_of_entries);\n\t\t\t\treturn amount_of_entries;\n\t\t\t})(),\n\t\tfalse\n\t);\n\n\treadonly isEmpty = createVariable(\n\t\tcreateExpressionBuilder(this.amountOfEntries).pipe((amount_of_entries) => {\n\t\t\tswitch (amount_of_entries) {\n\t\t\t\tcase 0:\n\t\t\t\t\tthis.collection.properties.is_empty.ensure(\"yes\", {});\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tthis.collection.properties.is_empty\n\t\t\t\t\t\t.ensure(\"no\", {\n\t\t\t\t\t\t\tsize: [\"single\", {}],\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.properties.size.ensure(\"single\", {});\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthis.collection.properties.is_empty\n\t\t\t\t\t\t.ensure(\"no\", {\n\t\t\t\t\t\t\tsize: [\"multiple\", {}],\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.properties.size.ensure(\"multiple\", {});\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn this.collection.properties.is_empty;\n\t\t})(),\n\t\tfalse\n\t);\n\n\tprivate mutationPermissionUpdater = createVariable<() => Promise>(\n\t\t() => new Promise((resolve) => hasCollectionCreationPermission(this.id_path, this.name, resolve)),\n\t\ttrue\n\t);\n\tupdateMutationPermissions() {\n\t\tthis.mutationPermissionUpdater.set(\n\t\t\t() => new Promise((resolve) => hasCollectionCreationPermission(this.id_path, this.name, resolve))\n\t\t);\n\t}\n\n\treadonly canCreateEntry = createVariable(\n\t\ttoStream(this.collection.component_root.properties.location)\n\t\t\t.stateSwitch({\n\t\t\t\tlocal: () => this.value_source === \"base\",\n\t\t\t\tremote: () =>\n\t\t\t\t\tcreateExpressionBuilder(\n\t\t\t\t\t\tsynchronize(createExpressionBuilder(this.mutationPermissionUpdater).pipe((update) => update())())\n\t\t\t\t\t).pipe((value) => value === true)(),\n\t\t\t})\n\t\t\t.pipe((create_permitted) => {\n\t\t\t\tif (create_permitted) {\n\t\t\t\t\tthis.collection.properties.is_editable.ensure(\"yes\", {\n\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t});\n\t\t\t\t\tthis.collection.properties.can_create_entry.ensure(\"yes\", {});\n\t\t\t\t} else {\n\t\t\t\t\tthis.collection.properties.can_create_entry.ensure(\"no\", {});\n\t\t\t\t}\n\t\t\t\treturn create_permitted;\n\t\t\t})(),\n\t\tfalse\n\t);\n\n\treadonly modified = createVariable(\n\t\ttoStream(this.collection.properties.entries)\n\t\t\t.map(([, entry]) =>\n\t\t\t\ttoStream(entry.properties.location).stateSwitch({\n\t\t\t\t\tlocal: ($) =>\n\t\t\t\t\t\ttoStream($.properties.modified_by).stateSwitch({\n\t\t\t\t\t\t\tuser: () => \"user\" as const,\n\t\t\t\t\t\t\tengine: () => \"engine\" as const,\n\t\t\t\t\t\t})(),\n\t\t\t\t\tremote: ($) =>\n\t\t\t\t\t\ttoStream($.properties.marked_for_deletion).stateSwitch({\n\t\t\t\t\t\t\tno: () => \"no\" as const,\n\t\t\t\t\t\t\tyes: () => \"user\" as const,\n\t\t\t\t\t\t})(),\n\t\t\t\t})()\n\t\t\t)\n\t\t\t.reduce((acc: \"no\" | \"user\" | \"engine\", $) => {\n\t\t\t\tif ($ === \"user\") return \"user\";\n\t\t\t\treturn acc === \"no\" ? $ : acc;\n\t\t\t}, \"no\")\n\t\t\t.pipe((modified) => {\n\t\t\t\tif (modified === \"no\") {\n\t\t\t\t\tthis.collection.properties.modified.ensure(\"no\", {});\n\t\t\t\t} else {\n\t\t\t\t\tthis.collection.properties.modified\n\t\t\t\t\t\t.ensure(\"yes\", {\n\t\t\t\t\t\t\tby: modified,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.properties.by.ensure(modified, {});\n\t\t\t\t}\n\t\t\t\treturn modified === \"no\" ? false : true;\n\t\t\t})(),\n\t\tfalse\n\t);\n\n\treadonly entriesAreValid: Scalar = createVariable(\n\t\ttoStream(this.collection.properties.entries)\n\t\t\t.map(([, entry]) =>\n\t\t\t\ttoStream(entry.properties.location).stateSwitch({\n\t\t\t\t\tlocal: () => nodeValid(entry.properties.node),\n\t\t\t\t\tremote: ($) =>\n\t\t\t\t\t\ttoStream($.properties.marked_for_deletion).stateSwitch({\n\t\t\t\t\t\t\tno: () => nodeValid(entry.properties.node),\n\t\t\t\t\t\t\tyes: () => true,\n\t\t\t\t\t\t})(),\n\t\t\t\t})()\n\t\t\t)\n\t\t\t.reduce(reduceValid, true)(),\n\t\tfalse\n\t);\n\n\treadonly cardinalityConstraintViolated = createVariable(\n\t\tthis.collection.inferences.collection_type().properties.cardinality_constraint.properties.constraint.switch({\n\t\t\t\"non empty\": () =>\n\t\t\t\ttoStream(this.collection.component_root.properties.location)\n\t\t\t\t\t.stateSwitch({\n\t\t\t\t\t\tlocal: () => true,\n\t\t\t\t\t\tremote: () => this.modified,\n\t\t\t\t\t})\n\t\t\t\t\t.pipe((modified_or_local) =>\n\t\t\t\t\t\tmodified_or_local\n\t\t\t\t\t\t\t? createExpressionBuilder(this.amountOfEntries).pipe((amount_of_entries) => amount_of_entries <= 0)()\n\t\t\t\t\t\t\t: false\n\t\t\t\t\t)(),\n\t\t\tnone: () => false as Scalar,\n\t\t}),\n\t\tfalse\n\t);\n\n\tisValid = createVariable(\n\t\tcreateExpressionBuilder(this.entriesAreValid)\n\t\t\t.and(this.cardinalityConstraintViolated)\n\t\t\t.pipe(([entries_are_valid, cardinality_constraint_violation]) => {\n\t\t\t\tconst direct_invalid = cardinality_constraint_violation || entries_are_valid === false;\n\t\t\t\tconst indirect_invalid = entries_are_valid === Indirect;\n\t\t\t\tif (direct_invalid || indirect_invalid) {\n\t\t\t\t\tconst invalid = this.collection.properties.is_valid.ensure(\"no\", {\n\t\t\t\t\t\t\"entries are invalid\": [\"no\", {}],\n\t\t\t\t\t\t\"cardinality constraint violation\": [\"no\", {}],\n\t\t\t\t\t});\n\t\t\t\t\tinvalid.properties.entries_are_invalid.ensure(entries_are_valid ? \"no\" : \"yes\", {});\n\t\t\t\t\tinvalid.properties.cardinality_constraint_violation.ensure(\n\t\t\t\t\t\tcardinality_constraint_violation ? \"yes\" : \"no\",\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t\tif (!direct_invalid) {\n\t\t\t\t\t\treturn Indirect;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\tthis.collection.properties.is_valid.ensure(\"yes\", {});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t})(),\n\t\tfalse\n\t);\n}\n\nexport type iCollection = CollectionInterface;\n\nexport const iCollection = WeakCache(\n\t(collection) => new CollectionInterface(collection)\n);\n","import DestructorTree from \"../DestructorTree\";\nimport { api_configuration } from \"../../common\";\nimport { registerText } from \"./registerClientState\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { descendant_object_path } from \"../state/expressions\";\nimport { addChild } from \"../DestructorTree\";\nimport * as Status from \"../Status\";\nimport { linkIdPath } from \"./ClientIdPath\";\nimport { onScalarValue } from \"../../../../../stream\";\n\n//TODO handle collection key clashes\nexport function applyCollectionJoin(join: api_cs.Cyes__joined, destructor: DestructorTree): void {\n\tlet current_id = 0;\n\tconst collection_key_definition = join.parent.inferences.collection_type().properties.key_property.ref;\n\tconst joined_collection_key_definition = collection_key_definition.properties.has_reference\n\t\t.cast(\"yes\")\n\t\t.properties.expression.output.collection().properties.key_property.ref;\n\tconst key_tail = collection_key_definition.properties.has_reference.cast(\"yes\").properties.expression.properties.tail;\n\n\tconst joined_entry_map = new Map();\n\n\tconst remove_entry = (key: string) => {\n\t\tconst joined_entry = joined_entry_map.get(key);\n\t\tif (joined_entry !== undefined) {\n\t\t\tjoin.properties.entries.delete(key);\n\t\t\tjoined_entry_map.delete(joined_entry.key_value);\n\t\t}\n\t};\n\n\tconst remove_collection_entry = (key: string) => {\n\t\tconst joined_entry = joined_entry_map.get(key);\n\t\tif (joined_entry !== undefined) {\n\t\t\tswitch (joined_entry.properties.referenced_entry.state.name) {\n\t\t\t\tcase \"entry\": {\n\t\t\t\t\tjoined_entry.properties.collection_entry.set(\"none\", {});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"none\": {\n\t\t\t\t\tremove_entry(key);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(joined_entry.properties.referenced_entry.state);\n\t\t\t}\n\t\t}\n\t};\n\n\tdestructor.onDestroy(() => {\n\t\tjoined_entry_map.clear();\n\t\tfor (const entry of join.properties.entries.keys()) {\n\t\t\tjoin.properties.entries.delete(entry);\n\t\t}\n\t});\n\n\tconst remove_referenced_entry = (key: string) => {\n\t\tconst joined_entry = joined_entry_map.get(key);\n\t\tif (joined_entry !== undefined) {\n\t\t\tswitch (joined_entry.properties.collection_entry.state.name) {\n\t\t\t\tcase \"entry\": {\n\t\t\t\t\tjoined_entry.properties.referenced_entry.set(\"none\", {});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"none\": {\n\t\t\t\t\tremove_entry(key);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(joined_entry.properties.collection_entry.state);\n\t\t\t}\n\t\t}\n\t};\n\n\tdestructor.subscribeToCollection(\n\t\tjoin.parent.properties.entries,\n\t\t{\n\t\t\ton_add: (entry, entry_destructor) => {\n\t\t\t\tconst text = registerText(collection_key_definition, entry.properties.node, entry_destructor);\n\t\t\t\tlet previous_key: string | undefined = undefined;\n\t\t\t\tconst set_collection_entry = (key: string) => {\n\t\t\t\t\tif (previous_key !== undefined) {\n\t\t\t\t\t\tconst old_joined_entry = joined_entry_map.get(previous_key);\n\t\t\t\t\t\tif (old_joined_entry !== undefined) {\n\t\t\t\t\t\t\tswitch (old_joined_entry.properties.referenced_entry.state.name) {\n\t\t\t\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\t\t\t\told_joined_entry.properties.collection_entry.set(\"none\", {});\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"none\": {\n\t\t\t\t\t\t\t\t\tremove_entry(previous_key);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(old_joined_entry.properties.referenced_entry.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tprevious_key = key;\n\t\t\t\t\tlet joined_entry = joined_entry_map.get(key);\n\t\t\t\t\tif (joined_entry === undefined) {\n\t\t\t\t\t\tconst entry_id = (current_id++).toString();\n\t\t\t\t\t\tjoined_entry = join.properties.entries.create(entry_id, {\n\t\t\t\t\t\t\t\"collection entry\": [\n\t\t\t\t\t\t\t\t\"entry\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tentry: entry.key_value,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\"referenced entry\": \"none\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\tjoined_entry_map.set(key, joined_entry);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjoined_entry.properties.collection_entry.set(\"entry\", {\n\t\t\t\t\t\t\tentry: entry.key_value,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tentry_destructor.subscribeToStategroup(text.properties.is_set, (text_destructor) => {\n\t\t\t\t\tswitch (text.properties.is_set.state.name) {\n\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst is_set = text.properties.is_set.state.node;\n\t\t\t\t\t\t\ttext_destructor.subscribeToText(is_set, \"subscribe_text\", (text_value) => {\n\t\t\t\t\t\t\t\tif (text_value !== previous_key) {\n\t\t\t\t\t\t\t\t\tset_collection_entry(text_value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(text.properties.is_set.state);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tentry_destructor.onDestroy(() => {\n\t\t\t\t\tif (previous_key !== undefined) {\n\t\t\t\t\t\tremove_collection_entry(previous_key);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\ttrue\n\t);\n\n\tdestructor.subscribeToStategroup(join.properties.joined_collection, (joined_collection_destructor) => {\n\t\tswitch (join.properties.joined_collection.state.name) {\n\t\t\tcase \"resolved\": {\n\t\t\t\tconst resolved = join.properties.joined_collection.state.node;\n\t\t\t\tlinkIdPath(resolved.properties.referenced_node);\n\n\t\t\t\tjoined_collection_destructor.subscribeToCollection(\n\t\t\t\t\tresolved.properties.collection.ref.properties.entries,\n\t\t\t\t\t{\n\t\t\t\t\t\ton_add: (entry, entry_destructor) => {\n\t\t\t\t\t\t\tconst text = registerText(joined_collection_key_definition, entry.properties.node, entry_destructor);\n\t\t\t\t\t\t\tlet previous_key: string | undefined = undefined;\n\t\t\t\t\t\t\tlet valid_candidate = false;\n\t\t\t\t\t\t\tconst set_collection_entry = () => {\n\t\t\t\t\t\t\t\tlet key: string | undefined;\n\t\t\t\t\t\t\t\tswitch (text.properties.is_set.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tconst is_set = text.properties.is_set.state.node;\n\t\t\t\t\t\t\t\t\t\tkey = is_set.properties.text;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(text.properties.is_set.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (key === undefined || key === previous_key || !valid_candidate) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (previous_key !== undefined) {\n\t\t\t\t\t\t\t\t\tconst old_joined_entry = joined_entry_map.get(previous_key);\n\t\t\t\t\t\t\t\t\tif (old_joined_entry !== undefined) {\n\t\t\t\t\t\t\t\t\t\tswitch (old_joined_entry.properties.referenced_entry.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\t\t\t\t\t\t\told_joined_entry.properties.referenced_entry.set(\"none\", {});\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcase \"none\": {\n\t\t\t\t\t\t\t\t\t\t\t\tremove_entry(previous_key);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(old_joined_entry.properties.referenced_entry.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tprevious_key = key;\n\t\t\t\t\t\t\t\tlet joined_entry = joined_entry_map.get(key);\n\t\t\t\t\t\t\t\tif (joined_entry === undefined) {\n\t\t\t\t\t\t\t\t\tconst entry_id = (current_id++).toString();\n\t\t\t\t\t\t\t\t\tjoined_entry = join.properties.entries.create(entry_id, {\n\t\t\t\t\t\t\t\t\t\t\"referenced entry\": [\n\t\t\t\t\t\t\t\t\t\t\t\"entry\",\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tentry: entry.key_value,\n\t\t\t\t\t\t\t\t\t\t\t\t\"can create entry\": \"no\",\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\"collection entry\": \"none\",\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tjoined_entry_map.set(key, joined_entry);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tjoined_entry.properties.referenced_entry.set(\"entry\", {\n\t\t\t\t\t\t\t\t\t\tentry: entry.key_value,\n\t\t\t\t\t\t\t\t\t\t\"can create entry\": \"no\",\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tentry_destructor.subscribeToStategroup(join.parent.properties.can_create_entry, () => {\n\t\t\t\t\t\t\t\t\tswitch (joined_entry!.properties.referenced_entry.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\t\t\t\t\t\tconst entry = joined_entry!.properties.referenced_entry.state.node;\n\t\t\t\t\t\t\t\t\t\t\tswitch (join.parent.properties.can_create_entry.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (entry.properties.can_create_entry.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tentry.properties.can_create_entry.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(entry.properties.can_create_entry.state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (entry.properties.can_create_entry.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tentry.properties.can_create_entry.set(\"yes\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(entry.properties.can_create_entry.state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(join.parent.properties.can_create_entry.state);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"none\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState(joined_entry!.properties.referenced_entry.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tconst unset_collection_entry = () => {\n\t\t\t\t\t\t\t\tif (previous_key === undefined) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tremove_referenced_entry(previous_key);\n\t\t\t\t\t\t\t\tprevious_key = undefined;\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\tconst tail_expression = descendant_object_path(key_tail)(entry.properties.node);\n\t\t\t\t\t\t\tonScalarValue(\n\t\t\t\t\t\t\t\ttail_expression,\n\t\t\t\t\t\t\t\t(tail_context) => {\n\t\t\t\t\t\t\t\t\t//TODO how to distinguish insufficient rights?\n\t\t\t\t\t\t\t\t\t//TODO edg: add insufficient rights option to Async enum?\n\t\t\t\t\t\t\t\t\t// switch (tail_context.type) {\n\t\t\t\t\t\t\t\t\t// \tcase \"insufficient rights\": {\n\t\t\t\t\t\t\t\t\t// \t\tvalid_candidate = true;\n\t\t\t\t\t\t\t\t\t// \t\tset_collection_entry();\n\t\t\t\t\t\t\t\t\t// \t\tbreak;\n\t\t\t\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t\t\t\t// \tcase \"unexpected\": {\n\t\t\t\t\t\t\t\t\t// \t\tvalid_candidate = false;\n\t\t\t\t\t\t\t\t\t// \t\tunset_collection_entry();\n\t\t\t\t\t\t\t\t\t// \t\tbreak;\n\t\t\t\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t\t\t\t// \tcase \"dependency not set\": {\n\t\t\t\t\t\t\t\t\t// \t\tvalid_candidate = false;\n\t\t\t\t\t\t\t\t\t// \t\tunset_collection_entry();\n\t\t\t\t\t\t\t\t\t// \t\tbreak;\n\t\t\t\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t\t\t\t// \tdefault:\n\t\t\t\t\t\t\t\t\t// \t\tunexpectedState(tail_context.type);\n\t\t\t\t\t\t\t\t\t// }\n\t\t\t\t\t\t\t\t\tif (Status.isResolved(tail_context)) {\n\t\t\t\t\t\t\t\t\t\tvalid_candidate = true;\n\t\t\t\t\t\t\t\t\t\tset_collection_entry();\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tvalid_candidate = false;\n\t\t\t\t\t\t\t\t\t\tunset_collection_entry();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t(scalar, subscription) => entry_destructor.onDestroy(() => scalar.unsubscribe(subscription))\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tentry_destructor.subscribeToStategroup(text.properties.is_set, (text_destructor) => {\n\t\t\t\t\t\t\t\tswitch (text.properties.is_set.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tconst is_set = text.properties.is_set.state.node;\n\t\t\t\t\t\t\t\t\t\ttext_destructor.subscribeToText(is_set, \"subscribe_text\", () => {\n\t\t\t\t\t\t\t\t\t\t\tset_collection_entry();\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(text.properties.is_set.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tentry_destructor.onDestroy(() => {\n\t\t\t\t\t\t\t\tif (previous_key !== undefined) {\n\t\t\t\t\t\t\t\t\tremove_referenced_entry(previous_key);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\ttrue\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"unresolved\": {\n\t\t\t\tfor (const [key] of join.properties.entries) {\n\t\t\t\t\tremove_referenced_entry(key);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(join.properties.joined_collection.state);\n\t\t}\n\t});\n\tsetCollectionJoinSizeSubscriptions(join);\n}\n\nexport function setCollectionJoinSizeSubscriptions(join: api_cs.Cyes__joined): void {\n\tconst destructor = addChild(join);\n\n\tdestructor.subscribeToCollection(\n\t\tjoin.properties.entries,\n\t\t{\n\t\t\ton_change: () => {\n\t\t\t\tconst collection_size = join.properties.entries.size;\n\t\t\t\tjoin.set_amount_of_entries(collection_size);\n\t\t\t\tswitch (collection_size) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\tswitch (join.properties.is_empty.state.name) {\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tjoin.properties.is_empty.set(\"yes\", {});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(join.properties.is_empty.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tswitch (join.properties.is_empty.state.name) {\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tjoin.properties.is_empty.set(\"no\", {\n\t\t\t\t\t\t\t\t\tsize: [\"single\", {}],\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\tconst $ = join.properties.is_empty.state.node;\n\t\t\t\t\t\t\t\tswitch ($.properties.size.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"single\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"multiple\":\n\t\t\t\t\t\t\t\t\t\t$.properties.size.set(\"single\", {});\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState($.properties.size.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(join.properties.is_empty.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tswitch (join.properties.is_empty.state.name) {\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tjoin.properties.is_empty.set(\"no\", {\n\t\t\t\t\t\t\t\t\tsize: [\"multiple\", {}],\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\tconst $ = join.properties.is_empty.state.node;\n\t\t\t\t\t\t\t\tswitch ($.properties.size.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"single\":\n\t\t\t\t\t\t\t\t\t\t$.properties.size.set(\"multiple\", {});\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"multiple\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState($.properties.size.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(join.properties.is_empty.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t/*init=*/ true\n\t);\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport DestructorTree from \"../DestructorTree\";\nimport { updateEntriesSelection } from \"./selection\";\nimport { removeResultEntry } from \"./Query\";\nimport * as Text from \"../state/Text\";\nimport { getCollectionRegistrations, registrationInitialized } from \"../state/registerClientState\";\nimport * as requery from \"../state 2 interface/reQuery\";\nimport { None, ScalarProvider, WeakCache, createVariable, createExpressionBuilder } from \"../../../../../stream\";\nimport { toStream } from \"../toStream\";\nimport { entriesWithKey } from \"./Collection\";\nimport {\n\tregister,\n\tsubscriptionPending,\n\tgetCollectionKeyRegistration,\n\tregisterObjectPathTail,\n\tregisterStategroup,\n\tregisterText,\n} from \"../state/registerClientState\";\nimport { Failed } from \"../Status\";\nimport ClientStateObjectProxy from \"./ClientStateObjectProxy\";\nimport { iCollection } from \"../state/Collection\";\nimport { DestructorSet, addChild } from \"../../../../../destructables\";\n\nexport function removeQueryEntryDependencies(\n\tquery_entry_status: api_cs.Cquery_entry_status,\n\trequery_needed: boolean\n): void {\n\tif (query_entry_status.destroyed) {\n\t\treturn;\n\t}\n\tconst query = query_entry_status.input.query();\n\tconst has_result = query.properties.has_result.state;\n\tconst position = query_entry_status.input.position().variant;\n\tswitch (position.name) {\n\t\tcase \"result entry\":\n\t\t\tswitch (position.definition.properties.is_selected.state.name) {\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst selected_entry = position.definition.properties.is_selected.state.node.properties.selected_entry.ref;\n\t\t\t\t\tposition.definition.properties.is_selected.set(\"no\", {});\n\t\t\t\t\tselected_entry.parent.properties.selected_entries.delete(selected_entry.key);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"no\":\n\t\t\t}\n\t\t\tremoveResultEntry(position.definition);\n\t\t\tif (requery_needed) {\n\t\t\t\trequery.execute(position.definition.parent.parent);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"selected entry\": {\n\t\t\tconst selected_entry = position.definition;\n\t\t\tswitch (has_result.name) {\n\t\t\t\tcase \"yes\":\n\t\t\t\t\tfor (const entry of has_result.node.properties.entries.values()) {\n\t\t\t\t\t\tconst is_selected = entry.properties.is_selected.state;\n\t\t\t\t\t\tswitch (is_selected.name) {\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tif (is_selected.node.properties.selected_entry.ref === selected_entry) {\n\t\t\t\t\t\t\t\t\tentry.properties.is_selected.set(\"no\", {});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"no\":\n\t\t\t}\n\t\t\tselected_entry.parent.properties.selected_entries.delete(selected_entry.key);\n\t\t\tbreak;\n\t\t}\n\t}\n\tupdateEntriesSelection(query);\n\tswitch (has_result.name) {\n\t\tcase \"yes\":\n\t\t\thas_result.node.set_total_amount_of_entries(has_result.node.properties.total_amount_of_entries.value - 1);\n\t\t\tbreak;\n\t\tcase \"no\":\n\t}\n}\n\nexport function isMarkedForDeletion(entry: api_cs.Centries__collection): boolean {\n\tswitch (entry.properties.location.state.name) {\n\t\tcase \"remote\": {\n\t\t\tconst $ = entry.properties.location.state.node;\n\t\t\tswitch ($.properties.marked_for_deletion.state.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\treturn false;\n\t\t\t\tcase \"yes\":\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"local\":\n\t\t\treturn false;\n\t}\n}\n\nexport function getKeyValue(entry: api_cs.Centries__collection): string | undefined {\n\treturn Text.getValue(entry.properties.key.ref);\n}\n\nexport function getKeyBackendValue(entry: api_cs.Centries__collection): string | undefined {\n\treturn Text.getBackendValue(entry.properties.key.ref);\n}\n\nexport function getIndex(entry: api_cs.Centries__collection): string | undefined {\n\tswitch (entry.properties.location.state.name) {\n\t\tcase \"local\":\n\t\t\t// Local entries are indexed by their internal key, because that is guaranteed to be unique\n\t\t\treturn entry.key;\n\t\tcase \"remote\":\n\t\t\t// Remote entries are indexed by their backend key, because that is unique on the server\n\t\t\treturn getKeyBackendValue(entry);\n\t\tdefault:\n\t\t\tunexpectedState(entry.properties.location.state);\n\t}\n}\n\nexport function keyInitialized(entry: api_cs.Centries__collection): Promise {\n\tconst value = Text.getValue(entry.properties.key.ref);\n\tif (value === undefined) {\n\t\treturn Promise.resolve();\n\t} else {\n\t\tconst key_registration = getCollectionRegistrations(entry.parent).keys.get(value);\n\t\tif (key_registration) {\n\t\t\treturn registrationInitialized(key_registration);\n\t\t} else {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t}\n}\n\nclass EntryInterface extends ClientStateObjectProxy {\n\treadonly parent: iCollection;\n\treadonly keyUnique: ScalarProvider<\"yes\" | \"no\">;\n\n\tconstructor(readonly entry: api_cs.Centries__collection) {\n\t\tsuper();\n\t\tthis.parent = iCollection(entry.parent);\n\t\tthis.keyUnique = createVariable(\n\t\t\ttoStream(entry.properties.location)\n\t\t\t\t.stateSwitch({\n\t\t\t\t\tremote: () =>\n\t\t\t\t\t\ttoStream(entry.properties.key.ref.properties.is_editable).stateSwitch({\n\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\t\t\tyes: () => true,\n\t\t\t\t\t\t\t\t})(),\n\t\t\t\t\t\t})(),\n\t\t\t\t\tlocal: () => true,\n\t\t\t\t})\n\t\t\t\t.pipe((modified) => {\n\t\t\t\t\tif (!modified) return \"yes\" as \"yes\" | \"no\";\n\t\t\t\t\treturn createExpressionBuilder(Text.value(entry.properties.key.ref)).pipe((key) => {\n\t\t\t\t\t\tif (key === Failed) return \"yes\";\n\t\t\t\t\t\treturn subscriptionPending(getCollectionKeyRegistration(entry.parent, key)).pipe((pending) => {\n\t\t\t\t\t\t\tif (pending) return \"no\";\n\t\t\t\t\t\t\treturn entriesWithKey(entry.parent, key)\n\t\t\t\t\t\t\t\t.pipe((entries) => (entries === None ? 0 : entries.size))\n\t\t\t\t\t\t\t\t.pipe((amount_of_entries) => (amount_of_entries > 1 ? \"no\" : \"yes\"))();\n\t\t\t\t\t\t})();\n\t\t\t\t\t})();\n\t\t\t\t})\n\t\t\t\t.pipe((unique) => {\n\t\t\t\t\tentry.properties.key.inferences.key().properties.key_unique.ensure(unique, {});\n\t\t\t\t\treturn unique;\n\t\t\t\t})(),\n\t\t\tfalse\n\t\t);\n\t}\n\n\tprivate _registration_destructor: DestructorSet | undefined;\n\tregister(destructor: DestructorTree) {\n\t\tregister(this.entry, destructor);\n\t\tif (this._registration_destructor === undefined || this._registration_destructor.destroyed) {\n\t\t\tthis._registration_destructor = new DestructorSet(false);\n\t\t\tconst _destructor = new DestructorTree();\n\t\t\taddChild(this._registration_destructor, _destructor);\n\t\t\tfor (const graph of this.parent.graphs) {\n\t\t\t\tconst context_node = registerObjectPathTail(\n\t\t\t\t\tgraph.ordering_stategroup_path,\n\t\t\t\t\tthis.entry.properties.node,\n\t\t\t\t\tdestructor\n\t\t\t\t)!;\n\t\t\t\tconst ordering_stategroup = registerStategroup(graph.ordering_stategroup, context_node, destructor);\n\t\t\t\tconst edge_state = ordering_stategroup.properties.states.get(graph.edge_state.key)!;\n\t\t\t\tregisterText(graph.edge_reference, edge_state.properties.node, destructor);\n\t\t\t}\n\t\t}\n\t\tthis._registration_destructor!.add(destructor);\n\t}\n}\n\nexport type iEntry = EntryInterface;\nexport const iEntry = WeakCache((s) => new EntryInterface(s));\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { client_state } from \"../state/ClientState\";\nimport {\n\tgetCollectionRegistrations,\n\tisRegisteredOrSubscribed,\n\tisRegistered,\n\tgetReferenceCounter,\n\tEntriesRegistrationNode,\n} from \"../state/registerClientState\";\nimport { SingleTaskManager } from \"../TaskManager\";\nimport clientWorkIsDone from \"./tasks\";\nimport { iCollection } from \"../state/Collection\";\n\nexport function removeAttribute(attribute: api_cs.Cattributes): void {\n\tconst name = attribute.key.entry;\n\tattribute.parent.properties.attributes.delete(name);\n}\n\nfunction cleanAttribute(remove: boolean, attribute: api_cs.Cattributes) {\n\tif (remove) {\n\t\tremoveAttribute(attribute);\n\t}\n}\n\nexport function cleanNode(node: api_cs.Cnode) {\n\tswitch (node.properties.location.state.name) {\n\t\tcase \"local\":\n\t\t\tbreak;\n\t\tcase \"remote\":\n\t\t\tfor (const attribute of node.properties.attributes.values()) {\n\t\t\t\tswitch (attribute.properties.type.state.name) {\n\t\t\t\t\tcase \"operation\": {\n\t\t\t\t\t\tconst operation = attribute.properties.type.state.node;\n\t\t\t\t\t\tswitch (operation.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"command\": {\n\t\t\t\t\t\t\t\tconst command = operation.properties.type.state.node;\n\t\t\t\t\t\t\t\tcleanAttribute(!isRegisteredOrSubscribed(command), attribute);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"action\": {\n\t\t\t\t\t\t\t\tconst action = operation.properties.type.state.node;\n\t\t\t\t\t\t\t\tif (getReferenceCounter(action).count <= 0) {\n\t\t\t\t\t\t\t\t\tconst name = attribute.key.entry;\n\t\t\t\t\t\t\t\t\tattribute.parent.properties.attributes.delete(name);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(operation.properties.type.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"property\": {\n\t\t\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\tconst text = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tswitch (text.properties.is_key.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tswitch (text.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst $ = text.properties.is_editable.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\tswitch ($.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcleanAttribute(!isRegisteredOrSubscribed(text), attribute);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState($.properties.modified.state);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tcleanAttribute(!isRegisteredOrSubscribed(text), attribute);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(text.properties.is_editable.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(text.properties.is_key.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\tconst number = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tswitch (number.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tconst $ = number.properties.is_editable.state.node;\n\t\t\t\t\t\t\t\t\t\tswitch ($.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tcleanAttribute(!isRegisteredOrSubscribed(number), attribute);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState($.properties.modified.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tcleanAttribute(!isRegisteredOrSubscribed(number), attribute);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(number.properties.is_editable.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\t\t\tconst file = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tswitch (file.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tconst $ = file.properties.is_editable.state.node;\n\t\t\t\t\t\t\t\t\t\tswitch ($.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tcleanAttribute(!isRegisteredOrSubscribed(file), attribute);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState($.properties.modified.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tcleanAttribute(!isRegisteredOrSubscribed(file), attribute);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(file.properties.is_editable.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\t\t\tconst group = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tcleanNode(group.properties.node);\n\t\t\t\t\t\t\t\tswitch (group.properties.node.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tcleanAttribute(!isRegisteredOrSubscribed(group), attribute);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(group.properties.node.properties.modified.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\tconst stategroup = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tlet state_modified = false;\n\t\t\t\t\t\t\t\tfor (const state of stategroup.properties.states.values()) {\n\t\t\t\t\t\t\t\t\tcleanNode(state.properties.node);\n\t\t\t\t\t\t\t\t\tswitch (state.properties.is_selected.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\tswitch (state.properties.node.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tstate_modified = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(state.properties.node.properties.modified.state);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState(state.properties.is_selected.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (!state_modified) {\n\t\t\t\t\t\t\t\t\tswitch (stategroup.properties.is_modified.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\tcleanAttribute(!isRegisteredOrSubscribed(stategroup), attribute);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState(stategroup.properties.is_modified.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\t\tconst collection = property.properties.type.state.node;\n\t\t\t\t\t\t\t\t/*TODO edg: This is far too complex. Everyone that has a dependency on the collection\n\t\t\t\t\t\t\t\t\tshould add a registration directly on the collection so the garbage collector only has to check that\n\t\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\tconst collection_registrations = getCollectionRegistrations(collection);\n\t\t\t\t\t\t\t\tcleanEntriesRegistrationNode(collection_registrations.entries.node);\n\t\t\t\t\t\t\t\tconst has_entries_registration = isRegisteredOrSubscribed(collection_registrations.entries);\n\t\t\t\t\t\t\t\tconst has_updates_registration = isRegisteredOrSubscribed(collection_registrations.updates);\n\t\t\t\t\t\t\t\tlet has_key_registrations = false;\n\t\t\t\t\t\t\t\tfor (const [key, key_registration] of collection_registrations.keys) {\n\t\t\t\t\t\t\t\t\tif (!isRegisteredOrSubscribed(key_registration)) {\n\t\t\t\t\t\t\t\t\t\tcollection_registrations.keys.delete(key);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\thas_key_registrations = true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlet has_registered_entries = false;\n\t\t\t\t\t\t\t\tfor (const entry of collection.properties.entries.values()) {\n\t\t\t\t\t\t\t\t\tif (isRegistered(entry)) {\n\t\t\t\t\t\t\t\t\t\thas_registered_entries = true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlet modified_entries = false;\n\t\t\t\t\t\t\t\tfor (const entry of collection.properties.entries.values()) {\n\t\t\t\t\t\t\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"remote\": {\n\t\t\t\t\t\t\t\t\t\t\tconst remote = entry.properties.location.state.node;\n\t\t\t\t\t\t\t\t\t\t\tcleanNode(entry.properties.node);\n\n\t\t\t\t\t\t\t\t\t\t\tif (!isRegistered(entry)) {\n\t\t\t\t\t\t\t\t\t\t\t\tconst entry_modified = remote.properties.marked_for_deletion.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tno: () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tentry.properties.node.properties.modified.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t\tyes: true,\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\tif (!has_entries_registration && !entry_modified) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tiCollection(collection).removeEntry(entry);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tmodified_entries = modified_entries || entry_modified;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState(entry.properties.location.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlet has_join = false;\n\t\t\t\t\t\t\t\tswitch (collection.properties.joined.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tconst join = collection.properties.joined.state.node;\n\t\t\t\t\t\t\t\t\t\tif (!isRegistered(join)) {\n\t\t\t\t\t\t\t\t\t\t\tjoin.parent.properties.joined.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\thas_join = true;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(collection.properties.joined.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst is_modified = collection.properties.modified.switch({\n\t\t\t\t\t\t\t\t\tno: false,\n\t\t\t\t\t\t\t\t\tyes: true,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tcleanAttribute(\n\t\t\t\t\t\t\t\t\t!has_entries_registration &&\n\t\t\t\t\t\t\t\t\t\t!has_updates_registration &&\n\t\t\t\t\t\t\t\t\t\t!has_key_registrations &&\n\t\t\t\t\t\t\t\t\t\t!is_modified &&\n\t\t\t\t\t\t\t\t\t\t!modified_entries &&\n\t\t\t\t\t\t\t\t\t\t!has_registered_entries &&\n\t\t\t\t\t\t\t\t\t\t!has_join,\n\t\t\t\t\t\t\t\t\tattribute\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(node.properties.location.state);\n\t}\n}\n\nfunction cleanEntriesRegistrationNode(node: EntriesRegistrationNode): void {\n\tfor (const [name, att] of node) {\n\t\tswitch (att[0]) {\n\t\t\tcase \"command\":\n\t\t\t\tif (!isRegisteredOrSubscribed(att[1])) {\n\t\t\t\t\tnode.delete(name);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"text\":\n\t\t\t\tif (!isRegisteredOrSubscribed(att[1])) {\n\t\t\t\t\tnode.delete(name);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"number\":\n\t\t\t\tif (!isRegisteredOrSubscribed(att[1])) {\n\t\t\t\t\tnode.delete(name);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"file\":\n\t\t\t\tif (!isRegisteredOrSubscribed(att[1])) {\n\t\t\t\t\tnode.delete(name);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"group\":\n\t\t\t\tif (!isRegisteredOrSubscribed(att[1])) {\n\t\t\t\t\tnode.delete(name);\n\t\t\t\t} else {\n\t\t\t\t\tcleanEntriesRegistrationNode(att[1].node);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"stategroup\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tif (!isRegisteredOrSubscribed($)) {\n\t\t\t\t\tnode.delete(name);\n\t\t\t\t}\n\t\t\t\tfor (const state_tree of $.states.values()) {\n\t\t\t\t\tcleanEntriesRegistrationNode(state_tree);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"collection\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tif (!isRegisteredOrSubscribed($.entries) && !isRegisteredOrSubscribed($.updates)) {\n\t\t\t\t\tnode.delete(name);\n\t\t\t\t} else {\n\t\t\t\t\tcleanEntriesRegistrationNode($.entries.node);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(att[0]);\n\t\t}\n\t}\n}\n\nconst garbageCollector = new SingleTaskManager(async () => {\n\tawait clientWorkIsDone();\n\tcleanNode(client_state.properties.root);\n}, 100);\nexport default garbageCollector;\n","import { api_configuration } from \"../../common\";\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_client_request = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport { MutableVariable, createVariable, ScalarProvider, WeakCache } from \"../../../../../stream\";\nimport { Pending } from \"../Status\";\nimport { Sink, Source, None } from \"../Symbols\";\nimport { iText } from \"../state/Text\";\nimport { iReference } from \"../state/Reference\";\nimport { iStategroup, iState } from \"../state/Stategroup\";\nimport * as Entry from \"../state/Entry\";\nimport * as Collection from \"../state/Collection\";\nimport { registerObjectPathTail, registerText, registerStategroup } from \"../state/registerClientState\";\nimport DestructorTree from \"../DestructorTree\";\nimport { Failed } from \"../Status\";\nimport { createNodePathFromObjectPathTail } from \"../navigation/NodePathBuilder\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport { CollectionPathBuilder } from \"../navigation/createCollectionPathBuilder\";\nimport { createNodeExistanceFilter } from \"../state 2 interface/createPropertiesDictionaryFromColumns\";\nimport NodePathBuilder from \"../navigation/NodePathBuilder\";\nimport * as queryQueue from \"../queryQueue\";\nimport { iCollection } from \"../state/Collection\";\nimport ClientStateObjectProxy from \"./ClientStateObjectProxy\";\n\ntype Entry = api_cs.Centries__collection;\n\nexport function* ordered_graphs(collection: api_cs.Ccollection): IterableIterator {\n\tswitch (collection.properties.has_ordered_graphs.state.name) {\n\t\tcase \"yes\":\n\t\t\tfor (const graph of collection.properties.has_ordered_graphs.state.node.properties.ordered_graphs.values()) {\n\t\t\t\tyield iGraph(graph);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"no\":\n\t}\n}\n\nexport function definesGraphInsertionPosition(stategroup: api_cs.Cstate_group__type__property) {\n\tconst entity = stategroup.component_root.input.entity().variant;\n\tswitch (entity.name) {\n\t\tcase \"entry\":\n\t\t\treturn [...ordered_graphs(entity.definition.parent)].reduce((res, graph) => {\n\t\t\t\tif (res) return res;\n\t\t\t\tif (graph.ordering_stategroup === stategroup.inferences.state_group_type()) {\n\t\t\t\t\treturn graph.edge_reference.properties.ui.properties.default_value.switch({\n\t\t\t\t\t\tno: () => true,\n\t\t\t\t\t\tyes: () => false,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}, false);\n\t\tcase \"root\":\n\t}\n\treturn false;\n}\n\nfunction getBackendKeyValue(entry: Entry): string {\n\tconst backend_known = entry.properties.key.ref.properties.backend_known.state;\n\tswitch (backend_known.name) {\n\t\tcase \"no\":\n\t\t\treturn entry.properties.key.ref.properties.is_set.cast(\"yes\").properties.text;\n\t\tcase \"yes\":\n\t\t\treturn backend_known.node.properties.value;\n\t}\n}\n\nclass ForwardProxy {\n\tconstructor(\n\t\treadonly graph: Graph,\n\t\treadonly definer: Entry | Graph | undefined,\n\t\tpublic backward: Node | Graph | BackwardProxy,\n\t\tpublic key: string | Sink | Pending\n\t) {\n\t\tgraph.fproxies.add(this);\n\t}\n\n\tedgeUpdateValue(): string | Sink | undefined {\n\t\tif (this.key === Pending) return undefined;\n\t\treturn this.key;\n\t}\n\n\tdestruct() {\n\t\tthis.graph.fproxies.delete(this);\n\t}\n\n\tget destroyed() {\n\t\treturn !this.graph.fproxies.has(this);\n\t}\n}\n\nclass BackwardProxy {\n\tdestructor: DestructorTree | undefined;\n\n\tconstructor(\n\t\treadonly graph: Graph,\n\t\treadonly definer: Entry | Graph | undefined,\n\t\tpublic forward: Node | Graph | ForwardProxy,\n\t\tpublic edge: string | Sink\n\t) {\n\t\tgraph.bproxies.add(this);\n\t}\n\n\tupdateEdge() {\n\t\tif (!!this.destructor && !this.destructor.destroyed) return;\n\t\tthis.destructor = new DestructorTree();\n\n\t\tqueryQueue.add(\n\t\t\tthis.graph.queryVertex(this.edge).then((key) => {\n\t\t\t\tif (this.destructor!.destroyed) return;\n\t\t\t\tif (key === Failed) return;\n\t\t\t\tif (key === None) return;\n\t\t\t\tconst exp = Collection.openEntry(this.graph.collection, key, this.destructor!)();\n\t\t\t\tconst sub = exp.subscribe({ update: () => undefined });\n\t\t\t\tthis.destructor!.onDestroy(() => exp.unsubscribe(sub));\n\t\t\t})\n\t\t);\n\t}\n\n\tisModified() {\n\t\treturn this.forward !== this.definer;\n\t}\n\n\tdestruct() {\n\t\tthis.destructor?.destroy();\n\t\tthis.graph.bproxies.delete(this);\n\t}\n\n\tget destroyed() {\n\t\treturn !this.graph.bproxies.has(this);\n\t}\n}\n\nclass Node {\n\tbackward: Node | Graph | BackwardProxy;\n\tforward: Node | Graph | ForwardProxy;\n\n\tconstructor(\n\t\treadonly graph: Graph,\n\t\treadonly entry: Entry,\n\t\tpublic destructor: DestructorTree,\n\t\treadonly sink_state: api_cs.Cstates__state_group__type__property,\n\t\treadonly edge_state: api_cs.Cstates__state_group__type__property,\n\t\treadonly edge_reference: api_cs.Cyes__navigable\n\t) {}\n\n\tupdateEdge(by: \"user\" | \"engine\") {\n\t\tif (this.forward instanceof Node) {\n\t\t\tiState(this.edge_state).__select(by);\n\t\t\tiReference(this.edge_reference).setReferencedEntry(this.forward.entry);\n\t\t}\n\t\tconst update_value = this.forward.edgeUpdateValue();\n\t\tif (update_value !== undefined) {\n\t\t\tif (update_value === Sink) {\n\t\t\t\tiState(this.sink_state).__select(by);\n\t\t\t} else {\n\t\t\t\tiState(this.edge_state).__select(by);\n\t\t\t\tiText(this.edge_reference.parent).__update(update_value, by);\n\t\t\t}\n\t\t}\n\t\tif (Entry.isMarkedForDeletion(this.entry)) {\n\t\t\tthis.backward.updateEdge(by);\n\t\t}\n\t}\n\n\tedgeModified(): boolean {\n\t\treturn this.sink_state.parent.properties.is_modified.switch({\n\t\t\tno: () =>\n\t\t\t\tthis.edge_state.properties.is_selected.switch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: () => iText(this.edge_reference.parent).modified.value,\n\t\t\t\t}),\n\t\t\tyes: () => true,\n\t\t});\n\t}\n\n\tisModified(): boolean {\n\t\treturn Entry.isMarkedForDeletion(this.entry) || this.edgeModified();\n\t}\n\n\tgetEdgeValue() {\n\t\treturn this.sink_state.properties.is_selected.switch({\n\t\t\tyes: () => Sink as Sink | string | undefined,\n\t\t\tno: () =>\n\t\t\t\tthis.edge_reference.parent.properties.is_set.switch({\n\t\t\t\t\tno: () => undefined,\n\t\t\t\t\tyes: ($) => $.properties.text,\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tgetServerEdgeValue() {\n\t\treturn this.sink_state.parent.properties.initialized.switch({\n\t\t\tno: () => undefined,\n\t\t\tyes: ($) => {\n\t\t\t\tconst backend_state = $.properties.state_in_backend.ref;\n\t\t\t\tif (backend_state === this.sink_state) return Sink;\n\t\t\t\tif (backend_state === this.edge_state) {\n\t\t\t\t\treturn this.edge_reference.parent.properties.backend_known.switch({\n\t\t\t\t\t\tno: () => undefined,\n\t\t\t\t\t\tyes: ($) => $.properties.value,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn undefined; // What to do in this case?\n\t\t\t},\n\t\t});\n\t}\n\n\tdiscardEdge() {\n\t\tthis.sink_state.parent.properties.initialized.switch({\n\t\t\tno: () => iStategroup(this.sink_state.parent).discard(),\n\t\t\tyes: ($) => {\n\t\t\t\tconst backend_state = $.properties.state_in_backend.ref;\n\t\t\t\tiState(backend_state).__select(\"engine\");\n\t\t\t\tif (backend_state === this.edge_state) {\n\t\t\t\t\tthis.edge_reference.parent.properties.backend_known.switch({\n\t\t\t\t\t\tno: () => iText(this.edge_reference.parent).discard(),\n\t\t\t\t\t\tyes: ($) => iText(this.edge_reference.parent).__update($.properties.value, \"engine\"),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\tedgeUpdateValue(): string | Sink | undefined {\n\t\tif (Entry.isMarkedForDeletion(this.entry)) {\n\t\t\treturn this.forward.edgeUpdateValue();\n\t\t} else {\n\t\t\treturn this.entry.properties.key.ref.properties.is_set.switch({\n\t\t\t\tno: () => undefined,\n\t\t\t\tyes: ($) => $.properties.text,\n\t\t\t});\n\t\t}\n\t}\n\n\tget key() {\n\t\treturn this.entry.properties.key.ref.properties.is_set.switch({\n\t\t\tno: () => \"-\",\n\t\t\tyes: ($) => $.properties.text,\n\t\t});\n\t}\n\n\tcreateBackwardProxy() {\n\t\treturn new BackwardProxy(this.graph, this.entry, this, getBackendKeyValue(this.entry));\n\t}\n\n\tcreateForwardProxy() {\n\t\treturn new ForwardProxy(this.graph, this.entry, this, this.getServerEdgeValue() ?? Pending);\n\t}\n\n\tdestruct() {\n\t\tthis.destructor.destroy();\n\t\tthis.graph.nodes.delete(this.entry);\n\t}\n\n\tget destroyed() {\n\t\treturn this.destructor.destroyed || this.entry.destroyed;\n\t}\n}\n\nclass Graph extends ClientStateObjectProxy {\n\treadonly ordering_stategroup_path: api_app.Cobject_path_tail;\n\treadonly ordering_stategroup: api_app.Cstate_group;\n\treadonly sink_state: api_app.Cstates__state_group;\n\treadonly edge_state: api_app.Cstates__state_group;\n\treadonly edge_reference: api_app.Ctext__type__property;\n\n\treadonly collection: api_cs.Ccollection;\n\n\tnodes = new Map();\n\tfproxies = new Set();\n\tbproxies = new Set();\n\tpending_updates = new Set();\n\n\tforward: Node | Graph | ForwardProxy; // Source\n\tbackward: Node | Graph | BackwardProxy; // Sink\n\n\tdefault: Sink | Source;\n\tsource_key: string | Sink | Pending = Pending;\n\treadonly key = Sink;\n\n\tconstructor(readonly ordered_graph: api_cs.Cordered_graphs) {\n\t\tsuper();\n\t\tthis.collection = ordered_graph.parent.parent;\n\t\tswitch (this.collection.component_root.properties.location.state.name) {\n\t\t\tcase \"local\":\n\t\t\t\tthis.forward = this;\n\t\t\t\tthis.backward = this;\n\t\t\t\tbreak;\n\t\t\tcase \"remote\":\n\t\t\t\tthis.forward = this.createForwardProxy();\n\t\t\t\tthis.backward = this.createBackwardProxy();\n\t\t\t\tbreak;\n\t\t}\n\t\tconst definition = ordered_graph.key.ref.properties.ordering_property_path;\n\t\tthis.ordering_stategroup_path = definition.properties.ordering_state_group_path.properties.head;\n\t\tthis.ordering_stategroup = definition.properties.ordering_state_group_path.inferences.state_group();\n\t\tthis.sink_state = definition.properties.ordering_states.properties.sink_state.ref;\n\t\tthis.edge_state = definition.properties.ordering_states.properties.edge_state.ref;\n\t\tthis.edge_reference = definition.properties.ordering_states.properties.edge_reference.ref.parent;\n\t\t// Always default to Source, except when the default expression only and explicitly references the Sink\n\t\tthis.default = this.ordering_stategroup.properties.ui.properties.default_state.switch({\n\t\t\tno: () => Source as Source | Sink,\n\t\t\tyes: ($) => {\n\t\t\t\tconst operation = $.properties.default_.properties.expression.properties.operation.state;\n\t\t\t\tif (operation.name !== \"produce value\") return Source;\n\t\t\t\tconst value = operation.node.properties.value.state;\n\t\t\t\tif (value.name !== \"scalar\") return Source;\n\t\t\t\tconst expression = value.node.properties.expression.properties.type.state;\n\t\t\t\tif (expression.name !== \"state\") return Source;\n\t\t\t\treturn expression.node.properties.state.ref.switch({\n\t\t\t\t\tstate: ($) => ($ === this.sink_state ? Sink : Source),\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t}\n\n\tget destroyed() {\n\t\treturn this.ordered_graph.destroyed;\n\t}\n\n\tcreateBackwardProxy() {\n\t\treturn new BackwardProxy(this, this, this, Sink);\n\t}\n\n\tgetBackwardProxy(definer: Entry | Graph): BackwardProxy | undefined {\n\t\tfor (const proxy of this.bproxies) {\n\t\t\tif (proxy.definer === definer) return proxy;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tcreateForwardProxy() {\n\t\treturn new ForwardProxy(this, this, this, this.source_key);\n\t}\n\n\tgetForwardProxy(definer: Entry | Graph): ForwardProxy | undefined {\n\t\tfor (const proxy of this.fproxies) {\n\t\t\tif (proxy.definer === definer) return proxy;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tcreateNode(entry: Entry, backward?: Node | Graph | BackwardProxy, forward?: Node | Graph | ForwardProxy) {\n\t\tconst destructor = new DestructorTree();\n\t\tconst context_node = registerObjectPathTail(this.ordering_stategroup_path, entry.properties.node, destructor)!;\n\t\tconst ordering_stategroup = registerStategroup(this.ordering_stategroup, context_node, destructor);\n\t\tconst edge_state = ordering_stategroup.properties.states.get(this.edge_state.key)!;\n\t\tconst node = new Node(\n\t\t\tthis,\n\t\t\tentry,\n\t\t\tdestructor,\n\t\t\tordering_stategroup.properties.states.get(this.sink_state.key)!,\n\t\t\tedge_state,\n\t\t\tregisterText(this.edge_reference, edge_state.properties.node, destructor).properties.navigable.cast(\"yes\")\n\t\t);\n\t\tnode.backward = backward ?? node.createBackwardProxy();\n\t\tnode.forward = forward ?? node.createForwardProxy();\n\t\tthis.nodes.set(entry, node);\n\t\treturn node;\n\t}\n\n\tgetNode(entry: Entry) {\n\t\treturn this.nodes.get(entry);\n\t}\n\n\tfindByKey(key: string | Sink): Node | Graph | undefined {\n\t\tif (key === Sink) return this;\n\t\tfor (const node of this.nodes.values()) {\n\t\t\tif (\n\t\t\t\tnode.entry.properties.node.properties.is_busy_saving.switch({\n\t\t\t\t\tno: () =>\n\t\t\t\t\t\tnode.entry.properties.key.ref.properties.backend_known.switch({\n\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\tyes: ($) => $.properties.value === key,\n\t\t\t\t\t\t}),\n\t\t\t\t\tyes: () =>\n\t\t\t\t\t\tnode.entry.properties.key.ref.properties.is_set.switch({\n\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\tyes: ($) => $.properties.text === key,\n\t\t\t\t\t\t}),\n\t\t\t\t})\n\t\t\t)\n\t\t\t\treturn node;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tupdateEdge(): void {\n\t\treturn void 0;\n\t}\n\n\tisModified() {\n\t\treturn this.source_key !== this.forward.key;\n\t}\n\n\tedgeUpdateValue(): string | Sink | undefined {\n\t\treturn Sink;\n\t}\n\n\tconnect(\n\t\tbackward: Node | Graph | BackwardProxy,\n\t\tforward: Node | Graph | ForwardProxy,\n\t\tby: \"user\" | \"engine\" = \"engine\"\n\t): void {\n\t\tif (backward.destroyed || forward.destroyed) throw new Error(\"Something unexpected\");\n\t\tforward.backward = backward;\n\t\tbackward.forward = forward;\n\t\tbackward.updateEdge(by);\n\t}\n\n\tmove(node: Node | undefined, before: Node | Graph | ForwardProxy | undefined, by: \"user\" | \"engine\" = \"user\") {\n\t\tif (!node || !before) return;\n\t\tif (node === before) return;\n\t\tthis.connect(node.backward, node.forward, by);\n\t\tthis.connect(before.backward, node, by);\n\t\tthis.connect(node, before, by);\n\t\tthis.updateSorting();\n\t}\n\n\tmerge(bproxy: BackwardProxy, fproxy: ForwardProxy) {\n\t\tconst forward = bproxy.forward;\n\t\tconst backward = fproxy.backward;\n\t\tbackward.forward = forward;\n\t\tforward.backward = backward;\n\t\tfproxy.destruct();\n\t\tbproxy.destruct();\n\t\tthis.updateSorting();\n\t}\n\n\tprivate _reset_as_local() {\n\t\tfor (const entry of this.collection.properties.entries.values()) {\n\t\t\tthis.addEntry(entry);\n\t\t}\n\t\tthis.updateSorting();\n\t}\n\tprivate _clear() {\n\t\tfor (const node of this.nodes.values()) {\n\t\t\tnode.destruct();\n\t\t}\n\t\tfor (const proxy of this.fproxies.values()) {\n\t\t\tproxy.destruct();\n\t\t}\n\t\tfor (const proxy of this.bproxies.values()) {\n\t\t\tproxy.destruct();\n\t\t}\n\t}\n\treset(force_init = true) {\n\t\tfor (const node of this.nodes.values()) {\n\t\t\tswitch (node.entry.properties.location.state.name) {\n\t\t\t\tcase \"local\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"remote\":\n\t\t\t\t\tnode.entry.properties.location.state.node.properties.marked_for_deletion.ensure(\"no\", {});\n\t\t\t\t\tnode.discardEdge();\n\t\t\t}\n\t\t\tnode.destruct();\n\t\t}\n\t\tfor (const proxy of this.fproxies.values()) {\n\t\t\tproxy.destruct();\n\t\t}\n\t\tfor (const proxy of this.bproxies.values()) {\n\t\t\tproxy.destruct();\n\t\t}\n\t\tswitch (this.collection.component_root.properties.location.state.name) {\n\t\t\tcase \"local\": {\n\t\t\t\tthis.forward = this;\n\t\t\t\tthis.backward = this;\n\t\t\t\tfor (const entry of this.collection.properties.entries.values()) {\n\t\t\t\t\tconst node = this.getNode(entry) ?? this.createNode(entry, this, this);\n\t\t\t\t\tconst edge = node.getEdgeValue();\n\t\t\t\t\tif (edge === undefined) {\n\t\t\t\t\t\tif (force_init) this._reset_as_local();\n\t\t\t\t\t\telse this._clear();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (edge === Sink) {\n\t\t\t\t\t\tnode.forward = this;\n\t\t\t\t\t\tthis.backward = node;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst other_entry = iCollection(this.collection).find(edge);\n\t\t\t\t\t\tif (other_entry === undefined) {\n\t\t\t\t\t\t\tif (force_init) this._reset_as_local();\n\t\t\t\t\t\t\telse this._clear();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst other_node = this.getNode(other_entry) ?? this.createNode(other_entry, this, this);\n\t\t\t\t\t\tnode.forward = other_node;\n\t\t\t\t\t\tother_node.backward = node;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst list = new Set();\n\t\t\t\tlet node = this.backward;\n\t\t\t\twhile (node instanceof Node) {\n\t\t\t\t\tconst key = node.entry.key;\n\t\t\t\t\tif (list.has(key)) {\n\t\t\t\t\t\tif (force_init) this._reset_as_local();\n\t\t\t\t\t\telse this._clear();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlist.add(key);\n\t\t\t\t\tif (node.backward === this) break;\n\t\t\t\t\tnode = node.backward as Node | Graph;\n\t\t\t\t}\n\t\t\t\tthis.forward = node;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"remote\":\n\t\t\t\tthis.forward = this.createForwardProxy();\n\t\t\t\tthis.backward = this.createBackwardProxy();\n\t\t\t\tfor (const entry of this.collection.properties.entries.values()) {\n\t\t\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\tthis.addEntry(entry);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"remote\": {\n\t\t\t\t\t\t\tthis.addServerEntry(entry);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.updateSorting();\n\t}\n\n\tsort(): string[] {\n\t\tconst all_keys = [...this.collection.properties.entries.keys()];\n\t\tconst list = new Set();\n\t\tlet node = this.forward;\n\t\twhile (node instanceof Node) {\n\t\t\tconst key = node.entry.key;\n\t\t\tif (list.has(key)) {\n\t\t\t\t// Loop detected; unable to sort, return unsorted keys instead\n\t\t\t\treturn all_keys;\n\t\t\t}\n\t\t\tlist.add(key);\n\t\t\tnode = node.forward;\n\t\t}\n\t\tif (list.size !== all_keys.length) {\n\t\t\t// Incomplete assortment; return unsorted keys instead\n\t\t\treturn all_keys;\n\t\t}\n\t\treturn [...list].reverse();\n\t}\n\n\t_sorted: MutableVariable | undefined;\n\tget sorted(): ScalarProvider {\n\t\tif (!this._sorted || this._sorted.destroyed) {\n\t\t\tthis._sorted = createVariable(this.sort(), true);\n\t\t}\n\t\treturn this._sorted;\n\t}\n\tupdateSorting() {\n\t\tthis._sorted?.set(this.sort());\n\t}\n\n\tasync queryVertex(value: string | Sink): Promise {\n\t\tconst ordering_stategroup_name = this.ordering_stategroup.parent.parent.key;\n\t\tconst collection_name = this.ordered_graph.parent.parent.parent.parent.key.entry;\n\t\tconst context_node_path = createIdPathBuilderFromNode(this.ordered_graph.component_root);\n\n\t\tconst filters: Record = {};\n\t\tif (value === Sink) {\n\t\t\tfilters[ordering_stategroup_name] = createNodeExistanceFilter(\n\t\t\t\tnew NodePathBuilder().state(ordering_stategroup_name, this.sink_state.key).build()\n\t\t\t);\n\t\t} else {\n\t\t\tconst ordering_property_path_builder = createNodePathFromObjectPathTail(this.ordering_stategroup_path);\n\t\t\tconst edge_stategroup_path = ordering_property_path_builder.state(ordering_stategroup_name, this.edge_state.key);\n\t\t\tfilters[ordering_stategroup_name] = createNodeExistanceFilter(edge_stategroup_path.build());\n\t\t\tfilters[ordering_stategroup_name + this.edge_reference.parent.parent.key] = {\n\t\t\t\tpath: edge_stategroup_path.reference(this.edge_reference.parent.parent.key).build(),\n\t\t\t\ttype: [\n\t\t\t\t\t\"node\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"containment\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\toperator: [\"in\", {}],\n\t\t\t\t\t\t\t\treferences: {\n\t\t\t\t\t\t\t\t\t\"has alternative\": [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\"referenced node\": context_node_path.collectionEntry(collection_name, value).build(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst result = await DatastoreProxy.instance.collectionQuery({\n\t\t\t\tfilters: {\n\t\t\t\t\t\"todo filter\": [\"no\", {}],\n\t\t\t\t\t\"value filters\": filters,\n\t\t\t\t},\n\t\t\t\t\"context node path\": context_node_path.build(),\n\t\t\t\t\"collection path\": CollectionPathBuilder.create().collection(collection_name).build(),\n\t\t\t\t\"select entries\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"limit number of entries\": 1,\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\taggregates: {},\n\t\t\t});\n\t\t\tswitch (result.properties.context.state.name) {\n\t\t\t\tcase \"exists\": {\n\t\t\t\t\tconst exists = result.properties.context.state.node;\n\t\t\t\t\tswitch (exists.properties.entries.state.name) {\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst $ = exists.properties.entries.state.node;\n\t\t\t\t\t\t\tswitch ($.properties.limit_exceeded.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tswitch ($.properties.entries.properties.has_steps.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\tconst collection = $.properties.entries.properties.has_steps.state.node;\n\t\t\t\t\t\t\t\t\t\t\tconst [entry] = [...collection.properties.entries.keys()];\n\t\t\t\t\t\t\t\t\t\t\treturn entry;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\treturn None;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"does not exist\":\n\t\t\t\t\treturn Failed;\n\t\t\t\tcase \"permission denied\":\n\t\t\t\t\treturn Failed;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\treturn Failed;\n\t\t}\n\t}\n\n\tsetServerEdgeValue(entry: Entry | undefined, value: string | Sink) {\n\t\tlet node;\n\t\tif (entry) {\n\t\t\tnode = this.nodes.get(entry);\n\t\t\tif (!node) {\n\t\t\t\treturn this.addServerEntry(entry);\n\t\t\t}\n\t\t\tthis.getForwardProxy(entry)?.destruct();\n\t\t} else {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\t\tnode = this;\n\t\t}\n\t\tif (node.isModified()) {\n\t\t\treturn this.reset();\n\t\t}\n\t\tconst other_node = this.findByKey(value);\n\t\tif (other_node) {\n\t\t\tif (other_node.backward.isModified()) {\n\t\t\t\treturn this.reset();\n\t\t\t}\n\t\t\tif (other_node.backward instanceof BackwardProxy) {\n\t\t\t\tother_node.backward.destruct();\n\t\t\t}\n\t\t\tnode.forward = other_node;\n\t\t\tother_node.backward = node;\n\t\t} else {\n\t\t\tconst forward = node.forward;\n\t\t\tif (forward instanceof ForwardProxy) {\n\t\t\t\tforward.destruct();\n\t\t\t} else {\n\t\t\t\tforward.backward = forward.createBackwardProxy();\n\t\t\t}\n\t\t\tnode.forward = node.createForwardProxy();\n\t\t}\n\t\tthis.updateSorting();\n\t}\n\n\tsetServerSourceValue(value: string | Sink) {\n\t\tif (this.source_key === value) return;\n\t\tif (this.source_key !== Pending) {\n\t\t\tthis.source_key = value;\n\t\t\treturn this.setServerEdgeValue(undefined, value);\n\t\t}\n\t\tthis.source_key = value;\n\n\t\tif (this.forward instanceof Node) {\n\t\t\tif (this.forward.key !== value) {\n\t\t\t\tthis.reset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (this.forward === this) {\n\t\t\tthis.forward = this.createForwardProxy();\n\t\t\tthis.backward = this.createBackwardProxy();\n\t\t}\n\t\tconst fproxy = this.getForwardProxy(this);\n\t\tif (fproxy) {\n\t\t\tfproxy.key = value;\n\t\t\tfproxy.backward.updateEdge(\"user\");\n\t\t}\n\t\tfor (const bproxy of this.bproxies.values()) {\n\t\t\tif (bproxy.edge === value) {\n\t\t\t\tif (fproxy) {\n\t\t\t\t\tthis.merge(bproxy, fproxy);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tthis.updateSorting();\n\t}\n\n\tupdateServerKeyValue(entry: Entry, value: string) {\n\t\tconst proxy = this.getBackwardProxy(entry);\n\t\tif (proxy) {\n\t\t\tproxy.edge = value;\n\t\t}\n\t}\n\n\taddServerEntry(entry: Entry): Node | undefined {\n\t\tlet node = this.getNode(entry);\n\t\tif (node) return node;\n\n\t\tnode = this.createNode(entry);\n\t\tconst edge = node.getServerEdgeValue();\n\t\tif (edge === undefined) {\n\t\t\t(node.forward as ForwardProxy).destruct();\n\t\t\t(node.backward as BackwardProxy).destruct();\n\t\t\tnode.destruct();\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst key_value = getBackendKeyValue(entry);\n\t\tfor (const proxy of this.fproxies.values()) {\n\t\t\tif (proxy.key === key_value) {\n\t\t\t\tconst backward = proxy.backward;\n\t\t\t\t(node.backward as BackwardProxy).destruct();\n\t\t\t\tnode.backward = backward;\n\t\t\t\tbackward.forward = node;\n\t\t\t\tproxy.destruct();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (const proxy of this.bproxies.values()) {\n\t\t\tif (proxy.edge === edge) {\n\t\t\t\t(node.forward as ForwardProxy).destruct();\n\t\t\t\tthis.connect(node, proxy.forward);\n\t\t\t\tproxy.destruct();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tthis.updateSorting();\n\t\treturn node;\n\t}\n\n\tdeleteServerEntry(entry: Entry) {\n\t\tconst node = this.getNode(entry);\n\t\tif (!node) return;\n\t\tthis.connect(node.backward, node.forward);\n\t\tnode.destruct();\n\t}\n\n\tremoveEntry(entry: Entry) {\n\t\tconst node = this.getNode(entry);\n\t\tif (!node) return;\n\t\tswitch (entry.properties.location.state.name) {\n\t\t\tcase \"remote\": {\n\t\t\t\tif (!Entry.isMarkedForDeletion(node.entry) && node.edgeModified()) {\n\t\t\t\t\tthis.reset();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst backward = node.backward;\n\t\t\t\tconst forward = node.forward;\n\t\t\t\tif (backward instanceof BackwardProxy) {\n\t\t\t\t\tbackward.destruct();\n\t\t\t\t} else {\n\t\t\t\t\tbackward.forward = backward.createForwardProxy();\n\t\t\t\t}\n\t\t\t\tif (forward instanceof ForwardProxy) {\n\t\t\t\t\tforward.destruct();\n\t\t\t\t} else {\n\t\t\t\t\tforward.backward = forward.createBackwardProxy();\n\t\t\t\t}\n\t\t\t\tnode.destruct();\n\t\t\t\tthis.updateSorting();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"local\":\n\t\t\t\tthis.connect(node.backward, node.forward);\n\t\t\t\tnode.destruct();\n\t\t\t\tthis.updateSorting();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\taddEntry(entry: Entry, by: \"user\" | \"engine\" = \"user\") {\n\t\tswitch (this.default) {\n\t\t\tcase Sink: {\n\t\t\t\tconst node = this.createNode(entry, this.backward, this);\n\t\t\t\tconst backward = this.backward;\n\t\t\t\tthis.connect(backward, node, by);\n\t\t\t\tthis.connect(node, this, by);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase Source: {\n\t\t\t\tconst node = this.createNode(entry, this, this.forward);\n\t\t\t\tconst forward = this.forward;\n\t\t\t\tthis.connect(this, node, by);\n\t\t\t\tthis.connect(node, forward, by);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tthis.updateSorting();\n\t}\n\n\tdeleteEntry(entry: Entry) {\n\t\tconst node = this.getNode(entry);\n\t\tif (!node) return;\n\t\tswitch (entry.properties.location.state.name) {\n\t\t\tcase \"remote\":\n\t\t\t\tnode.backward.updateEdge(\"user\");\n\t\t\t\tbreak;\n\t\t\tcase \"local\":\n\t\t\t\tthis.connect(node.backward, node.forward);\n\t\t\t\tnode.destruct();\n\t\t\t\tthis.updateSorting();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tinsertBeforeKey(entry: Entry, key: string) {\n\t\tconst other_entry = iCollection(this.collection).find(key);\n\t\tif (other_entry) {\n\t\t\tthis.insertBefore(entry, other_entry);\n\t\t} else {\n\t\t\tconst node = this.getNode(entry);\n\t\t\tif (!node) return;\n\t\t\tconst fproxy = new ForwardProxy(this, undefined, this, key);\n\t\t\tconst bproxy = new BackwardProxy(this, undefined, fproxy, key);\n\t\t\tfproxy.backward = bproxy;\n\t\t\tthis.move(node, fproxy);\n\t\t}\n\t}\n\n\tinsertBefore(entry_to_insert: Entry, before_entry: Entry) {\n\t\tconst node_to_insert = this.getNode(entry_to_insert);\n\t\tconst before_node = this.getNode(before_entry);\n\t\tthis.move(node_to_insert, before_node);\n\t}\n\n\tinsertAfter(entry_to_insert: Entry, after_entry: Entry) {\n\t\tconst node_to_insert = this.getNode(entry_to_insert);\n\t\tconst after_node = this.getNode(after_entry);\n\t\tthis.move(node_to_insert, after_node?.forward);\n\t}\n\n\tmoveForward(entry: Entry) {\n\t\tconst node = this.getNode(entry);\n\t\tconst forward = node?.forward;\n\t\tif (!(forward instanceof Node)) return;\n\t\tthis.move(node, forward.forward);\n\t}\n\n\tmoveBackward(entry: Entry) {\n\t\tconst node = this.getNode(entry);\n\t\tconst backward = node?.backward;\n\t\tif (!(backward instanceof Node)) return;\n\t\tthis.move(node, backward);\n\t}\n\n\tmoveToSink(entry: Entry) {\n\t\tconst node = this.getNode(entry);\n\t\tthis.move(node, this);\n\t}\n\n\tmoveToSource(entry: Entry) {\n\t\tconst node = this.getNode(entry);\n\t\tthis.move(node, this.forward);\n\t}\n}\n\nexport type iGraph = Graph;\nexport const iGraph = WeakCache((graph) => new Graph(graph));\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { WeakCache } from \"../../../../../stream\";\nimport { iText } from \"../state/Text\";\nimport { iStategroup } from \"../state/Stategroup\";\nimport { iCollection } from \"../state/Collection\";\nimport update = require(\"../widgets/instructions/update\");\nimport ClientStateObjectProxy from \"./ClientStateObjectProxy\";\n\nexport function isSaving(node: api_cs.Cnode): boolean {\n\tswitch (node.properties.is_busy_saving.state.name) {\n\t\tcase \"yes\":\n\t\t\treturn true;\n\t\tcase \"no\": {\n\t\t\tconst parent = node.input.position().input.parent();\n\t\t\tswitch (parent.variant.name) {\n\t\t\t\tcase \"node\":\n\t\t\t\t\treturn isSaving(parent.variant.definition);\n\t\t\t\tcase \"none\":\n\t\t\t\t\treturn false;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(parent.variant);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(node.properties.is_busy_saving.state);\n\t}\n}\n\nexport function parent(node: api_cs.Cnode): api_cs.Cnode | undefined {\n\tconst parent = node.input.position().input.parent();\n\tswitch (parent.variant.name) {\n\t\tcase \"node\":\n\t\t\treturn parent.variant.definition;\n\t\tcase \"none\":\n\t\t\treturn undefined;\n\t\tdefault:\n\t\t\tunexpectedState(parent.variant);\n\t}\n}\n\nclass NodeInterface extends ClientStateObjectProxy {\n\tconstructor(readonly node: api_cs.Cnode) {\n\t\tsuper();\n\t}\n\n\tdiscard() {\n\t\tfor (const attribute of this.node.properties.attributes.values()) {\n\t\t\tattribute.properties.type.switch({\n\t\t\t\toperation: undefined,\n\t\t\t\tproperty: (property) => {\n\t\t\t\t\tproperty.properties.type.switch({\n\t\t\t\t\t\tfile: (file) => {\n\t\t\t\t\t\t\tfile.properties.is_editable.switch({\n\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\tyes: (is_editable) => {\n\t\t\t\t\t\t\t\t\tthis.node.properties.location.switch({\n\t\t\t\t\t\t\t\t\t\tremote: () => {\n\t\t\t\t\t\t\t\t\t\t\tfile.properties.backend_known.switch({\n\t\t\t\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.is_readable.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis_editable.properties.modified.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfile.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttoken: $.properties.token,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\textension: $.properties.extension,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tlocal: () => {\n\t\t\t\t\t\t\t\t\t\t\tis_editable.properties.modified.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\tfile.properties.is_set.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttext: (text) => {\n\t\t\t\t\t\t\tiText(text).discard();\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnumber: (number_property) => {\n\t\t\t\t\t\t\tnumber_property.properties.is_editable.switch({\n\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\tthis.node.properties.location.switch({\n\t\t\t\t\t\t\t\t\t\tremote: () => {\n\t\t\t\t\t\t\t\t\t\t\tupdate.number_toBackendValue(number_property);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tlocal: () => {\n\t\t\t\t\t\t\t\t\t\t\tnumber_property.properties.is_editable.switch({\n\t\t\t\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.modified.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.properties.is_set.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"state group\": (state_group) => {\n\t\t\t\t\t\t\tiStategroup(state_group).discard();\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcollection: (collection) => {\n\t\t\t\t\t\t\tiCollection(collection).discard();\n\t\t\t\t\t\t},\n\t\t\t\t\t\tgroup: (group) => {\n\t\t\t\t\t\t\tiNode(group.properties.node).discard();\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n}\n\nexport type iNode = NodeInterface;\nexport const iNode = WeakCache((s) => new NodeInterface(s));\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport DestructorTree from \"../DestructorTree\";\nimport { registrationInitialized } from \"../state/registerClientState\";\nimport { Failed } from \"../Status\";\nimport { ScalarProvider, WeakCache, createVariable } from \"../../../../../stream\";\nimport { toStream, toVariable } from \"../toStream\";\n\n/**@deprecated*/\nexport function getValue(number_property: api_cs.Cnumber__type__property): number | undefined {\n\tswitch (number_property.properties.is_set.state.name) {\n\t\tcase \"no\":\n\t\t\treturn undefined;\n\t\tcase \"yes\":\n\t\t\treturn number_property.properties.is_set.state.node.properties.number.value;\n\t}\n}\n\n/**@deprecated*/\nexport async function subscribeToValue(\n\tnumber_property: api_cs.Cnumber__type__property,\n\tdestructor: DestructorTree,\n\tcallback: (value: number | undefined, destructor: DestructorTree) => R\n): Promise {\n\tawait registrationInitialized(number_property);\n\tlet value: number | undefined | null = null;\n\tlet child_destructor = destructor.addChild();\n\tconst on_value = (new_value: number | undefined) => {\n\t\tif (value !== null && value !== new_value) {\n\t\t\tchild_destructor.destroy();\n\t\t\tchild_destructor = destructor.addChild();\n\t\t\tcallback(new_value, child_destructor);\n\t\t}\n\t\tvalue = new_value;\n\t};\n\tdestructor.subscribeToStategroup(number_property.properties.is_set, (destructor) => {\n\t\tswitch (number_property.properties.is_set.state.name) {\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = number_property.properties.is_set.state.node;\n\t\t\t\treturn destructor.subscribeToNumber($, \"subscribe_number\", on_value);\n\t\t\t}\n\t\t\tcase \"no\":\n\t\t\t\treturn on_value(undefined);\n\t\t\tdefault:\n\t\t\t\treturn unexpectedState(number_property.properties.is_set.state);\n\t\t}\n\t});\n\treturn callback(getValue(number_property), child_destructor);\n}\n\nexport const value = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.is_set)\n\t\t\t.stateSwitch({\n\t\t\t\tno: () => Failed as number | Failed,\n\t\t\t\tyes: ($) => toVariable($, \"number\"),\n\t\t\t})\n\t\t\t.pipe((v) => v)(),\n\t\tfalse\n\t)\n);\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport { IdPathBuilder, Raw_Id_Path_Head } from \"../navigation/IdPathBuilder\";\nimport { identity } from \"../validation\";\nimport DestructorTree from \"../DestructorTree\";\nimport { evaluateStyle, hasStyle, initializedStyle, unsetStyle } from \"../state 2 interface/style\";\nimport {\n\tevaluateNumericalTypeProperty,\n\tinitializedNumericalTypeProperties,\n} from \"../state 2 interface/numericalTypeProperties\";\nimport createIdPathBuilderFromClientIdPath from \"../navigation/createIdPathBuilderFromClientIdPath\";\nimport { getDecimalsFromNumericalTypeProperties, serializeNumber } from \"../state 2 interface/serializeNumber\";\nimport uuid = require(\"../state/uuid\");\nimport walkNodePath from \"../navigation/walkNodePath\";\nimport { client_state } from \"../state/ClientState\";\nimport * as Collection from \"./Collection\";\nimport * as Entry from \"./Entry\";\nimport { iReference } from \"./Reference\";\nimport subscribeToClientQueryEntry from \"./subscribeToClientQueryEntry\";\nimport { patchQuery } from \"./sorting\";\nimport { Cunknown__initialized } from \"../../../../../common/api_configuration-state/lib/types/client_state/alan_api\";\nimport createClientIdPathFromNode from \"../navigation/createClientIdPathFromNode\";\nimport {\n\tregisterIdPath,\n\tregisterNodeContext,\n\tregisterStategroup,\n\tregisterCollection,\n} from \"../state/registerClientState\";\nimport { addChild } from \"../DestructorTree\";\nimport { getTranslation } from \"./phrases\";\nimport { linkIdPath } from \"./ClientIdPath\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { isResolved, Unknown } from \"../Status\";\nimport ClientStateObjectProxy from \"./ClientStateObjectProxy\";\nimport { Scalar, WeakCache, createExpressionBuilder, createVariable } from \"../../../../../stream\";\nimport { iCollection } from \"../state/Collection\";\n\ntype PatchedQuery = { subscribed?: boolean };\n\nexport function setSubscribed(query: api_cs.Cquery__client_state): DestructorTree | undefined {\n\tconst patched_query = query as unknown as PatchedQuery;\n\tif (patched_query.subscribed) {\n\t\treturn;\n\t} else {\n\t\tpatched_query.subscribed = true;\n\t\tconst destructor = addChild(query);\n\t\tdestructor.onDestroy(() => {\n\t\t\tpatched_query.subscribed = false;\n\t\t});\n\t\treturn destructor;\n\t}\n}\n\nexport function isSubscribed(query: api_cs.Cquery__client_state): boolean {\n\tconst patched_query = query as unknown as PatchedQuery;\n\treturn patched_query.subscribed !== undefined && patched_query.subscribed;\n}\n\nexport interface QueryEntryLocation {\n\t(local: (entry: api_cs.Centries__collection) => T, remote: (id_path_builder: IdPathBuilder) => T): T;\n}\n\nexport function localQueryEntry(entry: api_cs.Centries__collection): QueryEntryLocation {\n\treturn (context_callback) => context_callback(entry);\n}\n\nexport function remoteQueryEntry(id_path_builder: IdPathBuilder): QueryEntryLocation {\n\treturn (_, context_callback) => context_callback(id_path_builder);\n}\n\nexport function hasResult(query: api_cs.Cquery__client_state): api_cs.Cyes__has_result {\n\tswitch (query.properties.has_result.state.name) {\n\t\tcase \"no\":\n\t\t\tquery.root.transact(() => {\n\t\t\t\tquery.properties.has_result.set(\"yes\", {\n\t\t\t\t\t\"selected entries\": \"none\",\n\t\t\t\t\t\"amount of entries visible\": 0,\n\t\t\t\t\t\"is empty\": [\"yes\", {}],\n\t\t\t\t\t\"total amount of entries\": 0,\n\t\t\t\t\t\"backend updates are available\": [\"no\", {}],\n\t\t\t\t\t\"has more entries than maximum\": [\"no\", {}],\n\t\t\t\t\tentries: {},\n\t\t\t\t});\n\t\t\t\tpatchQuery(query.properties.has_result.cast(\"yes\"));\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"yes\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(query.properties.has_result.state);\n\t}\n\treturn query.properties.has_result.cast(\"yes\");\n}\n\nexport function updateIsEmpty(query: api_cs.Cyes__has_result): void {\n\tconst amount_of_entries_visible = query.properties.amount_of_entries_visible.value;\n\tif (amount_of_entries_visible === 0) {\n\t\tswitch (query.properties.is_empty.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\tquery.properties.is_empty.set(\"yes\", {});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"yes\":\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(query.properties.is_empty.state);\n\t\t}\n\t} else {\n\t\tswitch (query.properties.is_empty.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\tconst not_empty = query.properties.is_empty.state.node;\n\t\t\t\tswitch (not_empty.properties.result_size.state.name) {\n\t\t\t\t\tcase \"multiple\": {\n\t\t\t\t\t\tif (amount_of_entries_visible === 1) {\n\t\t\t\t\t\t\tnot_empty.properties.result_size.set(\"one\", {});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"one\": {\n\t\t\t\t\t\tif (amount_of_entries_visible > 1) {\n\t\t\t\t\t\t\tnot_empty.properties.result_size.set(\"multiple\", {});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(not_empty.properties.result_size.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"yes\": {\n\t\t\t\tquery.properties.is_empty.set(\"no\", {\n\t\t\t\t\t\"result size\": identity(\n\t\t\t\t\t\tamount_of_entries_visible === 1 ? [\"one\", {}] : [\"multiple\", {}]\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(query.properties.is_empty.state);\n\t\t}\n\t}\n}\n\nfunction compareIds(id_path: Raw_Id_Path_Head, id: api_cs.Cid_path): boolean {\n\treturn id.properties.has_steps.switch({\n\t\tno: () => id_path[\"has steps\"][0] === \"no\",\n\t\tyes: ($) => {\n\t\t\tif (id_path[\"has steps\"][0] === \"no\") {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst path_type = id_path[\"has steps\"][1].type;\n\t\t\tconst type_result = $.properties.type.switch({\n\t\t\t\t\"collection entry\": ($) =>\n\t\t\t\t\tpath_type[0] === \"collection entry\" &&\n\t\t\t\t\tpath_type[1].collection === $.properties.collection.entry &&\n\t\t\t\t\tpath_type[1].id === $.properties.id,\n\t\t\t\tgroup: ($) => path_type[0] === \"group\" && path_type[1].group === $.properties.group.entry,\n\t\t\t\tstate: ($) =>\n\t\t\t\t\tpath_type[0] === \"state\" &&\n\t\t\t\t\tpath_type[1][\"state group\"] === $.properties.state_group.entry &&\n\t\t\t\t\tpath_type[1][\"state\"] === $.properties.state.entry,\n\t\t\t});\n\t\t\treturn type_result && compareIds(id_path[\"has steps\"][1].tail, $.properties.tail);\n\t\t},\n\t});\n}\n\nexport function isEntrySelected(\n\tquery: api_cs.Cquery__client_state,\n\tentry_location: QueryEntryLocation\n): api_cs.Tentries__yes__has_result[\"is selected\"] {\n\tswitch (query.properties.has_selected_entries.state.name) {\n\t\tcase \"no\":\n\t\t\treturn \"no\";\n\t\tcase \"yes\": {\n\t\t\tconst $ = query.properties.has_selected_entries.state.node;\n\t\t\treturn entry_location(\n\t\t\t\t(entry) => {\n\t\t\t\t\tfor (const [key, selected_entry] of $.properties.selected_entries) {\n\t\t\t\t\t\tswitch (selected_entry.properties.entry_status.properties.initialized.state.name) {\n\t\t\t\t\t\t\tcase \"unknown\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst local = selected_entry.properties.entry_status.properties.initialized.state.node;\n\t\t\t\t\t\t\t\tif (local.properties.referenced_node.output.result_node().is(entry.properties.node)) {\n\t\t\t\t\t\t\t\t\treturn [\"yes\", { \"selected entry\": key }];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(selected_entry.properties.entry_status.properties.initialized.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn \"no\";\n\t\t\t\t},\n\t\t\t\t(id_path_builder) => {\n\t\t\t\t\tconst id_path = id_path_builder.build();\n\t\t\t\t\tfor (const [key, entry] of $.properties.selected_entries) {\n\t\t\t\t\t\tswitch (entry.properties.entry_status.properties.initialized.state.name) {\n\t\t\t\t\t\t\tcase \"unknown\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst local = entry.properties.entry_status.properties.initialized.state.node;\n\t\t\t\t\t\t\t\tconst selected_entry_path = createIdPathBuilderFromNode(\n\t\t\t\t\t\t\t\t\tlocal.properties.referenced_node.output.result_node()\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tif (selected_entry_path.equals(id_path_builder)) {\n\t\t\t\t\t\t\t\t\treturn [\"yes\", { \"selected entry\": key }];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\tconst remote = entry.properties.entry_status.properties.initialized.state.node;\n\t\t\t\t\t\t\t\tif (compareIds(id_path, remote.properties.referenced_node)) {\n\t\t\t\t\t\t\t\t\treturn [\"yes\", { \"selected entry\": key }];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(entry.properties.entry_status.properties.initialized.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn \"no\";\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(query.properties.has_selected_entries.state);\n\t}\n}\n\nexport function subscribeToEntryStyle(entry: api_cs.Centries__yes__has_result, destructor: DestructorTree): void {\n\tconst query = entry.parent.parent;\n\tquery.properties.definition.ref.properties.context.state.node.output\n\t\t.selected_context()\n\t\t.input.application_node()\n\t\t.input.location()\n\t\t.switch({\n\t\t\tgroup: undefined,\n\t\t\tstate: undefined,\n\t\t\tcollection: ($) => {\n\t\t\t\tswitch ($.properties.ui.properties.has_style.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst has_entry_style = $.properties.ui.properties.has_style.state.node;\n\t\t\t\t\t\tconst context_node = entry.properties.entry_status.properties.initialized.switch({\n\t\t\t\t\t\t\tunknown: () => null,\n\t\t\t\t\t\t\tyes: ($) => $.properties.referenced_node.output.result_node(),\n\t\t\t\t\t\t\tno: ($) => registerIdPath(createIdPathBuilderFromClientIdPath($.properties.referenced_node), destructor),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (context_node !== null) {\n\t\t\t\t\t\t\tevaluateStyle(\n\t\t\t\t\t\t\t\tinitializedStyle(entry.properties.style),\n\t\t\t\t\t\t\t\thas_entry_style.properties.style_expression,\n\t\t\t\t\t\t\t\tcontext_node\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.ui.properties.has_style.state);\n\t\t\t\t}\n\t\t\t},\n\t\t\troot: undefined,\n\t\t});\n}\n\nexport function subscribeToCellNumericalTypeProperties(\n\tnumber_cell: api_cs.Cnumber__type__cells,\n\tthis_node: api_cs.Cnode,\n\tdestructor: DestructorTree\n): void {\n\tconst number_column = number_cell.inferences.column_type();\n\tconst app_number = number_column.inferences.number_type().properties.number.ref.inferences.number();\n\tconst gui_numerical_type = number_column.inferences.number_type().properties.number.ref.properties.numerical_type.ref;\n\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\tnumber_cell.properties.numerical_type_properties\n\t);\n\tconst subscription = numerical_type_properties.subscribe_decimals({\n\t\ton_update: () => {\n\t\t\tswitch (number_cell.properties.is_set.state.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst $ = number_cell.properties.is_set.state.node;\n\t\t\t\t\t$.set_textual_representation(\n\t\t\t\t\t\tserializeNumber(\n\t\t\t\t\t\t\t$.properties.number.value,\n\t\t\t\t\t\t\tgetDecimalsFromNumericalTypeProperties(numerical_type_properties.parent),\n\t\t\t\t\t\t\tapp_number.properties.numerical_type.ref\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(number_cell.properties.is_set.state);\n\t\t\t}\n\t\t},\n\t});\n\tdestructor.onDestroy(() => {\n\t\tsubscription.unsubscribe();\n\t});\n\tevaluateNumericalTypeProperty(numerical_type_properties, app_number, this_node);\n\tswitch (app_number.properties.ui.properties.dynamic_numerical_type.state.name) {\n\t\tcase \"no\":\n\t\t\tswitch (gui_numerical_type.key.ref.properties.ui.properties.represent_as.state.name) {\n\t\t\t\tcase \"model\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"date\":\n\t\t\t\t\tnumerical_type_properties.set_unit(\"\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"date and time\":\n\t\t\t\t\tnumerical_type_properties.set_unit(\"\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"duration\":\n\t\t\t\t\tnumerical_type_properties.set_unit(\"\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"custom type\":\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(gui_numerical_type.key.ref.properties.ui.properties.represent_as.state);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"yes\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(app_number.properties.ui.properties.dynamic_numerical_type.state);\n\t}\n}\n\nexport function subscribeToStategroupCellStyle(\n\tstategroup_cell: api_cs.Cstate_group__type__cells,\n\tparent_context: api_cs.Cstate_group__type__property | IdPathBuilder,\n\tdestructor: DestructorTree\n): void {\n\tconst state_group_column = stategroup_cell.inferences.column_type();\n\tconst app_stategroup = state_group_column.inferences\n\t\t.state_group_type()\n\t\t.properties.state_group.ref.inferences.state_group();\n\tconst stategroup_name = app_stategroup.parent.parent.key;\n\tif (hasStyle(app_stategroup)) {\n\t\tdestructor.subscribeToStategroup(stategroup_cell.properties.is_set, (destructor) => {\n\t\t\tswitch (stategroup_cell.properties.is_set.state.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst is_set = stategroup_cell.properties.is_set.state.node;\n\t\t\t\t\tdestructor.subscribeToText(is_set, \"subscribe_state\", (state_name, destructor) => {\n\t\t\t\t\t\tconst style = initializedStyle(is_set.properties.style);\n\t\t\t\t\t\tconst app_state = app_stategroup.properties.states.get(state_name);\n\t\t\t\t\t\tif (app_state) {\n\t\t\t\t\t\t\tunsetStyle(style);\n\t\t\t\t\t\t\tswitch (app_state.properties.ui.properties.has_style.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\tconst $ = app_state.properties.ui.properties.has_style.state.node;\n\t\t\t\t\t\t\t\t\tlet context_node: api_cs.Cnode;\n\t\t\t\t\t\t\t\t\tif (parent_context instanceof api_cs.Cstate_group__type__property) {\n\t\t\t\t\t\t\t\t\t\tcontext_node = parent_context.properties.states.get(state_name)!.properties.node;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tcontext_node = registerIdPath(parent_context.state(stategroup_name, state_name), destructor);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tevaluateStyle(style, $.properties.style_expression, context_node);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(app_state.properties.ui.properties.has_style.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\nfunction subscribeToEntryExpressions(target: api_cs.Centries__yes__has_result, source: api_cs.Centries__collection) {\n\tconst destructor = addChild(target);\n\n\tsubscribeToEntryStyle(target, destructor);\n\n\ttarget.properties.cells.forEach((cell) => {\n\t\tswitch (cell.properties.type.state.name) {\n\t\t\tcase \"number\": {\n\t\t\t\tconst number_cell = cell.properties.type.state.node;\n\t\t\t\tconst number_column = number_cell.inferences.column_type();\n\t\t\t\tconst app_number = number_column.inferences.number_type().properties.number.ref.inferences.number();\n\t\t\t\tswitch (app_number.properties.ui.properties.dynamic_numerical_type.state.name) {\n\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\tconst this_node = client_state.properties.root;\n\t\t\t\t\t\tsubscribeToCellNumericalTypeProperties(number_cell, this_node, destructor);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst node = walkNodePath(\n\t\t\t\t\t\t\tnumber_column.inferences.number_type().parent.properties.path,\n\t\t\t\t\t\t\tsource.properties.node\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (node) {\n\t\t\t\t\t\t\tregisterNodeContext(node, destructor);\n\t\t\t\t\t\t\tsubscribeToCellNumericalTypeProperties(number_cell, node, destructor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(app_number.properties.ui.properties.dynamic_numerical_type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"file\":\n\t\t\t\tbreak;\n\t\t\tcase \"text\":\n\t\t\t\tbreak;\n\t\t\tcase \"widget\":\n\t\t\t\tbreak;\n\t\t\tcase \"state group\": {\n\t\t\t\tconst state_group_cell = cell.properties.type.state.node;\n\t\t\t\tconst state_group_column = state_group_cell.inferences.column_type().inferences.state_group_type();\n\t\t\t\tconst node = walkNodePath(state_group_column.parent.properties.path, source.properties.node);\n\t\t\t\tif (node) {\n\t\t\t\t\tregisterNodeContext(node, destructor);\n\t\t\t\t\tconst state_group_definition = state_group_column.properties.state_group.ref.inferences.state_group();\n\t\t\t\t\tconst state_group = registerStategroup(state_group_definition, node, destructor);\n\t\t\t\t\tsubscribeToStategroupCellStyle(state_group_cell, state_group, destructor);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t});\n}\n\nexport function getTotalAmountOfLocalEntries(query: api_cs.Cquery__client_state): number {\n\tswitch (query.properties.entries_are_editable.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst editable = query.properties.entries_are_editable.state.node;\n\t\t\tswitch (editable.properties.can_create_entry.state.name) {\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst can_create_entry = editable.properties.can_create_entry.state.node;\n\t\t\t\t\tswitch (can_create_entry.properties.in_.state.name) {\n\t\t\t\t\t\tcase \"query\": {\n\t\t\t\t\t\t\tconst editable_query = can_create_entry.properties.in_.state.node;\n\t\t\t\t\t\t\tconst collection = editable_query.properties.collection.ref;\n\t\t\t\t\t\t\treturn Collection.getAmountOfLocalEntries(collection);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"candidates\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"no\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tbreak;\n\t}\n\tswitch (query.properties.use_for.state.name) {\n\t\tcase \"query\": //already handled above\n\t\t\tbreak;\n\t\tcase \"candidates\": {\n\t\t\tconst reference = query.properties.use_for.state.node.inferences.reference_property().parent;\n\t\t\tconst collection = iReference(reference).collectionContext.value;\n\t\t\tif (isResolved(collection)) {\n\t\t\t\treturn Collection.getAmountOfLocalEntries(collection);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}\n\nexport function removeResultEntry(entry: api_cs.Centries__yes__has_result): void {\n\tconst has_result = entry.parent;\n\tconst new_amount_of_entries = has_result.properties.amount_of_entries_visible.value - 1;\n\thas_result.set_amount_of_entries_visible(new_amount_of_entries);\n\thas_result.properties.entries.delete(entry.key);\n\tupdateIsEmpty(has_result);\n}\n\nexport function subscribeToCollectionEntry(entry_status: api_cs.Cquery_entry_status): void {\n\tconst destructor = addChild(entry_status);\n\tconst position = entry_status.input.position();\n\tswitch (position.variant.name) {\n\t\tcase \"result entry\": {\n\t\t\tconst entry = position.variant.definition;\n\t\t\tconst query = entry.parent.parent;\n\t\t\tconst can_create_entry = query.properties.entries_are_editable.switch({\n\t\t\t\tyes: ($) =>\n\t\t\t\t\t$.properties.can_create_entry.switch({\n\t\t\t\t\t\tyes: true,\n\t\t\t\t\t\tno: false,\n\t\t\t\t\t}),\n\t\t\t\tno: false,\n\t\t\t});\n\t\t\tif (!can_create_entry) {\n\t\t\t\tsubscribeToClientQueryEntry(entry, destructor);\n\t\t\t} else {\n\t\t\t\tdestructor.subscribeToStategroup(entry_status.properties.initialized, (destructor) => {\n\t\t\t\t\tswitch (entry_status.properties.initialized.state.name) {\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst initialized = entry_status.properties.initialized.state.node;\n\t\t\t\t\t\t\tconst collection_entry = initialized.properties.referenced_node.output\n\t\t\t\t\t\t\t\t.result_node()\n\t\t\t\t\t\t\t\t.input.entity()\n\t\t\t\t\t\t\t\t.cast(\"entry\");\n\t\t\t\t\t\t\tdestructor.subscribeToStategroup(collection_entry.properties.node.properties.is_valid, () => {\n\t\t\t\t\t\t\t\tconst collection_entry_status = collection_entry.properties.node.properties.is_valid.state.name;\n\t\t\t\t\t\t\t\tconst result_entry_status = entry.properties.is_valid.state.name;\n\t\t\t\t\t\t\t\tif (result_entry_status !== collection_entry_status) {\n\t\t\t\t\t\t\t\t\tentry.properties.is_valid.set(collection_entry_status, {});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tdestructor.subscribeToStategroup(collection_entry.properties.node.properties.can_be_deleted, () => {\n\t\t\t\t\t\t\t\tconst collection_entry_status = collection_entry.properties.node.properties.can_be_deleted.state.name;\n\t\t\t\t\t\t\t\tconst result_entry_status = entry.properties.is_editable.state.name;\n\t\t\t\t\t\t\t\tif (result_entry_status !== collection_entry_status) {\n\t\t\t\t\t\t\t\t\tentry.properties.is_editable.set(collection_entry_status, {});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tsubscribeToEntryExpressions(entry, collection_entry);\n\t\t\t\t\t\t\tsubscribeToClientQueryEntry(entry, destructor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tsubscribeToClientQueryEntry(entry, destructor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"unknown\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(entry_status.properties.initialized.state);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"selected entry\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(position.variant);\n\t}\n\tdestructor.subscribeToStategroup(entry_status.properties.initialized, () => {\n\t\tswitch (entry_status.properties.initialized.state.name) {\n\t\t\tcase \"yes\": {\n\t\t\t\tconst initialized = entry_status.properties.initialized.state.node;\n\t\t\t\tlinkIdPath(initialized.properties.referenced_node);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tcase \"unknown\":\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(entry_status.properties.initialized.state);\n\t\t}\n\t});\n}\n\nfunction createResultEntry(\n\tquery: api_cs.Cquery__client_state,\n\tentry_location: QueryEntryLocation\n): api_cs.Tentries__yes__has_result {\n\treturn {\n\t\t\"is editable\": entry_location(\n\t\t\t(entry) => {\n\t\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\treturn [\"yes\", {}];\n\t\t\t\t\tcase \"remote\":\n\t\t\t\t\t\treturn [\"no\", {}];\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => [\"no\", {}]\n\t\t),\n\t\t\"use for\": query.properties.use_for.switch({\n\t\t\tcandidates: [\"candidates\", {}],\n\t\t\tquery: [\"query\", {}],\n\t\t}),\n\t\t\"is valid\": [\"yes\", {}],\n\t\t\"entry status\": entry_location(\n\t\t\t(entry) => ({\n\t\t\t\tinitialized: [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"referenced node\": createClientIdPathFromNode(entry.properties.node),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t\t(id_path) => ({\n\t\t\t\tinitialized: [\n\t\t\t\t\t\"no\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"referenced node\": id_path.build(),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t})\n\t\t),\n\t\tstyle: { initialized: \"no\" },\n\t\t\"is selected\": isEntrySelected(query, entry_location),\n\t\t\"has cells\": query.properties.has_columns.switch({\n\t\t\tno: [\"no\", {}],\n\t\t\tyes: ($) => [\"yes\", { first: $.properties.first.entry }],\n\t\t}),\n\t\tcells: query.properties.columns.map(($) => ({\n\t\t\t\"has successor\": $.properties.has_successor.switch({\n\t\t\t\tno: [\"no\", {}],\n\t\t\t\tyes: ($) => [\"yes\", { successor: $.properties.successor.entry }],\n\t\t\t}),\n\t\t\t\"column type\": $.properties.column_type.switch({\n\t\t\t\tid: [\"id\", {}],\n\t\t\t\tcontent: [\"content\", {}],\n\t\t\t}),\n\t\t\ttype: $.properties.type.switch({\n\t\t\t\ttext: [\n\t\t\t\t\t\"text\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"is set\": [\"no\", {}],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tfile: [\n\t\t\t\t\t\"file\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"is set\": [\"no\", {}],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tnumber: [\n\t\t\t\t\t\"number\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"is set\": [\"no\", {}],\n\t\t\t\t\t\t\"numerical type properties\": {\n\t\t\t\t\t\t\tinitialized: \"no\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t\"state group\": ($): api_cs.Tcells[\"type\"] => [\n\t\t\t\t\t\"state group\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"is set\": [\"no\", {}],\n\t\t\t\t\t\tstates: $.properties.has_filter.switch({\n\t\t\t\t\t\t\tno: () => ({}),\n\t\t\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\t\t\t$.properties.states.map(($) => ({\n\t\t\t\t\t\t\t\t\tname: getTranslation($.key_value),\n\t\t\t\t\t\t\t\t\t\"is selected\": [\"no\", {}],\n\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\twidget: [\n\t\t\t\t\t\"widget\",\n\t\t\t\t\t{\n\t\t\t\t\t\tinitialized: [\"no\", {}],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t})),\n\t};\n}\n\nexport function addResultEntry(\n\thas_result: api_cs.Cyes__has_result,\n\tentry_location: QueryEntryLocation\n): api_cs.Centries__yes__has_result {\n\tconst internal_key = uuid.generate();\n\tconst entry = has_result.properties.entries.create(\n\t\tinternal_key,\n\t\tcreateResultEntry(has_result.parent, entry_location)\n\t);\n\n\tconst amount_of_entries = has_result.properties.amount_of_entries_visible.value + 1;\n\thas_result.set_amount_of_entries_visible(amount_of_entries);\n\tupdateIsEmpty(has_result);\n\n\tsubscribeToCollectionEntry(entry.properties.entry_status);\n\treturn entry;\n}\n\nfunction getKeyFromIdPath(id_path: api_cs.Cid_path, collection_def?: api_app.Ccollection__type__property) {\n\tlet key: string | undefined;\n\twhile (id_path.properties.has_steps.state.name === \"yes\") {\n\t\tconst has_steps = id_path.properties.has_steps.state.node;\n\t\tswitch (has_steps.properties.type.state.name) {\n\t\t\tcase \"group\":\n\t\t\t\tbreak;\n\t\t\tcase \"state\":\n\t\t\t\tbreak;\n\t\t\tcase \"collection entry\": {\n\t\t\t\tconst $ = has_steps.properties.type.state.node;\n\t\t\t\tif (!collection_def || $.properties.collection.ref.is(collection_def)) {\n\t\t\t\t\tkey = $.properties.id;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(has_steps.properties.type.state);\n\t\t}\n\t\tid_path = has_steps.properties.tail;\n\t}\n\treturn key;\n}\n\nfunction getKeyFromNode(node: api_cs.Cnode, collection_def?: api_app.Ccollection__type__property): string | undefined {\n\tlet current_node: api_cs.Cnode | undefined = node;\n\tfor (let position = node.input.position(); current_node !== undefined; position = current_node.input.position()) {\n\t\tswitch (position.variant.name) {\n\t\t\tcase \"entity\": {\n\t\t\t\tconst entity = position.variant.definition;\n\t\t\t\tswitch (entity.variant.name) {\n\t\t\t\t\tcase \"root\":\n\t\t\t\t\t\tcurrent_node = undefined;\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\tconst entry = entity.variant.definition;\n\t\t\t\t\t\tif (!collection_def || entry.parent.inferences.collection_type().is(collection_def)) {\n\t\t\t\t\t\t\tcurrent_node = undefined;\n\t\t\t\t\t\t\treturn Entry.getIndex(entry);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcurrent_node = entry.parent.parent.parent.parent;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(entity.variant);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"group\":\n\t\t\t\tcurrent_node = position.variant.definition.parent.parent.parent;\n\t\t\t\tbreak;\n\t\t\tcase \"state\":\n\t\t\t\tcurrent_node = position.variant.definition.parent.parent.parent.parent;\n\t\t\t\tbreak;\n\t\t\tcase \"root\":\n\t\t\t\tcurrent_node = undefined;\n\t\t\t\treturn;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(position.variant);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport function getQueryEntryKey(query_entry: api_cs.Cquery_entry_status): string | undefined {\n\tswitch (query_entry.properties.initialized.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst entry = query_entry.properties.initialized.state.node.properties.referenced_node.output\n\t\t\t\t.result_node()\n\t\t\t\t.input.entity()\n\t\t\t\t.cast(\"entry\");\n\t\t\treturn Entry.getKeyValue(entry);\n\t\t}\n\t\tcase \"no\": {\n\t\t\tconst id_path = query_entry.properties.initialized.state.node.properties.referenced_node;\n\t\t\treturn getKeyFromIdPath(id_path);\n\t\t}\n\t\tcase \"unknown\": {\n\t\t\tconst unkown = query_entry.properties.initialized.state.node;\n\t\t\tconst entry = getLocalEntry(unkown);\n\t\t\tif (entry === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t} else {\n\t\t\t\treturn Entry.getKeyValue(entry);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn unexpectedState(query_entry.properties.initialized.state);\n\t}\n}\n\nexport function buildQueryEntryIndex(\n\tquery: api_cs.Cquery__client_state,\n\tgetKeyFunc: (collection_def?: api_app.Ccollection__type__property) => string | undefined\n): string | undefined {\n\tswitch (query.properties.use_for.state.name) {\n\t\tcase \"query\": {\n\t\t\tlet query_path = query.properties.use_for.state.node.inferences.node_context().properties.path;\n\t\t\tlet index = \"\";\n\t\t\twhile (query_path.properties.has_steps.state.name === \"yes\") {\n\t\t\t\tconst $ = query_path.properties.has_steps.state.node;\n\t\t\t\tindex = index.length > 0 ? index + \".\" : index;\n\t\t\t\tindex += getKeyFunc($.properties.collection.ref.inferences.collection()) ?? \"\";\n\t\t\t\tquery_path = $.properties.tail;\n\t\t\t}\n\t\t\treturn index;\n\t\t}\n\t\tcase \"candidates\":\n\t\t\treturn getKeyFunc();\n\t\tdefault:\n\t\t\tunexpectedState(query.properties.use_for.state);\n\t}\n}\n\nexport function getQueryEntryIndex(query_entry: api_cs.Cquery_entry_status): string | undefined {\n\tconst query = query_entry.input.query();\n\tswitch (query_entry.properties.initialized.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst initialized = query_entry.properties.initialized.state.node;\n\t\t\tconst node = initialized.properties.referenced_node.output.result_node();\n\t\t\treturn buildQueryEntryIndex(query, (cdef?: api_app.Ccollection__type__property) => getKeyFromNode(node, cdef));\n\t\t}\n\t\tcase \"no\": {\n\t\t\tconst id_path = query_entry.properties.initialized.state.node.properties.referenced_node;\n\t\t\treturn buildQueryEntryIndex(query, (cdef?: api_app.Ccollection__type__property) =>\n\t\t\t\tgetKeyFromIdPath(id_path, cdef)\n\t\t\t);\n\t\t}\n\t\tcase \"unknown\": {\n\t\t\tconst unknown = query_entry.properties.initialized.state.node;\n\t\t\tconst entry = getLocalEntry(unknown);\n\t\t\tif (entry) {\n\t\t\t\treturn buildQueryEntryIndex(query, (cdef?: api_app.Ccollection__type__property) =>\n\t\t\t\t\tgetKeyFromNode(entry.properties.node, cdef)\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(query_entry.properties.initialized.state);\n\t}\n}\n\nexport function getQueryEntryIndexForEntry(\n\tquery: api_cs.Cquery__client_state,\n\tentry: api_cs.Centries__collection\n): string | undefined {\n\treturn buildQueryEntryIndex(query, (cdef?: api_app.Ccollection__type__property) =>\n\t\tgetKeyFromNode(entry.properties.node, cdef)\n\t);\n}\n\nexport function getIndexedResultEntries(\n\thas_result: api_cs.Cyes__has_result\n): Map {\n\tconst entries_indexed_on_key = new Map();\n\tfor (const entry of has_result.properties.entries.values()) {\n\t\tconst index_key = getQueryEntryIndex(entry.properties.entry_status);\n\t\tif (index_key !== undefined) {\n\t\t\tentries_indexed_on_key.set(index_key, entry);\n\t\t}\n\t}\n\treturn entries_indexed_on_key;\n}\n\ntype PatchedUnkownLocation = {\n\t__local_entry: api_cs.Centries__collection;\n};\nexport function patchEntryWithLocalEntry(\n\tunkown_location: Cunknown__initialized,\n\tentry: api_cs.Centries__collection\n): void {\n\tconst patched_location = unkown_location as unknown as PatchedUnkownLocation;\n\tpatched_location.__local_entry = entry;\n}\n\nexport function getLocalEntry(unkown_location: Cunknown__initialized): api_cs.Centries__collection | undefined {\n\tconst patched_location = unkown_location as unknown as PatchedUnkownLocation;\n\treturn patched_location.__local_entry;\n}\n\ntype PatchedEntryId = {\n\t__id_path: IdPathBuilder;\n};\n\nexport function storeEntryId(entry: api_cs.Cquery_entry_status, id_path_builder: IdPathBuilder) {\n\t(entry as any as PatchedEntryId).__id_path = id_path_builder;\n}\n\nexport function getEntryId(entry: api_cs.Cquery_entry_status): IdPathBuilder {\n\treturn (entry as any as PatchedEntryId).__id_path;\n}\n\nexport function getPropertyForCell(\n\tentry: api_cs.Centries__collection,\n\tcell: api_cs.Ctext__type__cells\n): api_cs.Ctext__type__property | undefined;\nexport function getPropertyForCell(\n\tentry: api_cs.Centries__collection,\n\tcell: api_cs.Cnumber__type__cells\n): api_cs.Cnumber__type__property | undefined;\nexport function getPropertyForCell(\n\tentry: api_cs.Centries__collection,\n\tcell: api_cs.Cfile__type__cells\n): api_cs.Cfile__type__property | undefined;\nexport function getPropertyForCell(\n\tentry: api_cs.Centries__collection,\n\tcell: api_cs.Cstate_group__type__cells\n): api_cs.Cstate_group__type__property | undefined;\nexport function getPropertyForCell(\n\tentry: api_cs.Centries__collection,\n\tcell:\n\t\t| api_cs.Ctext__type__cells\n\t\t| api_cs.Cnumber__type__cells\n\t\t| api_cs.Cfile__type__cells\n\t\t| api_cs.Cstate_group__type__cells\n):\n\t| api_cs.Ctext__type__property\n\t| api_cs.Cnumber__type__property\n\t| api_cs.Cfile__type__property\n\t| api_cs.Cstate_group__type__property\n\t| undefined {\n\tconst column = cell.inferences.column_type().parent.key.ref;\n\tconst context_node = walkNodePath(column.properties.path, entry.properties.node);\n\tconst column_type = column.properties.type.state;\n\tswitch (column_type.name) {\n\t\tcase \"text\":\n\t\t\treturn context_node?.properties.attributes\n\t\t\t\t.get(column_type.node.properties.text.entry)\n\t\t\t\t?.properties.type.cast(\"property\")\n\t\t\t\t.properties.type.cast(\"text\");\n\t\tcase \"number\": {\n\t\t\treturn context_node?.properties.attributes\n\t\t\t\t.get(column_type.node.properties.number.entry)\n\t\t\t\t?.properties.type.cast(\"property\")\n\t\t\t\t.properties.type.cast(\"number\");\n\t\t\tbreak;\n\t\t}\n\t\tcase \"file\": {\n\t\t\treturn context_node?.properties.attributes\n\t\t\t\t.get(column_type.node.properties.file.entry)\n\t\t\t\t?.properties.type.cast(\"property\")\n\t\t\t\t.properties.type.cast(\"file\");\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state group\": {\n\t\t\treturn context_node?.properties.attributes\n\t\t\t\t.get(column_type.node.properties.state_group.entry)\n\t\t\t\t?.properties.type.cast(\"property\")\n\t\t\t\t.properties.type.cast(\"state group\");\n\t\t\tbreak;\n\t\t}\n\t\tcase \"widget\":\n\t\t\treturn undefined;\n\t}\n}\n\nfunction findCollectionForQuery(query: api_cs.Cquery__client_state, destructor: DestructorTree) {\n\tswitch (query.properties.use_for.state.name) {\n\t\tcase \"query\": {\n\t\t\tconst for_query = query.properties.use_for.state.node;\n\t\t\tconst node = for_query.inferences.node();\n\t\t\tconst node_context_query = for_query.inferences.node_context();\n\t\t\tswitch (node_context_query.properties.switch_.state.name) {\n\t\t\t\tcase \"current\":\n\t\t\t\t\tswitch (node_context_query.properties.path.properties.has_steps.state.name) {\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst has_steps = node_context_query.properties.path.properties.has_steps.state.node;\n\t\t\t\t\t\t\tswitch (has_steps.properties.head.properties.has_steps.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tswitch (has_steps.properties.tail.properties.has_steps.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\treturn registerCollection(\n\t\t\t\t\t\t\t\t\t\t\t\thas_steps.properties.collection.ref.inferences.collection(),\n\t\t\t\t\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tcase \"yes\": //can't create new entries for sub nodes\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"root\":\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"candidates\": // this is determined when the reference is selected.\n\t}\n\treturn undefined;\n}\n\nclass QueryInterface extends ClientStateObjectProxy {\n\tprivate destructor: DestructorTree;\n\treadonly entriesAreEditable: Scalar;\n\treadonly collection: iCollection | undefined;\n\n\tconstructor(readonly query: api_cs.Cquery__client_state) {\n\t\tsuper();\n\t\tthis.destructor = new DestructorTree();\n\t\tconst collection = findCollectionForQuery(query, this.destructor);\n\t\tif (collection) {\n\t\t\tthis.collection = iCollection(collection);\n\t\t\tthis.entriesAreEditable = createVariable(\n\t\t\t\tcreateExpressionBuilder(this.collection.canCreateEntry).pipe((can_create_entry) => {\n\t\t\t\t\tif (can_create_entry) {\n\t\t\t\t\t\tquery.properties.entries_are_editable.set(\"yes\", {\n\t\t\t\t\t\t\t\"is importing\": [\"no\", {}],\n\t\t\t\t\t\t\t\"can create entry\": [\n\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tin: [\n\t\t\t\t\t\t\t\t\t\t\"query\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcollection: collection.parent.parent.key_value,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tquery.properties.entries_are_editable.set(\"no\", {});\n\t\t\t\t\t}\n\t\t\t\t\treturn can_create_entry;\n\t\t\t\t})(),\n\t\t\t\tfalse\n\t\t\t);\n\t\t} else {\n\t\t\tthis.entriesAreEditable = Unknown;\n\t\t}\n\t\tquery.onDestroy(() => this.destructor.destroy());\n\t}\n}\n\nexport const iQuery = WeakCache((query) => new QueryInterface(query));\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport DestructorTree from \"../DestructorTree\";\nimport { IdPathBuilder, Raw_Id_Path_Head } from \"../navigation/IdPathBuilder\";\nimport * as Text from \"../state/Text\";\nimport * as Collection from \"../state/Collection\";\nimport { registerRelativeIdPath } from \"../state/registerClientState\";\nimport * as referenceResolver from \"../state 2 interface/referenceResolver\";\nimport supportsSelfReference from \"../state/supportsSelfReference\";\nimport { entry_reference_definition, descendant_object_path } from \"../state/expressions\";\nimport * as step from \"../state/step\";\nimport {\n\tScalar,\n\tScalarProvider,\n\tWeakCache,\n\tcreateVariable,\n\tMutableVariable,\n\tReadonlyVariable,\n\tcreateExpressionBuilder,\n} from \"../../../../../stream\";\nimport { Pending, Unknown, Result, Failed, isResolved } from \"../Status\";\nimport { entryReferenceSynchronized } from \"../state/expressionSynchronized\";\nimport { getGuiText } from \"../guiModel\";\nimport * as microtaskQueue from \"../microtaskQueue\";\nimport { setModified } from \"./SaveModifiedStatus\";\nimport { iText } from \"../state/Text\";\nimport ClientStateObjectProxy from \"./ClientStateObjectProxy\";\n\nfunction updateLastKeyInRawIdPath(path: Raw_Id_Path_Head, new_key: string): string | undefined {\n\tswitch (path[\"has steps\"][0]) {\n\t\tcase \"no\":\n\t\t\treturn new_key;\n\t\tcase \"yes\": {\n\t\t\tconst step = path[\"has steps\"][1];\n\t\t\tconst tail = updateLastKeyInRawIdPath(step.tail, new_key);\n\t\t\tswitch (step.type[0]) {\n\t\t\t\tcase \"group\":\n\t\t\t\t\treturn tail;\n\t\t\t\tcase \"state\":\n\t\t\t\t\treturn tail;\n\t\t\t\tcase \"collection entry\":\n\t\t\t\t\tif (tail !== undefined) {\n\t\t\t\t\t\tstep.type[1].id = tail;\n\t\t\t\t\t}\n\t\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction createIdPathBuilderFromRawIdPath(\n\traw_path: Raw_Id_Path_Head,\n\tpath_builder = new IdPathBuilder()\n): IdPathBuilder {\n\tswitch (raw_path[\"has steps\"][0]) {\n\t\tcase \"no\":\n\t\t\treturn path_builder;\n\t\tcase \"yes\": {\n\t\t\tconst step = raw_path[\"has steps\"][1];\n\t\t\tswitch (step.type[0]) {\n\t\t\t\tcase \"group\":\n\t\t\t\t\tpath_builder = path_builder.group(step.type[1].group);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"state\":\n\t\t\t\t\tpath_builder = path_builder.state(step.type[1][\"state group\"], step.type[1].state);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"collection entry\":\n\t\t\t\t\tpath_builder = path_builder.collectionEntry(step.type[1].collection, step.type[1].id);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn createIdPathBuilderFromRawIdPath(step.tail, path_builder);\n\t\t}\n\t}\n}\n\nfunction synchronized(reference: Reference): Scalar> {\n\tswitch (\n\t\treference.parent.parent.inferences.property_type().properties.type.state.node.output.value_source().variant.name\n\t) {\n\t\tcase \"derived\":\n\t\t\treturn \"yes\";\n\t\tcase \"base\": {\n\t\t\tconst stream = createVariable(\n\t\t\t\tentryReferenceSynchronized(reference.parent, reference.inferences.is_navigable().properties.expression)(),\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tstream.subscribe({\n\t\t\t\tupdate: (synchronized) => {\n\t\t\t\t\tif (reference.destroyed) return;\n\t\t\t\t\tswitch (synchronized) {\n\t\t\t\t\t\tcase Pending:\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Failed:\n\t\t\t\t\t\t\treference.parent.properties.backend_known.switch({\n\t\t\t\t\t\t\t\tno: () => undefined,\n\t\t\t\t\t\t\t\tyes: (backend_known) =>\n\t\t\t\t\t\t\t\t\treference.parent.properties.is_editable.switch({\n\t\t\t\t\t\t\t\t\t\tno: () => undefined,\n\t\t\t\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t\t\t\tconst is_modified = $.properties.modified.ensure(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: backend_known.properties.value,\n\t\t\t\t\t\t\t\t\t\t\t\tsaving: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\tsetModified(is_modified);\n\t\t\t\t\t\t\t\t\t\t\treturn is_modified;\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Unknown:\n\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\treference.parent.properties.is_editable.switch({\n\t\t\t\t\t\t\t\tno: () => undefined,\n\t\t\t\t\t\t\t\tyes: ($) => $.properties.modified.ensure(\"no\", {}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t\treference.onDestroy(() => stream.destroy());\n\t\t\treturn stream;\n\t\t}\n\t}\n}\n\ntype Reference = api_cs.Cyes__navigable;\ntype ResolveStatus = [\"failed to resolve\"] | [\"is busy resolving\"] | [\"resolved\", api_cs.Cnode] | [\"unresolved\"];\n\nexport class ReferenceInterface extends ClientStateObjectProxy {\n\treadonly isMandatory: boolean;\n\treadonly propagateKeyUpdates: boolean;\n\treadonly selfReferenceAllowed: boolean;\n\treadonly backendValue: MutableVariable>;\n\treadonly synchronized: Scalar>;\n\treadonly collectionContext: ReadonlyVariable>;\n\treadonly referencedEntry: MutableVariable>;\n\treadonly expression: ReadonlyVariable>;\n\treadonly referencedNode: ReadonlyVariable>;\n\treadonly status: ReadonlyVariable;\n\n\tconstructor(readonly reference: Reference) {\n\t\tsuper();\n\t\tconst definition = reference.inferences.is_navigable();\n\t\tconst expression = definition.properties.expression;\n\t\tconst resolve_status = reference.properties.resolve_status;\n\t\tthis.isMandatory = definition.properties.behaviour.properties.type.switch({\n\t\t\tmandatory: () => true,\n\t\t\toptional: () =>\n\t\t\t\tgetGuiText(definition.parent)?.properties.navigable.switch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\t$.properties.validate.switch({\n\t\t\t\t\t\t\tno: false,\n\t\t\t\t\t\t\tyes: true,\n\t\t\t\t\t\t}),\n\t\t\t\t}) ?? false,\n\t\t});\n\t\tthis.propagateKeyUpdates = definition.properties.behaviour.properties.type.switch({\n\t\t\tmandatory: () => true,\n\t\t\toptional: () =>\n\t\t\t\tdefinition.properties.behaviour_specialization.switch({\n\t\t\t\t\tnone: () => false,\n\t\t\t\t\t\"propagate key to value\": () => true,\n\t\t\t\t}),\n\t\t});\n\t\tthis.selfReferenceAllowed = supportsSelfReference(expression);\n\t\tthis.backendValue = createVariable(Unknown, true);\n\t\tthis.synchronized = synchronized(reference);\n\t\tthis.collectionContext = createVariable(entry_reference_definition(expression)(reference.component_root), false);\n\t\tthis.referencedEntry = createVariable(\n\t\t\tcreateExpressionBuilder(this.collectionContext).pipe(\n\t\t\t\tstep.sync((collection) =>\n\t\t\t\t\tcreateExpressionBuilder(Text.value(this.reference.parent))\n\t\t\t\t\t\t.pipe(step.sync((key, destructor) => Collection.openEntry(collection, key, destructor)()))\n\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\tstep.sync((entry, destructor) => {\n\t\t\t\t\t\t\t\tif (!this.entryIsAllowed(entry)) return Failed;\n\t\t\t\t\t\t\t\tiText(entry.properties.key.ref).setR2M(this, destructor);\n\t\t\t\t\t\t\t\treturn entry;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)()\n\t\t\t\t)\n\t\t\t)(),\n\t\t\ttrue\n\t\t);\n\t\tthis.expression = createVariable(\n\t\t\tcreateExpressionBuilder(this.referencedEntry)\n\t\t\t\t.pipe(step.sync((entry) => entry.properties.node))\n\t\t\t\t.pipe(descendant_object_path(expression.properties.tail))() as ScalarProvider>,\n\t\t\tfalse\n\t\t);\n\t\tthis.referencedNode = createVariable(\n\t\t\tcreateExpressionBuilder(this.synchronized).pipe((synchronized) => {\n\t\t\t\tswitch (synchronized) {\n\t\t\t\t\tcase Pending:\n\t\t\t\t\t\treturn Pending;\n\t\t\t\t\tcase Unknown:\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\treturn createExpressionBuilder(this.backendValue).pipe(\n\t\t\t\t\t\t\tstep.sync((id_path, destructor) => registerRelativeIdPath(id_path, reference.component_root, destructor))\n\t\t\t\t\t\t)();\n\t\t\t\t\tcase Failed:\n\t\t\t\t\t\treturn this.expression;\n\t\t\t\t}\n\t\t\t})(),\n\t\t\tfalse\n\t\t);\n\t\tthis.status = createVariable(\n\t\t\tcreateExpressionBuilder(this.referencedNode)\n\t\t\t\t.pipe((node): ResolveStatus => {\n\t\t\t\t\tif (resolve_status.destroyed) return [\"unresolved\"];\n\t\t\t\t\tswitch (node) {\n\t\t\t\t\t\tcase Pending:\n\t\t\t\t\t\t\tresolve_status.properties.status.ensure(\"is busy resolving\", {});\n\t\t\t\t\t\t\treturn [\"is busy resolving\"];\n\t\t\t\t\t\tcase Unknown:\n\t\t\t\t\t\t\tresolve_status.properties.status.ensure(\"unresolved\", {});\n\t\t\t\t\t\t\treturn [\"unresolved\"];\n\t\t\t\t\t\tcase Failed:\n\t\t\t\t\t\t\tresolve_status.properties.status.ensure(\"failed to resolve\", {});\n\t\t\t\t\t\t\treturn [\"failed to resolve\"];\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tresolve_status.properties.status.ensure(\"resolved\", {});\n\t\t\t\t\t\t\treturn [\"resolved\", node];\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.fallback([\"unresolved\"])(),\n\t\t\tfalse,\n\t\t\t() => {\n\t\t\t\tif (resolve_status.destroyed) return;\n\t\t\t\tresolve_status.properties.status.ensure(\"unresolved\", {});\n\t\t\t}\n\t\t);\n\t\treferenceResolver.subscribeToReference(resolve_status);\n\t\treference.onDestroy(() => {\n\t\t\tthis.expression.destroy();\n\t\t\tthis.collectionContext.destroy();\n\t\t\tthis.referencedEntry.destroy();\n\t\t\tthis.referencedNode.destroy();\n\t\t\tthis.destructor?.destroy();\n\t\t});\n\t}\n\n\tentryIsAllowed(entry: api_cs.Centries__collection) {\n\t\treturn this.selfReferenceAllowed || entry !== this.reference.component_root.input.entity().cast(\"entry\");\n\t}\n\n\tsetServerValue(backend_value: Result): void {\n\t\tthis.backendValue.set(Unknown);\n\t\tmicrotaskQueue.add(() => {\n\t\t\tif (this.reference.destroyed) return;\n\t\t\tthis.backendValue.set(backend_value);\n\t\t});\n\t}\n\n\tupdateKeyInServerValue(value: string): void {\n\t\tconst id_path = this.backendValue.value;\n\t\tif (!isResolved(id_path)) return;\n\t\tconst raw_path = id_path.build();\n\t\tupdateLastKeyInRawIdPath(raw_path, value);\n\t\tthis.setServerValue(createIdPathBuilderFromRawIdPath(raw_path));\n\t}\n\n\tdestructor: DestructorTree | undefined;\n\tsetReferencedEntry(entry: api_cs.Centries__collection) {\n\t\tthis.referencedEntry.set(entry);\n\t\tthis.destructor?.destroy();\n\t\tthis.destructor = new DestructorTree();\n\t\tiText(entry.properties.key.ref).setR2M(this, this.destructor);\n\t}\n\n\tdiscard() {\n\t\tthis.destructor?.destroy();\n\t\tthis.referencedEntry.discard();\n\t}\n}\n\nexport const iReference = WeakCache((reference) => new ReferenceInterface(reference));\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport * as Rule from \"../state/Rule\";\nimport { iReference } from \"../state/Reference\";\nimport { Result, isResolved } from \"../Status\";\nimport { scalarValue } from \"../../../../../stream\";\n\nexport function getReferencedNode(resolved_reference: api_cs.Cresolved__status): api_cs.Cnode {\n\tconst resolvable = resolved_reference.parent.input.resolvable();\n\tlet node: Result;\n\tswitch (resolvable.variant.name) {\n\t\tcase \"reference\":\n\t\t\tnode = iReference(resolvable.variant.definition).referencedNode.value;\n\t\t\tbreak;\n\t\tcase \"rule\":\n\t\t\tnode = scalarValue(Rule.node(resolvable.variant.definition));\n\t\t\tbreak;\n\t}\n\tif (!isResolved(node)) {\n\t\tthrow new Error(\"Expected value to be a node of a resolved object.\");\n\t}\n\treturn node;\n}\n\nexport function isBusyResolving(resolve_status: api_cs.Cresolve_status): boolean {\n\tswitch (resolve_status.properties.status.state.name) {\n\t\tcase \"failed to resolve\":\n\t\t\treturn false;\n\t\tcase \"is busy resolving\":\n\t\t\treturn true;\n\t\tcase \"resolved\":\n\t\t\treturn false;\n\t\tcase \"unresolved\":\n\t\t\treturn false;\n\t}\n}\n\nexport async function isResolvedPromise(resolve_status: api_cs.Cresolve_status): Promise {\n\tif (isBusyResolving(resolve_status) === false) return Promise.resolve();\n\treturn new Promise((resolve) => {\n\t\tresolve_status.properties.status.subscribe({\n\t\t\ton_update: (_, subscription) => {\n\t\t\t\tif (isResolved(resolve_status)) {\n\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tresolve_status.onDestroy(() => resolve());\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport NodePathBuilder from \"../navigation/NodePathBuilder\";\nimport { CollectionPathBuilder } from \"../navigation/createCollectionPathBuilder\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport * as mapToIdPathBuilder from \"../state/mapToIdPathBuilder\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport * as Text from \"../state/Text\";\nimport { registerIdPath, registrationDone } from \"../state/registerClientState\";\nimport { entry_reference_definition, descendant_object_path, where_rule_object_path } from \"../state/expressions\";\nimport * as step from \"../state/step\";\nimport supportsSelfReference from \"../state/supportsSelfReference\";\nimport * as referenceResolver from \"../state 2 interface/referenceResolver\";\nimport {\n\tScalarProvider,\n\tWeakCache,\n\tScalar,\n\tcreateVariable,\n\tcreateExpressionBuilder,\n\tDefaultExpressionBuilder,\n\tlambda,\n} from \"../../../../../stream\";\nimport { Pending, Unknown, Result, Failed } from \"../Status\";\nimport { whereRuleObjectPath, entryReferenceSynchronized } from \"../state/expressionSynchronized\";\nimport { getGuiRule } from \"../guiModel\";\nimport { toStream } from \"../toStream\";\n\nexport function isMandatory(rule: api_cs.Crules): boolean {\n\treturn rule.key.ref.properties.behaviour.properties.type.switch({\n\t\tmandatory: () => true,\n\t\toptional: () => getGuiRule(rule.key.ref)?.properties.validate.switch({ no: false, yes: true }) ?? false,\n\t});\n}\n\nexport function query_constraint(id_path_builder: IdPathBuilder, path: NodePathBuilder) {\n\tconst stream = createVariable>(Unknown, true);\n\tDatastoreProxy.instance\n\t\t.collectionQuery({\n\t\t\t\"collection path\": CollectionPathBuilder.create().build(),\n\t\t\t\"context node path\": id_path_builder.build(),\n\t\t\tfilters: {\n\t\t\t\t\"todo filter\": [\"no\", {}],\n\t\t\t\t\"value filters\": {},\n\t\t\t},\n\t\t\taggregates: {},\n\t\t\t\"select entries\": [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t[\"parameter\"]: {\n\t\t\t\t\t\t\t\tpath: path.build(),\n\t\t\t\t\t\t\t\ttype: [\"id path\", {}],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t\"limit number of entries\": 1,\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t\t.then((result) => {\n\t\t\tresult.properties.context.switch({\n\t\t\t\t\"permission denied\": () => stream.set(Failed),\n\t\t\t\t\"does not exist\": () => stream.set(Failed),\n\t\t\t\texists: ($) =>\n\t\t\t\t\t$.properties.entries\n\t\t\t\t\t\t.cast(\"yes\")\n\t\t\t\t\t\t.properties.entries.properties.has_steps.cast(\"no\")\n\t\t\t\t\t\t.properties.properties.properties.properties.get(\"parameter\")!\n\t\t\t\t\t\t.properties.result.switch({\n\t\t\t\t\t\t\t\"permission denied\": () => stream.set(Failed),\n\t\t\t\t\t\t\t\"does not exist\": () => stream.set(Failed),\n\t\t\t\t\t\t\texists: ($) =>\n\t\t\t\t\t\t\t\tstream.set(mapToIdPathBuilder.fromClientReply($.properties.type.cast(\"id path\").properties.id_path)),\n\t\t\t\t\t\t}),\n\t\t\t});\n\t\t});\n\treturn stream;\n}\n\nexport const ruleExpressionBuilder = WeakCache<\n\tapi_app.Crules,\n\tDefaultExpressionBuilder>\n>((definition) => {\n\tconst definer = definition.parent.input.definer().variant;\n\tswitch (definition.properties.type.state.name) {\n\t\tcase \"entry reference\": {\n\t\t\tconst $ = definition.properties.type.state.node;\n\t\t\tconst expression = $.properties.expression;\n\t\t\tswitch (definer.name) {\n\t\t\t\tcase \"text\": {\n\t\t\t\t\tconst self_reference_allowed = supportsSelfReference(expression);\n\t\t\t\t\treturn lambda((rule: api_cs.Crules) => {\n\t\t\t\t\t\tconst text = rule.parent.input.definer().cast(\"reference\").parent;\n\t\t\t\t\t\tconst this_node = text.component_root;\n\t\t\t\t\t\treturn entry_reference_definition(expression)\n\t\t\t\t\t\t\t.pipe(step.entry(registrationDone(text, () => Text.value(text))()))\n\t\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\t\tstep.sync((entry) => {\n\t\t\t\t\t\t\t\t\tconst this_entry = text.component_root.input.entity().cast(\"entry\").properties.node;\n\t\t\t\t\t\t\t\t\tif (!self_reference_allowed && entry === this_entry) return Failed;\n\t\t\t\t\t\t\t\t\treturn entry;\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.pipe(descendant_object_path(expression.properties.tail))(this_node) as ScalarProvider<\n\t\t\t\t\t\t\tResult\n\t\t\t\t\t\t>;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tcase \"state\": {\n\t\t\t\t\treturn lambda((rule: api_cs.Crules) =>\n\t\t\t\t\t\tcreateExpressionBuilder(\n\t\t\t\t\t\t\tquery_constraint(\n\t\t\t\t\t\t\t\tcreateIdPathBuilderFromNode(rule.parent.input.definer().cast(\"state\").properties.node),\n\t\t\t\t\t\t\t\tnew NodePathBuilder().state_rule(definition.key_value)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t).pipe(step.sync((id_path_builder, destructor) => registerIdPath(id_path_builder, destructor)))()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"node reference\": {\n\t\t\tconst $ = definition.properties.type.state.node;\n\t\t\tconst $type = $.properties.type.state;\n\t\t\tswitch ($type.name) {\n\t\t\t\tcase \"existence\":\n\t\t\t\t\treturn where_rule_object_path($.properties.object_path) as DefaultExpressionBuilder<\n\t\t\t\t\t\tapi_cs.Crules,\n\t\t\t\t\t\tResult\n\t\t\t\t\t>;\n\t\t\t\tcase \"equality\": {\n\t\t\t\t\treturn lambda((rule: api_cs.Crules) =>\n\t\t\t\t\t\twhere_rule_object_path($.properties.object_path).pipe(\n\t\t\t\t\t\t\tstep.sync((object) =>\n\t\t\t\t\t\t\t\twhere_rule_object_path($type.node.properties.node_path).pipe(\n\t\t\t\t\t\t\t\t\tstep.sync((other_object) => {\n\t\t\t\t\t\t\t\t\t\tif (object.is(other_object)) {\n\t\t\t\t\t\t\t\t\t\t\treturn object as api_cs.Cnode;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t)(rule)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)(rule)\n\t\t\t\t\t) as DefaultExpressionBuilder>;\n\t\t\t\t}\n\t\t\t\tcase \"containment\": {\n\t\t\t\t\tconst key_stream = where_rule_object_path($type.node.properties.key_node_path).pipe(\n\t\t\t\t\t\tstep.sync((key_node) => {\n\t\t\t\t\t\t\tconst key = (key_node as api_cs.Cnode).input.entity().cast(\"entry\").properties.key.ref;\n\t\t\t\t\t\t\treturn registrationDone(key, () => Text.value(key))();\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\treturn lambda((rule: api_cs.Crules) =>\n\t\t\t\t\t\twhere_rule_object_path($.properties.object_path)\n\t\t\t\t\t\t\t.pipe((col) => col as Result) // just to cast to col\n\t\t\t\t\t\t\t.pipe(step.entry(key_stream(rule)))(rule)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n});\n\nexport const node = WeakCache>>((rule) => {\n\tconst resolve_status = rule.properties.resolve_status;\n\tresolve_status.properties.status.ensure(\"is busy resolving\", {});\n\tconst stream = createVariable(ruleExpressionBuilder(rule.key.ref)(rule), false);\n\tstream.subscribe({\n\t\tupdate: (node) => {\n\t\t\tif (resolve_status.destroyed) return;\n\t\t\tswitch (node) {\n\t\t\t\tcase Pending:\n\t\t\t\t\tresolve_status.properties.status.ensure(\"is busy resolving\", {});\n\t\t\t\t\tbreak;\n\t\t\t\tcase Unknown:\n\t\t\t\t\tresolve_status.properties.status.ensure(\"unresolved\", {});\n\t\t\t\t\tbreak;\n\t\t\t\tcase Failed:\n\t\t\t\t\tresolve_status.properties.status.ensure(\"failed to resolve\", {});\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tresolve_status.properties.status.ensure(\"resolved\", {});\n\t\t\t}\n\t\t},\n\t});\n\treferenceResolver.subscribeToReference(resolve_status);\n\trule.onDestroy(() => stream.destroy());\n\treturn stream;\n});\n\nexport const synchronized = WeakCache>>((rule) => {\n\tconst definition = rule.key.ref;\n\tconst definer = rule.parent.input.definer().variant;\n\tswitch (\n\t\tdefiner.definition.parent.parent.inferences.property_type().properties.type.state.node.output.value_source().variant\n\t\t\t.name\n\t) {\n\t\tcase \"derived\":\n\t\t\treturn \"yes\";\n\t\tcase \"base\":\n\t\t\tswitch (definition.properties.type.state.name) {\n\t\t\t\tcase \"entry reference\": {\n\t\t\t\t\tconst $ = definition.properties.type.state.node;\n\t\t\t\t\tconst expression = $.properties.expression;\n\t\t\t\t\tswitch (definer.name) {\n\t\t\t\t\t\tcase \"reference\":\n\t\t\t\t\t\t\treturn createVariable(entryReferenceSynchronized(definer.definition.parent, expression)(), false);\n\t\t\t\t\t\tcase \"state\":\n\t\t\t\t\t\t\treturn \"yes\";\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"node reference\": {\n\t\t\t\t\tconst $ = definition.properties.type.state.node;\n\t\t\t\t\treturn createVariable(\n\t\t\t\t\t\trule.parent.input\n\t\t\t\t\t\t\t.definer()\n\t\t\t\t\t\t\t.switch({\n\t\t\t\t\t\t\t\tstate: ($) => toStream($.properties.node.properties.location),\n\t\t\t\t\t\t\t\treference: ($) => toStream($.component_root.properties.location),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.stateSwitch({\n\t\t\t\t\t\t\t\tlocal: () => Failed as Scalar>,\n\t\t\t\t\t\t\t\tremote: () => {\n\t\t\t\t\t\t\t\t\tconst $type = $.properties.type.state;\n\t\t\t\t\t\t\t\t\tswitch ($type.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"existence\":\n\t\t\t\t\t\t\t\t\t\t\treturn whereRuleObjectPath($.properties.object_path)(rule);\n\t\t\t\t\t\t\t\t\t\tcase \"equality\":\n\t\t\t\t\t\t\t\t\t\t\treturn whereRuleObjectPath($.properties.object_path)\n\t\t\t\t\t\t\t\t\t\t\t\t.and(createExpressionBuilder(rule).pipe(whereRuleObjectPath($type.node.properties.node_path))())\n\t\t\t\t\t\t\t\t\t\t\t\t.pipe(([left, right]) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (left === Failed || right === Failed) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t\t\t\t\t\t\t\t} else if (left === Pending || right === Pending) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn Pending;\n\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn \"yes\" as const;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t})(rule);\n\t\t\t\t\t\t\t\t\t\tcase \"containment\":\n\t\t\t\t\t\t\t\t\t\t\treturn whereRuleObjectPath($type.node.properties.key_node_path)\n\t\t\t\t\t\t\t\t\t\t\t\t.and(createExpressionBuilder(rule).pipe(whereRuleObjectPath($.properties.object_path))())\n\t\t\t\t\t\t\t\t\t\t\t\t.pipe(([left, right]) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (left === Failed || right === Failed) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t\t\t\t\t\t\t\t} else if (left === Pending || right === Pending) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn Pending;\n\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn \"yes\" as const;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t})(rule);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})(),\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t}\n});\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\n\nexport const Saving = Symbol(\"SavingProperty\");\nexport const ModifiedDuringSave = Symbol(\"ModifiedDuringSave\");\nexport type Saving = typeof Saving;\nexport type ModifiedDuringSave = typeof ModifiedDuringSave;\ntype ModifiedSaveStatus = Saving | ModifiedDuringSave | undefined;\n\nexport function setToSaving(\n\tproperty:\n\t\t| api_cs.Cyes__modified__yes__is_editable__text\n\t\t| api_cs.Cyes__modified__yes__is_editable__number\n\t\t| api_cs.Cyes__modified__yes__is_editable__file\n\t\t| api_cs.Cyes__is_modified\n) {\n\ttoSavestatus(property).__alan__saving = Saving;\n}\n\nexport function setModified(\n\tproperty:\n\t\t| api_cs.Cyes__modified__yes__is_editable__text\n\t\t| api_cs.Cyes__modified__yes__is_editable__number\n\t\t| api_cs.Cyes__modified__yes__is_editable__file\n\t\t| api_cs.Cyes__is_modified\n) {\n\tconst saving_object = toSavestatus(property);\n\tif (saving_object.__alan__saving === Saving) {\n\t\tsaving_object.__alan__saving = ModifiedDuringSave;\n\t}\n}\n\nexport function shouldResetModifiedState(\n\tproperty:\n\t\t| api_cs.Cyes__modified__yes__is_editable__text\n\t\t| api_cs.Cyes__modified__yes__is_editable__number\n\t\t| api_cs.Cyes__modified__yes__is_editable__file\n\t\t| api_cs.Cyes__is_modified\n) {\n\tconst saving_object = toSavestatus(property);\n\treturn saving_object.__alan__saving === Saving;\n}\n\nfunction toSavestatus(object: any): { __alan__saving: ModifiedSaveStatus } {\n\treturn object;\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport DestructorTree from \"../DestructorTree\";\nimport { registrationInitialized } from \"../state/registerClientState\";\nimport { Failed } from \"../Status\";\nimport { WeakCache, createVariable, ReadonlyVariable } from \"../../../../../stream\";\nimport { toStream } from \"../toStream\";\nimport { setModified } from \"../state/SaveModifiedStatus\";\nimport { setStickyStateGroupValue } from \"../state/mapCommandParameters\";\nimport { addStateAttributes } from \"../state/addClientState\";\nimport { is_updating, stop_updating, notifyEntityUpdate } from \"../widgets/instructions/update\";\nimport { nodeEditMode } from \"../state/editMode\";\nimport { setStateLocationToLocal, setNodeLocationToRemote } from \"../state/setLocation\";\nimport { ordered_graphs, iGraph } from \"../state/Graph\";\nimport { Sink } from \"../Symbols\";\nimport { iNode } from \"../state/Node\";\nimport ClientStateObjectProxy from \"./ClientStateObjectProxy\";\n\ntype Stategroup = api_cs.Cstate_group__type__property;\ntype State = api_cs.Cstates__state_group__type__property;\n\nfunction getSelectedState(stategroup: Stategroup): State | undefined {\n\tswitch (stategroup.properties.is_set.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst $ = stategroup.properties.is_set.state.node;\n\t\t\treturn $.properties.state.ref;\n\t\t}\n\t\tcase \"no\":\n\t\t\treturn undefined;\n\t\tdefault:\n\t\t\tunexpectedState(stategroup.properties.is_set.state);\n\t}\n}\n\n/**@deprecated*/\nexport async function subscribeToSelectedState(\n\tstategroup: Stategroup,\n\tdestructor: DestructorTree,\n\tcallback: (state: State | undefined, destructor: DestructorTree) => R\n): Promise {\n\tawait registrationInitialized(stategroup);\n\tlet selected_state: State | undefined | null = null;\n\tlet child_destructor = destructor.addChild();\n\tfunction on_selected(new_selected_state: State | undefined) {\n\t\tif (selected_state !== null && selected_state !== new_selected_state) {\n\t\t\tchild_destructor.destroy();\n\t\t\tchild_destructor = destructor.addChild();\n\t\t\tcallback(new_selected_state, child_destructor);\n\t\t}\n\t\tselected_state = new_selected_state;\n\t}\n\tdestructor.subscribeToStategroup(stategroup.properties.is_set, (destructor) => {\n\t\tswitch (stategroup.properties.is_set.state.name) {\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = stategroup.properties.is_set.state.node;\n\t\t\t\treturn destructor.subscribeToText($, \"subscribe_state\", () => on_selected($.properties.state.ref));\n\t\t\t}\n\t\t\tcase \"no\":\n\t\t\t\treturn on_selected(undefined);\n\t\t\tdefault:\n\t\t\t\tunexpectedState(stategroup.properties.is_set.state);\n\t\t}\n\t});\n\treturn callback(getSelectedState(stategroup), child_destructor);\n}\n\nclass StategroupInterface extends ClientStateObjectProxy {\n\treadonly selected_state: ReadonlyVariable;\n\n\tconstructor(readonly stategroup: Stategroup) {\n\t\tsuper();\n\t\tthis.selected_state = createVariable(\n\t\t\ttoStream(stategroup.properties.is_set)\n\t\t\t\t.stateSwitch({\n\t\t\t\t\tno: () => Failed as State | Failed,\n\t\t\t\t\tyes: (is_set) => toStream(is_set, \"state\").pipe(() => is_set.properties.state.ref)(),\n\t\t\t\t})\n\t\t\t\t.pipe((v) => v)(),\n\t\t\tfalse\n\t\t);\n\t}\n\n\tgetSelectedState(): State | undefined {\n\t\tconst is_set = this.stategroup.properties.is_set.state;\n\t\tswitch (is_set.name) {\n\t\t\tcase \"yes\":\n\t\t\t\treturn is_set.node.properties.state.ref;\n\t\t\tcase \"no\":\n\t\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tupdatePermissions(permitted: \"yes\" | \"no\") {\n\t\tswitch (this.stategroup.inferences.state_group_type().properties.type.state.name) {\n\t\t\tcase \"base\":\n\t\t\t\tswitch (permitted) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tthis.stategroup.properties.is_editable.ensure(\"no\", {});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\tthis.stategroup.properties.is_editable.ensure(\"yes\", {\n\t\t\t\t\t\t\t\"edit mode\": nodeEditMode(this.stategroup.parent.parent.parent),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"derived\":\n\t\t}\n\t}\n\n\tdiscard() {\n\t\tthis.stategroup.properties.initialized.switch({\n\t\t\tyes: ($) => iState($.properties.state_in_backend.ref).select(\"engine\"),\n\t\t\tno: () => {\n\t\t\t\tthis.stategroup.properties.is_editable.switch({\n\t\t\t\t\tyes: () => {\n\t\t\t\t\t\tthis.stategroup.properties.is_modified.ensure(\"no\", {});\n\t\t\t\t\t\tthis.deselect();\n\t\t\t\t\t},\n\t\t\t\t\tno: undefined,\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t\tfor (const state of this.stategroup.properties.states.values()) {\n\t\t\tiNode(state.properties.node).discard();\n\t\t}\n\t\tnotifyEntityUpdate(this.stategroup.parent);\n\t}\n\n\tdeselect() {\n\t\tthis.stategroup.properties.is_set.switch({\n\t\t\tno: () => undefined,\n\t\t\tyes: ($) => {\n\t\t\t\tconst state = $.properties.state.ref;\n\t\t\t\tstate.parent.properties.is_set.set(\"no\", {});\n\t\t\t\tstate.properties.is_selected.set(\"no\", {});\n\t\t\t\tiNode(state.properties.node).discard();\n\t\t\t},\n\t\t});\n\t}\n}\n\nexport type iStategroup = StategroupInterface;\nexport const iStategroup = WeakCache((sg) => new StategroupInterface(sg));\n\nclass StateInterface extends ClientStateObjectProxy {\n\treadonly stategroup: Stategroup;\n\treadonly is_selected: ReadonlyVariable;\n\tgraph: iGraph | undefined;\n\tentry: api_cs.Centries__collection | undefined;\n\n\tconstructor(readonly state: State) {\n\t\tsuper();\n\t\tthis.stategroup = state.parent;\n\t\tthis.is_selected = createVariable(\n\t\t\ttoStream(state.properties.is_selected)\n\t\t\t\t.stateSwitch({\n\t\t\t\t\tno: () => Failed as api_cs.Cnode | Failed,\n\t\t\t\t\tyes: () => state.properties.node,\n\t\t\t\t})\n\t\t\t\t.pipe((v) => v)(),\n\t\t\tfalse\n\t\t);\n\t\tthis.graph = state.component_root.input.entity().switch({\n\t\t\troot: () => undefined,\n\t\t\tentry: (entry) => {\n\t\t\t\tthis.entry = entry;\n\t\t\t\tfor (const graph of ordered_graphs(entry.parent)) {\n\t\t\t\t\tif (state.key.ref === graph.sink_state) {\n\t\t\t\t\t\treturn graph;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t});\n\t}\n\n\t__select(by: \"user\" | \"engine\") {\n\t\tthis.state.properties.is_selected.switch({\n\t\t\tyes: () => undefined, // Already set\n\t\t\tno: () => {\n\t\t\t\tif (is_updating(this.stategroup.parent)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst state_name = this.state.key.entry;\n\t\t\t\tiStategroup(this.stategroup).deselect();\n\t\t\t\taddStateAttributes(this.state);\n\t\t\t\tthis.state.properties.is_selected.set(\"yes\", {\n\t\t\t\t\t\"all rules are valid\": [\"yes\", {}],\n\t\t\t\t});\n\t\t\t\tconst is_set = this.stategroup.properties.is_set.set(\"yes\", {\n\t\t\t\t\tstate: state_name,\n\t\t\t\t\tby: by,\n\t\t\t\t});\n\t\t\t\tswitch (is_set.properties.by.state.name) {\n\t\t\t\t\tcase \"engine\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"user\":\n\t\t\t\t\t\tsetStickyStateGroupValue(this.stategroup.inferences.state_group_type(), state_name);\n\t\t\t\t}\n\t\t\t\tstop_updating(this.stategroup.parent);\n\t\t\t},\n\t\t});\n\t\tconst modified = this.stategroup.properties.initialized.switch({\n\t\t\tno: () => \"yes\" as \"no\" | \"yes\",\n\t\t\tyes: ($) => ($.properties.state_in_backend.ref === this.state ? \"no\" : \"yes\"),\n\t\t});\n\t\tthis.stategroup.properties.is_modified.ensure(modified, {});\n\t\tif (modified === \"yes\") {\n\t\t\tsetModified(this.stategroup.properties.is_modified.cast(\"yes\"));\n\t\t}\n\t\tnotifyEntityUpdate(this.stategroup.parent);\n\t}\n\n\tselect(by: \"user\" | \"engine\") {\n\t\tthis.__select(by);\n\t\tthis.graph?.moveToSink(this.entry!);\n\t}\n\n\t__server_state(): void {\n\t\tconst state_name = this.state.key_value;\n\t\tthis.state.properties.location.ensure(\"remote\", {});\n\t\tsetNodeLocationToRemote(this.state.properties.node);\n\t\tfor (const other_state of this.stategroup.properties.states.values()) {\n\t\t\tif (other_state === this.state) continue;\n\t\t\tsetStateLocationToLocal(other_state);\n\t\t}\n\t\tthis.stategroup.properties.initialized.set(\"yes\", {\n\t\t\t\"state in backend\": state_name,\n\t\t});\n\t\tswitch (this.stategroup.properties.is_set.state.name) {\n\t\t\tcase \"yes\": {\n\t\t\t\tconst current_state = this.stategroup.properties.is_set.state.node.properties.state;\n\t\t\t\tswitch (this.stategroup.properties.is_modified.state.name) {\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\tif (current_state.entry === state_name) {\n\t\t\t\t\t\t\tthis.__select(\"engine\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tthis.__select(\"engine\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"no\":\n\t\t\t\tthis.__select(\"engine\");\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetServerState() {\n\t\tconst old_backend_state = this.stategroup.properties.initialized.switch({\n\t\t\tno: () => undefined,\n\t\t\tyes: ($) => $.properties.state_in_backend.ref,\n\t\t});\n\t\tif (old_backend_state !== this.state) {\n\t\t\tif (this.is_selected.value !== Failed) {\n\t\t\t\tiNode(this.is_selected.value).discard();\n\t\t\t}\n\t\t\tthis.__server_state();\n\t\t\tthis.graph?.setServerEdgeValue(this.entry!, Sink);\n\t\t}\n\t}\n}\n\nexport type iState = StateInterface;\nexport const iState = WeakCache((s) => new StateInterface(s));\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport DestructorTree from \"../DestructorTree\";\nimport { registrationInitialized, getRegistrationStatus } from \"../state/registerClientState\";\nimport { Pending, Failed } from \"../Status\";\nimport { ScalarProvider, WeakCache, createVariable, createExpressionBuilder } from \"../../../../../stream\";\nimport { toStream, toVariable } from \"../toStream\";\nimport { is_updating, stop_updating, notifyEntityUpdate } from \"../widgets/instructions/update\";\nimport { setModified } from \"../state/SaveModifiedStatus\";\nimport { setStickyTextValue } from \"../state/mapCommandParameters\";\nimport { isPasswordProperty } from \"../state/password\";\nimport { iCollection } from \"../state/Collection\";\nimport { nodeEditMode } from \"../state/editMode\";\nimport { ordered_graphs, iGraph } from \"../state/Graph\";\nimport { iReference, ReferenceInterface } from \"../state/Reference\";\nimport ClientStateObjectProxy from \"./ClientStateObjectProxy\";\n\nexport function getValue(text_property: api_cs.Ctext__type__property): string | undefined {\n\tswitch (text_property.properties.is_set.state.name) {\n\t\tcase \"no\":\n\t\t\treturn undefined;\n\t\tcase \"yes\":\n\t\t\treturn text_property.properties.is_set.state.node.properties.text;\n\t}\n}\n\n/**@deprecated*/\nexport async function subscribeToValue(\n\ttext_property: api_cs.Ctext__type__property,\n\tdestructor: DestructorTree,\n\tcallback: (value: string | undefined, destructor: DestructorTree) => R\n): Promise {\n\tawait registrationInitialized(text_property);\n\tlet value: string | undefined | null = null;\n\tlet child_destructor = destructor.addChild();\n\tconst on_value = (new_value: string | undefined) => {\n\t\tif (value !== null && value !== new_value) {\n\t\t\tchild_destructor.destroy();\n\t\t\tchild_destructor = destructor.addChild();\n\t\t\tcallback(new_value, child_destructor);\n\t\t}\n\t\tvalue = new_value;\n\t};\n\tdestructor.subscribeToStategroup(text_property.properties.is_set, (destructor) => {\n\t\tswitch (text_property.properties.is_set.state.name) {\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = text_property.properties.is_set.state.node;\n\t\t\t\treturn destructor.subscribeToText($, \"subscribe_text\", on_value);\n\t\t\t}\n\t\t\tcase \"no\":\n\t\t\t\treturn on_value(undefined);\n\t\t\tdefault:\n\t\t\t\treturn unexpectedState(text_property.properties.is_set.state);\n\t\t}\n\t});\n\treturn callback(getValue(text_property), child_destructor);\n}\n\nexport function getBackendValue(text_property: api_cs.Ctext__type__property): string | undefined {\n\tswitch (text_property.properties.backend_known.state.name) {\n\t\tcase \"yes\":\n\t\t\treturn text_property.properties.backend_known.state.node.properties.value;\n\t\tcase \"no\":\n\t\t\treturn undefined;\n\t}\n}\n\nexport const value = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.is_set)\n\t\t\t.stateSwitch({\n\t\t\t\tno: () => Failed as string | Failed,\n\t\t\t\tyes: ($) => toVariable($, \"text\"),\n\t\t\t})\n\t\t\t.pipe((v) => v)(),\n\t\tfalse\n\t)\n);\n\nexport const valueModified = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.is_editable)\n\t\t\t.stateSwitch({\n\t\t\t\tno: () => false,\n\t\t\t\tyes: () =>\n\t\t\t\t\ttoStream(property.properties.backend_known).stateSwitch({\n\t\t\t\t\t\tno: () =>\n\t\t\t\t\t\t\ttoStream(property.properties.is_set).stateSwitch({\n\t\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\t\tyes: (is_set) =>\n\t\t\t\t\t\t\t\t\ttoStream(is_set.properties.by).stateSwitch({\n\t\t\t\t\t\t\t\t\t\tengine: () => false,\n\t\t\t\t\t\t\t\t\t\tuser: () => true,\n\t\t\t\t\t\t\t\t\t})(),\n\t\t\t\t\t\t\t})(),\n\t\t\t\t\t\tyes: (backend_known) =>\n\t\t\t\t\t\t\ttoStream(property.properties.is_set).stateSwitch({\n\t\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\t\tyes: (is_set) =>\n\t\t\t\t\t\t\t\t\ttoStream(is_set, \"text\")\n\t\t\t\t\t\t\t\t\t\t.and(toVariable(backend_known, \"value\"))\n\t\t\t\t\t\t\t\t\t\t.pipe(([value, backend_value]) => value !== backend_value)(),\n\t\t\t\t\t\t\t})(),\n\t\t\t\t\t})(),\n\t\t\t})\n\t\t\t.pipe((v) => v)(),\n\t\tfalse\n\t)\n);\n\nexport const synchronized = WeakCache>(\n\t(property) =>\n\t\tcreateVariable(\n\t\t\tcreateExpressionBuilder(getRegistrationStatus(property)).pipe((status) => {\n\t\t\t\tswitch (status) {\n\t\t\t\t\tcase \"unsubscribed\":\n\t\t\t\t\tcase \"pending\":\n\t\t\t\t\t\treturn \"pending\" as \"no\" | \"pending\" | \"yes\";\n\t\t\t\t\tcase \"failed\":\n\t\t\t\t\t\treturn \"no\";\n\t\t\t\t\tcase \"not subscribable\":\n\t\t\t\t\t\treturn \"no\";\n\t\t\t\t\tcase \"subscribed\":\n\t\t\t\t\t\treturn createExpressionBuilder(valueModified(property)).pipe((modified) => (modified ? \"no\" : \"yes\"))();\n\t\t\t\t}\n\t\t\t})(),\n\t\t\tfalse\n\t\t)\n);\n\nexport const backendValue = WeakCache>(\n\t(property) =>\n\t\tcreateVariable(\n\t\t\ttoStream(property.properties.backend_known)\n\t\t\t\t.stateSwitch({\n\t\t\t\t\tno: () => Pending as string | Pending | Failed,\n\t\t\t\t\tyes: ($) => toVariable($, \"value\"),\n\t\t\t\t})\n\t\t\t\t.pipe((v) => v)(),\n\t\t\tfalse\n\t\t)\n);\n\nclass TextInterface extends ClientStateObjectProxy {\n\tmodified: ScalarProvider;\n\tgraph: iGraph | undefined;\n\tentry: api_cs.Centries__collection | undefined;\n\treferences_to_me: Set | undefined;\n\treference: ReferenceInterface | undefined;\n\n\tconstructor(readonly property: api_cs.Ctext__type__property) {\n\t\tsuper();\n\t\tthis.modified = createVariable(\n\t\t\ttoStream(property.properties.is_editable).stateSwitch({\n\t\t\t\tyes: ($) =>\n\t\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\tyes: () => true,\n\t\t\t\t\t})(),\n\t\t\t\tno: () => false,\n\t\t\t})(),\n\t\t\tfalse\n\t\t);\n\t\tthis.graph = property.component_root.input.entity().switch({\n\t\t\troot: () => undefined,\n\t\t\tentry: (entry) => {\n\t\t\t\tthis.entry = entry;\n\t\t\t\tfor (const graph of ordered_graphs(entry.parent)) {\n\t\t\t\t\tif (property.inferences.text_type() === graph.edge_reference) {\n\t\t\t\t\t\treturn graph;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t});\n\t\tswitch (property.properties.navigable.state.name) {\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tcase \"yes\":\n\t\t\t\tthis.reference = iReference(property.properties.navigable.state.node);\n\t\t}\n\t}\n\n\t*_graphs_for_which_is_key(): IterableIterator {\n\t\tconst is_key = this.property.properties.is_key.state;\n\t\tswitch (is_key.name) {\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tcase \"yes\":\n\t\t\t\tfor (const graph of iCollection(is_key.node.inferences.entry().parent).graphs) {\n\t\t\t\t\tyield graph;\n\t\t\t\t}\n\t\t}\n\t}\n\n\t__ensure(value: string) {\n\t\tconst is_set = this.property.properties.is_set.state;\n\t\tswitch (is_set.name) {\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tcase \"yes\":\n\t\t\t\tif (is_set.node.properties.text === value) return;\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.__update(value);\n\t}\n\n\t__update(value: string, by?: \"user\" | \"engine\") {\n\t\tconst modified = this.property.properties.backend_known.switch({\n\t\t\tno: () => true,\n\t\t\tyes: ($) => $.properties.value !== value,\n\t\t});\n\t\tthis.property.root.transact(() => {\n\t\t\tthis.property.properties.is_editable.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: ($) => {\n\t\t\t\t\tif (modified) {\n\t\t\t\t\t\tconst is_modified = $.properties.modified.ensure(\"yes\", {\n\t\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\t\tsaving: [\"no\", {}],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetModified(is_modified);\n\t\t\t\t\t\tif (is_modified.properties.value !== value) {\n\t\t\t\t\t\t\tis_modified.set_value(value);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$.properties.modified.ensure(\"no\", {});\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst is_set = this.property.properties.is_set.ensure(\"yes\", {\n\t\t\t\ttext: value,\n\t\t\t\tby: by ?? \"engine\",\n\t\t\t});\n\t\t\tif (is_set.properties.text !== value) {\n\t\t\t\tis_set.set_text(value);\n\t\t\t}\n\t\t\tif (by !== undefined) {\n\t\t\t\tis_set.properties.by.ensure(by, {});\n\t\t\t}\n\t\t\tswitch (is_set.properties.by.state.name) {\n\t\t\t\tcase \"engine\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"user\":\n\t\t\t\t\tsetStickyTextValue(this.property.inferences.text_type(), value);\n\t\t\t}\n\t\t});\n\t\tnotifyEntityUpdate(this.property.parent);\n\t}\n\n\tupdate(value: string, by: \"user\" | \"engine\", update_graphs = true) {\n\t\tif (!is_updating(this.property.parent)) {\n\t\t\tif (this.references_to_me) {\n\t\t\t\tfor (const reference of this.references_to_me) {\n\t\t\t\t\tif (reference.propagateKeyUpdates) {\n\t\t\t\t\t\tiText(reference.reference.parent).__update(value, by);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.__update(value, by);\n\t\t\tif (update_graphs && this.graph) {\n\t\t\t\tconst node = this.graph.getNode(this.entry!)!;\n\t\t\t\tswitch (node.edge_state.properties.is_selected.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\tthis.graph.insertBeforeKey(this.entry!, value);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.reference) {\n\t\t\t\tthis.reference.discard();\n\t\t\t}\n\t\t\tstop_updating(this.property.parent);\n\t\t}\n\t}\n\n\tdiscard() {\n\t\tthis.property.properties.is_set.switch({\n\t\t\tno: undefined,\n\t\t\tyes: () => {\n\t\t\t\tthis.property.properties.is_editable.switch({\n\t\t\t\t\tno: undefined,\n\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\tthis.property.properties.backend_known.switch({\n\t\t\t\t\t\t\tno: () => {\n\t\t\t\t\t\t\t\t$.properties.modified.ensure(\"no\", {});\n\t\t\t\t\t\t\t\tthis.property.properties.navigable.switch({\n\t\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\t\tthis.property.properties.is_set.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tno: () => {\n\t\t\t\t\t\t\t\t\t\tconst is_set = this.property.properties.is_set.ensure(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\ttext: \"\",\n\t\t\t\t\t\t\t\t\t\t\tby: [\"engine\", {}],\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tis_set.set_text(\"\");\n\t\t\t\t\t\t\t\t\t\tis_set.properties.by.ensure(\"engine\", {});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tnotifyEntityUpdate(this.property.parent);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\tthis.update($.properties.value, \"engine\");\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t}\n\n\t__server_value(value: string) {\n\t\tif (isPasswordProperty(this.property.inferences.text_type())) return;\n\t\tthis.property.root.transact(() => {\n\t\t\tthis.property.properties.backend_known\n\t\t\t\t.ensure(\"yes\", {\n\t\t\t\t\tvalue: value,\n\t\t\t\t})\n\t\t\t\t.set_value(value);\n\t\t\tthis.property.properties.is_editable.switch({\n\t\t\t\tno: () => this.__update(value, \"engine\"),\n\t\t\t\tyes: (editable) =>\n\t\t\t\t\teditable.properties.modified.switch({\n\t\t\t\t\t\tno: () => this.__update(value, \"engine\"),\n\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\tif ($.properties.value === value) {\n\t\t\t\t\t\t\t\teditable.properties.modified.set(\"no\", {});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t});\n\t\t\tthis.property.properties.navigable.switch({\n\t\t\t\tno: () => undefined,\n\t\t\t\tyes: ($) => iReference($).updateKeyInServerValue(value),\n\t\t\t});\n\t\t});\n\t}\n\n\tsetServerValue(value: string) {\n\t\tthis.__server_value(value);\n\t\tthis.graph?.setServerEdgeValue(this.entry!, value);\n\t\tfor (const graph of this._graphs_for_which_is_key()) {\n\t\t\tgraph.updateServerKeyValue(this.entry!, value);\n\t\t}\n\t\tif (this.references_to_me) {\n\t\t\tfor (const reference of this.references_to_me) {\n\t\t\t\tif (reference.propagateKeyUpdates) {\n\t\t\t\t\tiText(reference.reference.parent).__ensure(value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tupdatePermissions(permitted: \"yes\" | \"no\") {\n\t\tswitch (this.property.inferences.text_type().properties.type.state.name) {\n\t\t\tcase \"derived\":\n\t\t\t\tbreak;\n\t\t\tcase \"base\":\n\t\t\t\tswitch (permitted) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tthis.property.properties.is_editable.ensure(\"no\", {});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\tthis.property.properties.is_editable.ensure(\"yes\", {\n\t\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\t\t\"edit mode\": nodeEditMode(this.property.component_root),\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t}\n\t}\n\n\tsetR2M(reference: ReferenceInterface, destructor: DestructorTree) {\n\t\t(this.references_to_me ??= new Set()).add(reference);\n\t\tdestructor.onDestroy(() => this.references_to_me?.delete(reference));\n\t}\n}\n\nexport type iText = TextInterface;\nexport const iText = WeakCache((s) => new TextInterface(s));\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\n\ntype CsObject =\n\t| api_cs.Cnode\n\t| api_cs.Cstate_group__type__property\n\t| api_cs.Ccollection\n\t| api_cs.Ctext__type__property\n\t| api_cs.Cnumber__type__property\n\t| api_cs.Cfile__type__property;\n\nexport class Variable {\n\tconstructor(public readonly parent: Variable | null, public readonly value: CsObject) {}\n}\n\nexport function ancestor_variable_path(root: api_app.Cancestor_variable_path, variable: Variable): Variable {\n\treturn root.properties.has_steps.switch({\n\t\tno: variable,\n\t\tyes: ($) => ancestor_variable_path($.properties.tail, variable.parent!),\n\t});\n}\n\nexport function ancestor_named_object_path(root: api_app.Cancestor_named_object_path, variable: Variable): Variable {\n\tswitch (root.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\treturn variable;\n\t\tcase \"yes\": {\n\t\t\tconst $ = root.properties.has_steps.state.node;\n\t\t\tif (!variable.parent) throw new Error(\"Unexpected undefined variable parent\");\n\t\t\treturn ancestor_named_object_path($.properties.tail, variable.parent);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(root.properties.has_steps.state);\n\t}\n}\n\nexport function variable_assignment(\n\troot: api_app.Cvariable_assignment | api_app.Cnamed_object_assignment,\n\tparent: Variable | null,\n\tvalue: CsObject\n): Variable {\n\tswitch (root.properties.name.state.name) {\n\t\tcase \"implicit\":\n\t\t\treturn new Variable(parent, value);\n\t\tcase \"explicit\":\n\t\t\treturn new Variable(parent, value);\n\t\tdefault:\n\t\t\tunexpectedState(root.properties.name.state);\n\t}\n}\n\nexport function optional_variable_assignment(\n\troot: api_app.Coptional_variable_assignment | api_app.Coptional_named_object_assignment,\n\tparent: Variable | null,\n\tvalue: CsObject\n): Variable | null {\n\tswitch (root.properties.has_assignment.state.name) {\n\t\tcase \"no\":\n\t\t\treturn parent;\n\t\tcase \"yes\": {\n\t\t\tconst $ = root.properties.has_assignment.state.node;\n\t\t\treturn variable_assignment($.properties.assignment, parent, value);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(root.properties.has_assignment.state);\n\t}\n}\n","import { awaitCondition } from \"../../../../../stream\";\nimport { api_configuration } from \"../../common\";\nimport DestructorTree from \"../DestructorTree\";\nimport openViewOnNode from \"../front/openViewOnNode\";\nimport { translate } from \"../front/translate\";\nimport { orderedAttributes } from \"../graphIterators\";\nimport { getGuiAction } from \"../guiModel\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport SubscriptionBuilder from \"../state 2 interface/SubscriptionBuilder\";\nimport * as SubscriptionManager from \"../state 2 interface/SubscriptionManager\";\nimport * as Collection from \"../state/Collection\";\nimport * as expressions from \"../state/expressions\";\nimport * as Number from \"../state/Number\";\nimport * as Stategroup from \"../state/Stategroup\";\nimport * as Text from \"../state/Text\";\nimport { optional_variable_assignment, Variable } from \"../state/Variable\";\nimport { Pending, Unknown, Failed, isResolved, valueOrFailed } from \"../Status\";\nimport { promiseSeries } from \"../utils\";\nimport { getWindowInstance } from \"../widgets/dom/Window\";\nimport * as add from \"../widgets/instructions/add\";\nimport { deleteCollectionEntry } from \"../widgets/instructions/delete\";\nimport * as execute from \"../widgets/instructions/execute\";\nimport { saveAll } from \"../widgets/instructions/save\";\nimport * as update from \"../widgets/instructions/update\";\nimport * as addClientState from \"./addClientState\";\nimport { iCollection } from \"../state/Collection\";\nimport { iStategroup, iState } from \"../state/Stategroup\";\nimport { iText } from \"../state/Text\";\nimport { iNode } from \"../state/Node\";\nimport * as edit from \"./editMode\";\nimport { startOperation } from \"./operations\";\nimport {\n\tregisterAction,\n\tregisterCollection,\n\tregisterCommand,\n\tregisterGroup,\n\tregisterIdPath,\n\tregisterNewNode,\n\tregisterNodeContext,\n\tregisterNumber,\n\tregisterStategroup,\n\tregisterText,\n\tregisterEntry,\n\tregistrationInitialized,\n} from \"./registerClientState\";\nimport clientWorkIsDone from \"./tasks\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_gui = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport { addMessage } from \"../front/messages\";\nimport { sendFeedback } from \"../error-logging\";\n\nexport async function executeAction(\n\taction: api_cs.Cyes__started,\n\tview_bindings: Record,\n\tcan_use_containing_view: boolean,\n\tview_node_type: api_app.Cnode__application\n): Promise {\n\tswitch (action.properties.executing.state.name) {\n\t\tcase \"no\": {\n\t\t\taction.properties.executing.set(\"yes\", {\n\t\t\t\t\"can continue\": [\"no\", {}],\n\t\t\t});\n\t\t\tconst node_context = action.parent.parent.parent;\n\t\t\tconst node_context_modified = nodeModified(node_context);\n\t\t\tconst history: History = { events: [] };\n\t\t\tconst execution_destructor = new DestructorTree();\n\t\t\tstartOperation(action.parent, execution_destructor);\n\t\t\ttry {\n\t\t\t\tawait executeActionStep({\n\t\t\t\t\taction,\n\t\t\t\t\taction_step: getGuiAction(action.parent.properties.type.cast(\"action\").inferences.action_type())!.properties\n\t\t\t\t\t\t.action,\n\t\t\t\t\tview_bindings,\n\t\t\t\t\tnode_context_modified,\n\t\t\t\t\tcan_use_containing_view,\n\t\t\t\t\tview_node_type,\n\t\t\t\t\thistory,\n\t\t\t\t});\n\t\t\t\tif (!action.destroyed) {\n\t\t\t\t\taction.properties.executing.set(\"no\", {\n\t\t\t\t\t\t\"last result\": [\"success\", {}],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} catch (reason) {\n\t\t\t\tif (reason === \"Cancelled\") {\n\t\t\t\t\tif (!action.destroyed) {\n\t\t\t\t\t\taction.properties.executing.set(\"no\", {\n\t\t\t\t\t\t\t\"last result\": [\"not invoked\", {}],\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (!action.destroyed) {\n\t\t\t\t\t\taction.properties.executing.set(\"no\", {\n\t\t\t\t\t\t\t\"last result\": [\"failure\", {}],\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tthrow reason;\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\texecution_destructor.destroy();\n\t\t\t\treinitializeOperation(action);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(action.properties.executing.state);\n\t}\n}\n\nfunction nodeModified(node_context: api_cs.Cnode) {\n\tswitch (node_context.properties.location.state.name) {\n\t\tcase \"local\": {\n\t\t\treturn true;\n\t\t}\n\t\tcase \"remote\": {\n\t\t\tswitch (node_context.properties.modified.state.name) {\n\t\t\t\tcase \"no\": {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(node_context.properties.modified.state);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(node_context.properties.location.state);\n\t}\n}\n\nexport function reinitializeOperation(action: api_cs.Cyes__started): void {\n\tif (action.properties.node.destroyed) return;\n\tiNode(action.properties.node).discard();\n}\n\nfunction operationVariableAssignment(operation: api_cs.Cyes__started): Variable | null {\n\tconst node = operation.properties.node;\n\tconst $type = operation.parent.properties.type.state;\n\tswitch ($type.name) {\n\t\tcase \"command\": {\n\t\t\tconst $implementation = $type.node.inferences.command_type().properties.implementation.state;\n\t\t\tswitch ($implementation.name) {\n\t\t\t\tcase \"external\":\n\t\t\t\t\treturn null;\n\t\t\t\tcase \"internal\":\n\t\t\t\t\treturn optional_variable_assignment($implementation.node.properties.variable_assignment, null, node);\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState($implementation);\n\t\t\t}\n\t\t}\n\t\tcase \"action\":\n\t\t\treturn optional_variable_assignment(\n\t\t\t\t$type.node.inferences.action_type().properties.variable_assignment,\n\t\t\t\tnull,\n\t\t\t\tnode\n\t\t\t);\n\t\tdefault:\n\t\t\tunexpectedState($type);\n\t}\n}\n\nasync function executeActionStep({\n\taction,\n\taction_step,\n\tview_bindings,\n\tnode_context_modified,\n\tcan_use_containing_view,\n\tview_node_type,\n\thistory,\n}: {\n\taction: api_cs.Cyes__started;\n\taction_step: api_gui.Cgui_action;\n\tview_bindings: Record;\n\tnode_context_modified: boolean;\n\tcan_use_containing_view: boolean;\n\tview_node_type: api_app.Cnode__application;\n\thistory: History;\n}): Promise {\n\tconst node_context = action.parent.parent.parent;\n\tconst action_expression_tasks: ActionTask[] = [];\n\tconst destructor = new DestructorTree();\n\n\tlet last_step = false;\n\tswitch (action_step.properties.has_next_action.state.name) {\n\t\tcase \"no\": {\n\t\t\tlast_step = true;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\":\n\t\t\tbreak;\n\t}\n\ttry {\n\t\tif (action.destroyed === true) {\n\t\t\taddMessage(\"warning\", \"Did not complete operation\", { body: \"The operation was lost before it was completed\" });\n\t\t\tsendFeedback(\"Action context was destroyed before it was finished\");\n\t\t\treturn;\n\t\t}\n\t\tawait executeActionExpression(\n\t\t\taction_step.properties.expression,\n\t\t\tinteractionBuilders(\n\t\t\t\taction,\n\t\t\t\tview_bindings,\n\t\t\t\tview_node_type,\n\t\t\t\t{\n\t\t\t\t\tnode_context_modified,\n\t\t\t\t\tcan_use_containing_view,\n\t\t\t\t\tlast_step,\n\t\t\t\t},\n\t\t\t\t(node_to_update) => {\n\t\t\t\t\tif (!can_use_containing_view) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn (\n\t\t\t\t\t\tlast_step && actionBoundry(node_context, view_node_type) === actionBoundry(node_to_update, view_node_type)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t(action_view) => {\n\t\t\t\t\taction_expression_tasks.push(action_view);\n\t\t\t\t}\n\t\t\t),\n\t\t\tnode_context,\n\t\t\taction,\n\t\t\taction.properties.node,\n\t\t\toperationVariableAssignment(action),\n\t\t\tdestructor,\n\t\t\tview_bindings,\n\t\t\thistory,\n\t\t\tfalse\n\t\t);\n\t\tfor (const task of action_expression_tasks) {\n\t\t\tawait task();\n\t\t}\n\t} finally {\n\t\tdestructor.destroy();\n\t}\n\tswitch (action_step.properties.has_next_action.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst $ = action_step.properties.has_next_action.state.node;\n\t\t\tawait executeActionStep({\n\t\t\t\taction,\n\t\t\t\taction_step: $.properties.action,\n\t\t\t\tview_bindings,\n\t\t\t\tnode_context_modified,\n\t\t\t\tcan_use_containing_view,\n\t\t\t\tview_node_type,\n\t\t\t\thistory,\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(action_step.properties.has_next_action.state);\n\t}\n}\n\ntype ActionTask = () => Promise;\ntype InteractionBuilder = {\n\texecute_action: (action_interaction: { action: api_cs.Cyes__started }) => void;\n\texecute_command: (command_interaction: api_cs.Cyes__started) => void;\n\tshow_target: (\n\t\tshow_target: api_app.Cui_action_visualization,\n\t\taction_view: api_gui.Cviews | undefined,\n\t\tclient_context_node: api_cs.Cnode\n\t) => Promise;\n\tupdate_properties: (update_properties_interaction: {\n\t\tinteractive: api_app.Cui_action_interaction;\n\t\taction_view: api_gui.Cviews | undefined;\n\t\ttarget_node: api_cs.Cnode;\n\t\tdestructor: DestructorTree;\n\t\tsave: boolean;\n\t\thistory: History;\n\t\ton_interactive: (view_context_node: api_cs.Cnode) => void;\n\t}) => Promise;\n};\nfunction interactionBuilders(\n\taction: api_cs.Cyes__started,\n\tview_bindings: Record,\n\tview_node_type: api_app.Cnode__application,\n\tflags: {\n\t\tnode_context_modified: boolean;\n\t\tcan_use_containing_view: boolean;\n\t\tlast_step: boolean;\n\t},\n\tcan_use_current_view: (context_node: api_cs.Cnode) => boolean,\n\tcallback: (interaction: ActionTask, show_target?: boolean) => void\n): InteractionBuilder {\n\treturn {\n\t\texecute_action: (action_interaction) => {\n\t\t\tcallback(() =>\n\t\t\t\texecuteAction(action_interaction.action, view_bindings, flags.can_use_containing_view, view_node_type)\n\t\t\t);\n\t\t},\n\t\texecute_command: (command_interaction) => {\n\t\t\tcallback(() =>\n\t\t\t\tcommand_interaction.parent.parent.parent.properties.location.switch({\n\t\t\t\t\tremote: () => execute.command(command_interaction),\n\t\t\t\t\tlocal: () =>\n\t\t\t\t\t\t//TODO make sure that the node is saved somehow\n\t\t\t\t\t\tPromise.resolve(),\n\t\t\t\t})\n\t\t\t);\n\t\t},\n\t\tshow_target: async (show_target, action_view, client_context_node) => {\n\t\t\tconst view_definition = action_view === undefined ? undefined : view_bindings[action_view.key];\n\t\t\tif (view_definition !== undefined) {\n\t\t\t\tswitch (show_target.properties.show_target.state.name) {\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tswitch (view_definition.properties.can_open_entry.state.name) {\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst $ = view_definition.properties.can_open_entry.state.node;\n\t\t\t\t\t\t\t\tcallback(async () => {\n\t\t\t\t\t\t\t\t\tconst view_context_node = client_context_node.output\n\t\t\t\t\t\t\t\t\t\t.position()\n\t\t\t\t\t\t\t\t\t\t.output.root()\n\t\t\t\t\t\t\t\t\t\t.switch({\n\t\t\t\t\t\t\t\t\t\t\troot: () => client_context_node,\n\t\t\t\t\t\t\t\t\t\t\toperation: ($) => $.parent.parent.parent,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\topenViewOnNode(\n\t\t\t\t\t\t\t\t\t\tview_context_node.input.entity().output.node(),\n\t\t\t\t\t\t\t\t\t\t$.properties.view.ref,\n\t\t\t\t\t\t\t\t\t\t$.properties.window.ref\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}, true);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tupdate_properties: async (update_properties_interaction) => {\n\t\t\tconst view_context_node = update_properties_interaction.target_node.output\n\t\t\t\t.position()\n\t\t\t\t.output.root()\n\t\t\t\t.switch({\n\t\t\t\t\troot: () => update_properties_interaction.target_node,\n\t\t\t\t\toperation: ($) => $.parent.parent.parent,\n\t\t\t\t});\n\t\t\tconst target_node = update_properties_interaction.target_node;\n\t\t\tlet view_definition: api_views.Cview_bindings | undefined;\n\t\t\tif (update_properties_interaction.action_view !== undefined) {\n\t\t\t\tview_definition = view_bindings[update_properties_interaction.action_view.key];\n\t\t\t}\n\t\t\tawait SubscriptionManager.finishedAndInitialized();\n\t\t\tconst node_must_be_validated = target_node.properties.location.switch({\n\t\t\t\tlocal: ($) =>\n\t\t\t\t\t$.properties.parent_location.switch({\n\t\t\t\t\t\tremote: true,\n\t\t\t\t\t\tlocal: update_properties_interaction.target_node.output\n\t\t\t\t\t\t\t.position()\n\t\t\t\t\t\t\t.output.root()\n\t\t\t\t\t\t\t.switch({\n\t\t\t\t\t\t\t\troot: () => false,\n\t\t\t\t\t\t\t\toperation: () => true,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t}),\n\t\t\t\tremote: true,\n\t\t\t});\n\n\t\t\tcallback(async () => {\n\t\t\t\tconst onTargetDone = async () => {\n\t\t\t\t\tlet should_save;\n\t\t\t\t\tif (!update_properties_interaction.save) {\n\t\t\t\t\t\tshould_save = false;\n\t\t\t\t\t} else if (!node_must_be_validated) {\n\t\t\t\t\t\tshould_save = false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tshould_save = !flags.node_context_modified;\n\t\t\t\t\t}\n\t\t\t\t\tif (should_save) {\n\t\t\t\t\t\tswitch (target_node.properties.is_valid.state.name) {\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tawait saveAll(target_node);\n\t\t\t\t\t\t\t\tif (!target_node.destroyed) {\n\t\t\t\t\t\t\t\t\tswitch (target_node.properties.location.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"remote\": {\n\t\t\t\t\t\t\t\t\t\t\tedit.switchOff(target_node);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState(target_node.properties.location.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(target_node.properties.is_valid.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tupdate_properties_interaction.destructor.destroy();\n\t\t\t\t};\n\t\t\t\tawait clientWorkIsDone();\n\t\t\t\tif (target_node.destroyed === true) return;\n\n\t\t\t\tlet can_finish = false;\n\t\t\t\tlet updateCanFinish: (b: boolean) => void = () => {\n\t\t\t\t\t// noop\n\t\t\t\t};\n\t\t\t\tlet checkCanFinish = () => {\n\t\t\t\t\tupdateCanFinish(can_finish);\n\t\t\t\t};\n\n\t\t\t\tconst openView = async () => {\n\t\t\t\t\tif (view_definition === undefined) {\n\t\t\t\t\t\tawait onTargetDone();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} else if (can_use_current_view(target_node)) {\n\t\t\t\t\t\tupdate_properties_interaction.save = false;\n\t\t\t\t\t\tawait onTargetDone();\n\t\t\t\t\t\tupdate_properties_interaction.on_interactive(target_node);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tupdate_properties_interaction.on_interactive(target_node);\n\t\t\t\t\tconst view = openViewOnNode(\n\t\t\t\t\t\tview_context_node,\n\t\t\t\t\t\tview_definition.properties.view.ref,\n\t\t\t\t\t\tview_definition.properties.window.ref\n\t\t\t\t\t);\n\t\t\t\t\tconst active_action = view.properties.action_active.set(\"yes\", {\n\t\t\t\t\t\t\"can finish step\": [\"yes\", {}],\n\t\t\t\t\t\t\"last step\": flags.last_step ? \"yes\" : \"no\",\n\t\t\t\t\t});\n\t\t\t\t\tconst action_view = active_action as unknown as ActionView;\n\t\t\t\t\tupdateCanFinish = (predicate) => {\n\t\t\t\t\t\tif (predicate) {\n\t\t\t\t\t\t\tactive_action.properties.can_finish_step.ensure(\"yes\", {});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tactive_action.properties.can_finish_step.set(\"no\", {});\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tview.onDestroy(() => {\n\t\t\t\t\t\tupdateCanFinish = () => {\n\t\t\t\t\t\t\t// Do nothing\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t\tcheckCanFinish();\n\t\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\t\taction_view.finish = async () => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tawait onTargetDone();\n\t\t\t\t\t\t\t\tgetWindowInstance(view.parent.key.entry).close_view(view);\n\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t} catch (reason) {\n\t\t\t\t\t\t\t\treject(reason);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\taction_view.cancel = () => {\n\t\t\t\t\t\t\tgetWindowInstance(view.parent.key.entry).close_view(view);\n\t\t\t\t\t\t\trollback(update_properties_interaction.history);\n\t\t\t\t\t\t\tswitch (target_node.properties.location.state.name) {\n\t\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"remote\": {\n\t\t\t\t\t\t\t\t\tedit.switchOff(target_node);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(target_node.properties.location.state);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treject(\"Cancelled\");\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst can_continue = action.properties.executing.cast(\"yes\").properties.can_continue.ensure(\"yes\", {});\n\t\t\t\t\t\t(can_continue as unknown as Action).continue = () => {\n\t\t\t\t\t\t\tgetWindowInstance(view.parent.key.entry).activate_view(view, true);\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t};\n\n\t\t\t\tif (node_must_be_validated) {\n\t\t\t\t\tlet node_valid = true;\n\t\t\t\t\tlet key_unique = true;\n\t\t\t\t\t//check the valid status of all started actions and commands.\n\t\t\t\t\tcheckCanFinish = () => {\n\t\t\t\t\t\tcan_finish = key_unique && node_valid;\n\t\t\t\t\t\tupdateCanFinish(can_finish);\n\t\t\t\t\t};\n\t\t\t\t\tconst valid_subscription = target_node.properties.is_valid.subscribe({\n\t\t\t\t\t\ton_update: () => {\n\t\t\t\t\t\t\ttarget_node.properties.is_valid.switch({\n\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\tnode_valid = true;\n\t\t\t\t\t\t\t\t\tcheckCanFinish();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tno: () => {\n\t\t\t\t\t\t\t\t\tnode_valid = false;\n\t\t\t\t\t\t\t\t\tcheckCanFinish();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tupdate_properties_interaction.destructor.onDestroy(() => {\n\t\t\t\t\t\tvalid_subscription.unsubscribe();\n\t\t\t\t\t});\n\t\t\t\t\tconst view_entity = target_node.input.entity();\n\t\t\t\t\tswitch (view_entity.variant.name) {\n\t\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\t\tconst entry = view_entity.variant.definition;\n\t\t\t\t\t\t\tconst key = entry.properties.key.inferences.key();\n\t\t\t\t\t\t\tconst entry_subscription = key.properties.key_unique.subscribe({\n\t\t\t\t\t\t\t\ton_update: () => {\n\t\t\t\t\t\t\t\t\tswitch (key.properties.key_unique.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\tkey_unique = false;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\tkey_unique = true;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState(key.properties.key_unique.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcheckCanFinish();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tupdate_properties_interaction.destructor.onDestroy(() => {\n\t\t\t\t\t\t\t\tentry_subscription?.unsubscribe();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"root\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcan_finish = true;\n\t\t\t\t}\n\t\t\t\tswitch (update_properties_interaction.interactive.properties.interactive.state.name) {\n\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\tif (can_finish) {\n\t\t\t\t\t\t\tawait onTargetDone();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tawait openView();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tif (node_must_be_validated) {\n\t\t\t\t\t\t\tawait openView();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tawait onTargetDone();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t};\n}\n\nexport function finishAction(action: api_cs.Cyes__action_active): void {\n\t(action as unknown as ActionView).finish?.();\n}\n\nexport function cancelAction(action: api_cs.Cyes__action_active): void {\n\tif (confirm(translate(\"Discard your changes?\"))) {\n\t\t//FIXME move this to the controls\n\t\t(action as unknown as ActionView).cancel?.();\n\t}\n}\n\nexport function continueAction(action: api_cs.Cyes__can_continue): void {\n\t(action as unknown as Action).continue?.();\n}\n\ntype ActionView = {\n\tfinish?: () => void;\n\tcancel?: () => void;\n};\n\ntype Action = {\n\tcontinue?: () => void;\n};\n\ntype ObjectTarget = api_cs.Cnode;\ntype StateGroupTarget = api_cs.Cstate_group__type__property;\ntype ScalarTarget = api_cs.Cnumber__type__property | api_cs.Ctext__type__property | api_cs.Cfile__type__property;\ntype CollectionTarget = api_cs.Ccollection;\ntype ActionTarget = api_cs.Cyes__started;\ntype UiTarget = ObjectTarget | StateGroupTarget | ScalarTarget | CollectionTarget | ActionTarget;\n\ntype Mutation =\n\t| [\n\t\t\t\"update text\",\n\t\t\t{\n\t\t\t\tproperty: api_cs.Ctext__type__property;\n\t\t\t\t\"old value\": string | undefined;\n\t\t\t\t\"new value\": string;\n\t\t\t}\n\t ]\n\t| [\n\t\t\t\"update number\",\n\t\t\t{\n\t\t\t\tproperty: api_cs.Cnumber__type__property;\n\t\t\t\t\"old value\": number | undefined;\n\t\t\t\t\"new value\": number;\n\t\t\t}\n\t ]\n\t| [\n\t\t\t\"update stategroup\",\n\t\t\t{\n\t\t\t\t\"old state\": api_cs.Cstates__state_group__type__property | undefined;\n\t\t\t\t\"new state\": api_cs.Cstates__state_group__type__property;\n\t\t\t}\n\t ]\n\t| [\"create entry\", api_cs.Centries__collection]\n\t| [\"delete entry\", api_cs.Centries__collection];\ntype History = {\n\tevents: Mutation[];\n};\n\nasync function update_text(text: api_cs.Ctext__type__property, value: string, history: History): Promise {\n\tlet old_value: string | undefined;\n\tif (textPropertyModifiedByUser(text)) {\n\t\told_value = Text.getValue(text);\n\t} else {\n\t\told_value = undefined;\n\t}\n\thistory.events.push([\n\t\t\"update text\",\n\t\t{\n\t\t\tproperty: text,\n\t\t\t\"old value\": old_value,\n\t\t\t\"new value\": value,\n\t\t},\n\t]);\n\tawait registrationInitialized(text);\n\treturn iText(text).update(value, \"user\");\n}\n\nasync function update_number(number: api_cs.Cnumber__type__property, value: number, history: History): Promise {\n\tlet old_value: number | undefined;\n\tif (numberPropertyModifiedByUser(number)) {\n\t\told_value = Number.getValue(number);\n\t} else {\n\t\told_value = undefined;\n\t}\n\thistory.events.push([\n\t\t\"update number\",\n\t\t{\n\t\t\tproperty: number,\n\t\t\t\"old value\": old_value,\n\t\t\t\"new value\": value,\n\t\t},\n\t]);\n\tawait registrationInitialized(number);\n\tupdate.number(number, value, \"user\");\n}\n\nasync function update_stategroup(state: api_cs.Cstates__state_group__type__property, history: History): Promise {\n\tconst stategroup = state.parent;\n\tlet old_state: api_cs.Cstates__state_group__type__property | undefined;\n\tif (stategroupPropertyModifiedByUser(stategroup)) {\n\t\told_state = iStategroup(stategroup).getSelectedState();\n\t} else {\n\t\told_state = undefined;\n\t}\n\thistory.events.push([\n\t\t\"update stategroup\",\n\t\t{\n\t\t\t\"old state\": old_state,\n\t\t\t\"new state\": state,\n\t\t},\n\t]);\n\tawait registrationInitialized(stategroup);\n\tiState(state).select(\"user\");\n}\n\nasync function rollback(history: History): Promise {\n\tfor (const item of history.events.reverse()) {\n\t\tswitch (item[0]) {\n\t\t\tcase \"update text\": {\n\t\t\t\tif (item[1].property.destroyed) continue;\n\t\t\t\tconst text = item[1].property;\n\t\t\t\tconst old_value = item[1][\"old value\"];\n\t\t\t\tif (old_value === undefined) {\n\t\t\t\t\tiText(text).discard();\n\t\t\t\t} else {\n\t\t\t\t\tawait iText(text).update(old_value, \"user\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"update number\": {\n\t\t\t\tif (item[1].property.destroyed) continue;\n\t\t\t\tconst number = item[1].property;\n\t\t\t\tconst old_value = item[1][\"old value\"];\n\t\t\t\tif (old_value === undefined) {\n\t\t\t\t\tupdate.unset_number(number);\n\t\t\t\t} else {\n\t\t\t\t\tupdate.number(number, old_value, \"user\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"update stategroup\": {\n\t\t\t\tif (item[1][\"new state\"].parent.destroyed) continue;\n\t\t\t\tconst old_state = item[1][\"old state\"];\n\t\t\t\tconst new_state = item[1][\"new state\"];\n\t\t\t\tif (old_state === undefined) {\n\t\t\t\t\tiStategroup(new_state.parent).discard();\n\t\t\t\t} else {\n\t\t\t\t\tiState(old_state).select(\"user\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"create entry\": {\n\t\t\t\tif (item[1].destroyed) continue;\n\t\t\t\tconst entry = item[1];\n\t\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\t\tcase \"remote\":\n\t\t\t\t\t\t// Do not roll back saved changes\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\tdeleteCollectionEntry(entry);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"delete entry\": {\n\t\t\t\tif (item[1].destroyed) continue;\n\t\t\t\tconst entry = item[1];\n\t\t\t\tif (!entry.destroyed) {\n\t\t\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\t\t\tcase \"remote\":\n\t\t\t\t\t\t\tentry.properties.location.state.node.properties.marked_for_deletion.ensure(\"no\", {});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(entry.properties.location.state);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(item[0]);\n\t\t}\n\t}\n}\n\nasync function executeActionExpression(\n\texpression: api_gui.Cgui_action_expression,\n\ton_target: InteractionBuilder,\n\tthis_node: api_cs.Cnode,\n\ttarget: UiTarget,\n\tparameter: api_cs.Cnode,\n\tvariable: Variable | null,\n\tdestructor: DestructorTree,\n\tview_bindings: Record,\n\thistory: History,\n\tupdating_properties: boolean\n): Promise {\n\tswitch (expression.properties.operation.state.name) {\n\t\tcase \"node switch\": {\n\t\t\tconst node_switch = expression.properties.operation.state.node;\n\t\t\tconst node = await awaitCondition(\n\t\t\t\texpressions.node_expression(node_switch.inferences.node_switch().properties.expression)([this_node, variable]),\n\t\t\t\t(value) => value !== Pending && !(value === Unknown && SubscriptionManager.size() > 0),\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tswitch (node) {\n\t\t\t\tcase Unknown:\n\t\t\t\t\treturn undefined;\n\t\t\t\tcase Failed:\n\t\t\t\t\tawait executeActionExpression(\n\t\t\t\t\t\tnode_switch.properties.cases.properties.false_case.properties.expression,\n\t\t\t\t\t\ton_target,\n\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\tparameter,\n\t\t\t\t\t\tvariable,\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tview_bindings,\n\t\t\t\t\t\thistory,\n\t\t\t\t\t\tupdating_properties\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Pending:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: {\n\t\t\t\t\tregisterNodeContext(node, destructor);\n\t\t\t\t\tconst variable_assignment =\n\t\t\t\t\t\tnode_switch.inferences.node_switch().properties.cases.properties.node_case.properties.variable_assignment;\n\t\t\t\t\tconst new_variable = optional_variable_assignment(variable_assignment, variable, node);\n\t\t\t\t\tawait executeActionExpression(\n\t\t\t\t\t\tnode_switch.properties.cases.properties.true_case.properties.expression,\n\t\t\t\t\t\ton_target,\n\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\tparameter,\n\t\t\t\t\t\tnew_variable,\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tview_bindings,\n\t\t\t\t\t\thistory,\n\t\t\t\t\t\tupdating_properties\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"ignore\": {\n\t\t\tbreak;\n\t\t}\n\t\tcase \"walk\": {\n\t\t\tconst walk = expression.properties.operation.state.node;\n\t\t\tconst walk_expression = walk.inferences.walk();\n\t\t\tconst node = await awaitCondition(\n\t\t\t\texpressions.singular_node_path(walk_expression.properties.path)([this_node, variable]),\n\t\t\t\tvalueOrFailed,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tif (node === Failed) {\n\t\t\t\treturn undefined; //TODO reject?\n\t\t\t}\n\t\t\tregisterNodeContext(node, destructor);\n\t\t\tconst entries = await entriesOf(node, walk_expression.properties.collection.entry);\n\t\t\tfor (let entry of entries) {\n\t\t\t\tif (entry instanceof IdPathBuilder) {\n\t\t\t\t\tentry = registerIdPath(entry, destructor);\n\t\t\t\t}\n\t\t\t\tconst filtered_entry = await awaitCondition(\n\t\t\t\t\texpressions.node_path_tail(walk_expression.properties.tail)(entry),\n\t\t\t\t\tvalueOrFailed\n\t\t\t\t);\n\t\t\t\tif (!isResolved(filtered_entry)) continue;\n\n\t\t\t\tconst new_variable = optional_variable_assignment(\n\t\t\t\t\twalk_expression.properties.variable_assignment,\n\t\t\t\t\tvariable,\n\t\t\t\t\tfiltered_entry\n\t\t\t\t);\n\t\t\t\tswitch (walk_expression.properties.collection.ref.properties.ui.properties.size.state.name) {\n\t\t\t\t\tcase \"large\": {\n\t\t\t\t\t\tupdating_properties = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"small\": {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait executeActionExpression(\n\t\t\t\t\twalk.properties.expression,\n\t\t\t\t\ton_target,\n\t\t\t\t\tthis_node,\n\t\t\t\t\ttarget,\n\t\t\t\t\tparameter,\n\t\t\t\t\tnew_variable,\n\t\t\t\t\tdestructor,\n\t\t\t\t\tview_bindings,\n\t\t\t\t\thistory,\n\t\t\t\t\tupdating_properties\n\t\t\t\t);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state switch\": {\n\t\t\tconst $ = expression.properties.operation.state.node;\n\t\t\tconst state_switch = $.inferences.state_switch();\n\t\t\tconst node = await awaitCondition(\n\t\t\t\texpressions.ui_parametrized_node_path(state_switch.properties.path.properties.path)([this_node, variable]),\n\t\t\t\tvalueOrFailed,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tif (node === Failed) {\n\t\t\t\treturn Promise.resolve();\n\t\t\t\t//TODO or throw error?\n\t\t\t}\n\t\t\tregisterNodeContext(node, destructor);\n\t\t\tconst stategroup = state_switch.properties.path.properties.stategroup.ref;\n\t\t\tconst cs_stategroup = registerStategroup(stategroup, node, destructor);\n\t\t\tawait registrationInitialized(cs_stategroup);\n\t\t\tconst cs_state = await Stategroup.subscribeToSelectedState(cs_stategroup, destructor, async (state) => state);\n\t\t\tif (!cs_state) return Promise.resolve();\n\t\t\tconst state = $.properties.states.get(cs_state.key.entry)!;\n\t\t\tconst new_variable = optional_variable_assignment(\n\t\t\t\tstate.key.ref.properties.variable_assignment,\n\t\t\t\tvariable,\n\t\t\t\tcs_state.properties.node\n\t\t\t);\n\t\t\tawait executeActionExpression(\n\t\t\t\tstate.properties.expression,\n\t\t\t\ton_target,\n\t\t\t\tthis_node,\n\t\t\t\ttarget,\n\t\t\t\tparameter,\n\t\t\t\tnew_variable,\n\t\t\t\tdestructor,\n\t\t\t\tview_bindings,\n\t\t\t\thistory,\n\t\t\t\tupdating_properties\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"update properties\": {\n\t\t\tconst update_properties = expression.properties.operation.state.node;\n\t\t\tconst singular_node_path_stream = expressions.singular_node_path(\n\t\t\t\tupdate_properties.inferences.update_properties()!.properties.path\n\t\t\t)([this_node, variable]);\n\t\t\tconst node = await awaitCondition(singular_node_path_stream, valueOrFailed, destructor);\n\t\t\tif (node === Failed) {\n\t\t\t\treturn undefined; //TODO reject?\n\t\t\t}\n\t\t\tregisterNodeContext(node, destructor);\n\t\t\tswitch (update_properties.properties.target.state.name) {\n\t\t\t\tcase \"node\": {\n\t\t\t\t\tconst node_target = update_properties.properties.target.state.node;\n\t\t\t\t\ton_target.show_target(\n\t\t\t\t\t\tupdate_properties.inferences.update_properties().properties.visualization,\n\t\t\t\t\t\tnode_target.properties.bind_view.ref,\n\t\t\t\t\t\tnode\n\t\t\t\t\t);\n\t\t\t\t\tawait on_target.update_properties({\n\t\t\t\t\t\taction_view: node_target.properties.bind_view.ref,\n\t\t\t\t\t\ttarget_node: node,\n\t\t\t\t\t\tinteractive: update_properties.inferences.update_properties().properties.interaction,\n\t\t\t\t\t\tdestructor: destructor.addChild(),\n\t\t\t\t\t\tsave: true,\n\t\t\t\t\t\thistory: history,\n\t\t\t\t\t\ton_interactive: (view_context_node) => {\n\t\t\t\t\t\t\tedit.switchOn(view_context_node);\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tawait executeObjectExpression(\n\t\t\t\t\t\tnode_target.properties.expression,\n\t\t\t\t\t\ton_target,\n\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tparameter,\n\t\t\t\t\t\tvariable,\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tview_bindings,\n\t\t\t\t\t\thistory,\n\t\t\t\t\t\ttrue\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"property\": {\n\t\t\t\t\tconst property_target = update_properties.properties.target.state.node;\n\t\t\t\t\tconst property_reference = property_target.inferences.property().properties.property.ref;\n\t\t\t\t\tlet new_target: UiTarget;\n\t\t\t\t\tlet view: api_gui.Cviews | undefined;\n\t\t\t\t\tlet interactive_callback: () => void;\n\t\t\t\t\tswitch (property_target.properties.action_view.state.name) {\n\t\t\t\t\t\tcase \"available\": {\n\t\t\t\t\t\t\tview = property_target.properties.action_view.state.node.properties.bind_view.ref;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"unavailable\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tlet should_update_properties = true;\n\t\t\t\t\tswitch (property_reference.properties.type.state.name) {\n\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\tnew_target = registerCollection(property_reference.properties.type.state.node, node, destructor);\n\t\t\t\t\t\t\tinteractive_callback = () => {\n\t\t\t\t\t\t\t\t// Do nothing for collections.\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tshould_update_properties = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\tconst text_property = registerText(property_reference.properties.type.state.node, node, destructor);\n\t\t\t\t\t\t\tnew_target = text_property;\n\t\t\t\t\t\t\tinteractive_callback = () => {\n\t\t\t\t\t\t\t\tedit.textOn(text_property);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\tconst number_property = registerNumber(property_reference.properties.type.state.node, node, destructor);\n\t\t\t\t\t\t\tnew_target = number_property;\n\t\t\t\t\t\t\tinteractive_callback = () => {\n\t\t\t\t\t\t\t\tedit.numberOn(number_property);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\tconst stategroup_property = registerStategroup(\n\t\t\t\t\t\t\t\tproperty_reference.properties.type.state.node,\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tnew_target = stategroup_property;\n\t\t\t\t\t\t\tinteractive_callback = () => {\n\t\t\t\t\t\t\t\tedit.stategroupOn(stategroup_property);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\t\tconst group_node = registerGroup(property_reference.properties.type.state.node, node, destructor)\n\t\t\t\t\t\t\t\t.properties.node;\n\t\t\t\t\t\t\tnew_target = group_node;\n\t\t\t\t\t\t\tinteractive_callback = () => {\n\t\t\t\t\t\t\t\tedit.switchOn(group_node);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\t\tthrow new Error(\"file property is not a valid property target\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ton_target.show_target(update_properties.inferences.update_properties().properties.visualization, view, node);\n\t\t\t\t\tif (!updating_properties && should_update_properties) {\n\t\t\t\t\t\tawait on_target.update_properties({\n\t\t\t\t\t\t\taction_view: view,\n\t\t\t\t\t\t\ttarget_node: node,\n\t\t\t\t\t\t\tinteractive: update_properties.inferences.update_properties().properties.interaction,\n\t\t\t\t\t\t\tdestructor: destructor,\n\t\t\t\t\t\t\tsave: true,\n\t\t\t\t\t\t\thistory: history,\n\t\t\t\t\t\t\ton_interactive: interactive_callback,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tawait executeActionExpression(\n\t\t\t\t\t\tproperty_target.properties.expression,\n\t\t\t\t\t\ton_target,\n\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\tnew_target,\n\t\t\t\t\t\tparameter,\n\t\t\t\t\t\tvariable,\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tview_bindings,\n\t\t\t\t\t\thistory,\n\t\t\t\t\t\tshould_update_properties\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(update_properties.properties.target.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"execute operation\": {\n\t\t\tconst execute_operation = expression.properties.operation.state.node;\n\t\t\tconst node = await awaitCondition(\n\t\t\t\texpressions.singular_node_path(execute_operation.inferences.execute_operation().properties.path)([\n\t\t\t\t\tthis_node,\n\t\t\t\t\tvariable,\n\t\t\t\t]),\n\t\t\t\tvalueOrFailed,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tif (node === Failed) {\n\t\t\t\treturn undefined; //TODO reject?\n\t\t\t}\n\t\t\tregisterNodeContext(node, destructor);\n\t\t\tconst operation_type = execute_operation.inferences.execute_operation().properties.operation.ref;\n\t\t\toperation_type.properties.type.switch({\n\t\t\t\taction: ($) => registerAction($, node, destructor),\n\t\t\t\tcommand: ($) =>\n\t\t\t\t\t$.properties.type.switch({\n\t\t\t\t\t\tglobal: ($) => registerCommand($, node, destructor),\n\t\t\t\t\t\tcomponent: () => undefined,\n\t\t\t\t\t}),\n\t\t\t\t\"reference set\": undefined,\n\t\t\t\tproperty: undefined,\n\t\t\t});\n\t\t\tconst operation_attribute = node.properties.attributes.get(operation_type.key)!;\n\t\t\tconst started_operation = startOperation(operation_attribute.properties.type.cast(\"operation\"), destructor);\n\t\t\tconst parameters_node = started_operation.properties.node;\n\t\t\tconst execute_operation_destructor = destructor.addChild();\n\t\t\tawait on_target.update_properties({\n\t\t\t\ttarget_node: parameters_node,\n\t\t\t\tinteractive: execute_operation.inferences.execute_operation().properties.interaction,\n\t\t\t\taction_view: execute_operation.properties.bind_view.ref,\n\t\t\t\tdestructor: execute_operation_destructor,\n\t\t\t\tsave: false,\n\t\t\t\thistory: history,\n\t\t\t\ton_interactive: () => {\n\t\t\t\t\t// No need to do anything for operations\n\t\t\t\t},\n\t\t\t});\n\t\t\texecute_operation.properties.operation.switch({\n\t\t\t\tcommand: () => {\n\t\t\t\t\ton_target.execute_command(started_operation);\n\t\t\t\t},\n\t\t\t\taction: () => {\n\t\t\t\t\ton_target.execute_action({\n\t\t\t\t\t\taction: started_operation,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t\tawait executeObjectExpression(\n\t\t\t\texecute_operation.properties.expression,\n\t\t\t\ton_target,\n\t\t\t\tthis_node,\n\t\t\t\tparameters_node,\n\t\t\t\tparameter,\n\t\t\t\tvariable,\n\t\t\t\texecute_operation_destructor,\n\t\t\t\tview_bindings,\n\t\t\t\thistory,\n\t\t\t\tupdating_properties\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"produce value\": {\n\t\t\tconst produce_value = expression.properties.operation.state.node;\n\t\t\tswitch (produce_value.properties.value.state.name) {\n\t\t\t\tcase \"object\": {\n\t\t\t\t\tconst object_target = produce_value.properties.value.state.node;\n\t\t\t\t\tawait executeObjectExpression(\n\t\t\t\t\t\tobject_target.properties.expression,\n\t\t\t\t\t\ton_target,\n\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\tparameter,\n\t\t\t\t\t\tvariable,\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tview_bindings,\n\t\t\t\t\t\thistory,\n\t\t\t\t\t\tupdating_properties\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state group\": {\n\t\t\t\t\tconst state_group_target = produce_value.properties.value.state.node;\n\t\t\t\t\tconst state_to_select = state_group_target.inferences.state_group().properties.state.entry;\n\t\t\t\t\tconst target_state_group = state_group_target.inferences.state_group().inferences.target_state_group();\n\t\t\t\t\tswitch (target_state_group.variant.name) {\n\t\t\t\t\t\tcase \"stategroup property\": {\n\t\t\t\t\t\t\tconst state_group = target as api_cs.Cstate_group__type__property;\n\t\t\t\t\t\t\tswitch (state_group.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\tconst state = state_group.properties.states.get(state_to_select)!;\n\t\t\t\t\t\t\t\t\tawait update_stategroup(state, history);\n\t\t\t\t\t\t\t\t\tawait executeObjectExpression(\n\t\t\t\t\t\t\t\t\t\tstate_group_target.properties.expression,\n\t\t\t\t\t\t\t\t\t\ton_target,\n\t\t\t\t\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\t\t\t\t\tstate.properties.node,\n\t\t\t\t\t\t\t\t\t\tparameter,\n\t\t\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\t\t\tview_bindings,\n\t\t\t\t\t\t\t\t\t\thistory,\n\t\t\t\t\t\t\t\t\t\tupdating_properties\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(state_group.properties.is_editable.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(target_state_group.variant.name);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"scalar\": {\n\t\t\t\t\tconst scalar_target = produce_value.properties.value.state.node;\n\t\t\t\t\tconst expression = scalar_target.inferences.scalar().properties.expression;\n\t\t\t\t\tconst target_scalar = scalar_target.inferences.scalar().inferences.target_scalar();\n\t\t\t\t\tswitch (target_scalar.variant.name) {\n\t\t\t\t\t\tcase \"property value\": {\n\t\t\t\t\t\t\tconst $ = target_scalar.variant.definition;\n\t\t\t\t\t\t\tswitch ($.variant.name) {\n\t\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\t\tconst number$ = $.variant.definition;\n\t\t\t\t\t\t\t\t\tswitch (number$.variant.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"intermediate result\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"number property\": {\n\t\t\t\t\t\t\t\t\t\t\tconst number_property = target as api_cs.Cnumber__type__property;\n\t\t\t\t\t\t\t\t\t\t\tconst value = await awaitCondition(\n\t\t\t\t\t\t\t\t\t\t\t\texpressions.ui_scalar_value_expression(expression)([\n\t\t\t\t\t\t\t\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.parent,\n\t\t\t\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\t\t\t\tvalueOrFailed\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tif (value === Failed) {\n\t\t\t\t\t\t\t\t\t\t\t\tif (!numberPropertyModifiedByUser(number_property)) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdate.unset_number(number_property);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tawait update_number(number_property, value, history);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState(number$.variant);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\t\tconst text$ = $.variant.definition;\n\t\t\t\t\t\t\t\t\tswitch (text$.variant.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"intermediate result\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"text property\": {\n\t\t\t\t\t\t\t\t\t\t\tconst text_property = target as api_cs.Ctext__type__property;\n\t\t\t\t\t\t\t\t\t\t\tconst value = await awaitCondition(\n\t\t\t\t\t\t\t\t\t\t\t\texpressions.ui_scalar_value_expression(expression)([\n\t\t\t\t\t\t\t\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext_property.parent,\n\t\t\t\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\t\t\t\tvalueOrFailed\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tif (value === Failed) {\n\t\t\t\t\t\t\t\t\t\t\t\tif (!textPropertyModifiedByUser(text_property)) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tiText(text_property).discard();\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tawait update_text(text_property, value.toString(), history);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\t\t\t\tconst file_property = target as api_cs.Cfile__type__property;\n\t\t\t\t\t\t\t\t\tconst value = await awaitCondition(\n\t\t\t\t\t\t\t\t\t\texpressions.ui_scalar_value_expression(expression)([\n\t\t\t\t\t\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\t\t\t\tfile_property.parent,\n\t\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\t\tvalueOrFailed\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tif (value !== Failed) {\n\t\t\t\t\t\t\t\t\t\tupdate.fileToken(file_property, value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"state choice\": {\n\t\t\t\t\t\t\t\t\tconst state_choice = $.variant.definition;\n\t\t\t\t\t\t\t\t\tswitch (state_choice.variant.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"state node choice\": {\n\t\t\t\t\t\t\t\t\t\t\tconst stategroup_property = target as api_cs.Cstate_group__type__property;\n\t\t\t\t\t\t\t\t\t\t\tconst value = await awaitCondition(\n\t\t\t\t\t\t\t\t\t\t\t\texpressions.ui_scalar_value_expression(expression)([\n\t\t\t\t\t\t\t\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstategroup_property.parent,\n\t\t\t\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\t\t\t\tvalueOrFailed\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tif (value === Failed) {\n\t\t\t\t\t\t\t\t\t\t\t\tif (!stategroupPropertyModifiedByUser(stategroup_property)) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tiStategroup(stategroup_property).discard();\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tconst state_to_set = stategroup_property.properties.states.get(value.key)!;\n\t\t\t\t\t\t\t\t\t\t\t\tawait update_stategroup(state_to_set, history);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState(state_choice.variant.name);\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState($.variant);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"style\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(target_scalar.variant);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(produce_value.properties.value.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"entry list\": {\n\t\t\tconst $ = expression.properties.operation.state.node;\n\t\t\tawait executeEntryExpressionList(\n\t\t\t\t$.properties.entries,\n\t\t\t\ton_target,\n\t\t\t\tthis_node,\n\t\t\t\ttarget,\n\t\t\t\tparameter,\n\t\t\t\tvariable,\n\t\t\t\tdestructor,\n\t\t\t\tview_bindings,\n\t\t\t\thistory,\n\t\t\t\tupdating_properties\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"entry\": {\n\t\t\tconst entry_expression = expression.properties.operation.state.node;\n\t\t\tswitch (entry_expression.properties.type.state.name) {\n\t\t\t\tcase \"create\": {\n\t\t\t\t\tconst create_entry = entry_expression.properties.type.state.node;\n\t\t\t\t\tswitch (create_entry.properties.collection_type.state.name) {\n\t\t\t\t\t\tcase \"parameter\": {\n\t\t\t\t\t\t\tconst collection = target as api_cs.Ccollection;\n\t\t\t\t\t\t\tconst entry = add.addCollectionEntry(collection);\n\t\t\t\t\t\t\tregisterEntry(entry, destructor);\n\t\t\t\t\t\t\tawait executeObjectExpression(\n\t\t\t\t\t\t\t\tcreate_entry.properties.expression,\n\t\t\t\t\t\t\t\ton_target,\n\t\t\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\t\t\tentry.properties.node,\n\t\t\t\t\t\t\t\tparameter,\n\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\tdestructor.addChild(),\n\t\t\t\t\t\t\t\tview_bindings,\n\t\t\t\t\t\t\t\thistory,\n\t\t\t\t\t\t\t\tupdating_properties\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"node\": {\n\t\t\t\t\t\t\tconst node_collection = create_entry.properties.collection_type.state.node;\n\t\t\t\t\t\t\tconst collection = target as api_cs.Ccollection;\n\t\t\t\t\t\t\tconst new_entry = iCollection(collection).addEntry(\"user\");\n\t\t\t\t\t\t\tregisterEntry(new_entry, destructor);\n\t\t\t\t\t\t\tiCollection(collection).clearDefaultEntries();\n\t\t\t\t\t\t\thistory.events.push([\"create entry\", new_entry]);\n\t\t\t\t\t\t\tconst new_node = new_entry.properties.node;\n\t\t\t\t\t\t\tregisterNewNode(new_node, destructor);\n\t\t\t\t\t\t\ton_target.show_target(\n\t\t\t\t\t\t\t\tcreate_entry.inferences.create().properties.visualization,\n\t\t\t\t\t\t\t\tnode_collection.properties.bind_view.ref,\n\t\t\t\t\t\t\t\tnew_node\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (!updating_properties) {\n\t\t\t\t\t\t\t\tawait on_target.update_properties({\n\t\t\t\t\t\t\t\t\taction_view: node_collection.properties.bind_view.ref,\n\t\t\t\t\t\t\t\t\ttarget_node: new_node,\n\t\t\t\t\t\t\t\t\tinteractive: create_entry.inferences.create().properties.interaction,\n\t\t\t\t\t\t\t\t\tdestructor: destructor.addChild(),\n\t\t\t\t\t\t\t\t\tsave: true,\n\t\t\t\t\t\t\t\t\thistory: history,\n\t\t\t\t\t\t\t\t\ton_interactive: (view_context_node) => {\n\t\t\t\t\t\t\t\t\t\tedit.switchOn(view_context_node);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait executeObjectExpression(\n\t\t\t\t\t\t\t\tcreate_entry.properties.expression,\n\t\t\t\t\t\t\t\ton_target,\n\t\t\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\t\t\tnew_node,\n\t\t\t\t\t\t\t\tparameter,\n\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tview_bindings,\n\t\t\t\t\t\t\t\thistory,\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(create_entry.properties.collection_type.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"delete\": {\n\t\t\t\t\tconst delete_entry = entry_expression.properties.type.state.node;\n\t\t\t\t\tconst collection = target as api_cs.Ccollection;\n\t\t\t\t\tconst view_context_node = collection.parent.parent.parent;\n\t\t\t\t\tawait on_target.update_properties({\n\t\t\t\t\t\taction_view: delete_entry.properties.bind_view.ref,\n\t\t\t\t\t\ttarget_node: view_context_node,\n\t\t\t\t\t\tinteractive: delete_entry.inferences.delete_().properties.interaction,\n\t\t\t\t\t\tdestructor: destructor.addChild(),\n\t\t\t\t\t\tsave: true,\n\t\t\t\t\t\thistory: history,\n\t\t\t\t\t\ton_interactive: () => {\n\t\t\t\t\t\t\t// Do nothing on delete?\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tconst node = await awaitCondition(\n\t\t\t\t\t\texpressions.singular_node_path(delete_entry.inferences.delete_().properties.path)([this_node, variable]),\n\t\t\t\t\t\tvalueOrFailed,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tif (node === Failed) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\tregisterNodeContext(node, destructor);\n\t\t\t\t\tconst entry = node.input.position().cast(\"entity\").cast(\"entry\");\n\t\t\t\t\thistory.events.push([\"delete entry\", entry]);\n\t\t\t\t\tdeleteCollectionEntry(entry);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(entry_expression.properties.type.state);\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(expression.properties.operation.state);\n\t}\n}\n\nasync function executeObjectExpression(\n\texpression: api_gui.Cobject_expression,\n\ton_target: InteractionBuilder,\n\tthis_node: api_cs.Cnode,\n\ttarget: UiTarget,\n\tparameter: api_cs.Cnode,\n\tvariable: Variable | null,\n\tdestructor: DestructorTree,\n\tview_bindings: Record,\n\thistory: History,\n\tupdating_properties: boolean\n): Promise {\n\tawait expression.input\n\t\t.object_expression()\n\t\t.input.target()\n\t\t.switch({\n\t\t\tnode: (node_target) => {\n\t\t\t\tconst context_node = target as api_cs.Cnode;\n\t\t\t\treturn promiseSeries(\n\t\t\t\t\torderedAttributes(node_target).map((attribute_name) => async () => {\n\t\t\t\t\t\tswitch (attribute_name.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"action\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"command\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"reference set\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"property\": {\n\t\t\t\t\t\t\t\tconst object_expression_property = expression.properties.properties.get(attribute_name.key);\n\t\t\t\t\t\t\t\tif (object_expression_property) {\n\t\t\t\t\t\t\t\t\tconst property_def = context_node.input\n\t\t\t\t\t\t\t\t\t\t.node_type()\n\t\t\t\t\t\t\t\t\t\t.properties.attributes.get(attribute_name.key)!\n\t\t\t\t\t\t\t\t\t\t.properties.type.cast(\"property\");\n\t\t\t\t\t\t\t\t\tawait executeActionExpression(\n\t\t\t\t\t\t\t\t\t\tobject_expression_property.properties.default_,\n\t\t\t\t\t\t\t\t\t\ton_target,\n\t\t\t\t\t\t\t\t\t\tthis_node,\n\t\t\t\t\t\t\t\t\t\tobject_expression_property.key.ref.key.ref.properties.type.switch({\n\t\t\t\t\t\t\t\t\t\t\tcollection: () =>\n\t\t\t\t\t\t\t\t\t\t\t\taddClientState.addCollectionAttribute(\n\t\t\t\t\t\t\t\t\t\t\t\t\tproperty_def.properties.type.cast(\"collection\"),\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontext_node\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tfile: () => {\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new Error(\"not supported\");\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tgroup: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tregisterGroup(property_def.properties.type.cast(\"group\"), context_node, destructor).properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t.node,\n\t\t\t\t\t\t\t\t\t\t\t\"state group\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\tregisterStategroup(property_def.properties.type.cast(\"state group\"), context_node, destructor),\n\t\t\t\t\t\t\t\t\t\t\tnumber: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tregisterNumber(property_def.properties.type.cast(\"number\"), context_node, destructor),\n\t\t\t\t\t\t\t\t\t\t\ttext: () => registerText(property_def.properties.type.cast(\"text\"), context_node, destructor),\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tparameter,\n\t\t\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\t\t\tview_bindings,\n\t\t\t\t\t\t\t\t\t\thistory,\n\t\t\t\t\t\t\t\t\t\tupdating_properties\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(attribute_name.properties.type.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t},\n\t\t});\n}\n\nasync function executeEntryExpressionList(\n\texpression: api_gui.Centry_expression_list,\n\ton_target: InteractionBuilder,\n\tthis_node: api_cs.Cnode,\n\ttarget: UiTarget,\n\tparameter: api_cs.Cnode,\n\tvariable: Variable | null,\n\tdestructor: DestructorTree,\n\tview_bindings: Record,\n\thistory: History,\n\tupdating_properties: boolean\n): Promise {\n\tawait executeActionExpression(\n\t\texpression.properties.expression,\n\t\ton_target,\n\t\tthis_node,\n\t\ttarget,\n\t\tparameter,\n\t\tvariable,\n\t\tdestructor,\n\t\tview_bindings,\n\t\thistory,\n\t\tupdating_properties\n\t);\n\tswitch (expression.properties.more_entries.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst $ = expression.properties.more_entries.state.node;\n\t\t\tawait executeEntryExpressionList(\n\t\t\t\t$.properties.tail,\n\t\t\t\ton_target,\n\t\t\t\tthis_node,\n\t\t\t\ttarget,\n\t\t\t\tparameter,\n\t\t\t\tvariable,\n\t\t\t\tdestructor,\n\t\t\t\tview_bindings,\n\t\t\t\thistory,\n\t\t\t\tupdating_properties\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(expression.properties.more_entries.state);\n\t}\n}\n\nfunction numberPropertyModifiedByUser(cs_number: api_cs.Cnumber__type__property) {\n\treturn cs_number.properties.is_set.switch({\n\t\tno: false,\n\t\tyes: ($) =>\n\t\t\t$.properties.by.switch({\n\t\t\t\tengine: false,\n\t\t\t\tuser: true,\n\t\t\t}),\n\t});\n}\n\nfunction textPropertyModifiedByUser(cs_text: api_cs.Ctext__type__property) {\n\treturn cs_text.properties.is_set.switch({\n\t\tno: false,\n\t\tyes: ($) =>\n\t\t\t$.properties.by.switch({\n\t\t\t\tengine: false,\n\t\t\t\tuser: true,\n\t\t\t}),\n\t});\n}\n\nfunction stategroupPropertyModifiedByUser(cs_stategroup: api_cs.Cstate_group__type__property) {\n\treturn cs_stategroup.properties.is_set.switch({\n\t\tno: false,\n\t\tyes: ($) =>\n\t\t\t$.properties.by.switch({\n\t\t\t\tengine: false,\n\t\t\t\tuser: true,\n\t\t\t}),\n\t});\n}\n\nfunction remoteEntries(id_path: IdPathBuilder, collection_name: string): Promise {\n\tconst builder = SubscriptionBuilder.create();\n\tbuilder.collection_entries(collection_name);\n\treturn new Promise((resolve) => {\n\t\tDatastoreProxy.instance.subscribeOnce(\n\t\t\t{\n\t\t\t\t\"context node\": id_path.build(),\n\t\t\t\t\"mutation permissions\": [\"ignore\", {}],\n\t\t\t\t\"node subscription\": { attributes: builder.properties },\n\t\t\t},\n\t\t\t(subscribed) => {\n\t\t\t\tresolve(\n\t\t\t\t\tsubscribed.properties.context.switch({\n\t\t\t\t\t\t\"does not exist\": () => [],\n\t\t\t\t\t\t\"permission denied\": () => [],\n\t\t\t\t\t\texists: (existing_context) =>\n\t\t\t\t\t\t\texisting_context.properties.subscription_result_data.properties.read_permitted.switch({\n\t\t\t\t\t\t\t\tyes: (yes) =>\n\t\t\t\t\t\t\t\t\tArray.from(\n\t\t\t\t\t\t\t\t\t\tyes.properties.attributes\n\t\t\t\t\t\t\t\t\t\t\t.get(collection_name)!\n\t\t\t\t\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t\t\t\t\t.properties.type.cast(\"collection\")\n\t\t\t\t\t\t\t\t\t\t\t.properties.result.cast(\"entries\").properties.entries\n\t\t\t\t\t\t\t\t\t).map((entry) => {\n\t\t\t\t\t\t\t\t\t\treturn id_path.collectionEntry(collection_name, entry[1].key);\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\tno: () => [],\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t});\n}\n\nasync function entriesOf(node: api_cs.Cnode, collection: string): Promise<(api_cs.Cnode | IdPathBuilder)[]> {\n\tlet result: (api_cs.Cnode | IdPathBuilder)[] = [];\n\tconst getRemoteEntries = async (id_path: IdPathBuilder) => {\n\t\tresult = await remoteEntries(id_path, collection);\n\t};\n\n\tconst attribute = node.properties.attributes.get(collection);\n\tif (attribute !== undefined) {\n\t\tconst collection_property = attribute.properties.type.cast(\"property\").properties.type.cast(\"collection\");\n\t\tconst getLocalEntries = () => {\n\t\t\tfor (const entry of collection_property.properties.entries.values()) {\n\t\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\t\tcase \"remote\": {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"local\": {\n\t\t\t\t\t\tresult.push(entry.properties.node);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(entry.properties.location.state);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tconst initialized = Collection.isInitialized(collection_property);\n\t\tswitch (initialized) {\n\t\t\tcase false: {\n\t\t\t\tawait getRemoteEntries(createIdPathBuilderFromNode(node));\n\t\t\t\tgetLocalEntries();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase true: {\n\t\t\t\tfor (const entry of collection_property.properties.entries.values()) {\n\t\t\t\t\tresult.push(entry.properties.node);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(initialized);\n\t\t}\n\t} else {\n\t\tawait getRemoteEntries(createIdPathBuilderFromNode(node));\n\t}\n\treturn result;\n}\n\n// Fixme do this in the generator?\n/// Returns the ancestor node that acts as an action boundry. This relies heavily on the generated desktop UI. But it\n/// the current view can be used to handle an action step.\nfunction actionBoundry(node: api_cs.Cnode, view_node_type: api_app.Cnode__application): api_cs.Cnode {\n\tif (node.input.node_type() === view_node_type) return node;\n\tconst position = node.input.position();\n\tswitch (position.variant.name) {\n\t\tcase \"entity\": {\n\t\t\tconst entity = position.variant.definition;\n\t\t\tswitch (entity.variant.name) {\n\t\t\t\tcase \"root\":\n\t\t\t\t\treturn node;\n\t\t\t\tcase \"entry\": {\n\t\t\t\t\tconst entry = entity.variant.definition;\n\t\t\t\t\tconst collection = entry.parent;\n\t\t\t\t\tconst collection_context_node = collection.parent.parent.parent;\n\n\t\t\t\t\tconst small = collection.inferences.collection_type().properties.ui.properties.size;\n\t\t\t\t\tswitch (small.state.name) {\n\t\t\t\t\t\tcase \"small\": {\n\t\t\t\t\t\t\tconst breakout = collection.inferences.collection_type().properties.ui.properties.break_out;\n\t\t\t\t\t\t\tswitch (breakout.state.name) {\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\treturn collection_context_node;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\treturn actionBoundry(collection_context_node, view_node_type);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"large\": {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"group\": {\n\t\t\tconst group = position.variant.definition;\n\t\t\tconst breakout = group.inferences.group_type().properties.ui.properties.break_out;\n\t\t\tswitch (breakout.state.name) {\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\treturn node;\n\t\t\t\t}\n\t\t\t\tcase \"no\": {\n\t\t\t\t\treturn actionBoundry(group.parent.parent.parent, view_node_type);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"root\": {\n\t\t\treturn node;\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst state = position.variant.definition;\n\t\t\treturn actionBoundry(state.parent.parent.parent.parent, view_node_type);\n\t\t}\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport { client_state } from \"./ClientState\";\nimport { canDownloadFiles } from \"../widgets/instructions/fileUpload\";\nimport uuid = require(\"../state/uuid\");\nimport { isKeyProperty } from \"./isKey\";\nimport { validateText } from \"./textValidation\";\nimport { getInitializedEntryWithKey } from \"../state/Collection\";\nimport { getGuiText } from \"../guiModel\";\nimport { iCollection } from \"../state/Collection\";\n\nfunction get_parent_location(node: api_cs.Cnode): \"local\" | \"remote\" {\n\tswitch (node.properties.location.state.name) {\n\t\tcase \"local\": {\n\t\t\tconst $ = node.properties.location.state.node;\n\t\t\treturn $.properties.parent_location.state.name;\n\t\t}\n\t\tcase \"remote\":\n\t\t\treturn \"remote\";\n\t\tdefault:\n\t\t\tunexpectedState(node.properties.location.state);\n\t}\n}\n\nfunction createNode(\n\tdefinition: api_app.Cnode__application,\n\tlocation: api_cs.Tnode[\"location\"],\n\tinit = true\n): api_cs.Tnode {\n\tlet todo: api_cs.Tnode[\"todo\"];\n\tswitch (definition.properties.todo_definition.properties.todo.state.name) {\n\t\tcase \"no\":\n\t\t\ttodo = [\"no\", {}];\n\t\t\tbreak;\n\t\tcase \"yes\":\n\t\t\ttodo = [\"yes\", { for: [\"someone else\", {}] }];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(definition.properties.todo_definition.properties.todo.state);\n\t}\n\tconst attributes: api_cs.Tnode[\"attributes\"] = {};\n\n\tif (init) {\n\t\tfor (const [key, attribute] of definition.properties.attributes) {\n\t\t\tswitch (attribute.properties.type.state.name) {\n\t\t\t\tcase \"property\": {\n\t\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\t\tconst kind = property.properties.type.state.node.output.value_source();\n\t\t\t\t\tswitch (kind.variant.name) {\n\t\t\t\t\t\tcase \"base\": {\n\t\t\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\t\t\tattributes[key] = createCollectionAttribute(property.properties.type.state.node, \"local\");\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\t\t\tattributes[key] = createFileAttribute(property.properties.type.state.node, \"local\");\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\t\t\tattributes[key] = createGroupAttribute(property.properties.type.state.node, \"local\", \"local\");\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\t\t\tattributes[key] = createNumberAttribute(property.properties.type.state.node, \"local\");\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\t\t\t\tattributes[key] = createStategroupAttribute(property.properties.type.state.node, \"local\", \"local\");\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\t\t\tattributes[key] = createTextAttribute(property.properties.type.state.node, \"local\");\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(kind.variant);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"action\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"command\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"reference set\":\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tlocation: location,\n\t\ttodo: todo,\n\t\t\"read permitted\": [\"yes\", {}],\n\t\t\"can be deleted\": [\"yes\", {}],\n\t\tmodified: [\"no\", {}],\n\t\t\"is valid\": [\"yes\", {}],\n\t\t\"is busy discarding\": [\"no\", {}],\n\t\t\"is busy saving\": [\"no\", {}],\n\t\tattributes: attributes,\n\t\tqueries: {},\n\t\t\"report types\": {},\n\t};\n}\n\nexport function createEmptyRemoteNode(definition: api_app.Cnode__application): api_cs.Tnode {\n\treturn createNode(\n\t\tdefinition,\n\t\t[\n\t\t\t\"remote\",\n\t\t\t{\n\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t},\n\t\t],\n\t\tfalse\n\t);\n}\n\nexport function createLocalNode(\n\tdefinition: api_app.Cnode__application,\n\tparent_location: api_cs.Tlocal__location__node[\"parent location\"],\n\tinit = true\n): api_cs.Tnode {\n\treturn createNode(\n\t\tdefinition,\n\t\t[\n\t\t\t\"local\",\n\t\t\t{\n\t\t\t\t\"parent location\": parent_location,\n\t\t\t},\n\t\t],\n\t\tinit\n\t);\n}\n\nfunction createTextAttribute(\n\tdefinition: api_app.Ctext__type__property,\n\tlocation: \"remote\" | \"local\",\n\tbackend_value?: string\n): api_cs.Tattributes {\n\tlet is_set: api_cs.Ttext__type__property[\"is set\"] = [\"no\", {}];\n\tlet backend_known: api_cs.Ttext__type__property[\"backend known\"] = [\"no\", {}];\n\tlet is_editable: api_cs.Ttext__type__property[\"is editable\"] = [\"no\", {}];\n\tlet is_valid: api_cs.Ttext__type__property[\"is valid\"] = [\"yes\", {}];\n\tlet validation_result: api_cs.Ttext__type__property[\"validation result\"] = [\"success\", {}];\n\tlet reference: api_cs.Ttext__type__property[\"navigable\"] = definition.properties.has_reference.switch<\n\t\tapi_cs.Ttext__type__property[\"navigable\"]\n\t>({\n\t\tno: [\"no\", {}],\n\t\tyes: ($) => [\n\t\t\t\"yes\",\n\t\t\t{\n\t\t\t\t\"resolve status\": {\n\t\t\t\t\tstatus: [\"unresolved\", {}],\n\t\t\t\t\t\"validation result\": [\"success\", {}],\n\t\t\t\t},\n\t\t\t\ttype: $.properties.behaviour.properties.type.switch({\n\t\t\t\t\tmandatory: [\"mandatory\", {}],\n\t\t\t\t\toptional: [\"optional\", {}],\n\t\t\t\t}),\n\t\t\t\trules: {\n\t\t\t\t\trules: $.properties.rules.properties.rules.map(() => ({\n\t\t\t\t\t\t\"is valid\": \"no\",\n\t\t\t\t\t\t\"resolve status\": {\n\t\t\t\t\t\t\tstatus: [\"unresolved\", {}],\n\t\t\t\t\t\t\t\"validation result\": [\"success\", {}],\n\t\t\t\t\t\t},\n\t\t\t\t\t})),\n\t\t\t\t},\n\t\t\t\tqueries: {},\n\t\t\t},\n\t\t],\n\t});\n\n\tconst gui_definition = getGuiText(definition);\n\tswitch (location) {\n\t\tcase \"local\": {\n\t\t\tif (gui_definition) {\n\t\t\t\tlet reference_not_resolved = false;\n\t\t\t\tlet text_does_not_match_pattern: api_cs.Tno__is_valid__text__type__property[\"text does not match pattern\"] = [\n\t\t\t\t\t\"no\",\n\t\t\t\t\t{},\n\t\t\t\t];\n\t\t\t\tlet invalid_rules = false;\n\t\t\t\tswitch (gui_definition.properties.validation.state.name) {\n\t\t\t\t\tcase \"none\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"model\": {\n\t\t\t\t\t\tconst model_validation = gui_definition.properties.validation.state.node;\n\t\t\t\t\t\tconst rules = model_validation.inferences.text_with_validation().properties.rules;\n\t\t\t\t\t\tconst text_is_valid = validateText(\"\", rules);\n\t\t\t\t\t\tif (!text_is_valid) {\n\t\t\t\t\t\t\ttext_does_not_match_pattern = [\n\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpattern: rules.properties.regular_expression,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\tvalidation_result = [\"failure\", {}];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"custom\": {\n\t\t\t\t\t\tconst custom_validation = gui_definition.properties.validation.state.node;\n\t\t\t\t\t\tconst rules = custom_validation.properties.rules;\n\t\t\t\t\t\tconst text_is_valid = validateText(\"\", rules);\n\t\t\t\t\t\tif (!text_is_valid) {\n\t\t\t\t\t\t\ttext_does_not_match_pattern = [\n\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpattern: rules.properties.regular_expression,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\tvalidation_result = [\"failure\", {}];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(gui_definition.properties.validation.state);\n\t\t\t\t}\n\t\t\t\tswitch (gui_definition.properties.navigable.state.name) {\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst navigable = gui_definition.properties.navigable.state.node;\n\t\t\t\t\t\treference = [\n\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"resolve status\": {\n\t\t\t\t\t\t\t\t\tstatus: [\"unresolved\", {}],\n\t\t\t\t\t\t\t\t\t\"validation result\": navigable.properties.validate.switch<\n\t\t\t\t\t\t\t\t\t\tapi_cs.Tresolve_status[\"validation result\"]\n\t\t\t\t\t\t\t\t\t>({\n\t\t\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\t\t\treference_not_resolved = true;\n\t\t\t\t\t\t\t\t\t\t\treturn [\"failure\", {}] as api_cs.Tresolve_status[\"validation result\"];\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tno: [\"success\", {}],\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttype: navigable.inferences.reference().properties.behaviour.properties.type.switch({\n\t\t\t\t\t\t\t\t\tmandatory: [\"mandatory\", {}],\n\t\t\t\t\t\t\t\t\toptional: [\"optional\", {}],\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\trules: {\n\t\t\t\t\t\t\t\t\trules: navigable.properties.rules.properties.rules.map(($) => {\n\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\"is valid\": \"no\",\n\t\t\t\t\t\t\t\t\t\t\t\"resolve status\": {\n\t\t\t\t\t\t\t\t\t\t\t\tstatus: [\"unresolved\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\"validation result\": $.properties.validate.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tinvalid_rules = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn [\"failure\", {}] as api_cs.Tresolve_status[\"validation result\"];\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tno: [\"success\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tqueries: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(gui_definition.properties.navigable.state);\n\t\t\t\t}\n\t\t\t\tif (reference_not_resolved || text_does_not_match_pattern[0] === \"yes\" || invalid_rules) {\n\t\t\t\t\tis_valid = [\n\t\t\t\t\t\t\"no\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"reference not resolved\": reference_not_resolved ? [\"yes\", {}] : [\"no\", {}],\n\t\t\t\t\t\t\t\"referenced node not valid\": [\"no\", {}],\n\t\t\t\t\t\t\t\"text does not match pattern\": text_does_not_match_pattern,\n\t\t\t\t\t\t\t\"invalid rules\": invalid_rules ? [\"yes\", {}] : [\"no\", {}],\n\t\t\t\t\t\t\t\"key is not unique\": [\"no\", {}],\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t}\n\t\t\tswitch (definition.properties.type.state.name) {\n\t\t\t\tcase \"base\":\n\t\t\t\t\tis_editable = [\n\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"derived\":\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(definition.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"remote\":\n\t\t\tif (backend_value !== undefined) {\n\t\t\t\tbackend_known = [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\tvalue: backend_value,\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t\tis_set = [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: backend_value,\n\t\t\t\t\t\tby: [\"engine\", {}],\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\treturn {\n\t\ttype: [\n\t\t\t\"property\",\n\t\t\t{\n\t\t\t\ttype: [\n\t\t\t\t\t\"text\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"is editable\": is_editable,\n\t\t\t\t\t\t\"is set\": is_set,\n\t\t\t\t\t\t\"backend known\": backend_known,\n\t\t\t\t\t\t\"is valid\": is_valid,\n\t\t\t\t\t\t\"validation result\": validation_result,\n\t\t\t\t\t\tnavigable: reference,\n\t\t\t\t\t\t\"is key\": isKeyProperty(definition)\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"key unique\": [\"yes\", {}],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t: [\"no\", {}],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction createNumberAttribute(\n\tdefinition: api_app.Cnumber__type__property,\n\tlocation: \"remote\" | \"local\"\n): api_cs.Tattributes {\n\tlet is_editable: api_cs.Tnumber__type__property[\"is editable\"] = [\"no\", {}];\n\tlet is_valid: api_cs.Tnumber__type__property[\"is valid\"] = [\"yes\", {}];\n\tswitch (definition.properties.type.state.name) {\n\t\tcase \"base\": {\n\t\t\tconst base = definition.properties.type.state.node;\n\t\t\tswitch (base.properties.type.state.name) {\n\t\t\t\tcase \"simple\":\n\t\t\t\t\tis_editable = [\n\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t\tswitch (location) {\n\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\tis_valid = [\n\t\t\t\t\t\t\t\t\"no\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"exceeds maximum\": \"no\",\n\t\t\t\t\t\t\t\t\t\"exceeds minimum\": \"no\",\n\t\t\t\t\t\t\t\t\t\"not a number\": \"no\",\n\t\t\t\t\t\t\t\t\t\"not set\": \"yes\",\n\t\t\t\t\t\t\t\t\t\"should be positive\": \"no\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"remote\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(location);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"causal\":\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(base.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"derived\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(definition.properties.type.state);\n\t}\n\treturn {\n\t\ttype: [\n\t\t\t\"property\",\n\t\t\t{\n\t\t\t\ttype: [\n\t\t\t\t\t\"number\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"is editable\": is_editable,\n\t\t\t\t\t\t\"is set\": [\"no\", {}],\n\t\t\t\t\t\t\"is valid\": is_valid,\n\t\t\t\t\t\t\"backend known\": [\"no\", {}],\n\t\t\t\t\t\t\"number type\": definition.properties.set_type.switch({\n\t\t\t\t\t\t\tinteger: [\"integer\", {}],\n\t\t\t\t\t\t\tpositive: [\"positive\", {}],\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t\"numerical type properties\": {\n\t\t\t\t\t\t\tinitialized: \"no\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction createFileAttribute(definition: api_app.Cfile, location: \"remote\" | \"local\"): api_cs.Tattributes {\n\tlet is_valid: api_cs.Tfile__type__property[\"is valid\"];\n\tlet is_editable: api_cs.Tfile__type__property[\"is editable\"];\n\tswitch (definition.properties.type.state.name) {\n\t\tcase \"base\": {\n\t\t\tswitch (location) {\n\t\t\t\tcase \"local\":\n\t\t\t\t\tis_valid = [\n\t\t\t\t\t\t\"no\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"extension not valid\": \"no\",\n\t\t\t\t\t\t\t\"not set\": \"yes\",\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t\tis_editable = [\n\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"remote\":\n\t\t\t\t\tis_valid = [\"yes\", {}];\n\t\t\t\t\tis_editable = [\"no\", {}];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(location);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"derived\":\n\t\t\tis_valid = [\"yes\", {}];\n\t\t\tis_editable = [\"no\", {}];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(definition.properties.type.state);\n\t}\n\treturn {\n\t\ttype: [\n\t\t\t\"property\",\n\t\t\t{\n\t\t\t\ttype: [\n\t\t\t\t\t\"file\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"is editable\": is_editable,\n\t\t\t\t\t\t\"backend known\": [\"no\", {}],\n\t\t\t\t\t\t\"is set\": \"no\",\n\t\t\t\t\t\t\"is valid\": is_valid,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction createGroupAttribute(\n\tdefinition: api_app.Cgroup__type__property,\n\tlocation: \"remote\" | \"local\",\n\tparent_location: \"remote\" | \"local\"\n): api_cs.Tattributes {\n\tlet group_node: api_cs.Tnode;\n\tswitch (location) {\n\t\tcase \"remote\":\n\t\t\tgroup_node = createEmptyRemoteNode(definition.properties.node);\n\t\t\tbreak;\n\t\tcase \"local\":\n\t\t\tgroup_node = createLocalNode(definition.properties.node, [parent_location, {}]);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(location);\n\t}\n\treturn {\n\t\ttype: [\n\t\t\t\"property\",\n\t\t\t{\n\t\t\t\ttype: [\n\t\t\t\t\t\"group\",\n\t\t\t\t\t{\n\t\t\t\t\t\tnode: group_node,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction mapToOrderedDictionary_states(\n\tstategroup: api_app.Cstate_group,\n\tmap: (state: api_app.Cstates__state_group) => T\n): { [key: string]: T } {\n\tconst result: { [key: string]: T } = {};\n\tlet state: api_app.Cstates__state_group | undefined = stategroup.properties.first_state.ref;\n\twhile (state) {\n\t\tresult[state.key] = map(state);\n\t\tswitch (state.properties.has_successor.state.name) {\n\t\t\tcase \"yes\":\n\t\t\t\tstate = state.properties.has_successor.state.node.properties.successor.ref;\n\t\t\t\tbreak;\n\t\t\tcase \"no\":\n\t\t\t\tstate = undefined;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(state.properties.has_successor.state);\n\t\t}\n\t}\n\treturn result;\n}\n\nfunction createStategroupAttribute(\n\tdefinition: api_app.Cstate_group,\n\tlocation: \"remote\" | \"local\",\n\tparent_location: \"remote\" | \"local\",\n\tremote_state?: api_app.Cstates__state_group\n): api_cs.Tattributes {\n\treturn {\n\t\ttype: [\n\t\t\t\"property\",\n\t\t\t{\n\t\t\t\ttype: [\n\t\t\t\t\t\"state group\",\n\t\t\t\t\t{\n\t\t\t\t\t\tinitialized: [\"no\", {}],\n\t\t\t\t\t\t\"is set\":\n\t\t\t\t\t\t\tremote_state !== undefined\n\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tstate: remote_state.key,\n\t\t\t\t\t\t\t\t\t\t\tby: [\"user\", {}],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t: [\"no\", {}],\n\t\t\t\t\t\t\"is modified\": [\"no\", {}],\n\t\t\t\t\t\t\"is valid\": definition.properties.type.switch({\n\t\t\t\t\t\t\tbase: [\n\t\t\t\t\t\t\t\t\"no\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"invalid rules\": \"no\",\n\t\t\t\t\t\t\t\t\t\"no state selected\": \"yes\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tderived: [\"yes\", {}],\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t\"is editable\": definition.properties.type.switch({\n\t\t\t\t\t\t\tbase: [\n\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tderived: [\"no\", {}],\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tstates: mapToOrderedDictionary_states(definition, ($) => {\n\t\t\t\t\t\t\tif ($ === remote_state) {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\"is selected\": [\"yes\", {}],\n\t\t\t\t\t\t\t\t\t\"create permitted\": [\"yes\", {}],\n\t\t\t\t\t\t\t\t\tlocation: [\"remote\", {}],\n\t\t\t\t\t\t\t\t\tstyle: { initialized: \"no\" },\n\t\t\t\t\t\t\t\t\trules: {\n\t\t\t\t\t\t\t\t\t\trules: $.properties.rules.properties.rules.map(($) => ({\n\t\t\t\t\t\t\t\t\t\t\t\"is valid\": \"no\",\n\t\t\t\t\t\t\t\t\t\t\t\"resolve status\": {\n\t\t\t\t\t\t\t\t\t\t\t\tstatus: [\"unresolved\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\"validation result\": $.properties.ui.properties.has_validation.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tyes: [\"failure\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\tno: [\"success\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnode: createEmptyRemoteNode($.properties.node),\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\"is selected\": [\"no\", {}],\n\t\t\t\t\t\t\t\t\tlocation: [\"local\", {}],\n\t\t\t\t\t\t\t\t\t\"create permitted\": [location === \"local\" ? \"yes\" : \"no\", {}],\n\t\t\t\t\t\t\t\t\tstyle: { initialized: \"no\" },\n\t\t\t\t\t\t\t\t\trules: {\n\t\t\t\t\t\t\t\t\t\trules: $.properties.rules.properties.rules.map(($) => ({\n\t\t\t\t\t\t\t\t\t\t\t\"is valid\": \"no\",\n\t\t\t\t\t\t\t\t\t\t\t\"resolve status\": {\n\t\t\t\t\t\t\t\t\t\t\t\tstatus: [\"unresolved\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\"validation result\": $.properties.ui.properties.has_validation.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tyes: [\"failure\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\tno: [\"success\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnode: createLocalNode($.properties.node, parent_location),\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction createCollectionAttribute(\n\tdefinition: api_app.Ccollection__type__property,\n\tlocation: \"remote\" | \"local\"\n): api_cs.Tattributes {\n\tlet is_editable: api_cs.Tcollection[\"is editable\"];\n\tlet has_ordered_graphs: api_cs.Tcollection[\"has ordered graphs\"] = [\"no\", {}];\n\tswitch (definition.properties.type.state.name) {\n\t\tcase \"base\": {\n\t\t\tswitch (location) {\n\t\t\t\tcase \"local\":\n\t\t\t\t\tswitch (client_state.properties.session.properties.status.state.name) {\n\t\t\t\t\t\tcase \"authenticated\":\n\t\t\t\t\t\t\tis_editable = [\n\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"edit mode\": [\"off\", {}],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"not authenticated\":\n\t\t\t\t\t\t\tis_editable = [\"no\", {}];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(client_state.properties.session.properties.status.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"remote\":\n\t\t\t\t\tis_editable = [\"no\", {}];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(location);\n\t\t\t}\n\t\t\tconst ordered_graphs = definition.properties.graph_constraints.properties.graphs\n\t\t\t\t.toArray()\n\t\t\t\t.reduce<{ [key: string]: api_cs.Tordered_graphs }>((ordered_graphs, graph) => {\n\t\t\t\t\tswitch (graph[1].properties.type.state.name) {\n\t\t\t\t\t\tcase \"ordered\":\n\t\t\t\t\t\t\tordered_graphs[graph[0]] = { \"is valid\": [\"yes\", {}] };\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"acyclic\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(graph[1].properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t\treturn ordered_graphs;\n\t\t\t\t}, {});\n\t\t\tif (Object.keys(ordered_graphs).length > 0) {\n\t\t\t\thas_ordered_graphs = [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"ordered graphs\": ordered_graphs,\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"derived\":\n\t\t\tis_editable = [\"no\", {}];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(definition.properties.type.state);\n\t}\n\treturn {\n\t\ttype: [\n\t\t\t\"property\",\n\t\t\t{\n\t\t\t\ttype: [\n\t\t\t\t\t\"collection\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"is valid\": [\"yes\", {}],\n\t\t\t\t\t\t\"can create entry\": definition.properties.type.switch({\n\t\t\t\t\t\t\tderived: \"no\",\n\t\t\t\t\t\t\tbase: \"yes\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t\"can download files\": canDownloadFiles(definition) ? \"yes\" : \"no\",\n\t\t\t\t\t\t\"amount of entries\": 0,\n\t\t\t\t\t\t\"is empty\": [\"yes\", {}],\n\t\t\t\t\t\t\"is editable\": is_editable,\n\t\t\t\t\t\tmodified: [\"no\", {}],\n\t\t\t\t\t\tentries: {},\n\t\t\t\t\t\t\"last created entry\": \"none\",\n\t\t\t\t\t\tjoined: \"no\",\n\t\t\t\t\t\t\"has ordered graphs\": has_ordered_graphs,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction createCommandAttribute(): api_cs.Tattributes {\n\treturn {\n\t\ttype: [\n\t\t\t\"operation\",\n\t\t\t{\n\t\t\t\ttype: [\n\t\t\t\t\t\"command\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"execute permitted\": \"no\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tstarted: [\"no\", {}],\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction createActionAttribute(): api_cs.Tattributes {\n\treturn {\n\t\ttype: [\n\t\t\t\"operation\",\n\t\t\t{\n\t\t\t\ttype: \"action\",\n\t\t\t\tstarted: [\"no\", {}],\n\t\t\t},\n\t\t],\n\t};\n}\n\nexport function addTextAttribute(\n\tdefinition: api_app.Ctext__type__property,\n\tnode: api_cs.Cnode\n): api_cs.Ctext__type__property {\n\tconst name = definition.parent.parent.key;\n\tlet attribute = node.properties.attributes.get(name);\n\tif (!attribute) {\n\t\tconst raw_attribute = createTextAttribute(definition, node.properties.location.state.name);\n\t\tattribute = node.properties.attributes.create(name, raw_attribute);\n\t}\n\treturn attribute.properties.type.cast(\"property\").properties.type.cast(\"text\");\n}\n\nexport function addNumberAttribute(\n\tdefinition: api_app.Cnumber__type__property,\n\tnode: api_cs.Cnode\n): api_cs.Cnumber__type__property {\n\tconst name = definition.parent.parent.key;\n\tlet attribute = node.properties.attributes.get(name);\n\tif (!attribute) {\n\t\tconst raw_attribute = createNumberAttribute(definition, node.properties.location.state.name);\n\t\tattribute = node.properties.attributes.create(name, raw_attribute);\n\t}\n\treturn attribute.properties.type.cast(\"property\").properties.type.cast(\"number\");\n}\n\nexport function addFileAttribute(definition: api_app.Cfile, node: api_cs.Cnode): api_cs.Cfile__type__property {\n\tconst name = definition.parent.parent.key;\n\tlet attribute = node.properties.attributes.get(name);\n\tif (!attribute) {\n\t\tconst raw_attribute = createFileAttribute(definition, node.properties.location.state.name);\n\t\tattribute = node.properties.attributes.create(name, raw_attribute);\n\t}\n\treturn attribute.properties.type.cast(\"property\").properties.type.cast(\"file\");\n}\n\nexport function addGroupAttribute(\n\tdefinition: api_app.Cgroup__type__property,\n\tnode: api_cs.Cnode\n): api_cs.Cgroup__type__property {\n\tconst name = definition.parent.parent.key;\n\tlet attribute = node.properties.attributes.get(name);\n\tif (!attribute) {\n\t\tconst raw_attribute = createGroupAttribute(\n\t\t\tdefinition,\n\t\t\tnode.properties.location.state.name,\n\t\t\tget_parent_location(node)\n\t\t);\n\t\tattribute = node.properties.attributes.create(name, raw_attribute);\n\t}\n\treturn attribute.properties.type.cast(\"property\").properties.type.cast(\"group\");\n}\n\nexport function addStategroupAttribute(\n\tdefinition: api_app.Cstate_group,\n\tnode: api_cs.Cnode,\n\tremote_state?: api_app.Cstates__state_group\n): api_cs.Cstate_group__type__property {\n\tconst name = definition.parent.parent.key;\n\tlet attribute = node.properties.attributes.get(name);\n\tif (!attribute) {\n\t\tconst raw_stategroup = createStategroupAttribute(\n\t\t\tdefinition,\n\t\t\tnode.properties.location.state.name,\n\t\t\tget_parent_location(node),\n\t\t\tremote_state\n\t\t);\n\t\tattribute = node.properties.attributes.create(name, raw_stategroup);\n\t}\n\treturn attribute.properties.type.cast(\"property\").properties.type.cast(\"state group\");\n}\n\nexport function addStateAttributes(state: api_cs.Cstates__state_group__type__property): void {\n\tswitch (state.properties.location.state.name) {\n\t\tcase \"local\": {\n\t\t\tconst definition = state.key.ref.properties.node;\n\t\t\tconst state_node = state.properties.node;\n\t\t\tfor (const attribute of definition.properties.attributes.values()) {\n\t\t\t\tswitch (attribute.properties.type.state.name) {\n\t\t\t\t\tcase \"property\": {\n\t\t\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\t\t\tconst kind = property.properties.type.state.node.output.value_source();\n\t\t\t\t\t\tswitch (kind.variant.name) {\n\t\t\t\t\t\t\tcase \"base\": {\n\t\t\t\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\t\t\t\taddCollectionAttribute(property.properties.type.state.node, state_node);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\t\t\t\taddFileAttribute(property.properties.type.state.node, state_node);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\t\t\t\taddGroupAttribute(property.properties.type.state.node, state_node);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\t\t\t\taddNumberAttribute(property.properties.type.state.node, state_node);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\t\t\t\t\taddStategroupAttribute(property.properties.type.state.node, state_node);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\t\t\t\taddTextAttribute(property.properties.type.state.node, state_node);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(kind.variant);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"action\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"command\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"reference set\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"remote\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(state.properties.location.state);\n\t}\n}\n\nexport function addCollectionAttribute(\n\tdefinition: api_app.Ccollection__type__property,\n\tnode: api_cs.Cnode\n): api_cs.Ccollection {\n\tconst name = definition.parent.parent.key;\n\tlet attribute = node.properties.attributes.get(name);\n\tif (!attribute) {\n\t\tconst raw_collection = createCollectionAttribute(definition, node.properties.location.state.name);\n\t\tattribute = node.properties.attributes.create(name, raw_collection);\n\t}\n\treturn attribute.properties.type.cast(\"property\").properties.type.cast(\"collection\");\n}\n\nexport function addCommandAttribute(\n\tdefinition: api_app.Cglobal,\n\tnode: api_cs.Cnode\n): api_cs.Coperation__type__attributes {\n\tconst name = definition.parent.parent.key;\n\tlet attribute = node.properties.attributes.get(name);\n\tif (!attribute) {\n\t\tattribute = node.properties.attributes.create(name, createCommandAttribute());\n\t}\n\treturn attribute.properties.type.cast(\"operation\");\n}\n\nexport function addActionAttribute(\n\tdefinition: api_app.Caction,\n\tnode: api_cs.Cnode\n): api_cs.Coperation__type__attributes {\n\tconst name = definition.parent.key;\n\tlet attribute = node.properties.attributes.get(name);\n\tif (!attribute) {\n\t\tattribute = node.properties.attributes.create(name, createActionAttribute());\n\t}\n\treturn attribute.properties.type.cast(\"operation\");\n}\n\nexport function addRemoteEntry(collection: api_cs.Ccollection, key: string): api_cs.Centries__collection {\n\tlet entry = getInitializedEntryWithKey(collection, key);\n\tif (entry) {\n\t\treturn entry;\n\t} else {\n\t\tconst collection_definition = collection.inferences.collection_type();\n\t\tconst key_property_name = collection_definition.properties.key_property.entry;\n\t\tconst raw_node = createEmptyRemoteNode(collection_definition.properties.node);\n\t\tconst raw_key_property = createTextAttribute(collection_definition.properties.key_property.ref, \"remote\", key);\n\t\traw_node[\"attributes\"][key_property_name] = raw_key_property;\n\t\tconst internal_key = uuid.generate();\n\t\tentry = collection.properties.entries.create(internal_key, {\n\t\t\tlocation: [\n\t\t\t\t\"remote\",\n\t\t\t\t{\n\t\t\t\t\t\"marked for deletion\": [\"no\", {}],\n\t\t\t\t},\n\t\t\t],\n\t\t\tkey: key_property_name,\n\t\t\tstyle: { initialized: \"no\" },\n\t\t\tnode: raw_node,\n\t\t});\n\t\tiCollection(collection).addServerEntry(entry);\n\t\treturn entry;\n\t}\n}\n\nexport function addLocalEntry(\n\tcollection: api_cs.Ccollection,\n\tby: \"user\" | \"engine\" = \"user\",\n\tkey?: string\n): api_cs.Centries__collection {\n\tconst collection_definition = collection.inferences.collection_type();\n\tconst key_property_name = collection_definition.properties.key_property.entry;\n\tconst raw_node = createLocalNode(\n\t\tcollection_definition.properties.node,\n\t\tcollection.parent.parent.parent.properties.location.state.name\n\t);\n\tconst raw_key_property = createTextAttribute(collection_definition.properties.key_property.ref, \"local\");\n\traw_node[\"attributes\"][key_property_name] = raw_key_property;\n\tconst internal_key = uuid.generate();\n\tconst entry = collection.properties.entries.create(internal_key, {\n\t\tlocation: [\n\t\t\t\"local\",\n\t\t\t{\n\t\t\t\t\"modified by\": [by, {}],\n\t\t\t},\n\t\t],\n\t\tkey: key_property_name,\n\t\tstyle: { initialized: \"no\" },\n\t\tnode: raw_node,\n\t});\n\tcollection.properties.last_created_entry.set(\"entry\", {\n\t\tentry: internal_key,\n\t});\n\tif (key !== undefined) {\n\t\tentry.properties.key.ref.properties.is_set.set(\"yes\", {\n\t\t\ttext: key,\n\t\t\tby: [by, {}],\n\t\t});\n\t\tentry.properties.key.ref.properties.is_editable.set(\"yes\", {\n\t\t\tmodified: [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\tvalue: key,\n\t\t\t\t\tsaving: [\"no\", {}],\n\t\t\t\t},\n\t\t\t],\n\t\t\t\"edit mode\": \"off\",\n\t\t});\n\t}\n\treturn entry;\n}\n","import { api_configuration } from \"../../common\";\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport getQueryInstanceKey from \"../state/getQueryInstanceKey\";\nimport { isDefined } from \"../validation\";\nimport { canDownloadFilesQuery } from \"../widgets/instructions/fileUpload\";\nimport { client_state } from \"./ClientState\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport client_state_decorator = api_configuration.types.client_state.alan_api;\nimport createColumnsFromColumnsBinding from \"./createColumnsFromColumnsBinding\";\n\nexport function forQuery(\n\tcontext: api_client_state.Cnode,\n\tquery_definition: api_views.Cqueries,\n\ton_added: (query: api_client_state.Cquery__client_state) => void\n): api_client_state.Cquery__client_state {\n\tconst view_context_name = isDefined(query_definition.parent.parent.key);\n\tconst view_name = query_definition.parent.key;\n\tconst query_name = query_definition.key;\n\tconst query_instance_name = getQueryInstanceKey(query_definition);\n\tconst can_download_files = canDownloadFilesQuery(query_definition);\n\n\treturn context.properties.queries.switchOnEntryExists(\n\t\tquery_instance_name,\n\t\tfunction ($) {\n\t\t\treturn $.properties.query;\n\t\t},\n\t\tfunction () {\n\t\t\tconst added_query = context.properties.queries.create(query_instance_name, {\n\t\t\t\tquery: {\n\t\t\t\t\t\"view definition context\": view_context_name,\n\t\t\t\t\t\"view definition\": view_name,\n\t\t\t\t\tdefinition: query_name,\n\t\t\t\t\t\"use for\": [\"query\", {}],\n\t\t\t\t\t\"delay query\": [\"yes\", {}],\n\t\t\t\t\t\"has selected entries\": \"no\",\n\t\t\t\t\t\"can download files\": can_download_files ? \"yes\" : \"no\",\n\t\t\t\t\t\"entries are editable\": client_state.properties.session.properties.status.switch<\n\t\t\t\t\t\tclient_state_decorator.Tquery__client_state[\"entries are editable\"]\n\t\t\t\t\t>({\n\t\t\t\t\t\t\"not authenticated\": [\"no\", {}],\n\t\t\t\t\t\tauthenticated: function () {\n\t\t\t\t\t\t\tconst query_path = query_definition.properties.context.cast(\"node\").properties.path;\n\t\t\t\t\t\t\treturn query_path.output\n\t\t\t\t\t\t\t\t.result_node()\n\t\t\t\t\t\t\t\t.input.application_node()\n\t\t\t\t\t\t\t\t.input.value_source()\n\t\t\t\t\t\t\t\t.switch({\n\t\t\t\t\t\t\t\t\tderived: \"no\",\n\t\t\t\t\t\t\t\t\tbase: (): client_state_decorator.Tquery__client_state[\"entries are editable\"] => [\n\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\"is importing\": [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\"can create entry\": [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\t\"has columns\": query_definition.properties.has_columns.switch<\n\t\t\t\t\t\tclient_state_decorator.Tquery__client_state[\"has columns\"]\n\t\t\t\t\t>({\n\t\t\t\t\t\tyes: ($) => [\"yes\", { first: $.properties.first.entry }],\n\t\t\t\t\t\tno: [\"no\", {}],\n\t\t\t\t\t}),\n\t\t\t\t\tcolumns: createColumnsFromColumnsBinding(query_definition),\n\t\t\t\t\t\"show all\": \"no\",\n\t\t\t\t\t\"has result\": \"no\",\n\t\t\t\t\t\"is busy querying\": [\"no\", { \"request status\": [\"success\", {}] }],\n\t\t\t\t\tfilters: query_definition.properties.filters.properties.filters.map(() => {\n\t\t\t\t\t\treturn { active: \"yes\" };\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t}).properties.query;\n\t\t\ton_added(added_query);\n\t\t\treturn added_query;\n\t\t}\n\t);\n}\n\nfunction entriesAreEditableState(\n\tis_editable: boolean\n): client_state_decorator.Tquery__client_state[\"entries are editable\"] {\n\treturn is_editable\n\t\t? [\"yes\", { \"is importing\": [\"no\", {}], \"can create entry\": [\"yes\", { in: [\"candidates\", {}] }] }]\n\t\t: [\"no\", {}];\n}\n\nfunction createCandidatesQuery(\n\tquery_definition: api_views.Cqueries,\n\tcontext_node: api_client_state.Cnode,\n\tentries_are_editable = false\n): client_state_decorator.Tquery__client_state {\n\tconst view_context_name = isDefined(query_definition.parent.parent.key);\n\tconst view_name = query_definition.parent.key;\n\tconst query_name = query_definition.key;\n\tconst can_download_files = canDownloadFilesQuery(query_definition);\n\n\treturn {\n\t\t\"view definition context\": view_context_name,\n\t\t\"view definition\": view_name,\n\t\tdefinition: query_name,\n\t\t\"use for\": [\"candidates\", {}],\n\t\t\"has selected entries\": \"no\",\n\t\t\"can download files\": can_download_files ? \"yes\" : \"no\",\n\t\t\"delay query\": [\"yes\", {}],\n\t\t\"entries are editable\": entriesAreEditableState(entries_are_editable),\n\t\t\"has columns\": query_definition.properties.has_columns.switch<\n\t\t\tclient_state_decorator.Tquery__client_state[\"has columns\"]\n\t\t>({\n\t\t\tyes: ($) => [\"yes\", { first: $.properties.first.entry }],\n\t\t\tno: [\"no\", {}],\n\t\t}),\n\t\tcolumns: createColumnsFromColumnsBinding(query_definition),\n\t\t\"show all\": \"no\",\n\t\t\"has result\": \"no\",\n\t\t\"is busy querying\": [\"no\", { \"request status\": [\"success\", {}] }],\n\t\tfilters: query_definition.properties.filters.properties.filters.map(() => {\n\t\t\treturn {\n\t\t\t\tactive: \"yes\",\n\t\t\t};\n\t\t}),\n\t};\n}\n\nfunction updateEditable(query: api_client_state.Ccandidates__use_for__query, entries_editable: boolean | undefined) {\n\tif (entries_editable === undefined) {\n\t\treturn query.parent;\n\t}\n\tswitch (query.parent.properties.entries_are_editable.state.name) {\n\t\tcase \"yes\":\n\t\t\tif (!entries_editable) {\n\t\t\t\tquery.parent.properties.entries_are_editable.set(\"no\", {});\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"no\":\n\t\t\tif (entries_editable) {\n\t\t\t\tquery.parent.properties.entries_are_editable.set(\"yes\", {\n\t\t\t\t\t\"is importing\": [\"no\", {}],\n\t\t\t\t\t\"can create entry\": [\n\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tin: [\"candidates\", {}],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(query.parent.properties.entries_are_editable.state);\n\t}\n\treturn query.parent;\n}\n\nexport function forReference(\n\tnavigable_text: api_client_state.Cyes__navigable,\n\tquery_definition: api_views.Cqueries,\n\tentries_are_editable: boolean | undefined\n): api_client_state.Cquery__client_state {\n\tconst query_instance_name = getQueryInstanceKey(query_definition);\n\treturn navigable_text.properties.queries.switchOnEntryExists(\n\t\tquery_instance_name,\n\t\t(q) => updateEditable(q.properties.query.properties.use_for.cast(\"candidates\"), entries_are_editable),\n\t\t() =>\n\t\t\tnavigable_text.properties.queries.create(query_instance_name, {\n\t\t\t\tquery: createCandidatesQuery(\n\t\t\t\t\tquery_definition,\n\t\t\t\t\tnavigable_text.parent.parent.parent.parent,\n\t\t\t\t\tentries_are_editable\n\t\t\t\t),\n\t\t\t}).properties.query\n\t);\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_crep = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_reply.alan_api;\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport { createIdPathBuilderFromNode, createIdPathFromNode } from \"../navigation/createIdPathFromNode\";\nimport NodePathBuilder from \"../navigation/NodePathBuilder\";\nimport { CollectionPathBuilder } from \"../navigation/createCollectionPathBuilder\";\nimport SubscriptionBuilder from \"../state 2 interface/SubscriptionBuilder\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport { isSaving } from \"../state/Node\";\nimport { pad } from \"../utils\";\nimport { ScalarProvider, createVariable } from \"../../../../../stream\";\nimport { Pending, Failed, Result } from \"../Status\";\n\ntype NakedIdPath = ([\"group\", string] | [\"state\", string, string, api_app.Cstate_group] | [\"collection\", string])[];\ntype Scope = { node: api_cs.Cnode; path: NakedIdPath };\n\nfunction getScope(definition: api_app.Cauto_increment, node: api_cs.Cnode): Scope | undefined {\n\tconst path: NakedIdPath = [];\n\tlet scope: api_app.Cancestor_node_path | null = definition.properties.scope;\n\tlet valid = true;\n\twhile (scope) {\n\t\tconst node_position = node.input.position();\n\t\tswitch (node_position.variant.name) {\n\t\t\tcase \"entity\": {\n\t\t\t\tconst entity = node_position.variant.definition;\n\t\t\t\tswitch (entity.variant.name) {\n\t\t\t\t\tcase \"root\": {\n\t\t\t\t\t\tvalid = false;\n\t\t\t\t\t\tscope = null;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\tconst entry = entity.variant.definition;\n\t\t\t\t\t\tconst attribute = entry.parent.parent.parent;\n\t\t\t\t\t\tpath.push([\"collection\", attribute.key.entry]);\n\t\t\t\t\t\tnode = attribute.parent;\n\t\t\t\t\t\tif (scope.properties.has_steps.state.name === \"no\") {\n\t\t\t\t\t\t\tscope = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"group\": {\n\t\t\t\tconst attribute = node_position.variant.definition.parent.parent;\n\t\t\t\tpath.push([\"group\", attribute.key.entry]);\n\t\t\t\tnode = attribute.parent;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state\": {\n\t\t\t\tconst state = node_position.variant.definition;\n\t\t\t\tconst attribute = state.parent.parent.parent;\n\t\t\t\tpath.push([\"state\", attribute.key.entry, state.key.entry, state.parent.inferences.state_group_type()]);\n\t\t\t\tnode = attribute.parent;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"root\":\n\t\t\t\tif (scope.properties.has_steps.state.name === \"yes\") {\n\t\t\t\t\tvalid = false;\n\t\t\t\t}\n\t\t\t\tscope = null;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(node_position.variant);\n\t\t}\n\t\tswitch (scope?.properties.has_steps.state.name) {\n\t\t\tcase undefined:\n\t\t\t\tbreak;\n\t\t\tcase \"no\":\n\t\t\t\t// don't stop yet, we still have to walk to the entity context\n\t\t\t\tbreak;\n\t\t\tcase \"yes\":\n\t\t\t\tscope = scope.properties.has_steps.state.node.properties.tail;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn valid\n\t\t? {\n\t\t\t\tnode: node,\n\t\t\t\tpath: path.reverse(),\n\t\t }\n\t\t: undefined;\n}\n\nfunction getScopeIdentifier(scope: Scope, text_property_name: string): string {\n\tlet identifier = IdPathBuilder.serialize(createIdPathBuilderFromNode(scope.node));\n\tfor (const step of scope.path) {\n\t\tswitch (step[0]) {\n\t\t\tcase \"group\":\n\t\t\t\tidentifier = identifier + \"+'\" + step[1] + \"'\";\n\t\t\t\tbreak;\n\t\t\tcase \"state\":\n\t\t\t\tidentifier = identifier + \"?'\" + step[1] + \"'*'\" + step[2] + \"'\";\n\t\t\t\tbreak;\n\t\t\tcase \"collection\":\n\t\t\t\tidentifier = identifier + \".'\" + step[1] + \"'\";\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tidentifier = identifier + \".'\" + text_property_name + \"'\";\n\treturn identifier;\n}\n\nfunction findRemoteValues(scope: Scope, text_property_name: string): Promise | undefined> {\n\tlet node_path_builder: NodePathBuilder = new NodePathBuilder();\n\tlet collection_path_builder = new CollectionPathBuilder();\n\tfor (const step of scope.path) {\n\t\tswitch (step[0]) {\n\t\t\tcase \"group\":\n\t\t\t\tcollection_path_builder = collection_path_builder.group(step[1]);\n\t\t\t\tnode_path_builder = node_path_builder.group(step[1]);\n\t\t\t\tbreak;\n\t\t\tcase \"state\":\n\t\t\t\tcollection_path_builder = collection_path_builder.state(step[1], step[2]);\n\t\t\t\tnode_path_builder = node_path_builder.state(step[1], step[2]);\n\t\t\t\tbreak;\n\t\t\tcase \"collection\":\n\t\t\t\tcollection_path_builder = collection_path_builder.collection(step[1]);\n\t\t\t\tnode_path_builder = new NodePathBuilder();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn DatastoreProxy.instance\n\t\t.collectionQuery({\n\t\t\tfilters: {\n\t\t\t\t\"todo filter\": [\"no\", {}],\n\t\t\t\t\"value filters\": {},\n\t\t\t},\n\t\t\t\"context node path\": createIdPathFromNode(scope.node),\n\t\t\t\"collection path\": collection_path_builder.build(),\n\t\t\t\"select entries\": [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\t\"limit number of entries\": Number.MAX_SAFE_INTEGER,\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t[text_property_name]: {\n\t\t\t\t\t\t\t\tpath: node_path_builder.build(),\n\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\"singular\",\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"dynamic\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpath: new NodePathBuilder().build(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttext: text_property_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\taggregates: {},\n\t\t})\n\t\t.then((result) =>\n\t\t\tresult.properties.context.switch | undefined>>({\n\t\t\t\texists: ($) => {\n\t\t\t\t\tconst values = new Set();\n\t\t\t\t\t$.properties.entries.switch({\n\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t(function init_entries(entries_type: api_crep.Ccollection_query_entries) {\n\t\t\t\t\t\t\t\tentries_type.properties.has_steps.switch({\n\t\t\t\t\t\t\t\t\tno: ($) => {\n\t\t\t\t\t\t\t\t\t\tconst property = $.properties.properties.properties.properties.get(text_property_name);\n\t\t\t\t\t\t\t\t\t\tproperty?.properties.result.switch({\n\t\t\t\t\t\t\t\t\t\t\t\"does not exist\": undefined,\n\t\t\t\t\t\t\t\t\t\t\t\"permission denied\": undefined,\n\t\t\t\t\t\t\t\t\t\t\texists: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\tvalues.add($.properties.type.cast(\"text\").properties.value);\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t\t\t$.properties.entries.forEach((entry) => {\n\t\t\t\t\t\t\t\t\t\t\tinit_entries(entry.properties.tail);\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t})($.properties.entries);\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn Promise.resolve(values);\n\t\t\t\t},\n\t\t\t\t\"does not exist\": () => Promise.resolve(undefined),\n\t\t\t\t\"permission denied\": () => Promise.resolve(undefined),\n\t\t\t})\n\t\t);\n}\n\nfunction findLocalValues(\n\tscope: Scope,\n\ttext_property_name: string,\n\ttext_property_to_exclude: api_cs.Ctext__type__property | undefined\n): Set {\n\tlet nodes = new Set([scope.node]);\n\tfor (const step of scope.path) {\n\t\tswitch (step[0]) {\n\t\t\tcase \"group\": {\n\t\t\t\tconst group_nodes = new Set();\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tconst attribute = node.properties.attributes.get(step[1]);\n\t\t\t\t\tif (attribute) {\n\t\t\t\t\t\tgroup_nodes.add(attribute.properties.type.cast(\"property\").properties.type.cast(\"group\").properties.node);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnodes = group_nodes;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state\": {\n\t\t\t\tconst state_nodes = new Set();\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tconst attribute = node.properties.attributes.get(step[1]);\n\t\t\t\t\tif (attribute) {\n\t\t\t\t\t\tconst state = attribute.properties.type\n\t\t\t\t\t\t\t.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"state group\")\n\t\t\t\t\t\t\t.properties.states.get(step[2]);\n\t\t\t\t\t\tif (state && state.properties.is_selected.state.name === \"yes\") {\n\t\t\t\t\t\t\tstate_nodes.add(state.properties.node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnodes = state_nodes;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"collection\": {\n\t\t\t\tconst entry_nodes = new Set();\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tconst attribute = node.properties.attributes.get(step[1]);\n\t\t\t\t\tif (attribute) {\n\t\t\t\t\t\tconst collection = attribute.properties.type.cast(\"property\").properties.type.cast(\"collection\");\n\t\t\t\t\t\tfor (const entry of collection.properties.entries.values()) {\n\t\t\t\t\t\t\tentry_nodes.add(entry.properties.node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnodes = entry_nodes;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tconst values = new Set();\n\tfor (const node of nodes) {\n\t\tnode.properties.attributes\n\t\t\t.get(text_property_name)\n\t\t\t?.properties.type.cast(\"property\")\n\t\t\t.properties.type.cast(\"text\")\n\t\t\t.properties.is_set.switch({\n\t\t\t\tyes: (key_set) => {\n\t\t\t\t\tif (key_set.parent !== text_property_to_exclude) {\n\t\t\t\t\t\tvalues.add(key_set.properties.text);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tno: undefined,\n\t\t\t});\n\t}\n\treturn values;\n}\n\nfunction increment(values: Set): string | undefined {\n\tlet candidate:\n\t\t| {\n\t\t\t\tprefix: string;\n\t\t\t\tnumber_part: string;\n\t\t\t\tnumber_value: number;\n\t\t }\n\t\t| undefined;\n\n\tfor (const key of values) {\n\t\tconst match = /^(.*?)([0-9]*)$/.exec(key);\n\t\tif (match !== null) {\n\t\t\tconst prefix = match[1];\n\t\t\tconst number_part = match[2];\n\t\t\tconst number_value = number_part.length > 0 ? Number.parseInt(number_part) : 0;\n\t\t\tif (candidate === undefined || candidate.number_value < number_value) {\n\t\t\t\tcandidate = {\n\t\t\t\t\tprefix: prefix,\n\t\t\t\t\tnumber_part: number_part,\n\t\t\t\t\tnumber_value: number_value,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\tif (candidate === undefined) {\n\t\treturn undefined;\n\t} else {\n\t\tconst number_part = (candidate.number_value + 1).toString();\n\t\tconst pad_length = candidate.number_part.length;\n\t\treturn candidate.prefix + pad(number_part, pad_length, \"0\");\n\t}\n}\n\nconst subscriptions: Record any)[]> = {};\nfunction subscribeToRemoteValues(\n\tscope: Scope,\n\ttext_property_name: string,\n\tdestructor: api_cs.IDestructable,\n\ton_value: (value: string | undefined) => any\n) {\n\tconst scope_id = getScopeIdentifier(scope, text_property_name);\n\tlet datastore_subscription: { unsubscribe: () => void } | undefined;\n\n\tif (subscriptions[scope_id] === undefined) {\n\t\tsubscriptions[scope_id] = [];\n\n\t\tconst subscription_builder = SubscriptionBuilder.create();\n\t\tlet sb = subscription_builder;\n\t\tfor (const step of scope.path) {\n\t\t\tswitch (step[0]) {\n\t\t\t\tcase \"group\":\n\t\t\t\t\tsb = sb.group(step[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"state\":\n\t\t\t\t\tsb = sb.state(step[1], step[2], step[3]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"collection\":\n\t\t\t\t\tsb = sb.collection_entries(step[1]);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tsb.text(text_property_name);\n\t\tconst conditions_valid = () =>\n\t\t\tsubscriptions[scope_id] !== undefined && !isSaving(scope.node) && !destructor.destroyed && !scope.node.destroyed;\n\t\tdatastore_subscription = DatastoreProxy.instance.subscribe(\n\t\t\t{\n\t\t\t\t\"context node\": createIdPathFromNode(scope.node),\n\t\t\t\t\"mutation permissions\": \"ignore\",\n\t\t\t\t\"node subscription\": {\n\t\t\t\t\tattributes: subscription_builder.properties,\n\t\t\t\t},\n\t\t\t},\n\t\t\t() => undefined,\n\t\t\t(notification) => {\n\t\t\t\tif (!conditions_valid()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tswitch (notification.properties.context.state.name) {\n\t\t\t\t\tcase \"exists\":\n\t\t\t\t\t\tfindRemoteValues(scope, text_property_name).then((values) => {\n\t\t\t\t\t\t\tif (!conditions_valid()) {\n\t\t\t\t\t\t\t\t//Timing can cause the subscription to be deleted during this query\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlet v: string | undefined;\n\t\t\t\t\t\t\tif (values === undefined) {\n\t\t\t\t\t\t\t\tv = values;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tv = increment(values);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor (const on_value of subscriptions[scope_id]) {\n\t\t\t\t\t\t\t\ton_value(v);\n\t\t\t\t\t\t\t\tif (!(v === undefined)) {\n\t\t\t\t\t\t\t\t\tv = increment(new Set([v]));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"permission denied\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"does not exist\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\tsubscriptions[scope_id].push(on_value);\n\tdestructor.onDestroy(() => {\n\t\tif (subscriptions[scope_id] !== undefined) {\n\t\t\tconst idx = subscriptions[scope_id].indexOf(on_value);\n\t\t\tif (idx >= 0) {\n\t\t\t\tsubscriptions[scope_id].splice(idx, 1);\n\t\t\t}\n\t\t\tif (subscriptions[scope_id].length <= 0) {\n\t\t\t\tdatastore_subscription?.unsubscribe();\n\t\t\t\tdelete subscriptions[scope_id];\n\t\t\t}\n\t\t}\n\t});\n}\n\nexport function property(definition: api_app.Cauto_increment, this_node: api_cs.Cnode): ScalarProvider> {\n\tconst ui_text = definition.parent.inferences.text_target();\n\tswitch (ui_text.variant.name) {\n\t\tcase \"text property\": {\n\t\t\tconst app_text = ui_text.variant.definition;\n\t\t\tconst text_property_name = app_text.parent.parent.key;\n\t\t\tconst stream = createVariable>(Pending, true);\n\t\t\tconst scope = getScope(definition, this_node);\n\t\t\tif (!scope) {\n\t\t\t\treturn stream;\n\t\t\t}\n\t\t\tconst this_text_property = this_node.properties.attributes\n\t\t\t\t.get(text_property_name)\n\t\t\t\t?.properties.type.cast(\"property\")\n\t\t\t\t.properties.type.cast(\"text\");\n\t\t\tconst local_values = findLocalValues(scope, text_property_name, this_text_property);\n\t\t\tswitch (scope.node.properties.location.state.name) {\n\t\t\t\tcase \"remote\": {\n\t\t\t\t\tfindRemoteValues(scope, text_property_name).then((remote_values) => {\n\t\t\t\t\t\tif (!remote_values) {\n\t\t\t\t\t\t\tstream.set(Failed);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (stream.destroyed) return;\n\t\t\t\t\t\t\tsubscribeToRemoteValues(scope, text_property_name, stream, (value) => {\n\t\t\t\t\t\t\t\tif (value === undefined) {\n\t\t\t\t\t\t\t\t\tstream.set(Failed);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tstream.set(value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}, 0);\n\t\t\t\t\t\tconst incremented_value = increment(new Set([...local_values, ...remote_values]));\n\t\t\t\t\t\tif (incremented_value === undefined) {\n\t\t\t\t\t\t\tstream.set(Failed);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstream.set(incremented_value);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"local\": {\n\t\t\t\t\tconst incremented_value = increment(local_values);\n\t\t\t\t\tif (incremented_value === undefined) {\n\t\t\t\t\t\tstream.set(Failed);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstream.set(incremented_value);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(scope.node.properties.location.state);\n\t\t\t}\n\t\t\treturn stream;\n\t\t}\n\t\tcase \"intermediate result\":\n\t\t\tthrow new Error(\"unexpected 'intermediate result'\");\n\t\tdefault:\n\t\t\tunexpectedState(ui_text.variant);\n\t}\n}\n","import { jstimestamp_2_julian_datetime } from \"../calendar/conversion\";\n\nconst tick_handlers: ((date: number) => void)[] = [];\nlet interval: number;\nlet onAdded: () => void;\nlet julianNow = function () {\n\treturn jstimestamp_2_julian_datetime(Date.now());\n};\n\nfunction doTickHandlersLoop() {\n\tconst julian_now = julianNow();\n\tfor (let i = 0; i < tick_handlers.length; i += 1) {\n\t\ttick_handlers[i](julian_now);\n\t}\n\tinterval = setTimeout(doTickHandlersLoop, 500);\n}\nfunction startWhenAdded() {\n\tinterval = setTimeout(doTickHandlersLoop, 500);\n\tonAdded = () => {\n\t\t//noop\n\t};\n}\nfunction stopWhenRemoved() {\n\tclearInterval(interval);\n\tonAdded = startWhenAdded;\n}\nonAdded = startWhenAdded;\n\nexport default {\n\ton: function (type: \"tick\", callback: (time: number) => void): void {\n\t\tswitch (type) {\n\t\t\tcase \"tick\":\n\t\t\t\ttick_handlers.push(callback);\n\t\t\t\tonAdded();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"unsupported clock event type \" + type);\n\t\t}\n\t},\n\toff: function (type: \"tick\", callback: (time: number) => void): void {\n\t\tswitch (type) {\n\t\t\tcase \"tick\":\n\t\t\t\ttick_handlers.splice(tick_handlers.indexOf(callback), 1);\n\t\t\t\tif (tick_handlers.length <= 0) {\n\t\t\t\t\tstopWhenRemoved();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"unsupported clock event type \" + type);\n\t\t}\n\t},\n\tgetNow: function (): number {\n\t\treturn julianNow();\n\t},\n\tsetNowFunction: function (nowFunction: () => number): void {\n\t\tjulianNow = nowFunction;\n\t},\n};\n","import { api_configuration } from \"../../common\";\nimport cs = api_configuration.types.client_state.alan_api;\nimport cr = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport { applyOperationDefaults } from \"./defaults\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport { DataStoreProtocolError, DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { iNode } from \"../state/Node\";\n\nfunction mapCommandArguments(parameters_node: cs.Cnode): cr.Tnode_initialization {\n\tconst command_arguments: cr.Tnode_initialization = {\n\t\tproperties: {},\n\t};\n\n\tfor (const [attribute_name, attribute] of parameters_node.properties.attributes) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"operation\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\tcommand_arguments.properties[attribute_name] = {\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"collection\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tentries: $.properties.entries.map(function ($) {\n\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\tinitialization: mapCommandArguments($.properties.node),\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\tswitch ($.properties.is_set.state.name) {\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst is_set = $.properties.is_set.state.node;\n\t\t\t\t\t\t\t\tcommand_arguments.properties[attribute_name] = {\n\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\"file\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ttoken: is_set.properties.token,\n\t\t\t\t\t\t\t\t\t\t\textension: is_set.properties.extension,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\tcommand_arguments.properties[attribute_name] = {\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"group\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tinitialization: mapCommandArguments($.properties.node),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\tcommand_arguments.properties[attribute_name] = {\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: $.properties.is_set.cast(\"yes\").properties.number.value,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\tconst selected_state = $.properties.is_set.cast(\"yes\").properties.state.ref;\n\t\t\t\t\t\tcommand_arguments.properties[attribute_name] = {\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"state group\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tstate: selected_state.key.entry,\n\t\t\t\t\t\t\t\t\tinitialization: mapCommandArguments(selected_state.properties.node),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\tcommand_arguments.properties[attribute_name] = {\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: $.properties.is_set.switch({ yes: ($) => $.properties.text, no: () => \"\" }),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t}\n\t}\n\treturn command_arguments;\n}\n\nfunction createCommandExecutionRequest(\n\tcontext_id_path: IdPathBuilder,\n\tcommand: cs.Cyes__started\n): cr.Tcommand_execution {\n\treturn {\n\t\t\"context node\": context_id_path.build(),\n\t\tcommand: command.parent.parent.key.entry,\n\t\targuments: mapCommandArguments(command.properties.node),\n\t};\n}\n\nexport async function executeCommand(command: cs.Cyes__started): Promise {\n\tif (command.destroyed === true) return;\n\tswitch (command.parent.parent.parent.properties.location.state.name) {\n\t\tcase \"remote\": {\n\t\t\tconst context_id_path_builder = createIdPathBuilderFromNode(command.parent.parent.parent);\n\t\t\tcommand.properties.executing.set(\"yes\", { \"can continue\": [\"no\", {}] });\n\t\t\ttry {\n\t\t\t\tawait DatastoreProxy.instance.execute(createCommandExecutionRequest(context_id_path_builder, command));\n\t\t\t\tif (command.destroyed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tiNode(command.properties.node).discard();\n\t\t\t\tcommand.properties.executing.set(\"no\", {\n\t\t\t\t\t\"last result\": [\"success\", {}],\n\t\t\t\t});\n\t\t\t\tapplyOperationDefaults(command);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof DataStoreProtocolError) {\n\t\t\t\t\tif (command.destroyed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tcommand.properties.executing.set(\"no\", {\n\t\t\t\t\t\t\"last result\": [\"failure\", {}],\n\t\t\t\t\t});\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"local\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(command.parent.parent.parent.properties.location.state);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport client_state_decorator = api_configuration.types.client_state.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport clock from \"../state/clock\";\nimport { getTranslation } from \"./phrases\";\n\nexport default function (gui_columns_binding: api_views.Cqueries): { [key: string]: client_state_decorator.Tcolumns } {\n\treturn gui_columns_binding.properties.columns.map(function (column) {\n\t\treturn {\n\t\t\tname: getTranslation(column.properties.name.entry), // the subscription on the selected language is handled somewhere else\n\t\t\t\"has successor\": column.properties.has_successor.switch({\n\t\t\t\tyes: ($) => [\"yes\", { successor: $.properties.successor.entry }],\n\t\t\t\tno: [\"no\", {}],\n\t\t\t}),\n\t\t\t\"column type\": column.properties.column_type.switch({\n\t\t\t\tid: [\"id\", {}],\n\t\t\t\tcontent: [\"content\", {}],\n\t\t\t}),\n\t\t\ttype: column.properties.type.switch({\n\t\t\t\ttext: function (text) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"has filter\": text.properties.filter.switch({\n\t\t\t\t\t\t\t\tnone: [\"no\", {}],\n\t\t\t\t\t\t\t\tsimple: function (yes__has_filter) {\n\t\t\t\t\t\t\t\t\tconst criteria = yes__has_filter.properties.criteria;\n\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\"filter set\": criteria.length > 0 ? [\"yes\", {}] : [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\"has default filter\": [\"yes\", {}],\n\t\t\t\t\t\t\t\t\t\t\tvalue: criteria,\n\t\t\t\t\t\t\t\t\t\t\toperation: [\"equals\", {}],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"current id path\": [\"no\", {}], //TODO remove when filters are supported in the generator\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\"filter on current id path\": text.properties.filter.switch({\n\t\t\t\t\t\t\t\t\"current id path\": [\"yes\", {}],\n\t\t\t\t\t\t\t\tnone: [\"no\", {}],\n\t\t\t\t\t\t\t\tsimple: [\"no\", {}],\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t},\n\t\t\t\tfile: [\"file\", {}],\n\t\t\t\tnumber: function (value) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"has filter\": value.properties.has_filter.switch<\n\t\t\t\t\t\t\t\tclient_state_decorator.Tnumber__type__columns[\"has filter\"]\n\t\t\t\t\t\t\t>({\n\t\t\t\t\t\t\t\tno: [\"no\", {}],\n\t\t\t\t\t\t\t\tyes: function (yes__has_filter) {\n\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\"operator selected\": yes__has_filter.properties.operator_selected.switch<\n\t\t\t\t\t\t\t\t\t\t\t\tclient_state_decorator.Tyes__has_filter__number[\"operator selected\"]\n\t\t\t\t\t\t\t\t\t\t\t>({\n\t\t\t\t\t\t\t\t\t\t\t\tyes: function ($) {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toperator: $.properties.operator.switch<\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state_decorator.Tyes__operator_selected[\"operator\"]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"equal to\": [\"equal to\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than\": [\"greater than\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than or equal to\": [\"greater than or equal to\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"smaller than\": [\"smaller than\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"smaller than or equal to\": [\"smaller than or equal to\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tno: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\"criteria is valid\": yes__has_filter.properties.initial_criteria.switch<\n\t\t\t\t\t\t\t\t\t\t\t\tclient_state_decorator.Tyes__has_filter__number[\"criteria is valid\"]\n\t\t\t\t\t\t\t\t\t\t\t>({\n\t\t\t\t\t\t\t\t\t\t\t\tnone: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\tyes: function (yes__initial_criteria) {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcriteria: yes__initial_criteria.properties.source.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnow: function (now__source) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclock.getNow() +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnow__source.properties.has_offset.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnone: 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: function (yes__has_offset) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn yes__has_offset.properties.offset.value;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstatic: function (static__source) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn static__source.properties.number.value;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\"filter range\": \"no\",\n\t\t\t\t\t\t\t\t\t\t\t\"has default filter\": [\"yes\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\"filter set\": yes__has_filter.properties.initial_criteria.switch({\n\t\t\t\t\t\t\t\t\t\t\t\tnone: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\tyes: [\"yes\", {}],\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\"numerical type properties\": {\n\t\t\t\t\t\t\t\t\t\t\t\tinitialized: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t},\n\t\t\t\t\"state group\": function (state_group) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t\"state group\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"has filter\": state_group.properties.has_filter.switch<\n\t\t\t\t\t\t\t\tclient_state_decorator.Tstate_group__type__columns[\"has filter\"]\n\t\t\t\t\t\t\t>({\n\t\t\t\t\t\t\t\tno: [\"no\", {}],\n\t\t\t\t\t\t\t\tyes: function (yes__has_filter) {\n\t\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\"filter enabled\": yes__has_filter.properties.filter_enabled.switch<\n\t\t\t\t\t\t\t\t\t\t\t\tclient_state_decorator.Tyes__has_filter__state_group[\"filter enabled\"]\n\t\t\t\t\t\t\t\t\t\t\t>({\n\t\t\t\t\t\t\t\t\t\t\t\tyes: [\"yes\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\tno: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\"has default filter\": [\"yes\", {}],\n\t\t\t\t\t\t\t\t\t\t\tstates: yes__has_filter.properties.states.map(function (state) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: getTranslation(state.key.entry),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"is selected\": state.properties.is_selected.switch<\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state_decorator.Tstates__yes[\"is selected\"]\n\t\t\t\t\t\t\t\t\t\t\t\t\t>({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: [\"yes\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t},\n\t\t\t\twidget: (): client_state_decorator.Tcolumns[\"type\"] => [\"widget\", {}],\n\t\t\t}),\n\t\t};\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_gui = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport parserNumber = require(\"../front 2 state/parseNumber\");\nimport parseNumber = parserNumber.parse;\nimport * as papa from \"papaparse\";\nimport { saveAs } from \"../widgets/instructions/saveAs\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport * as update from \"../widgets/instructions/update\";\nimport { CsvColumnPathBuilder } from \"../navigation/CsvColumnPathBuilder\";\nimport DestructorTree from \"../DestructorTree\";\nimport { createCSVBlob } from \"../utils\";\nimport * as Sets from \"../Sets\";\nimport { TranslationKey } from \"../front/translate\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { getStaticDecimalsFromNumericalType } from \"../state 2 interface/serializeNumber\";\nimport {\n\tregisterIdPath,\n\tregisterText,\n\tregisterNumber,\n\tregisterGroup,\n\tregisterStategroup,\n\tregisterEntry,\n} from \"../state/registerClientState\";\nimport * as GC from \"../state/GarbageCollector\";\nimport { addCollectionAttribute } from \"../state/addClientState\";\nimport { cancelDefault } from \"./defaults\";\nimport { serializeNumber } from \"../state 2 interface/serializeNumber\";\nimport { entryExists } from \"../state 2 interface/entryExists\";\nimport * as save from \"../widgets/instructions/save\";\nimport clientWorkIsDone from \"./tasks\";\nimport { ignoreCollectionDefaults } from \"../state/ClientState\";\nimport { createMutation } from \"../state 2 interface/createMutation\";\nimport { InstructionError } from \"../widgets/instructions/InstructionError\";\nimport { iText } from \"../state/Text\";\nimport { iState } from \"../state/Stategroup\";\nimport { iNode } from \"../state/Node\";\nimport { iCollection } from \"../state/Collection\";\n\n// Note that there is a zero width space before the error_prefix. This is to\n// prevent naming collissions with model properties starting with the same\n// name. If the model contains this exact prefix. More work has to be done to\n// avoid naming collissions.\nconst error_prefix = \"☹ Error: \";\n\nexport class ImportError extends Error {\n\tconstructor(public readonly message: TranslationKey) {\n\t\tsuper(message);\n\t}\n}\n\ntype CsvImportRecord = {\n\t[key: string]: string;\n\titem_operation: \"add\" | \"update\" | \"remove\";\n};\n\nclass ErrorReporter {\n\terror_fields = new Set();\n\tcreate_record_reporter(record: CsvImportRecord) {\n\t\treturn (column: string, error: string) => {\n\t\t\tconst error_column = error_prefix + column;\n\t\t\tthis.error_fields.add(error_column);\n\t\t\tthis.error_fields.add(error_prefix);\n\t\t\trecord[error_prefix] = \"x\";\n\t\t\tif (record[error_column] !== undefined) {\n\t\t\t\trecord[error_column] = record[error_column] + \", \" + error;\n\t\t\t} else {\n\t\t\t\trecord[error_column] = error;\n\t\t\t}\n\t\t};\n\t}\n}\n\nfunction validateRecord(\n\tgui_node: api_gui.Cgui_node,\n\tcsv_rec: CsvImportRecord,\n\tcolumn_path_builder: CsvColumnPathBuilder,\n\tcolumns: Set,\n\treportError: (column: string, error: string) => void\n) {\n\tfor (const [attribute_name, attribute] of gui_node.properties.attributes) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"reference set\":\n\t\t\t\tbreak;\n\t\t\tcase \"action\":\n\t\t\t\tbreak;\n\t\t\tcase \"command\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tconst kind = property.inferences.property_type().properties.type.state.node.output.value_source();\n\t\t\t\tswitch (kind.variant.name) {\n\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"base\":\n\t\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\tconst number = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst base_number = number.inferences.number().properties.type.cast(\"base\");\n\t\t\t\t\t\t\t\tswitch (base_number.properties.type.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"causal\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"simple\": {\n\t\t\t\t\t\t\t\t\t\tconst number_column = column_path_builder.number(attribute_name).build();\n\t\t\t\t\t\t\t\t\t\tconst value = csv_rec[number_column];\n\t\t\t\t\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t\t\t\t\t// An empty string is valid: the number will not be set\n\t\t\t\t\t\t\t\t\t\t\tconst number_type = number.inferences.number().properties.set_type.state.name;\n\t\t\t\t\t\t\t\t\t\t\tconst decimals = getStaticDecimalsFromNumericalType(\n\t\t\t\t\t\t\t\t\t\t\t\tnumber.inferences.number().properties.numerical_type.ref\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tconst number_parse_result = parseNumber(\n\t\t\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t\t\t\tnumber.properties.numerical_type.ref.key.ref,\n\t\t\t\t\t\t\t\t\t\t\t\tnumber_type,\n\t\t\t\t\t\t\t\t\t\t\t\tdecimals\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tswitch (number_parse_result[0]) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\treportError(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_column,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"Invalid '\" + number.properties.numerical_type.entry + \"': \" + number_parse_result[1].error\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(number_parse_result[0]);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(base_number.properties.type.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\t\t\tconst group = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tvalidateRecord(\n\t\t\t\t\t\t\t\t\tgroup.properties.gui_node,\n\t\t\t\t\t\t\t\t\tcsv_rec,\n\t\t\t\t\t\t\t\t\tcolumn_path_builder.group(attribute_name),\n\t\t\t\t\t\t\t\t\tcolumns,\n\t\t\t\t\t\t\t\t\treportError\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\tconst stategroup = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst stategroup_column = column_path_builder.state_group(attribute_name).build();\n\t\t\t\t\t\t\t\tconst value = csv_rec[stategroup_column];\n\t\t\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t\t\t// An empty string is valid: the stategroup will not be set\n\t\t\t\t\t\t\t\t\tconst selected_state = stategroup.properties.states.get(value);\n\t\t\t\t\t\t\t\t\tif (!selected_state) {\n\t\t\t\t\t\t\t\t\t\treportError(\n\t\t\t\t\t\t\t\t\t\t\tstategroup_column,\n\t\t\t\t\t\t\t\t\t\t\t\"Must be one of: \" + Array.from(stategroup.properties.states).map((state) => state[0])\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfor (const [state_name, state] of stategroup.properties.states) {\n\t\t\t\t\t\t\t\t\tvalidateRecord(\n\t\t\t\t\t\t\t\t\t\tstate.properties.gui_node,\n\t\t\t\t\t\t\t\t\t\tcsv_rec,\n\t\t\t\t\t\t\t\t\t\tcolumn_path_builder.state(attribute_name, state_name),\n\t\t\t\t\t\t\t\t\t\tcolumns,\n\t\t\t\t\t\t\t\t\t\treportError\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(kind.variant);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t}\n\t}\n}\n\nfunction findUsedColumns(\n\tgui_node: api_gui.Cgui_node,\n\tcolumn_path_builder: CsvColumnPathBuilder,\n\tcolumns: Set\n): Set {\n\tlet used_columns = new Set();\n\tfor (const [attribute_name, attribute] of gui_node.properties.attributes) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"reference set\":\n\t\t\t\tbreak;\n\t\t\tcase \"action\":\n\t\t\t\tbreak;\n\t\t\tcase \"command\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tconst kind = property.inferences.property_type().properties.type.state.node.output.value_source();\n\t\t\t\tswitch (kind.variant.name) {\n\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"base\":\n\t\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\tconst text_column = column_path_builder.text(attribute_name).build();\n\t\t\t\t\t\t\t\tif (columns.has(text_column)) {\n\t\t\t\t\t\t\t\t\tused_columns.add(text_column);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\tconst number = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst base_number = number.inferences.number().properties.type.cast(\"base\");\n\t\t\t\t\t\t\t\tswitch (base_number.properties.type.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"causal\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"simple\": {\n\t\t\t\t\t\t\t\t\t\tconst number_column = column_path_builder.number(attribute_name).build();\n\t\t\t\t\t\t\t\t\t\tif (columns.has(number_column)) {\n\t\t\t\t\t\t\t\t\t\t\tused_columns.add(number_column);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(base_number.properties.type.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\t\t\tconst group = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tused_columns = Sets.union(\n\t\t\t\t\t\t\t\t\tused_columns,\n\t\t\t\t\t\t\t\t\tfindUsedColumns(group.properties.gui_node, column_path_builder.group(attribute_name), columns)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\tconst stategroup = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst stategroup_column = column_path_builder.state_group(attribute_name).build();\n\t\t\t\t\t\t\t\tif (columns.has(stategroup_column)) {\n\t\t\t\t\t\t\t\t\tused_columns.add(stategroup_column);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Don't throw a fitty, ignore this for now even though we don't use it\n\t\t\t\t\t\t\t\tconst stategroup_operation_column = column_path_builder.state_group_operation(attribute_name).build();\n\t\t\t\t\t\t\t\tif (columns.has(stategroup_operation_column)) {\n\t\t\t\t\t\t\t\t\tused_columns.add(stategroup_operation_column);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfor (const [state_name, state] of stategroup.properties.states) {\n\t\t\t\t\t\t\t\t\tused_columns = Sets.union(\n\t\t\t\t\t\t\t\t\t\tused_columns,\n\t\t\t\t\t\t\t\t\t\tfindUsedColumns(\n\t\t\t\t\t\t\t\t\t\t\tstate.properties.gui_node,\n\t\t\t\t\t\t\t\t\t\t\tcolumn_path_builder.state(attribute_name, state_name),\n\t\t\t\t\t\t\t\t\t\t\tcolumns\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(kind.variant);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t}\n\t}\n\treturn used_columns;\n}\n\nfunction mergeErrorFields(fields: Set, error_fields: Set) {\n\tconst result = new Set();\n\tfor (const field of fields) {\n\t\tresult.add(field);\n\t\tconst error_field_name = error_prefix + field;\n\t\tif (error_fields.has(error_field_name)) {\n\t\t\tresult.add(error_field_name);\n\t\t\terror_fields.delete(error_field_name);\n\t\t}\n\t}\n\tfor (const field of error_fields) {\n\t\tresult.add(field);\n\t}\n\treturn result;\n}\n\nasync function validateCsv(\n\tcontext_node: api_cs.Cnode,\n\tgui_node: api_gui.Cgui_node,\n\tkey_fields: Set,\n\tfields: Set,\n\tlast_key_field: string,\n\trecords: CsvImportRecord[]\n) {\n\tconst error_reporter = new ErrorReporter();\n\t// Validate key_fields\n\tkey_fields.add(\"item_operation\"); // add to the key fields so it is noted when missing and not marked as unknown later\n\tconst missing_key_fields = Sets.difference(key_fields, fields);\n\tif (missing_key_fields.size > 0) {\n\t\t// We'll report the errors on the first row.\n\t\t// Since the column is missing there is no chance of clashes\n\t\tif (!records[0]) {\n\t\t\trecords.push({ item_operation: \"add\" });\n\t\t}\n\t\tconst reportError = error_reporter.create_record_reporter(records[0]);\n\t\tfor (const col of missing_key_fields) {\n\t\t\treportError(col, \"Key column is missing\");\n\t\t}\n\t}\n\t// Validate fields\n\tconst columns = Sets.difference(fields, key_fields);\n\tconst used_columns = findUsedColumns(gui_node, CsvColumnPathBuilder.create(), columns);\n\tconst unused_columns = Sets.difference(columns, used_columns);\n\tif (unused_columns.size > 0) {\n\t\t// We'll report the errors on the first row.\n\t\t// Since the column is not valid there is no chance of clashes\n\t\tif (!records[0]) {\n\t\t\trecords.push({ item_operation: \"add\" });\n\t\t}\n\t\tconst reportError = error_reporter.create_record_reporter(records[0]);\n\t\tfor (const col of unused_columns) {\n\t\t\treportError(col, \"Column unknown\");\n\t\t}\n\t}\n\t// Validate data\n\tconst nodes_to_check_for_existence = new Map }>();\n\tfor (const csv_record of records) {\n\t\tconst reportError = error_reporter.create_record_reporter(csv_record);\n\t\tconst [id_path_builder] = getRecordIdPath(context_node, gui_node, csv_record);\n\t\tswitch (csv_record.item_operation) {\n\t\t\tcase \"add\": {\n\t\t\t\t// The path always end in a collection entry. So removing the\n\t\t\t\t// tail will get us the parent node.\n\t\t\t\tconst parent_id_path_builder = id_path_builder.removeTail();\n\t\t\t\tconst id = IdPathBuilder.serialize(parent_id_path_builder);\n\t\t\t\tconst to_check = nodes_to_check_for_existence.get(id);\n\t\t\t\tif (to_check === undefined) {\n\t\t\t\t\tnodes_to_check_for_existence.set(id, {\n\t\t\t\t\t\tid_path: parent_id_path_builder,\n\t\t\t\t\t\trecords: new Set([csv_record]),\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tto_check.records.add(csv_record);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"update\": {\n\t\t\t\tnodes_to_check_for_existence.set(IdPathBuilder.serialize(id_path_builder), {\n\t\t\t\t\tid_path: id_path_builder,\n\t\t\t\t\trecords: new Set([csv_record]),\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"remove\": {\n\t\t\t\tnodes_to_check_for_existence.set(IdPathBuilder.serialize(id_path_builder), {\n\t\t\t\t\tid_path: id_path_builder,\n\t\t\t\t\trecords: new Set([csv_record]),\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treportError(\"item_operation\", \"Must be one of: add, update, remove\");\n\t\t}\n\t\tvalidateRecord(gui_node, csv_record, CsvColumnPathBuilder.create(), columns, reportError);\n\t}\n\n\tawait Promise.all(\n\t\t[...nodes_to_check_for_existence.values()].map(async ({ id_path, records }) => {\n\t\t\tif (!(await entryExists(id_path))) {\n\t\t\t\tfor (const record of records) {\n\t\t\t\t\terror_reporter.create_record_reporter(record)(last_key_field, \"Entry does not exist.\");\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t);\n\n\tif (error_reporter.error_fields.size > 0) {\n\t\tconst field_for_errors_csv = [...mergeErrorFields(fields, error_reporter.error_fields)];\n\t\tsaveAs(createCSVBlob(papa.unparse({ data: records, fields: field_for_errors_csv })), \"errors.csv\");\n\t\tthrow new ImportError(\"The CSV file is not valid. Refer to the error report and try again.\");\n\t}\n}\n\nfunction getRecordIdPath(\n\tcontext_node: api_cs.Cnode,\n\ttarget_node_def: api_gui.Cgui_node,\n\trecord: CsvImportRecord\n): [IdPathBuilder, string] {\n\tif (target_node_def.input.application_node().is(context_node.input.node_type())) {\n\t\treturn [createIdPathBuilderFromNode(context_node), \"\"];\n\t}\n\tconst location = target_node_def.output.location();\n\tswitch (location.variant.name) {\n\t\tcase \"root\":\n\t\t\treturn [new IdPathBuilder(), \"\"];\n\t\tcase \"collection\": {\n\t\t\tconst $ = location.variant.definition;\n\t\t\tconst [id_path_builder, prefix] = getRecordIdPath(context_node, $.parent.parent.parent, record);\n\t\t\tconst collection_name = $.parent.parent.key.entry;\n\t\t\tconst field_name = prefix + collection_name;\n\t\t\tconst key = record[field_name];\n\t\t\treturn [id_path_builder.collectionEntry(collection_name, key), field_name + \".\"];\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst $ = location.variant.definition;\n\t\t\tconst [id_path_builder, prefix] = getRecordIdPath(context_node, $.parent.parent.parent.parent, record);\n\t\t\tconst stategroup_name = $.parent.parent.parent.key.entry;\n\t\t\tconst state_name = $.key.entry;\n\t\t\treturn [id_path_builder.state(stategroup_name, state_name), prefix];\n\t\t}\n\t\tcase \"group\": {\n\t\t\tconst $ = location.variant.definition;\n\t\t\tconst [id_path_builder, prefix] = getRecordIdPath(context_node, $.parent.parent.parent, record);\n\t\t\tconst group_name = $.parent.parent.key.entry;\n\t\t\treturn [id_path_builder.group(group_name), prefix];\n\t\t}\n\t\tcase \"operation\":\n\t\t\tthrow new Error(\"Operations not supported in CSV importer\");\n\t\tdefault:\n\t\t\tunexpectedState(location.variant);\n\t}\n}\n\nfunction registerNodeFromRecord(\n\tnode: api_cs.Cnode,\n\trecord: CsvImportRecord,\n\tdestructor: DestructorTree,\n\tcolumn_path_builder: CsvColumnPathBuilder\n) {\n\tconst node_type = node.input.node_type();\n\tfor (const [attribute_name, attribute] of node_type.properties.attributes) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"reference set\":\n\t\t\t\tbreak;\n\t\t\tcase \"action\":\n\t\t\t\tbreak;\n\t\t\tcase \"command\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property_def = attribute.properties.type.state.node;\n\t\t\t\tconst kind = property_def.properties.type.state.node.output.value_source();\n\t\t\t\tswitch (kind.variant.name) {\n\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"base\":\n\t\t\t\t\t\tswitch (property_def.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\tconst text_def = property_def.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst text_column = column_path_builder.text(attribute_name).build();\n\t\t\t\t\t\t\t\tconst value = record[text_column];\n\t\t\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t\t\t// If empty or undefined, do not register\n\t\t\t\t\t\t\t\t\tconst text = registerText(text_def, node, destructor);\n\t\t\t\t\t\t\t\t\tcancelDefault(text.parent, destructor);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\tconst number_def = property_def.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst base_number = number_def.properties.type.cast(\"base\");\n\t\t\t\t\t\t\t\tswitch (base_number.properties.type.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"causal\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"simple\": {\n\t\t\t\t\t\t\t\t\t\tconst number_column = column_path_builder.number(attribute_name).build();\n\t\t\t\t\t\t\t\t\t\tconst value = record[number_column];\n\t\t\t\t\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t\t\t\t\t// If empty or undefined, do not register\n\t\t\t\t\t\t\t\t\t\t\tconst number = registerNumber(number_def, node, destructor);\n\t\t\t\t\t\t\t\t\t\t\tcancelDefault(number.parent, destructor);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(base_number.properties.type.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\t\t\tconst group_def = property_def.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst group = registerGroup(group_def, node, destructor);\n\t\t\t\t\t\t\t\tregisterNodeFromRecord(\n\t\t\t\t\t\t\t\t\tgroup.properties.node,\n\t\t\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\t\tcolumn_path_builder.group(attribute_name)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\tconst stategroup_def = property_def.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst stategroup = registerStategroup(stategroup_def, node, destructor);\n\t\t\t\t\t\t\t\tconst stategroup_column = column_path_builder.state_group(attribute_name).build();\n\t\t\t\t\t\t\t\tconst value = record[stategroup_column];\n\t\t\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t\t\tcancelDefault(stategroup.parent, destructor);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfor (const [state_name, state] of stategroup.properties.states) {\n\t\t\t\t\t\t\t\t\tregisterNodeFromRecord(\n\t\t\t\t\t\t\t\t\t\tstate.properties.node,\n\t\t\t\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\t\t\tcolumn_path_builder.state(attribute_name, state_name)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(property_def.properties.type.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(kind.variant);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t}\n\t}\n}\n\nfunction updateNodeFromRecord(node: api_cs.Cnode, record: CsvImportRecord, column_path_builder: CsvColumnPathBuilder) {\n\tfor (const [attribute_name, attribute] of node.properties.attributes) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"operation\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst text = property.properties.type.state.node;\n\t\t\t\t\t\tconst text_column = column_path_builder.text(attribute_name).build();\n\t\t\t\t\t\tconst value = record[text_column];\n\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t// If empty or undefined, do not set\n\t\t\t\t\t\t\tiText(text).__update(value, \"user\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst number = property.properties.type.state.node;\n\t\t\t\t\t\tconst number_column = column_path_builder.number(attribute_name).build();\n\t\t\t\t\t\tconst value = record[number_column];\n\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t// If empty or undefined, do not set\n\t\t\t\t\t\t\tconst number_type = number.inferences.number_type();\n\t\t\t\t\t\t\tconst number_parse_result = parseNumber(\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tnumber_type.properties.numerical_type.ref,\n\t\t\t\t\t\t\t\tnumber_type.properties.set_type.state.name,\n\t\t\t\t\t\t\t\tgetStaticDecimalsFromNumericalType(number_type.properties.numerical_type.ref)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tswitch (number_parse_result[0]) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tnumber.properties.is_valid.set(\"no\", {\n\t\t\t\t\t\t\t\t\t\t\"exceeds maximum\": \"no\",\n\t\t\t\t\t\t\t\t\t\t\"exceeds minimum\": \"no\",\n\t\t\t\t\t\t\t\t\t\t\"not a number\": \"yes\",\n\t\t\t\t\t\t\t\t\t\t\"not set\": \"no\",\n\t\t\t\t\t\t\t\t\t\t\"should be positive\": \"no\",\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\tconst number_value = (number_parse_result[1] as any).number;\n\t\t\t\t\t\t\t\t\tupdate.number(number, number_value, \"user\");\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\tupdateNodeFromRecord(\n\t\t\t\t\t\t\tproperty.properties.type.state.node.properties.node,\n\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\tcolumn_path_builder.group(attribute_name)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst stategroup = property.properties.type.state.node;\n\t\t\t\t\t\tconst stategroup_column = column_path_builder.state_group(attribute_name).build();\n\t\t\t\t\t\tconst value = record[stategroup_column];\n\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t// If empty or undefined, do not set\n\t\t\t\t\t\t\tconst state_to_set = stategroup.properties.states.get(value)!;\n\t\t\t\t\t\t\tiState(state_to_set).__select(\"user\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (const [state_name, state] of stategroup.properties.states) {\n\t\t\t\t\t\t\tupdateNodeFromRecord(\n\t\t\t\t\t\t\t\tstate.properties.node,\n\t\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\t\tcolumn_path_builder.state(attribute_name, state_name)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\nasync function executeCsv(\n\tcontext_node: api_cs.Cnode,\n\ttarget_node_def: api_gui.Cgui_node,\n\trecords: CsvImportRecord[],\n\terror_reporter: ErrorReporter,\n\tlast_key_field: string\n) {\n\tignoreCollectionDefaults.set(true);\n\tconst destructor = new DestructorTree();\n\tconst record_entry_map = new Map();\n\tfor (const record of records) {\n\t\tconst [id_path_builder, prefix] = getRecordIdPath(context_node, target_node_def, record);\n\t\tconst key_field = prefix.slice(0, -1); // The prefix has a \".\" at the end: remove\n\t\tlet entry: api_cs.Centries__collection;\n\t\tswitch (record.item_operation) {\n\t\t\tcase \"add\": {\n\t\t\t\t// The path always end in a collection entry. So removing the\n\t\t\t\t// tail will get us the parent node.\n\t\t\t\tconst parent_id_path_builder = id_path_builder.removeTail();\n\t\t\t\tconst parent_node = registerIdPath(parent_id_path_builder, destructor);\n\t\t\t\tconst collection_def = target_node_def.input.location().cast(\"collection\").inferences.collection();\n\t\t\t\tconst key = record[key_field];\n\t\t\t\tconst collection = addCollectionAttribute(collection_def, parent_node);\n\t\t\t\tentry = iCollection(collection).addEntry(\"user\", key);\n\t\t\t\tregisterEntry(entry, destructor);\n\t\t\t\tregisterNodeFromRecord(entry.properties.node, record, destructor, CsvColumnPathBuilder.create());\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"update\": {\n\t\t\t\tconst node = registerIdPath(id_path_builder, destructor);\n\t\t\t\tentry = node.input.entity().cast(\"entry\");\n\t\t\t\tregisterNodeFromRecord(node, record, destructor, CsvColumnPathBuilder.create());\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"remove\": {\n\t\t\t\tconst node = registerIdPath(id_path_builder, destructor);\n\t\t\t\tentry = node.input.entity().cast(\"entry\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\trecord_entry_map.set(record, entry);\n\t}\n\n\tawait clientWorkIsDone();\n\tfor (const [record, entry] of record_entry_map) {\n\t\tswitch (record.item_operation) {\n\t\t\tcase \"add\":\n\t\t\t\tupdateNodeFromRecord(entry.properties.node, record, CsvColumnPathBuilder.create());\n\t\t\t\tbreak;\n\t\t\tcase \"update\":\n\t\t\t\tupdateNodeFromRecord(entry.properties.node, record, CsvColumnPathBuilder.create());\n\t\t\t\tbreak;\n\t\t\tcase \"remove\":\n\t\t\t\tentry.properties.location.cast(\"remote\").properties.marked_for_deletion.set(\"yes\", {});\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tawait clientWorkIsDone();\n\tfor (const [record, entry] of record_entry_map) {\n\t\tswitch (record.item_operation) {\n\t\t\tcase \"add\":\n\t\t\t\treportErrorsOnNode(\n\t\t\t\t\tentry.properties.node,\n\t\t\t\t\trecord,\n\t\t\t\t\tCsvColumnPathBuilder.create(),\n\t\t\t\t\terror_reporter.create_record_reporter(record)\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase \"update\":\n\t\t\t\treportErrorsOnNode(\n\t\t\t\t\tentry.properties.node,\n\t\t\t\t\trecord,\n\t\t\t\t\tCsvColumnPathBuilder.create(),\n\t\t\t\t\terror_reporter.create_record_reporter(record)\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase \"remove\":\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst valid_entries = [...record_entry_map].filter(([record, entry]) => {\n\t\tconst node = entry.properties.node;\n\t\tswitch (record.item_operation) {\n\t\t\tcase \"add\":\n\t\t\t\tswitch (node.properties.is_valid.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"update\":\n\t\t\t\tswitch (node.properties.is_valid.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"remove\":\n\t\t\t\treturn true;\n\t\t}\n\t});\n\ttry {\n\t\tawait save.sendMutation(context_node, createMutation(new Set(valid_entries.map(([, entry]) => entry))));\n\t} catch (e) {\n\t\tif (e instanceof InstructionError) {\n\t\t\tfor (const [record] of valid_entries) {\n\t\t\t\terror_reporter.create_record_reporter(record)(last_key_field, \"Failed to save the entry.\");\n\t\t\t}\n\t\t} else {\n\t\t\tthrow e;\n\t\t}\n\t}\n\tiNode(context_node).discard();\n\tdestructor.destroy();\n\tGC.cleanNode(context_node);\n\tignoreCollectionDefaults.set(false);\n}\n\nasync function importCsvFile(file: File): Promise {\n\tconst csv_data = await new Promise((resolve) => {\n\t\tpapa.parse(file, {\n\t\t\theader: true,\n\t\t\tcomplete: (csv_data) => resolve(csv_data),\n\t\t\tskipEmptyLines: true,\n\t\t});\n\t});\n\tif (csv_data.errors.length > 0) {\n\t\tsaveAs(createCSVBlob(papa.unparse(csv_data.errors)), \"errors.csv\");\n\t\tthrow new ImportError(\"The CSV file is not valid. Refer to the error report and try again.\");\n\t}\n\treturn csv_data;\n}\n\nfunction getKeyFieldNames(\n\tcontext_node: api_app.Cnode__application,\n\ttarget_node: api_gui.Cgui_node\n): [Set, string] {\n\tif (target_node.input.application_node().is(context_node)) {\n\t\treturn [new Set(), \"\"];\n\t}\n\tconst location = target_node.output.location();\n\tswitch (location.variant.name) {\n\t\tcase \"root\":\n\t\t\treturn [new Set(), \"\"];\n\t\tcase \"collection\": {\n\t\t\tconst $ = location.variant.definition;\n\t\t\tconst [key_fields, prefix] = getKeyFieldNames(context_node, $.parent.parent.parent);\n\t\t\tconst field_name = prefix + $.parent.parent.key.entry;\n\t\t\tkey_fields.add(field_name);\n\t\t\treturn [key_fields, field_name + \".\"];\n\t\t}\n\t\tcase \"state\":\n\t\t\treturn getKeyFieldNames(context_node, location.variant.definition.parent.parent.parent.parent);\n\t\tcase \"group\":\n\t\t\treturn getKeyFieldNames(context_node, location.variant.definition.parent.parent.parent);\n\t\tcase \"operation\":\n\t\t\tswitch (location.variant.definition.variant.name) {\n\t\t\t\tcase \"action\": {\n\t\t\t\t\tconst $ = location.variant.definition.variant.definition;\n\t\t\t\t\treturn getKeyFieldNames(context_node, $.parent.parent);\n\t\t\t\t}\n\t\t\t\tcase \"command\": {\n\t\t\t\t\tconst $ = location.variant.definition.variant.definition;\n\t\t\t\t\treturn getKeyFieldNames(context_node, $.parent.parent);\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(location.variant.definition.variant);\n\t\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(location.variant);\n\t}\n}\n\nfunction reportErrorsOnNode(\n\tnode: api_cs.Cnode,\n\tcsv_record: CsvImportRecord,\n\tcolumn_path_builder: CsvColumnPathBuilder,\n\treport_error: (column_name: string, error: string) => void\n) {\n\tswitch (node.properties.is_valid.state.name) {\n\t\tcase \"no\": {\n\t\t\tfor (const [attribute_name, attribute] of node.properties.attributes) {\n\t\t\t\tswitch (attribute.properties.type.state.name) {\n\t\t\t\t\tcase \"operation\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"property\": {\n\t\t\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t\t\treportErrorsOnNode(\n\t\t\t\t\t\t\t\t\t$.properties.node,\n\t\t\t\t\t\t\t\t\tcsv_record,\n\t\t\t\t\t\t\t\t\tcolumn_path_builder.group(attribute_name),\n\t\t\t\t\t\t\t\t\treport_error\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\tconst number_property = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tswitch (number_property.properties.is_valid.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\tconst not_valid = number_property.properties.is_valid.state.node;\n\t\t\t\t\t\t\t\t\t\tconst column_name = column_path_builder.number(attribute_name).build();\n\t\t\t\t\t\t\t\t\t\tlet message = \"Not valid\";\n\t\t\t\t\t\t\t\t\t\tswitch (not_valid.properties.should_be_positive.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tmessage += \" must be positive\";\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(not_valid.properties.should_be_positive.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tswitch (not_valid.properties.exceeds_minimum.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst $ = not_valid.properties.exceeds_minimum.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type = number_property.inferences.number_type().properties.numerical_type.ref;\n\t\t\t\t\t\t\t\t\t\t\t\tmessage +=\n\t\t\t\t\t\t\t\t\t\t\t\t\t\" less then minimum: \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\tserializeNumber(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.minimum.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetStaticDecimalsFromNumericalType(numerical_type),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumerical_type,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"english\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(not_valid.properties.exceeds_minimum.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tswitch (not_valid.properties.exceeds_maximum.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst $ = not_valid.properties.exceeds_maximum.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type = number_property.inferences.number_type().properties.numerical_type.ref;\n\t\t\t\t\t\t\t\t\t\t\t\tmessage +=\n\t\t\t\t\t\t\t\t\t\t\t\t\t\" greater than maximum: \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\tserializeNumber(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.maximum.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetStaticDecimalsFromNumericalType(numerical_type),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumerical_type,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"english\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(not_valid.properties.exceeds_maximum.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treport_error(column_name, message);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(number_property.properties.is_valid.state);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\tconst state_group_property = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tswitch (state_group_property.properties.is_valid.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\tlet message = \"\";\n\t\t\t\t\t\t\t\t\t\tconst not_valid = state_group_property.properties.is_valid.state.node;\n\t\t\t\t\t\t\t\t\t\tswitch (not_valid.properties.no_state_selected.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tmessage = \"not set\";\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(not_valid.properties.no_state_selected.state);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tswitch (state_group_property.properties.is_set.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst $ = state_group_property.properties.is_set.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (not_valid.properties.invalid_rules.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst rules = $.properties.state.ref.properties.rules.properties.rules;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor (const rule of rules) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (rule[1].properties.is_valid.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage += \" violates rule \" + rule[0];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(rule[1].properties.is_valid.state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(not_valid.properties.invalid_rules.state);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\treportErrorsOnNode(\n\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.state.ref.properties.node,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcsv_record,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn_path_builder.state(attribute_name, $.properties.state.entry),\n\t\t\t\t\t\t\t\t\t\t\t\t\treport_error\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(state_group_property.properties.is_set.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (message.length > 0) {\n\t\t\t\t\t\t\t\t\t\t\tconst column_name = column_path_builder.state_group(attribute_name).build();\n\t\t\t\t\t\t\t\t\t\t\treport_error(column_name, message);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(state_group_property.properties.is_valid.state);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\tconst text_property = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tswitch (text_property.properties.is_valid.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\tlet message = \"\";\n\t\t\t\t\t\t\t\t\t\tconst column_name = column_path_builder.text(attribute_name).build();\n\t\t\t\t\t\t\t\t\t\tconst not_valid = text_property.properties.is_valid.state.node;\n\t\t\t\t\t\t\t\t\t\tswitch (not_valid.properties.invalid_rules.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst rules = text_property.properties.navigable.cast(\"yes\").properties.rules.properties.rules;\n\t\t\t\t\t\t\t\t\t\t\t\tfor (const rule of rules) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (rule[1].properties.is_valid.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage += \"violate rule(s):\" + rule[0];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(rule[1].properties.is_valid.state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t//cast to reference and walk rules\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(not_valid.properties.invalid_rules.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tswitch (not_valid.properties.key_is_not_unique.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tmessage += \" key must be unique\";\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(not_valid.properties.key_is_not_unique.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tswitch (not_valid.properties.text_does_not_match_pattern.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst $ = not_valid.properties.text_does_not_match_pattern.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\tmessage += \" text must match pattern \" + $.properties.pattern;\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(not_valid.properties.text_does_not_match_pattern.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tswitch (not_valid.properties.reference_not_resolved.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tmessage += \" must reference a valid entry\";\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(not_valid.properties.reference_not_resolved.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treport_error(column_name, message);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState(text_property.properties.is_valid.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(node.properties.is_valid.state);\n\t}\n}\n\nconst BATCH_SIZE = 250;\nexport async function importCsv(\n\tcontext_node: api_cs.Cnode,\n\ttarget_node_def: api_gui.Cgui_node,\n\tfile: File\n): Promise {\n\tconst csv_data = await importCsvFile(file);\n\tconst records = csv_data.data;\n\tconst fields = new Set(csv_data.meta.fields);\n\t// Remove any error columns in case the user edited the errors file and reuploaded\n\tconst error_fields = csv_data.meta.fields.filter((f) => f.startsWith(error_prefix));\n\tfor (const error_field of error_fields) {\n\t\tfor (const record of records) {\n\t\t\tdelete record[error_field];\n\t\t}\n\t\tfields.delete(error_field);\n\t}\n\t// Validate the executability of the CSV\n\tconst [key_fields] = getKeyFieldNames(context_node.input.node_type(), target_node_def);\n\tconst last_key_field = [...key_fields][key_fields.size - 1] ?? \"\";\n\tawait validateCsv(context_node, target_node_def, key_fields, fields, last_key_field, records);\n\tconst number_of_csv_entries = csv_data.data.length;\n\tlet error_batch: typeof records = [];\n\tconst error_fields_during_run = new Set();\n\tfor (let i = 0; i < number_of_csv_entries; i += BATCH_SIZE) {\n\t\tconst csv_data_batch = records.slice(i, i + BATCH_SIZE);\n\t\tconst error_reporter = new ErrorReporter();\n\t\tawait executeCsv(context_node, target_node_def, csv_data_batch, error_reporter, last_key_field);\n\t\tif (error_reporter.error_fields.size > 0) {\n\t\t\tfor (const field of error_reporter.error_fields) {\n\t\t\t\terror_fields_during_run.add(field);\n\t\t\t}\n\t\t\terror_batch = error_batch.concat(csv_data_batch);\n\t\t}\n\t}\n\tif (error_fields_during_run.size > 0) {\n\t\tconst field_for_errors_csv = [...mergeErrorFields(fields, error_fields_during_run)];\n\t\tsaveAs(createCSVBlob(papa.unparse({ data: error_batch, fields: field_for_errors_csv })), \"errors.csv\");\n\t\tthrow new ImportError(\"The CSV file is not valid. Refer to the error report and try again.\");\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport DestructorTree from \"../DestructorTree\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport NodePathBuilder from \"../navigation/NodePathBuilder\";\nimport { CollectionPathBuilder } from \"../navigation/createCollectionPathBuilder\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport { createNodeExistanceFilter } from \"../state 2 interface/createPropertiesDictionaryFromColumns\";\nimport {\n\tui_scalar_default,\n\tStateChoice,\n\tnode_path_tail,\n\tdescendant_object_path,\n\tUIContext,\n\tStringLike,\n} from \"../state/expressions\";\nimport supportsSelfReference from \"../state/supportsSelfReference\";\nimport { registerEntry } from \"./registerClientState\";\nimport { getUserNameOrDefault, ignoreCollectionDefaults } from \"./ClientState\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_cr = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport uuid = require(\"./uuid\");\nimport update = require(\"./../widgets/instructions/update\");\nimport { getCurrentDate, getCurrentDateAndTime } from \"../calendar/current\";\nimport messages = require(\"../front/messages\");\nimport SubscriptionBuilder from \"../state 2 interface/SubscriptionBuilder\";\nimport reQuery = require(\"../state 2 interface/reQuery\");\nimport * as Sets from \"../Sets\";\nimport * as Collection from \"../state/Collection\";\nimport * as Entry from \"../state/Entry\";\nimport * as Text from \"../state/Text\";\nimport { iReference } from \"../state/Reference\";\nimport { ObservableSet } from \"../observableTypes\";\nimport { isSaving } from \"../state/Node\";\nimport { getGuiText, getGuiNumber, getGuiStategroup, getGuiCollection } from \"../guiModel\";\nimport { TaskManager } from \"../TaskManager\";\nimport {\n\tlambda,\n\tscalarValue,\n\tScalarProvider,\n\tcreateExpressionBuilder,\n\tWeakCache,\n\tcreateVariable,\n\tNone,\n\tScalar,\n\tMutableVariable,\n\tDefaultExpressionBuilder,\n} from \"../../../../../stream\";\nimport { toStream, toVariable } from \"../toStream\";\nimport { Pending, Unknown, Failed, Result, isResolved } from \"../Status\";\nimport { iText } from \"../state/Text\";\nimport { iStategroup, iState } from \"../state/Stategroup\";\nimport { iCollection } from \"../state/Collection\";\nimport { definesGraphInsertionPosition } from \"../state/Graph\";\nimport clientWorkIsDone from \"../state/tasks\";\n\nconst stringUIScalarDefault = WeakCache<\n\tapi_app.Cui_scalar_default,\n\tDefaultExpressionBuilder>\n>((definition) => ui_scalar_default(definition));\n\nconst numberUIScalarDefault = WeakCache<\n\tapi_app.Cui_scalar_default,\n\tDefaultExpressionBuilder>\n>((definition) => ui_scalar_default(definition));\n\nconst stategroupUIScalarDefault = WeakCache<\n\tapi_app.Cui_scalar_default,\n\tDefaultExpressionBuilder>\n>((definition) => ui_scalar_default(definition));\n\nconst textDefaultExpression = WeakCache<\n\tapi_app.Ctext__type__property,\n\tDefaultExpressionBuilder>\n>((definition): DefaultExpressionBuilder> => {\n\tconst gui_text = getGuiText(definition);\n\tif (!gui_text) return lambda>(() => Unknown);\n\tconst has_default = gui_text.properties.default_.state;\n\tswitch (has_default.name) {\n\t\tcase \"no\":\n\t\t\treturn lambda>(() => Unknown);\n\t\tcase \"yes\": {\n\t\t\tconst $source = has_default.node.properties.source.state;\n\t\t\tswitch ($source.name) {\n\t\t\t\tcase \"current user\":\n\t\t\t\t\treturn createExpressionBuilder().pipe(() => getUserNameOrDefault() ?? Unknown);\n\t\t\t\tcase \"guid\":\n\t\t\t\t\treturn lambda>(() => ({ toString: () => uuid.generate() }));\n\t\t\t\tcase \"auto select only candidate\":\n\t\t\t\t\tswitch (definition.properties.has_reference.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\treturn lambda>(() => Unknown);\n\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\treturn lambda>((text) =>\n\t\t\t\t\t\t\t\tautofillOnlyCandidate(text.properties.navigable.cast(\"yes\"))\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"expression\":\n\t\t\t\t\treturn createExpressionBuilder().pipe((text) =>\n\t\t\t\t\t\tstringUIScalarDefault($source.node.inferences.text_with_default().properties.default_)([\n\t\t\t\t\t\t\ttext.component_root,\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\ttext.parent,\n\t\t\t\t\t\t])\n\t\t\t\t\t);\n\t\t\t\tcase \"select source\":\n\t\t\t\t\treturn lambda>(() => Unknown);\n\t\t\t}\n\t\t}\n\t}\n});\n\nconst numberDefaultExpression = WeakCache<\n\tapi_app.Cnumber__type__property,\n\tDefaultExpressionBuilder>\n>((definition) => {\n\tconst gui_number = getGuiNumber(definition);\n\tif (!gui_number) return lambda>(() => Unknown);\n\tconst has_default = gui_number.properties.default_.state;\n\tswitch (has_default.name) {\n\t\tcase \"no\":\n\t\t\treturn lambda>(() => Unknown);\n\t\tcase \"yes\": {\n\t\t\tconst $value = has_default.node.properties.value.state;\n\t\t\tswitch ($value.name) {\n\t\t\t\tcase \"today\":\n\t\t\t\t\treturn lambda>(() => getCurrentDate());\n\t\t\t\tcase \"now\":\n\t\t\t\t\treturn lambda>(() => getCurrentDateAndTime());\n\t\t\t\tcase \"zero\":\n\t\t\t\t\treturn lambda>(() => 0);\n\t\t\t\tcase \"one\":\n\t\t\t\t\treturn lambda>(() => 1);\n\t\t\t\tcase \"expression\":\n\t\t\t\t\treturn lambda>((number) =>\n\t\t\t\t\t\tnumberUIScalarDefault($value.node.inferences.model_expression().properties.default_)([\n\t\t\t\t\t\t\tnumber.component_root,\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\tnumber.parent,\n\t\t\t\t\t\t])\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n});\n\nconst stategroupDefaultExpression = WeakCache<\n\tapi_app.Cstate_group,\n\tDefaultExpressionBuilder>\n>((definition) => {\n\tconst gui_stategroup = getGuiStategroup(definition);\n\tif (!gui_stategroup) return lambda>(() => Unknown);\n\tconst has_default = gui_stategroup.properties.default_.state;\n\tswitch (has_default.name) {\n\t\tcase \"no\":\n\t\t\treturn lambda>(() => Unknown);\n\t\tcase \"yes\": {\n\t\t\tconst $source = has_default.node.properties.source.state;\n\t\t\tswitch ($source.name) {\n\t\t\t\tcase \"state\":\n\t\t\t\t\treturn lambda>(\n\t\t\t\t\t\t() => $source.node.properties.state.ref.key.ref\n\t\t\t\t\t);\n\t\t\t\tcase \"state switch\":\n\t\t\t\t\treturn lambda>((stategroup) =>\n\t\t\t\t\t\tstategroupUIScalarDefault($source.node.inferences.model_state_switch().properties.default_)([\n\t\t\t\t\t\t\tstategroup.component_root,\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\tstategroup.parent,\n\t\t\t\t\t\t])\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n});\n\nconst textDefault = WeakCache>>((text) =>\n\ttextDefaultExpression(text.inferences.text_type())(text)\n);\n\nconst numberDefault = WeakCache>>((number) =>\n\tnumberDefaultExpression(number.inferences.number_type())(number)\n);\n\nconst stategroupDefault = WeakCache>>((stategroup) =>\n\tstategroupDefaultExpression(stategroup.inferences.state_group_type())(stategroup)\n);\n\ntype LiveUpdatedObject = {\n\tlive_update: boolean;\n};\n\nfunction isLiveUpdated(live_updated_object: LiveUpdatedObject, destructor: DestructorTree): boolean {\n\tif (live_updated_object.live_update) {\n\t\treturn true;\n\t} else {\n\t\tlive_updated_object.live_update = true;\n\t\tdestructor.onDestroy(() => {\n\t\t\tlive_updated_object.live_update = false;\n\t\t});\n\t\treturn false;\n\t}\n}\n\nexport function cancelDefault(property: api_cs.Cproperty, destructor: DestructorTree): void {\n\tisLiveUpdated(property as unknown as LiveUpdatedObject, destructor);\n}\n\nconst defaultsManager = new TaskManager(0);\n\nexport const applyingDefaults = new ObservableSet();\nexport async function onFinishedApplyingDefaults(): Promise {\n\tawait defaultsManager.finished();\n\treturn applyingDefaults.size.await((value) => value <= 0);\n}\n\nfunction startApplying(property: api_cs.Cproperty, destructor: DestructorTree) {\n\tif (!applyingDefaults.has(property)) {\n\t\tdestructor.onDestroy(() => stopApplying(property));\n\t\tapplyingDefaults.add(property);\n\t}\n}\n\nfunction stopApplying(property: api_cs.Cproperty) {\n\tapplyingDefaults.delete(property);\n}\n\nexport function applyDefaultsWithUpdates(\n\tcs_node: api_cs.Cnode,\n\tdestructor: DestructorTree = new DestructorTree()\n): void {\n\tdestructor.subscribeToStategroup(cs_node.properties.location, (destructor) => {\n\t\tswitch (cs_node.properties.location.state.name) {\n\t\t\tcase \"remote\":\n\t\t\t\tbreak;\n\t\t\tcase \"local\":\n\t\t\t\tdestructor.subscribeToCollection(\n\t\t\t\t\tcs_node.properties.attributes,\n\t\t\t\t\t{\n\t\t\t\t\t\ton_add: (attribute, destructor) => {\n\t\t\t\t\t\t\tattribute.properties.type.switch({\n\t\t\t\t\t\t\t\toperation: undefined,\n\t\t\t\t\t\t\t\tproperty: (property) => {\n\t\t\t\t\t\t\t\t\tdefaultsManager.queue(() => {\n\t\t\t\t\t\t\t\t\t\tapplyPropertyDefault(property, destructor);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t/*init=*/ true\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(cs_node.properties.location.state);\n\t\t}\n\t});\n\tdestructor.subscribeToCollection(\n\t\tcs_node.properties.attributes,\n\t\t{\n\t\t\ton_add: (attribute, destructor) =>\n\t\t\t\tattribute.properties.type.switch({\n\t\t\t\t\toperation: undefined,\n\t\t\t\t\tproperty: (property) =>\n\t\t\t\t\t\tproperty.properties.type.switch({\n\t\t\t\t\t\t\tnumber: undefined,\n\t\t\t\t\t\t\ttext: undefined,\n\t\t\t\t\t\t\tfile: undefined,\n\t\t\t\t\t\t\tgroup: (group) => applyDefaultsWithUpdates(group.properties.node, destructor),\n\t\t\t\t\t\t\t\"state group\": (stategroup) =>\n\t\t\t\t\t\t\t\tdestructor.subscribeToStategroup(stategroup.properties.is_set, (destructor) => {\n\t\t\t\t\t\t\t\t\tstategroup.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t\t\t\tstategroupPropertySubscribeToSetBy($, destructor);\n\t\t\t\t\t\t\t\t\t\t\tapplyDefaultsWithUpdates($.properties.state.ref.properties.node, destructor);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcollection: (collection) =>\n\t\t\t\t\t\t\t\tdestructor.subscribeToCollection(\n\t\t\t\t\t\t\t\t\tcollection.properties.entries,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ton_add: (entry, destructor) => {\n\t\t\t\t\t\t\t\t\t\t\tdestructor.subscribeToStategroup(entry.properties.location, (destructor) => {\n\t\t\t\t\t\t\t\t\t\t\t\tentry.properties.location.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tremote: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocal: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpropertyEntrySubscribeToSetBy($, destructor);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\tapplyDefaultsWithUpdates(entry.properties.node, destructor);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t/*init=*/ true\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t},\n\t\t/*init=*/ true\n\t);\n}\n\nexport function applyOperationDefaults(\n\toperation: api_cs.Cyes__started,\n\tdestructor: DestructorTree = new DestructorTree()\n): void {\n\tdestructor.subscribeToStategroup(operation.properties.executing, (destructor) => {\n\t\toperation.properties.executing.switch({\n\t\t\tyes: undefined,\n\t\t\tno: () => applyDefaultsWithUpdates(operation.properties.node, destructor),\n\t\t});\n\t});\n}\n\nfunction applyPropertyDefault(cs_property: api_cs.Cproperty, destructor: DestructorTree): void {\n\tif (\n\t\tcs_property.destroyed ||\n\t\tdestructor.destroyed ||\n\t\tisLiveUpdated(cs_property as unknown as LiveUpdatedObject, destructor)\n\t) {\n\t\treturn;\n\t}\n\tconst this_node = cs_property.parent.parent;\n\tswitch (cs_property.properties.type.state.name) {\n\t\tcase \"text\": {\n\t\t\tconst cs_text = cs_property.properties.type.state.node;\n\t\t\tlet updating = false;\n\t\t\tconst exp = textPropertyModifiedByUser(cs_text).pipe((modified_by_user) => {\n\t\t\t\tif (modified_by_user) return Unknown;\n\t\t\t\treturn textDefault(cs_text);\n\t\t\t})();\n\t\t\tconst subscription = exp.subscribe({\n\t\t\t\tupdate: async (value) => {\n\t\t\t\t\tif (cs_property.destroyed) return;\n\t\t\t\t\tif (isSaving(this_node) || isSetByCollectionDefault(cs_text) || isRemote(cs_property.component_root)) {\n\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (updating) return;\n\t\t\t\t\tswitch (value) {\n\t\t\t\t\t\tcase Unknown:\n\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Pending:\n\t\t\t\t\t\t\tstartApplying(cs_property, destructor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Failed:\n\t\t\t\t\t\t\tupdating = true;\n\t\t\t\t\t\t\tiText(cs_text).discard();\n\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\tupdating = false;\n\t\t\t\t\t\t\tif (global.alan_debug) {\n\t\t\t\t\t\t\t\t(cs_text as any).__alan_default = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tupdating = true;\n\t\t\t\t\t\t\tconst str = value.toString();\n\t\t\t\t\t\t\tiText(cs_text).update(str, \"engine\", false);\n\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\tupdating = false;\n\t\t\t\t\t\t\tif (global.alan_debug) {\n\t\t\t\t\t\t\t\t(cs_text as any).__alan_default = \"applied \" + str;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t\tdestructor.onDestroy(() => exp.unsubscribe(subscription));\n\t\t\tbreak;\n\t\t}\n\t\tcase \"number\": {\n\t\t\tconst cs_number = cs_property.properties.type.state.node;\n\t\t\tif (global.alan_debug) {\n\t\t\t\t(cs_number as any).__alan_default = \"initialized\";\n\t\t\t}\n\t\t\tlet updating = false;\n\t\t\tconst exp = numberPropertyModifiedByUser(cs_number).pipe((modified_by_user) => {\n\t\t\t\tif (modified_by_user) return Unknown;\n\t\t\t\treturn numberDefault(cs_number);\n\t\t\t})();\n\t\t\tconst subscription = exp.subscribe({\n\t\t\t\tupdate: (value) => {\n\t\t\t\t\tif (cs_property.destroyed) return;\n\t\t\t\t\tif (isSaving(this_node) || isRemote(cs_property.component_root)) {\n\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (updating) return;\n\t\t\t\t\tif (global.alan_debug) {\n\t\t\t\t\t\t(cs_number as any).__alan_default = `applied ${String(value)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (value) {\n\t\t\t\t\t\tcase Unknown:\n\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Pending:\n\t\t\t\t\t\t\tstartApplying(cs_property, destructor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Failed:\n\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\tupdating = true;\n\t\t\t\t\t\t\tupdate.unset_number(cs_number);\n\t\t\t\t\t\t\tupdating = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\tupdating = true;\n\t\t\t\t\t\t\tupdate.number(cs_number, value, \"engine\");\n\t\t\t\t\t\t\tupdating = false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t\tdestructor.onDestroy(() => exp.unsubscribe(subscription));\n\t\t\tbreak;\n\t\t}\n\t\tcase \"file\":\n\t\t\tbreak;\n\t\tcase \"group\":\n\t\t\tbreak;\n\t\tcase \"state group\": {\n\t\t\tconst cs_stategroup = cs_property.properties.type.state.node;\n\t\t\tif (definesGraphInsertionPosition(cs_stategroup)) return;\n\t\t\tlet updating = false;\n\t\t\tconst exp = stategroupPropertyModifiedByUser(cs_stategroup).pipe((modified_by_user) => {\n\t\t\t\tif (modified_by_user) return Unknown;\n\t\t\t\treturn stategroupDefault(cs_stategroup);\n\t\t\t})();\n\t\t\tconst subscription = exp.subscribe({\n\t\t\t\tupdate: (value) => {\n\t\t\t\t\tif (cs_property.destroyed) return;\n\t\t\t\t\tif (isSaving(this_node) || isRemote(cs_property.component_root)) {\n\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (updating) return;\n\t\t\t\t\tif (global.alan_debug) {\n\t\t\t\t\t\t(cs_stategroup as any).__alan_default = \"initialized\";\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (value) {\n\t\t\t\t\t\tcase Unknown:\n\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Pending:\n\t\t\t\t\t\t\tstartApplying(cs_property, destructor);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Failed:\n\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\tupdating = true;\n\t\t\t\t\t\t\tiStategroup(cs_stategroup).discard();\n\t\t\t\t\t\t\tupdating = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\tupdating = true;\n\t\t\t\t\t\t\tiState(cs_stategroup.properties.states.get(value.key)!).__select(\"engine\");\n\t\t\t\t\t\t\tupdating = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t\tdestructor.onDestroy(() => exp.unsubscribe(subscription));\n\t\t\tbreak;\n\t\t}\n\t\tcase \"collection\": {\n\t\t\tconst cs_collection = cs_property.properties.type.state.node;\n\t\t\tconst gui_collection = getGuiCollection(cs_collection.inferences.collection_type());\n\t\t\tgui_collection?.properties.default_.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: ($) => {\n\t\t\t\t\tconst subscription_on_ignore = ignoreCollectionDefaults.subscribe({\n\t\t\t\t\t\tupdate: (ignore) => {\n\t\t\t\t\t\t\tif (ignore === true || isRemote(cs_property.component_root)) {\n\t\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\t\tclearCollectionDefaults(cs_collection);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (global.alan_debug) {\n\t\t\t\t\t\t\t\t(cs_collection as any).__alan_default = \"initialized\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst has_default = $.inferences.model_expression();\n\t\t\t\t\t\t\tconst source_collection_def = has_default.properties.key_reference.output\n\t\t\t\t\t\t\t\t.definition()\n\t\t\t\t\t\t\t\t.output.collection();\n\t\t\t\t\t\t\tfunction on_value(source_keys: Set) {\n\t\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\t\tif (global.alan_debug) {\n\t\t\t\t\t\t\t\t\t(cs_collection as any).__alan_default = \"applied\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst target_keys: Set = new Set();\n\t\t\t\t\t\t\t\tcs_collection.properties.entries.forEach((entry) => {\n\t\t\t\t\t\t\t\t\tconst target_key = Entry.getKeyValue(entry);\n\t\t\t\t\t\t\t\t\tif (target_key !== undefined) {\n\t\t\t\t\t\t\t\t\t\ttarget_keys.add(target_key);\n\t\t\t\t\t\t\t\t\t\tentry.properties.location.switch({\n\t\t\t\t\t\t\t\t\t\t\tremote: undefined,\n\t\t\t\t\t\t\t\t\t\t\tlocal: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t$.properties.modified_by.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tuser: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\tengine: () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst is_duplicate = entry.properties.key.inferences.key().properties.key_unique.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (!source_keys.has(target_key) || is_duplicate) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiCollection($.parent.parent).removeEntry($.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tsource_keys.forEach((source_key) => {\n\t\t\t\t\t\t\t\t\tif (!target_keys.has(source_key)) {\n\t\t\t\t\t\t\t\t\t\tconst entry = iCollection(cs_collection).__addEntry(\"engine\", source_key);\n\t\t\t\t\t\t\t\t\t\t// update graph only if no default on the edge reference\n\t\t\t\t\t\t\t\t\t\tfor (const graph of iCollection(cs_collection).graphs) {\n\t\t\t\t\t\t\t\t\t\t\tgraph.edge_reference.properties.ui.properties.default_value.switch({\n\t\t\t\t\t\t\t\t\t\t\t\tno: () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tgraph.addEntry(entry, \"engine\");\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tyes: () => undefined,\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tregisterEntry(entry, destructor);\n\t\t\t\t\t\t\t\t\t\t// the key that is referenced by default does not have to be the collection key (but can be a derived value)\n\t\t\t\t\t\t\t\t\t\tconst target_text_property = has_default.properties.key_reference.output.property().parent;\n\t\t\t\t\t\t\t\t\t\tconst source_key_property = source_collection_def.properties.key_property.ref;\n\t\t\t\t\t\t\t\t\t\tif (source_key_property !== target_text_property) {\n\t\t\t\t\t\t\t\t\t\t\tconst cs_target_text_property = entry.properties.node.properties.attributes\n\t\t\t\t\t\t\t\t\t\t\t\t.get(target_text_property.parent.parent.key)!\n\t\t\t\t\t\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t\t\t\t\t\t.properties.type.cast(\"text\");\n\t\t\t\t\t\t\t\t\t\t\tif (cs_target_text_property !== entry.properties.key.ref) {\n\t\t\t\t\t\t\t\t\t\t\t\tcs_target_text_property.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext: source_key,\n\t\t\t\t\t\t\t\t\t\t\t\t\tby: [\"engine\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\tcs_target_text_property.properties.backend_known.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: source_key,\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t// update queries\n\t\t\t\t\t\t\t\treQuery.queriesForCollectionFromNode(cs_property.parent.parent, cs_collection);\n\t\t\t\t\t\t\t\tclientWorkIsDone().then(() => {\n\t\t\t\t\t\t\t\t\tif (cs_collection.destroyed) return;\n\t\t\t\t\t\t\t\t\tfor (const graph of iCollection(cs_collection).graphs) {\n\t\t\t\t\t\t\t\t\t\tgraph.reset(false);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst definition = has_default.properties.key_reference.output.definition().variant;\n\t\t\t\t\t\t\tswitch (definition.name) {\n\t\t\t\t\t\t\t\tcase \"reference\": {\n\t\t\t\t\t\t\t\t\tconst key_reference_definition = definition.definition;\n\t\t\t\t\t\t\t\t\tconst exp = collectionPropertyModifiedByUser(cs_collection)\n\t\t\t\t\t\t\t\t\t\t.pipe((modified_by_user) => {\n\t\t\t\t\t\t\t\t\t\t\tif (modified_by_user) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn Unknown;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tstartApplying(cs_property, destructor);\n\t\t\t\t\t\t\t\t\t\t\treturn Collection.resolveMatrixSourceCollection(cs_collection, key_reference_definition)();\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t.pipe((source_collection) => {\n\t\t\t\t\t\t\t\t\t\t\tswitch (source_collection) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase Unknown:\n\t\t\t\t\t\t\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn Unknown;\n\t\t\t\t\t\t\t\t\t\t\t\tcase Pending:\n\t\t\t\t\t\t\t\t\t\t\t\t\tstartApplying(cs_property, destructor);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn Pending;\n\t\t\t\t\t\t\t\t\t\t\t\tcase Failed:\n\t\t\t\t\t\t\t\t\t\t\t\t\tclearCollectionDefaults(cs_collection);\n\t\t\t\t\t\t\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn subscribeToSourceCollection(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsource_collection,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey_reference_definition,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thas_default.properties.entry_filter\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t})();\n\t\t\t\t\t\t\t\t\tconst subscription = exp.subscribe({\n\t\t\t\t\t\t\t\t\t\tupdate: (source_collection) => {\n\t\t\t\t\t\t\t\t\t\t\tif (cs_property.destroyed) return;\n\t\t\t\t\t\t\t\t\t\t\t// huh? this is weird code\n\t\t\t\t\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\t\t\t\t\tswitch (source_collection) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase Unknown:\n\t\t\t\t\t\t\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\tcase Pending:\n\t\t\t\t\t\t\t\t\t\t\t\t\tstartApplying(cs_property, destructor);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\tcase Failed:\n\t\t\t\t\t\t\t\t\t\t\t\t\tclearCollectionDefaults(cs_collection);\n\t\t\t\t\t\t\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\ton_value(source_collection);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tdestructor.onDestroy(() => exp.unsubscribe(subscription));\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"containment\":\n\t\t\t\t\t\t\t\t\t//TODO properly implement containment\n\t\t\t\t\t\t\t\t\tstopApplying(cs_property);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tcs_collection.onDestroy(() => ignoreCollectionDefaults.unsubscribe(subscription_on_ignore));\n\t\t\t\t},\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nfunction isRemote(node: api_cs.Cnode) {\n\treturn node.properties.location.switch({\n\t\tlocal: false,\n\t\tremote: true,\n\t});\n}\n\nfunction clearCollectionDefaults(cs_collection: api_cs.Ccollection) {\n\tif (cs_collection.destroyed) return;\n\tcs_collection.properties.entries.forEach((entry) => {\n\t\tentry.properties.location.switch({\n\t\t\tremote: undefined,\n\t\t\tlocal: ($) => {\n\t\t\t\t$.properties.modified_by.switch({\n\t\t\t\t\tuser: undefined,\n\t\t\t\t\tengine: () => {\n\t\t\t\t\t\tiCollection($.parent.parent).removeEntry($.parent);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t});\n}\n\nfunction subscribeToSourceCollection(\n\tsource_collection: api_cs.Ccollection,\n\tkey_reference_definition: api_app.Centry_reference_definition,\n\tentry_filter: api_app.Cnode_path_tail\n): ScalarProvider>> {\n\tconst source_collection_name = source_collection.parent.parent.key.entry;\n\n\tasync function getRemoteEntries(id_path_builder: IdPathBuilder, stream: MutableVariable>>) {\n\t\tconst filters: Record = {};\n\t\tconst node_path = mapObjectPathTailToNodePath(\n\t\t\tkey_reference_definition.properties.tail.properties.path,\n\t\t\tnew NodePathBuilder()\n\t\t);\n\t\tif (node_path !== undefined) {\n\t\t\tfilters[\"reference filter\"] = createNodePathTailFilter(entry_filter, node_path);\n\t\t}\n\n\t\tasync function querySourceCollection(): Promise>> {\n\t\t\tconst result = await DatastoreProxy.instance.collectionQuery({\n\t\t\t\tfilters: {\n\t\t\t\t\t\"todo filter\": [\"no\", {}],\n\t\t\t\t\t\"value filters\": filters,\n\t\t\t\t},\n\t\t\t\t\"context node path\": id_path_builder.build(),\n\t\t\t\t\"collection path\": CollectionPathBuilder.create().collection(source_collection_name).build(),\n\t\t\t\t\"select entries\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"limit number of entries\": Number.MAX_SAFE_INTEGER,\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\taggregates: {},\n\t\t\t});\n\t\t\tif (stream.destroyed) {\n\t\t\t\treturn Failed;\n\t\t\t}\n\n\t\t\tconst $context = result.properties.context.state;\n\t\t\tswitch ($context.name) {\n\t\t\t\tcase \"exists\": {\n\t\t\t\t\tconst $entries = $context.node.properties.entries.state;\n\t\t\t\t\tswitch ($entries.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\treturn Unknown;\n\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\tswitch ($entries.node.properties.limit_exceeded.state.name) {\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\tmessages.addMessage(\"warning\", \"Not all subcollections copied\", {\n\t\t\t\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\t\t\tphrase: \"{0} have not been copied because it contains too many items.\",\n\t\t\t\t\t\t\t\t\t\t\tvars: [source_collection_name],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\treturn Unknown;\n\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\tconst $state = $entries.node.properties.entries.properties.has_steps.state;\n\t\t\t\t\t\t\t\t\tswitch ($state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\treturn Unknown;\n\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\treturn $state.node.properties.entries\n\t\t\t\t\t\t\t\t\t\t\t\t.toArray()\n\t\t\t\t\t\t\t\t\t\t\t\t.reduce>((r, e) => (r.add(e[0]), r), new Set());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"does not exist\":\n\t\t\t\t\treturn Unknown;\n\t\t\t\tcase \"permission denied\":\n\t\t\t\t\treturn Unknown;\n\t\t\t}\n\t\t}\n\t\tconst subscription_builder = SubscriptionBuilder.create();\n\t\tconst entry_subscription_builder = subscription_builder.collection_entries(source_collection_name);\n\t\tmapDescendantObjectPathToSubscriptionBuilder(key_reference_definition.properties.tail, entry_subscription_builder);\n\t\tmapNodePathTailToSubscriptionBuilder(entry_filter, entry_subscription_builder);\n\n\t\tconst datastore_subscription = DatastoreProxy.instance.subscribe(\n\t\t\t{\n\t\t\t\t\"context node\": id_path_builder.build(),\n\t\t\t\t\"mutation permissions\": \"ignore\",\n\t\t\t\t\"node subscription\": {\n\t\t\t\t\tattributes: subscription_builder.properties,\n\t\t\t\t},\n\t\t\t},\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\t\t\t() => {},\n\t\t\tasync (notification) => {\n\t\t\t\tif (stream.destroyed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tswitch (notification.properties.context.state.name) {\n\t\t\t\t\tcase \"exists\": {\n\t\t\t\t\t\tconst entries = await querySourceCollection();\n\t\t\t\t\t\tstream.set(entries);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"permission denied\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"does not exist\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tstream.onDestroy(() => {\n\t\t\tdatastore_subscription.unsubscribe();\n\t\t});\n\t\tconst entries = await querySourceCollection();\n\t\tstream.set(entries);\n\t}\n\n\tconst source_collection_node = source_collection.parent.parent.parent;\n\tswitch (source_collection_node.properties.location.state.name) {\n\t\tcase \"local\": {\n\t\t\tconst keyCollection = createVariable(new Set(), true);\n\t\t\tconst keyCollector = toStream(source_collection.properties.entries)\n\t\t\t\t.map(([, entry]) =>\n\t\t\t\t\tnode_path_tail(entry_filter).pipe((node) => (isResolved(node) ? entry : None))(entry.properties.node)\n\t\t\t\t)\n\t\t\t\t.filter()\n\t\t\t\t.map(([, entry]) =>\n\t\t\t\t\tcreateExpressionBuilder(entry).pipe((entry) =>\n\t\t\t\t\t\tcreateExpressionBuilder(Text.value(entry.properties.key.ref)).pipe((value) =>\n\t\t\t\t\t\t\tvalue === Failed ? None : value\n\t\t\t\t\t\t)()\n\t\t\t\t\t)()\n\t\t\t\t)\n\t\t\t\t.filter()();\n\t\t\tconst subscription = keyCollector.subscribe({\n\t\t\t\tadd: () => {\n\t\t\t\t\tkeyCollection.set(new Set([...keyCollector.entries.values()].map((v) => scalarValue(v))));\n\t\t\t\t},\n\t\t\t\tremove: () => {\n\t\t\t\t\tkeyCollection.set(new Set([...keyCollector.entries.values()].map((v) => scalarValue(v))));\n\t\t\t\t},\n\t\t\t});\n\t\t\tsource_collection.onDestroy(() => {\n\t\t\t\tkeyCollection.destroy();\n\t\t\t\tkeyCollector.unsubscribe(subscription);\n\t\t\t});\n\t\t\treturn keyCollection;\n\t\t}\n\t\tcase \"remote\": {\n\t\t\tconst remote_stream = createVariable>>(Pending, true);\n\t\t\tgetRemoteEntries(createIdPathBuilderFromNode(source_collection_node), remote_stream);\n\t\t\treturn remote_stream;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(source_collection_node.properties.location.state);\n\t}\n}\n\nfunction mapDescendantObjectPathToQueryFilters(path: api_app.Cdescendant_object_path): api_cr.Tvalue_filters[] {\n\tconst node_path = mapObjectPathTailToNodePath(path.properties.path, new NodePathBuilder());\n\tif (node_path) {\n\t\treturn [createNodeExistanceFilter(node_path.build())];\n\t}\n\treturn [];\n}\nfunction mapObjectPathTailToNodePath(\n\tpath: api_app.Cobject_path_tail,\n\tbuilder: NodePathBuilder\n): NodePathBuilder | undefined {\n\treturn path.properties.has_steps.switch({\n\t\tno: () => builder,\n\t\tyes: ($) => {\n\t\t\tconst tail = $.properties.tail;\n\t\t\treturn $.properties.type.switch({\n\t\t\t\tparent: () => builder.parent(),\n\t\t\t\tdependency: () => undefined, //TODO implement?\n\t\t\t\t\"reference set\": () => undefined,\n\t\t\t\t\"property value\": ($) =>\n\t\t\t\t\t$.properties.property.properties.property.ref.properties.type.switch({\n\t\t\t\t\t\tnumber: () => undefined,\n\t\t\t\t\t\ttext: () => undefined,\n\t\t\t\t\t\tfile: () => undefined,\n\t\t\t\t\t\tcollection: () => undefined,\n\t\t\t\t\t\tgroup: () =>\n\t\t\t\t\t\t\tmapObjectPathTailToNodePath(tail, builder.group($.properties.property.properties.property.entry)),\n\t\t\t\t\t\t\"state group\": () => mapObjectPathTailToNodePath(tail, builder),\n\t\t\t\t\t}),\n\t\t\t\tstate: ($) => {\n\t\t\t\t\tconst stategroup = $.properties.state.ref.parent.parent.parent.key;\n\t\t\t\t\tconst state = $.properties.state.entry;\n\t\t\t\t\treturn mapObjectPathTailToNodePath(tail, builder.state(stategroup, state));\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n}\n\nfunction createNodePathTailFilter(path: api_app.Cnode_path_tail, builder: NodePathBuilder): api_cr.Tvalue_filters {\n\treturn createNodeExistanceFilter(mapNodePathTailToNodePath(path, builder).build());\n}\nfunction mapNodePathTailToNodePath(path: api_app.Cnode_path_tail, path_builder: NodePathBuilder): NodePathBuilder {\n\treturn path.properties.has_steps.switch({\n\t\tyes: ($has_step) =>\n\t\t\t$has_step.properties.step.properties.type.switch({\n\t\t\t\tparent: () => mapNodePathTailToNodePath($has_step.properties.tail, path_builder.parent()),\n\t\t\t\tgroup: ($) =>\n\t\t\t\t\tmapNodePathTailToNodePath($has_step.properties.tail, path_builder.group($.properties.group.entry)),\n\t\t\t\t\"property rule\": ($) =>\n\t\t\t\t\tmapNodePathTailToNodePath(\n\t\t\t\t\t\t$has_step.properties.tail,\n\t\t\t\t\t\tpath_builder.reference_rule($.properties.text.entry, $.properties.rule.entry)\n\t\t\t\t\t),\n\t\t\t\treference: ($) =>\n\t\t\t\t\tmapNodePathTailToNodePath($has_step.properties.tail, path_builder.reference($.properties.text.entry)),\n\t\t\t\tstate: ($) =>\n\t\t\t\t\tmapNodePathTailToNodePath(\n\t\t\t\t\t\t$has_step.properties.tail,\n\t\t\t\t\t\tpath_builder.state($.properties.state_group.entry, $.properties.state.entry)\n\t\t\t\t\t),\n\t\t\t\t\"state context rule\": ($) =>\n\t\t\t\t\tmapNodePathTailToNodePath($has_step.properties.tail, path_builder.state_rule($.properties.rule.entry)),\n\t\t\t}),\n\t\tno: path_builder,\n\t});\n}\n\nfunction mapDescendantObjectPathToSubscriptionBuilder(\n\tpath: api_app.Cdescendant_object_path,\n\tsubscription_builder: SubscriptionBuilder\n): void {\n\treturn mapObjectPathToSubscriptionBuilder(path.properties.path, subscription_builder);\n}\nfunction mapObjectPathToSubscriptionBuilder(\n\tpath: api_app.Cobject_path_tail,\n\tsubscription_builder: SubscriptionBuilder\n): void {\n\tswitch (path.properties.has_steps.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst $ = path.properties.has_steps.state.node;\n\t\t\tconst tail = $.properties.tail;\n\t\t\tswitch ($.properties.type.state.name) {\n\t\t\t\tcase \"parent\":\n\t\t\t\t\t// Not supported\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dependency\":\n\t\t\t\t\t// Not supported\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"reference set\":\n\t\t\t\t\t// Not supported\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"property value\": {\n\t\t\t\t\tconst property = $.properties.type.state.node.properties.property.properties.property.ref;\n\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\tmapObjectPathToSubscriptionBuilder(tail, subscription_builder.group(property.parent.key));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\t\tmapObjectPathToSubscriptionBuilder(tail, subscription_builder);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state\": {\n\t\t\t\t\tconst stategroup = $.properties.type.state.node.properties.state.ref.parent;\n\t\t\t\t\tconst state_name = $.properties.type.state.node.properties.state.entry;\n\t\t\t\t\tmapObjectPathToSubscriptionBuilder(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\tsubscription_builder.state(stategroup.parent.parent.key, state_name, stategroup)\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(path.properties.has_steps.state);\n\t}\n}\n\nfunction mapNodePathTailToSubscriptionBuilder(\n\tpath: api_app.Cnode_path_tail,\n\tsubscription_builder: SubscriptionBuilder\n): void {\n\tswitch (path.properties.has_steps.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst $ = path.properties.has_steps.state.node;\n\t\t\tconst tail = $.properties.tail;\n\t\t\tswitch ($.properties.step.properties.type.state.name) {\n\t\t\t\tcase \"parent\":\n\t\t\t\t\t// Not supported\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"group\": {\n\t\t\t\t\tconst group_name = $.properties.step.properties.type.state.node.properties.group.entry;\n\t\t\t\t\tmapNodePathTailToSubscriptionBuilder(tail, subscription_builder.group(group_name));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"property rule\":\n\t\t\t\t\t// Not supported\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"reference\":\n\t\t\t\t\t// Not supported\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"state\": {\n\t\t\t\t\tconst stategroup = $.properties.step.properties.type.state.node.properties.state_group;\n\t\t\t\t\tconst state_name = $.properties.step.properties.type.state.node.properties.state.entry;\n\t\t\t\t\tmapNodePathTailToSubscriptionBuilder(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\tsubscription_builder.state(stategroup.entry, state_name, stategroup.ref)\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state context rule\":\n\t\t\t\t\t// Not supported\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($.properties.step.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(path.properties.has_steps.state);\n\t}\n}\n\nfunction createDormantFilter(collection: api_cs.Ccollection): api_cr.Tvalue_filters[] {\n\tconst ui_collection_attributes = collection.inferences.collection_type().properties.ui;\n\tconst filters: api_cr.Tvalue_filters[] = [];\n\tswitch (ui_collection_attributes.properties.can_be_dormant.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst $ = ui_collection_attributes.properties.can_be_dormant.state.node;\n\t\t\tlet path_builder = new NodePathBuilder();\n\t\t\tlet has_steps = $.properties.expression.properties.has_steps;\n\t\t\twhile (has_steps.state.name === \"yes\") {\n\t\t\t\tconst step = has_steps.state.node.properties.step;\n\t\t\t\tswitch (step.properties.type.state.name) {\n\t\t\t\t\tcase \"state\": {\n\t\t\t\t\t\tconst $ = step.properties.type.state.node;\n\t\t\t\t\t\tconst stategroup_name = $.properties.state_group.entry;\n\t\t\t\t\t\tconst state_name = $.properties.state.entry;\n\t\t\t\t\t\tswitch (has_steps.state.node.properties.tail.properties.has_steps.state.name) {\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\tconst states: api_cr.Tstate_group__type__property__type__value_filters[\"states to include\"] = {};\n\t\t\t\t\t\t\t\tfor (const sn of $.properties.state_group.ref.properties.states.keys()) {\n\t\t\t\t\t\t\t\t\tif (state_name !== sn) {\n\t\t\t\t\t\t\t\t\t\tstates[sn] = {};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfilters.push({\n\t\t\t\t\t\t\t\t\tpath: path_builder.build(),\n\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\"property\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tproperty: stategroup_name,\n\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\"state group\",\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"states to include\": states,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tpath_builder = path_builder.state(stategroup_name, state_name);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(has_steps.state.node.properties.tail.properties.has_steps.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst $ = step.properties.type.state.node;\n\t\t\t\t\t\tpath_builder = path_builder.group($.properties.group.entry);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"parent\":\n\t\t\t\t\t\tthrow new Error(\"parent step not yet supported in dormant filter path\");\n\t\t\t\t\tcase \"property rule\":\n\t\t\t\t\t\tthrow new Error(\"property rule step not yet supported in dormant filter path\");\n\t\t\t\t\tcase \"state context rule\":\n\t\t\t\t\t\tthrow new Error(\"state context rule step not yet supported in dormant filter path\");\n\t\t\t\t\tcase \"reference\":\n\t\t\t\t\t\tthrow new Error(\"reference step not yet supported in dormant filter path\");\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(step.properties.type.state);\n\t\t\t\t}\n\t\t\t\thas_steps = has_steps.state.node.properties.tail.properties.has_steps;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(ui_collection_attributes.properties.can_be_dormant.state);\n\t}\n\treturn filters;\n}\n\nfunction autofillOnlyCandidate(cs_reference: api_cs.Cyes__navigable): ScalarProvider> {\n\tconst this_node = cs_reference.parent.parent.parent.parent;\n\tconst reference_expression = cs_reference.inferences.is_navigable().properties.expression;\n\tconst self_reference_allowed = supportsSelfReference(reference_expression);\n\n\tconst stream = createVariable>(Pending, true);\n\tconst on_candidates = (candidates: Set) => {\n\t\tif (candidates.size === 1) {\n\t\t\tstream.set([...candidates][0]);\n\t\t} else {\n\t\t\tstream.set(Failed);\n\t\t}\n\t};\n\tconst filter = mapDescendantObjectPathToQueryFilters(reference_expression.properties.tail);\n\tlet collection_path = CollectionPathBuilder.create().collection(\n\t\treference_expression.output.collection().parent.parent.key\n\t);\n\tlet local_candidates = new Set();\n\tlet remote_candidates = new Set();\n\n\tlet destructor: DestructorTree | undefined;\n\tconst reference_context = iReference(cs_reference).collectionContext;\n\tconst subscription = reference_context.subscribe({\n\t\tupdate: async (cs_collection) => {\n\t\t\tdestructor?.destroy();\n\t\t\tif (!isResolved(cs_collection)) {\n\t\t\t\treturn on_candidates(new Set());\n\t\t\t}\n\t\t\tdestructor = new DestructorTree();\n\n\t\t\tconst on_change = () => {\n\t\t\t\tswitch (cs_reference.parent.properties.is_key.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\treturn on_candidates(Sets.union(local_candidates, remote_candidates));\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst key_property = cs_reference.parent.properties.is_key.state.node;\n\t\t\t\t\t\tconst local_entries = getLocalEntries(key_property);\n\t\t\t\t\t\tconst candidates = Sets.union(local_candidates, remote_candidates);\n\t\t\t\t\t\treturn on_candidates(Sets.difference(candidates, local_entries));\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(cs_reference.parent.properties.is_key.state);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst local_candidates_stream = localCandidatesStream(\n\t\t\t\tcs_collection,\n\t\t\t\treference_expression.properties.tail,\n\t\t\t\t(entry) => self_reference_allowed || entry.properties.node !== this_node.input.entity().output.node()\n\t\t\t);\n\t\t\tconst local_candidates_subscription = local_candidates_stream.subscribe({\n\t\t\t\tupdate: (candidates) => {\n\t\t\t\t\tlocal_candidates = candidates;\n\t\t\t\t\ton_change();\n\t\t\t\t},\n\t\t\t});\n\t\t\tdestructor.onDestroy(() => local_candidates_stream.unsubscribe(local_candidates_subscription));\n\n\t\t\tswitch (cs_collection.parent.parent.parent.properties.location.state.name) {\n\t\t\t\tcase \"remote\": {\n\t\t\t\t\tlet context_path = createIdPathBuilderFromNode(cs_collection.parent.parent.parent);\n\t\t\t\t\tlet max_remote_entries: number;\n\t\t\t\t\tswitch (cs_reference.parent.properties.is_key.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tmax_remote_entries = 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst key_property = cs_reference.parent.properties.is_key.state.node;\n\t\t\t\t\t\t\tconst cs_collection = this_node.input.position().cast(\"entity\").cast(\"entry\").parent;\n\t\t\t\t\t\t\tconst local_entries = getLocalEntries(key_property);\n\t\t\t\t\t\t\tmax_remote_entries = local_entries.size + 1;\n\t\t\t\t\t\t\tconst col_attribute = cs_collection.parent.parent;\n\t\t\t\t\t\t\tswitch (col_attribute.parent.properties.location.state.name) {\n\t\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"remote\":\n\t\t\t\t\t\t\t\t\tcontext_path = createIdPathBuilderFromNode(col_attribute.parent);\n\t\t\t\t\t\t\t\t\tcollection_path = CollectionPathBuilder.create().candidates(col_attribute.key.entry);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(col_attribute.parent.properties.location.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(cs_reference.parent.properties.is_key.state);\n\t\t\t\t\t}\n\t\t\t\t\tremote_candidates = await queryRemoteCandidates(\n\t\t\t\t\t\tfilter.concat(createDormantFilter(cs_collection)),\n\t\t\t\t\t\tcontext_path,\n\t\t\t\t\t\tcollection_path,\n\t\t\t\t\t\tmax_remote_entries\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"local\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (destructor.destroyed !== true) {\n\t\t\t\ton_change();\n\t\t\t}\n\t\t},\n\t});\n\tcs_reference.onDestroy(() => {\n\t\tdestructor?.destroy();\n\t\treference_context.unsubscribe(subscription);\n\t});\n\treturn stream;\n}\n\nfunction getLocalEntries(this_key_property: api_cs.Cyes__is_key): Set {\n\tconst entries = new Set();\n\tconst collection = this_key_property.inferences.entry().parent;\n\tfor (const entry of collection.properties.entries.values()) {\n\t\tswitch (entry.properties.location.state.name) {\n\t\t\tcase \"remote\":\n\t\t\t\tbreak;\n\t\t\tcase \"local\": {\n\t\t\t\tconst that_key_property = entry.properties.key.ref;\n\t\t\t\tswitch (that_key_property.properties.is_set.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst key = that_key_property.properties.is_set.state.node.properties.text;\n\t\t\t\t\t\tif (that_key_property !== this_key_property.parent) {\n\t\t\t\t\t\t\tentries.add(key);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(that_key_property.properties.is_set.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(entry.properties.location.state);\n\t\t}\n\t}\n\treturn entries;\n}\n\nfunction localCandidatesStream(\n\tcs_collection: api_cs.Ccollection,\n\ttail_path: api_app.Cdescendant_object_path,\n\tentry_filter: (entry: api_cs.Centries__collection) => boolean\n) {\n\tconst keyCollector = toStream(cs_collection.properties.entries)\n\t\t.map(([, entry]) => (entry_filter(entry) ? entry : None))\n\t\t.filter()\n\t\t.map(([, entry]) =>\n\t\t\tcreateExpressionBuilder(entry).pipe((entry) =>\n\t\t\t\ttoStream(entry.properties.location).stateSwitch({\n\t\t\t\t\tremote: () => None as Scalar,\n\t\t\t\t\tlocal: () =>\n\t\t\t\t\t\ttoStream(entry.properties.key.ref.properties.is_set).stateSwitch({\n\t\t\t\t\t\t\tno: () => None as Scalar,\n\t\t\t\t\t\t\tyes: (key_is_set) =>\n\t\t\t\t\t\t\t\tdescendant_object_path(tail_path).pipe((tail) =>\n\t\t\t\t\t\t\t\t\tisResolved(tail) ? (toVariable(key_is_set, \"text\") as ScalarProvider) : None\n\t\t\t\t\t\t\t\t)(entry.properties.node),\n\t\t\t\t\t\t})(),\n\t\t\t\t})()\n\t\t\t)()\n\t\t)\n\t\t.filter()();\n\tconst keyCollection = createVariable(new Set(), true);\n\tconst subscription = keyCollector.subscribe({\n\t\tadd: () => {\n\t\t\tkeyCollection.set(new Set([...keyCollector.entries.values()].map((v) => scalarValue(v))));\n\t\t},\n\t\tremove: () => {\n\t\t\tkeyCollection.set(new Set([...keyCollector.entries.values()].map((v) => scalarValue(v))));\n\t\t},\n\t});\n\tcs_collection.onDestroy(() => {\n\t\tkeyCollection.destroy();\n\t\tkeyCollector.unsubscribe(subscription);\n\t});\n\treturn keyCollection;\n}\n\nasync function queryRemoteCandidates(\n\tfilter: api_cr.Tvalue_filters[],\n\tcontext_path: IdPathBuilder,\n\tcollection_path: CollectionPathBuilder,\n\tmax_candidates: number\n) {\n\tconst reply = await DatastoreProxy.instance.collectionQuery({\n\t\tfilters: {\n\t\t\t\"todo filter\": [\"no\", {}],\n\t\t\t\"value filters\": filter.reduce>((obj, property, i) => {\n\t\t\t\tobj[i.toString()] = property;\n\t\t\t\treturn obj;\n\t\t\t}, {}),\n\t\t},\n\t\t\"context node path\": context_path.build(),\n\t\t\"collection path\": collection_path.build(),\n\t\t\"select entries\": [\n\t\t\t\"yes\",\n\t\t\t{\n\t\t\t\t\"limit number of entries\": max_candidates + 1,\n\t\t\t\tproperties: {\n\t\t\t\t\tproperties: {},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\taggregates: {},\n\t});\n\tlet candidates = new Set();\n\treply.properties.context.switch({\n\t\t\"does not exist\": () => undefined,\n\t\t\"permission denied\": () => undefined,\n\t\texists: ($) =>\n\t\t\t$.properties.entries.switch({\n\t\t\t\tno: () => undefined,\n\t\t\t\tyes: ($) =>\n\t\t\t\t\t$.properties.entries.properties.has_steps.switch({\n\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\tcandidates = new Set($.properties.entries.toArray().map(($) => $[0]));\n\t\t\t\t\t\t},\n\t\t\t\t\t\tno: () => undefined,\n\t\t\t\t\t}),\n\t\t\t}),\n\t});\n\treturn candidates;\n}\n\nfunction textPropertyModifiedByUser(cs_text: api_cs.Ctext__type__property) {\n\treturn toStream(cs_text.properties.backend_known)\n\t\t.stateSwitch({\n\t\t\tno: () =>\n\t\t\t\ttoStream(cs_text.properties.is_set).stateSwitch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: (is_set) =>\n\t\t\t\t\t\ttoStream(is_set.properties.by).stateSwitch({\n\t\t\t\t\t\t\tengine: () => false,\n\t\t\t\t\t\t\tuser: () => true,\n\t\t\t\t\t\t})(),\n\t\t\t\t})(),\n\t\t\tyes: () => true,\n\t\t})\n\t\t.pipe((value) => value); // This pipe acts as a 'unique' filter\n}\n\nfunction numberPropertyModifiedByUser(cs_number: api_cs.Cnumber__type__property) {\n\treturn toStream(cs_number.properties.backend_known)\n\t\t.stateSwitch({\n\t\t\tno: () =>\n\t\t\t\ttoStream(cs_number.properties.is_set).stateSwitch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: (is_set) =>\n\t\t\t\t\t\ttoStream(is_set.properties.by).stateSwitch({\n\t\t\t\t\t\t\tengine: () => false,\n\t\t\t\t\t\t\tuser: () => true,\n\t\t\t\t\t\t})(),\n\t\t\t\t})(),\n\t\t\tyes: () => true,\n\t\t})\n\t\t.pipe((value) => value); // This pipe acts as a 'unique' filter\n}\n\nfunction stategroupPropertyModifiedByUser(cs_stategroup: api_cs.Cstate_group__type__property) {\n\treturn toStream(cs_stategroup.properties.initialized)\n\t\t.stateSwitch({\n\t\t\tno: () =>\n\t\t\t\ttoStream(cs_stategroup.properties.is_set).stateSwitch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: (is_set) =>\n\t\t\t\t\t\ttoStream(is_set.properties.by).stateSwitch({\n\t\t\t\t\t\t\tengine: () => false,\n\t\t\t\t\t\t\tuser: () => true,\n\t\t\t\t\t\t})(),\n\t\t\t\t})(),\n\t\t\tyes: () => true,\n\t\t})\n\t\t.pipe((value) => value); // This pipe acts as a 'unique' filter\n}\n\nfunction collectionPropertyModifiedByUser(cs_collection: api_cs.Ccollection) {\n\treturn toStream(cs_collection.properties.modified)\n\t\t.stateSwitch({\n\t\t\tno: () => false,\n\t\t\tyes: (is_set) =>\n\t\t\t\ttoStream(is_set.properties.by).stateSwitch({\n\t\t\t\t\tengine: () => false,\n\t\t\t\t\tuser: () => true,\n\t\t\t\t})(),\n\t\t})\n\t\t.pipe((value) => value); // This pipe acts as a 'unique' filter\n}\n\nfunction stategroupPropertySubscribeToSetBy(\n\tdefinition: api_cs.Cyes__is_set__state_group__type__property,\n\tdestructor: DestructorTree\n) {\n\t/*\n\tIf any child property of the selected state is set by the user, we should not set any defaults for this stategroup anymore\n\tand we set the 'by' property for this stategroup to 'user'.\n\tIf no more child properties are set by the user, we switch to 'by':'engine' again.\n\tExcept however when the stategroup itself is already set by the user, in which case we start with a count of 1\n\t*/\n\tlet count: number = definition.properties.by.switch({\n\t\tuser: 1,\n\t\tengine: 0,\n\t});\n\tsubscribeToChildPropertiesSetByUser(\n\t\tdefinition.properties.state.ref.properties.node,\n\t\tdestructor,\n\t\t(set_by_user, init) => {\n\t\t\t/*\n\t\tHere 'init' is true when the subscription is returned for the first time with the initial value.\n\t\tFor the initial values, we only want to count the child properties that are set by the user,\n\t\tso if init==true we only update the count when it is set by the user,\n\t\tand after that we want to know when they have changed, so if init==false we increment and decrement the count.\n\t\tThis gives the following logic:\n\t\t*/\n\t\t\tif (set_by_user) {\n\t\t\t\tcount = count + 1;\n\t\t\t} else if (!init) {\n\t\t\t\tcount = count - 1;\n\t\t\t}\n\t\t\tif (count <= 0) {\n\t\t\t\tdefinition.properties.by.ensure(\"engine\", {});\n\t\t\t} else {\n\t\t\t\tdefinition.properties.by.ensure(\"user\", {});\n\t\t\t}\n\t\t}\n\t);\n}\nfunction propertyEntrySubscribeToSetBy(definition: api_cs.Clocal__location__entries, destructor: DestructorTree) {\n\tlet count: number = definition.properties.modified_by.switch({\n\t\tuser: 1,\n\t\tengine: 0,\n\t});\n\tsubscribeToChildPropertiesSetByUser(definition.parent.properties.node, destructor, (set_by_user, init) => {\n\t\tif (set_by_user) {\n\t\t\tcount = count + 1;\n\t\t} else if (!init) {\n\t\t\tcount = count - 1;\n\t\t}\n\t\tif (count <= 0) {\n\t\t\tif (definition.properties.modified_by.state.name === \"user\") {\n\t\t\t\t// only update if not already in that state\n\t\t\t\tdefinition.properties.modified_by.set(\"engine\", {});\n\t\t\t}\n\t\t} else {\n\t\t\tif (definition.properties.modified_by.state.name === \"engine\") {\n\t\t\t\t// only update if not already in that state\n\t\t\t\tdefinition.properties.modified_by.set(\"user\", {});\n\t\t\t}\n\t\t}\n\t});\n}\nfunction subscribeToChildPropertiesSetByUser(\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree,\n\tonSetByUser: (set_by_user: boolean, init: boolean) => void\n) {\n\tnode.properties.attributes.forEach((attribute) =>\n\t\tattribute.properties.type.switch({\n\t\t\toperation: undefined,\n\t\t\tproperty: (property) =>\n\t\t\t\tproperty.properties.type.switch({\n\t\t\t\t\tfile: undefined,\n\t\t\t\t\tcollection: undefined,\n\t\t\t\t\tgroup: (group) => subscribeToChildPropertiesSetByUser(group.properties.node, destructor, onSetByUser),\n\t\t\t\t\ttext: (text) =>\n\t\t\t\t\t\tdestructor.subscribeToStategroup(text.properties.is_set, (destructor) => {\n\t\t\t\t\t\t\ttext.properties.is_set.switch({\n\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\tyes: (yes) =>\n\t\t\t\t\t\t\t\t\tdestructor.subscribeToStategroup(yes.properties.by, (_, first) =>\n\t\t\t\t\t\t\t\t\t\tonSetByUser(\n\t\t\t\t\t\t\t\t\t\t\tyes.properties.by.switch({\n\t\t\t\t\t\t\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\t\t\t\t\t\t\tengine: false,\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\tfirst\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}),\n\t\t\t\t\tnumber: (number) =>\n\t\t\t\t\t\tdestructor.subscribeToStategroup(number.properties.is_set, (destructor) => {\n\t\t\t\t\t\t\tnumber.properties.is_set.switch({\n\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\tyes: (yes) =>\n\t\t\t\t\t\t\t\t\tdestructor.subscribeToStategroup(yes.properties.by, (_, first) =>\n\t\t\t\t\t\t\t\t\t\tonSetByUser(\n\t\t\t\t\t\t\t\t\t\t\tyes.properties.by.switch({\n\t\t\t\t\t\t\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\t\t\t\t\t\t\tengine: false,\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\tfirst\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}),\n\t\t\t\t\t\"state group\": (stategroup) =>\n\t\t\t\t\t\tdestructor.subscribeToStategroup(stategroup.properties.is_set, (destructor) => {\n\t\t\t\t\t\t\tstategroup.properties.is_set.switch({\n\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\tyes: (yes) =>\n\t\t\t\t\t\t\t\t\tdestructor.subscribeToStategroup(yes.properties.by, (_, first) =>\n\t\t\t\t\t\t\t\t\t\tonSetByUser(\n\t\t\t\t\t\t\t\t\t\t\tyes.properties.by.switch({\n\t\t\t\t\t\t\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\t\t\t\t\t\t\tengine: false,\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\tfirst\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}); // we don't have to recurse into the stategroup node, this is already handled\n\t\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t})\n\t);\n}\n\nfunction isSetByCollectionDefault(text_property: api_cs.Ctext__type__property) {\n\tswitch (text_property.properties.is_key.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst $ = text_property.properties.is_key.state.node;\n\t\t\treturn $.inferences.entry().properties.location.switch({\n\t\t\t\tlocal: ($) =>\n\t\t\t\t\t$.properties.modified_by.switch({\n\t\t\t\t\t\tuser: false,\n\t\t\t\t\t\tengine: true,\n\t\t\t\t\t}),\n\t\t\t\tremote: false,\n\t\t\t});\n\t\t}\n\t\tcase \"no\":\n\t\t\treturn false;\n\t}\n}\n","import { api_configuration } from \"common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { orderedAttributes } from \"../graphIterators\";\n\nexport function nodeEditMode(node: api_cs.Cnode): [\"on\", Record] | [\"off\", Record] {\n\tswitch (node.properties.location.state.name) {\n\t\tcase \"remote\": {\n\t\t\tconst $ = node.properties.location.state.node;\n\t\t\tswitch ($.properties.edit_mode.state.name) {\n\t\t\t\tcase \"on\":\n\t\t\t\t\treturn [\"on\", {}];\n\t\t\t\tcase \"off\":\n\t\t\t\t\treturn [\"off\", {}];\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($.properties.edit_mode.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"local\":\n\t\t\treturn [\"off\", {}];\n\t\tdefault:\n\t\t\tunexpectedState(node.properties.location.state);\n\t}\n}\n\nexport function switchOn(node: api_cs.Cnode): void {\n\tnode.properties.location.switch({\n\t\tremote: ($) => {\n\t\t\t$.properties.edit_mode.ensure(\"on\", {});\n\t\t},\n\t\tlocal: undefined,\n\t});\n\tconst application_node = node.input.node_type();\n\torderedAttributes(application_node).forEach(($) => {\n\t\tconst attribute = node.properties.attributes.get($.key);\n\t\tif (attribute === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tattribute.properties.type.switch({\n\t\t\toperation: undefined,\n\t\t\tproperty: ($) =>\n\t\t\t\t$.properties.type.switch({\n\t\t\t\t\tcollection: ($) => {\n\t\t\t\t\t\t$.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t$.properties.edit_mode.ensure(\"on\", {});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t\t$.properties.entries.forEach((entry) => switchOn(entry.properties.node));\n\t\t\t\t\t},\n\t\t\t\t\tfile: ($) => {\n\t\t\t\t\t\t$.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t$.properties.edit_mode.ensure(\"on\", {});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tgroup: ($) => {\n\t\t\t\t\t\tswitchOn($.properties.node);\n\t\t\t\t\t},\n\t\t\t\t\tnumber: ($) => {\n\t\t\t\t\t\t$.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t$.properties.edit_mode.ensure(\"on\", {});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\t\"state group\": ($) => {\n\t\t\t\t\t\tstategroupOn($);\n\t\t\t\t\t},\n\t\t\t\t\ttext: ($) => {\n\t\t\t\t\t\ttextOn($);\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t});\n\t});\n}\n\nexport function stategroupOn(stategroup: api_cs.Cstate_group__type__property) {\n\tstategroup.properties.is_editable.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\t$.properties.edit_mode.ensure(\"on\", {});\n\t\t},\n\t});\n\tfor (const state of stategroup.properties.states) {\n\t\tswitchOn(state[1].properties.node);\n\t}\n}\n\nexport function textOn(text: api_cs.Ctext__type__property) {\n\ttext.properties.is_editable.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\t$.properties.edit_mode.ensure(\"on\", {});\n\t\t},\n\t});\n}\n\nexport function numberOn(number: api_cs.Cnumber__type__property) {\n\tnumber.properties.is_editable.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\t$.properties.edit_mode.ensure(\"on\", {});\n\t\t},\n\t});\n}\n\nexport function switchOff(node: api_cs.Cnode): void {\n\tnode.properties.location.switch({\n\t\tremote: ($) => {\n\t\t\t$.properties.edit_mode.ensure(\"off\", {});\n\t\t},\n\t\tlocal: undefined,\n\t});\n\tnode.properties.attributes.forEach(($) =>\n\t\t$.properties.type.switch({\n\t\t\toperation: undefined,\n\t\t\tproperty: ($) =>\n\t\t\t\t$.properties.type.switch({\n\t\t\t\t\tcollection: ($) => {\n\t\t\t\t\t\t$.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\t$.properties.edit_mode.ensure(\"off\", {});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t\t$.properties.entries.forEach((entry) => switchOff(entry.properties.node));\n\t\t\t\t\t},\n\t\t\t\t\tfile: (file_type) => {\n\t\t\t\t\t\tfile_type.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\tfile_type.properties.is_valid.switch({\n\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\t\t$.properties.edit_mode.ensure(\"off\", {});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tgroup: ($) => {\n\t\t\t\t\t\tswitchOff($.properties.node);\n\t\t\t\t\t},\n\t\t\t\t\tnumber: (number_type) => {\n\t\t\t\t\t\tnumber_type.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\tnumber_type.properties.is_valid.switch({\n\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\t\t$.properties.edit_mode.ensure(\"off\", {});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\t\"state group\": (state_group) => {\n\t\t\t\t\t\tstate_group.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\tstate_group.properties.is_valid.switch({\n\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\t\t$.properties.edit_mode.ensure(\"off\", {});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfor (const state of state_group.properties.states) {\n\t\t\t\t\t\t\tswitchOff(state[1].properties.node);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttext: (text_type) => {\n\t\t\t\t\t\ttext_type.properties.is_editable.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t\ttext_type.properties.is_valid.switch({\n\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\t\t$.properties.edit_mode.ensure(\"off\", {});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t})\n\t);\n}\n","import { api_configuration } from \"../../common\";\nimport api_gui = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_crep = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_reply.alan_api;\nimport api_creq = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport NodePathBuilder from \"../navigation/NodePathBuilder\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport * as expressions from \"../state/expressions\";\nimport DestructorTree from \"../DestructorTree\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { registerIdPath } from \"../state/registerClientState\";\nimport { awaitCondition } from \"../../../../../stream\";\nimport * as Status from \"../Status\";\n\nfunction visitAncestorNodePath(path: api_gui.Cancestor_node_path, id_path_builder: IdPathBuilder): IdPathBuilder {\n\treturn path.properties.has_steps.switch({\n\t\tno: id_path_builder,\n\t\tyes: ($) => visitAncestorNodePath($.properties.tail, id_path_builder.removeTail()),\n\t});\n}\n\nfunction visitGuiStaticSingularPath(\n\tgui_static_singular_path: api_gui.Cgui_static_singular_path,\n\tid_path_builder: IdPathBuilder\n): IdPathBuilder {\n\tconst ancestor_builder = visitAncestorNodePath(gui_static_singular_path.properties.head, id_path_builder);\n\treturn gui_static_singular_path.properties.has_steps.switch({\n\t\tno: ancestor_builder,\n\t\tyes: ($) =>\n\t\t\tvisitGuiStaticSingularPath(\n\t\t\t\t$.properties.tail,\n\t\t\t\t$.properties.type.switch({\n\t\t\t\t\tgroup: (group) => ancestor_builder.group(group.properties.group.entry),\n\t\t\t\t})\n\t\t\t),\n\t});\n}\nfunction createEmptyNodePath() {\n\treturn new NodePathBuilder().build();\n}\ntype PropertyResult = api_crep.Cproperties__node_query_result | undefined;\nfunction queryProperty(\n\tid_path_builder: IdPathBuilder,\n\tproperty: { [key: string]: api_creq.Tproperties__node_query }\n): Promise {\n\treturn DatastoreProxy.instance\n\t\t.collectionQuery({\n\t\t\t\"context node path\": id_path_builder.build(),\n\t\t\t\"select entries\": [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\t\"limit number of entries\": 1,\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tproperties: property,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\t\"collection path\": {\n\t\t\t\t\"has steps\": [\"no\", {}],\n\t\t\t},\n\t\t\tfilters: {\n\t\t\t\t\"todo filter\": [\"no\", {}],\n\t\t\t\t\"value filters\": {},\n\t\t\t},\n\t\t\taggregates: {},\n\t\t})\n\t\t.then((result) =>\n\t\t\tresult.properties.context.switch({\n\t\t\t\t\"does not exist\": undefined,\n\t\t\t\t\"permission denied\": undefined,\n\t\t\t\texists: (result) =>\n\t\t\t\t\tresult.properties.entries.switch({\n\t\t\t\t\t\tyes: (has_entries) =>\n\t\t\t\t\t\t\thas_entries.properties.entries.properties.has_steps.switch({\n\t\t\t\t\t\t\t\tno: (no_step) => no_step.properties.properties.properties.properties.get(Object.keys(property)[0]),\n\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\tthrow new Error(\"Collection step is not expected\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t}),\n\t\t\t})\n\t\t);\n}\nfunction evaluateFileNameExpression(\n\tid_path_builder: IdPathBuilder,\n\tfile_name_expression: api_gui.Cfile_name_expression\n): Promise {\n\treturn file_name_expression.properties.has_steps.switch({\n\t\tno: () => Promise.resolve(\"\"),\n\t\tyes: ($) =>\n\t\t\t$.properties.type\n\t\t\t\t.switch>({\n\t\t\t\t\tstatic: ($) => Promise.resolve($.properties.text),\n\t\t\t\t\tproperty: function ($) {\n\t\t\t\t\t\tconst id_path_builder_to_property = visitGuiStaticSingularPath($.properties.path, id_path_builder);\n\t\t\t\t\t\treturn $.properties.type.switch({\n\t\t\t\t\t\t\ttext: function ($) {\n\t\t\t\t\t\t\t\tconst property_name = $.properties.text.entry;\n\t\t\t\t\t\t\t\treturn queryProperty(id_path_builder_to_property, {\n\t\t\t\t\t\t\t\t\t[property_name]: {\n\t\t\t\t\t\t\t\t\t\tpath: createEmptyNodePath(),\n\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"singular\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"dynamic\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpath: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"has steps\": [\"no\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttext: property_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}).then((property) => {\n\t\t\t\t\t\t\t\t\tlet property_value = \"\";\n\t\t\t\t\t\t\t\t\tif (property) {\n\t\t\t\t\t\t\t\t\t\tproperty.properties.result.switch({\n\t\t\t\t\t\t\t\t\t\t\t\"does not exist\": undefined,\n\t\t\t\t\t\t\t\t\t\t\t\"permission denied\": undefined,\n\t\t\t\t\t\t\t\t\t\t\texists: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\tproperty_value = $.properties.type.cast(\"text\").properties.value;\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn property_value;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnumber: function ($) {\n\t\t\t\t\t\t\t\tconst property_name = $.properties.number.entry;\n\t\t\t\t\t\t\t\treturn queryProperty(id_path_builder_to_property, {\n\t\t\t\t\t\t\t\t\t[property_name]: {\n\t\t\t\t\t\t\t\t\t\tpath: createEmptyNodePath(),\n\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\texpression: {\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"number property\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"signed number property\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpath: createEmptyNodePath(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsign: [\"positive\", {}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"property name\": property_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}).then((property) => {\n\t\t\t\t\t\t\t\t\tlet property_value = \"\";\n\t\t\t\t\t\t\t\t\tif (property) {\n\t\t\t\t\t\t\t\t\t\tproperty.properties.result.switch({\n\t\t\t\t\t\t\t\t\t\t\t\"does not exist\": undefined,\n\t\t\t\t\t\t\t\t\t\t\t\"permission denied\": undefined,\n\t\t\t\t\t\t\t\t\t\t\texists: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\tproperty_value = \"\" + $.properties.type.cast(\"number\").properties.value.value;\n\t\t\t\t\t\t\t\t\t\t\t\t//TODO numberical type conversion\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn property_value;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"state group\": function (state_group_expression) {\n\t\t\t\t\t\t\t\tconst property_name = state_group_expression.properties.state_group.entry;\n\t\t\t\t\t\t\t\treturn queryProperty(id_path_builder_to_property, {\n\t\t\t\t\t\t\t\t\t[property_name]: {\n\t\t\t\t\t\t\t\t\t\tpath: createEmptyNodePath(),\n\t\t\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\t\t\"state group\",\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\"state group\": property_name,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}).then((property) => {\n\t\t\t\t\t\t\t\t\tif (property) {\n\t\t\t\t\t\t\t\t\t\treturn property.properties.result.switch({\n\t\t\t\t\t\t\t\t\t\t\t\"does not exist\": Promise.resolve(\"-\"),\n\t\t\t\t\t\t\t\t\t\t\t\"permission denied\": Promise.resolve(\"-\"),\n\t\t\t\t\t\t\t\t\t\t\texists: ($) => {\n\t\t\t\t\t\t\t\t\t\t\t\tconst state_name = $.properties.type.cast(\"state group\").properties.state.entry;\n\t\t\t\t\t\t\t\t\t\t\t\tconst state_file_name_expression =\n\t\t\t\t\t\t\t\t\t\t\t\t\tstate_group_expression.properties.states.get(state_name)!.properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.state_file_name_expression;\n\t\t\t\t\t\t\t\t\t\t\t\treturn evaluateFileNameExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\tid_path_builder_to_property.state(property_name, state_name),\n\t\t\t\t\t\t\t\t\t\t\t\t\tstate_file_name_expression\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn Promise.resolve(\"\");\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\t.then((file_name_prefix) =>\n\t\t\t\t\tevaluateFileNameExpression(id_path_builder, $.properties.tail).then(\n\t\t\t\t\t\t(tail_value) => file_name_prefix + tail_value\n\t\t\t\t\t)\n\t\t\t\t),\n\t});\n}\n\nexport default async function (\n\tfile: api_gui.Cfile__type__property,\n\tcontext: api_cs.Cnode | IdPathBuilder,\n\textension: string\n): Promise {\n\tlet file_name = \"\";\n\tswitch (file.properties.file_name_source.state.name) {\n\t\tcase \"expression\": {\n\t\t\tconst $ = file.properties.file_name_source.state.node;\n\t\t\tconst destructor = new DestructorTree();\n\t\t\tlet node: api_cs.Cnode;\n\t\t\tif (context instanceof IdPathBuilder) {\n\t\t\t\tnode = registerIdPath(context, destructor);\n\t\t\t} else {\n\t\t\t\tnode = context;\n\t\t\t}\n\t\t\tconst expression = expressions.ui_scalar_default(\n\t\t\t\t$.inferences.expression().properties.file_name_expression\n\t\t\t)([node, null]);\n\t\t\tconst last_value = await awaitCondition(expression, (value): value is expressions.StringLike =>\n\t\t\t\tStatus.isResolved(value)\n\t\t\t);\n\t\t\tdestructor.destroy();\n\t\t\tif (last_value === undefined) {\n\t\t\t\tfile_name = \"\";\n\t\t\t} else {\n\t\t\t\tfile_name = last_value.toString();\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"generated\": {\n\t\t\tconst $ = file.properties.file_name_source.state.node;\n\t\t\tlet id_path_builder: IdPathBuilder;\n\t\t\tif (context instanceof api_cs.Cnode) {\n\t\t\t\tid_path_builder = createIdPathBuilderFromNode(context);\n\t\t\t} else {\n\t\t\t\tid_path_builder = context;\n\t\t\t}\n\t\t\tfile_name = await evaluateFileNameExpression(id_path_builder, $.properties.file_name_expression);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(file.properties.file_name_source.state);\n\t}\n\treturn joinWithDot(file_name, extension);\n}\n\nfunction joinWithDot(file_name: string, extension: string) {\n\tif (file_name.endsWith(\".\") || extension.startsWith(\".\")) {\n\t\treturn file_name + extension;\n\t} else if (extension.length > 0) {\n\t\treturn file_name + \".\" + extension;\n\t} else {\n\t\treturn file_name;\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport * as microtaskQueue from \"../microtaskQueue\";\n\nconst nodeObservers = new WeakMap void>>();\n\nexport function on_node_update(node: api_cs.Cnode, callback: () => void): { unsubscribe: () => void } {\n\tlet observers = nodeObservers.get(node);\n\tif (!observers) {\n\t\tobservers = new Set();\n\t\tnodeObservers.set(node, observers);\n\t}\n\tobservers.add(callback);\n\treturn {\n\t\tunsubscribe: () => {\n\t\t\tobservers?.delete(callback);\n\t\t},\n\t};\n}\n\nconst queue = new WeakMap void>();\n\nexport function notify_node_update(node: api_cs.Cnode): void {\n\tif (!queue.has(node)) {\n\t\tqueue.set(\n\t\t\tnode,\n\t\t\tmicrotaskQueue.add(() => {\n\t\t\t\tconst observers = nodeObservers.get(node);\n\t\t\t\tif (observers) {\n\t\t\t\t\tfor (const observer of observers) {\n\t\t\t\t\t\tobserver();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tqueue.delete(node);\n\t\t\t})\n\t\t);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport { createExpressionBuilder, lambda, DefaultExpressionBuilder } from \"../../../../../stream\";\nimport { CsObject, context_object_step, where_rule_context } from \"../state/expressions\";\nimport { Pending, Unknown, Result, Failed } from \"../Status\";\nimport * as Text from \"../state/Text\";\nimport * as Rule from \"../state/Rule\";\nimport { iReference } from \"../state/Reference\";\nimport * as step from \"../state/step\";\nimport { toStream } from \"../toStream\";\nimport { registrationDone } from \"../state/registerClientState\";\n\nexport function isResult(value: Result): value is T {\n\tswitch (value) {\n\t\tcase Pending:\n\t\tcase Unknown:\n\t\tcase Failed:\n\t\tcase \"yes\":\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n\nfunction selectProperty(\n\tdefinition: api_app.Ctext__type__property\n): DefaultExpressionBuilder, Result>;\nfunction selectProperty(\n\tdefinition: api_app.Cnumber__type__property\n): DefaultExpressionBuilder, Result>;\nfunction selectProperty(\n\tdefinition: api_app.Cfile\n): DefaultExpressionBuilder, Result>;\nfunction selectProperty(\n\tdefinition: api_app.Cgroup__type__property\n): DefaultExpressionBuilder, Result>;\nfunction selectProperty(\n\tdefinition: api_app.Cstate_group\n): DefaultExpressionBuilder, Result>;\nfunction selectProperty(\n\tdefinition: api_app.Ccollection__type__property\n): DefaultExpressionBuilder, Result>;\nfunction selectProperty(\n\tdefinition: step.AppProperty\n): DefaultExpressionBuilder, Result>;\nfunction selectProperty(\n\tdefinition: step.AppProperty\n): DefaultExpressionBuilder, Result> {\n\tconst name = definition.parent.parent.key;\n\treturn lambda((node) => {\n\t\tif (!isResult(node)) return node;\n\t\tlet object: any = node.properties.attributes.get(name)?.properties.type.cast(\"property\").properties.type.state.node;\n\t\tif (object instanceof api_cs.Cgroup__type__property) {\n\t\t\tobject = object.properties.node;\n\t\t}\n\t\treturn object ?? \"yes\";\n\t});\n}\n\nfunction propertyStep(root: api_app.Cproperty_step) {\n\treturn selectProperty(root.properties.property.ref.properties.type.state.node);\n}\n\nfunction dependencyStep(\n\troot: api_app.Cdependency_step\n): DefaultExpressionBuilder {\n\tconst $type = root.properties.type.state;\n\tswitch ($type.name) {\n\t\tcase \"reference\":\n\t\t\treturn selectProperty($type.node.properties.property.inferences.text()).pipe((text) => {\n\t\t\t\tif (isResult(text)) return iReference(text.properties.navigable.cast(\"yes\")).synchronized;\n\t\t\t\treturn text;\n\t\t\t});\n\t\tcase \"reference rule\": {\n\t\t\tconst name = $type.node.properties.rule.properties.rule.ref.key;\n\t\t\treturn selectProperty($type.node.properties.property.inferences.text()).pipe((text) => {\n\t\t\t\tif (isResult(text))\n\t\t\t\t\treturn Rule.synchronized(text.properties.navigable.cast(\"yes\").properties.rules.properties.rules.get(name)!);\n\t\t\t\treturn text;\n\t\t\t});\n\t\t}\n\t\tcase \"state context rule\": {\n\t\t\tconst name = $type.node.properties.rule.properties.rule.ref.key;\n\t\t\treturn lambda((node: api_cs.Cnode) => {\n\t\t\t\tif (isResult(node))\n\t\t\t\t\treturn Rule.synchronized(node.input.position().cast(\"state\").properties.rules.properties.rules.get(name)!);\n\t\t\t\treturn node;\n\t\t\t});\n\t\t}\n\t}\n}\n\nfunction objectPathTail(\n\troot: api_app.Cobject_path_tail\n): DefaultExpressionBuilder, Result> {\n\tconst $has_steps = root.properties.has_steps.state;\n\tswitch ($has_steps.name) {\n\t\tcase \"no\":\n\t\t\treturn lambda((object: Result) => object);\n\t\tcase \"yes\": {\n\t\t\tconst $type = $has_steps.node.properties.type.state;\n\t\t\tswitch ($type.name) {\n\t\t\t\tcase \"parent\":\n\t\t\t\t\treturn lambda((node: Result) =>\n\t\t\t\t\t\t!isResult(node) ? node : node.input.position().input.parent().cast(\"node\")\n\t\t\t\t\t).pipe(objectPathTail($has_steps.node.properties.tail));\n\t\t\t\tcase \"property value\":\n\t\t\t\t\treturn propertyStep($type.node.properties.property).pipe(objectPathTail($has_steps.node.properties.tail));\n\t\t\t\tcase \"dependency\":\n\t\t\t\t\treturn dependencyStep($type.node.properties.dependency);\n\t\t\t\tcase \"reference set\":\n\t\t\t\t\tthrow new Error(\"Unsupported 'Reference set' step\");\n\t\t\t\tcase \"state\":\n\t\t\t\t\treturn lambda((stategroup: Result) =>\n\t\t\t\t\t\t!isResult(stategroup)\n\t\t\t\t\t\t\t? stategroup\n\t\t\t\t\t\t\t: toStream(stategroup.component_root.properties.location).stateSwitch({\n\t\t\t\t\t\t\t\t\tlocal: () => Failed as Result,\n\t\t\t\t\t\t\t\t\tremote: () =>\n\t\t\t\t\t\t\t\t\t\ttoStream(stategroup.properties.is_modified).stateSwitch({\n\t\t\t\t\t\t\t\t\t\t\tno: () => {\n\t\t\t\t\t\t\t\t\t\t\t\tconst state = stategroup.properties.states.get($type.node.properties.state.ref.key_value)!;\n\t\t\t\t\t\t\t\t\t\t\t\treturn toStream(state.properties.is_selected).stateSwitch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tno: () => \"yes\" as Result,\n\t\t\t\t\t\t\t\t\t\t\t\t\tyes: () => state.properties.node,\n\t\t\t\t\t\t\t\t\t\t\t\t})();\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tyes: () => Failed as Result,\n\t\t\t\t\t\t\t\t\t\t})(),\n\t\t\t\t\t\t\t })()\n\t\t\t\t\t).pipe(objectPathTail($has_steps.node.properties.tail));\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function entryReferenceSynchronized(\n\tconstraining_text: api_cs.Ctext__type__property,\n\tdefinition: api_app.Centry_reference_definition\n) {\n\treturn registrationDone(constraining_text, (subscribed) => {\n\t\tif (subscribed === false) return Failed;\n\t\treturn createExpressionBuilder(Text.valueModified(constraining_text)).pipe((modified) => {\n\t\t\tif (modified === true) return Failed;\n\t\t\treturn createExpressionBuilder(constraining_text.component_root)\n\t\t\t\t.pipe(context_object_step(definition.properties.collection_path.properties.head))\n\t\t\t\t.pipe(objectPathTail(definition.properties.collection_path.properties.path))\n\t\t\t\t.pipe((res) => (isResult(res) ? \"yes\" : res))();\n\t\t})();\n\t});\n}\n\nexport function whereRuleObjectPath(\n\tdefinition: api_app.Cwhere_rule_object_path\n): DefaultExpressionBuilder> {\n\tconst $context = definition.properties.context.state;\n\tswitch ($context.name) {\n\t\tcase \"this\": {\n\t\t\tconst $step = $context.node.properties.head;\n\t\t\tswitch ($step.properties.context.state.name) {\n\t\t\t\tcase \"this\":\n\t\t\t\t\treturn where_rule_context()\n\t\t\t\t\t\t.pipe(objectPathTail(definition.properties.path))\n\t\t\t\t\t\t.pipe(lambda((res) => (isResult(res) ? \"yes\" : res)));\n\t\t\t\tcase \"variable\":\n\t\t\t\t\treturn lambda(\n\t\t\t\t\t\t(rule: api_cs.Crules) => iReference(rule.parent.input.definer().cast(\"reference\")).synchronized\n\t\t\t\t\t);\n\t\t\t\tcase \"dynamic user\":\n\t\t\t\t\treturn lambda(() => \"yes\");\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"sibling rule\":\n\t\t\treturn lambda((rule: api_cs.Crules) => {\n\t\t\t\tconst sibling = rule.parent.properties.rules.get($context.node.properties.rule.entry)!;\n\t\t\t\treturn Rule.synchronized(sibling);\n\t\t\t});\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport {\n\tVariable,\n\tancestor_variable_path,\n\tancestor_named_object_path,\n\toptional_variable_assignment,\n\tvariable_assignment,\n} from \"../state/Variable\";\nimport { iReference } from \"../state/Reference\";\nimport * as Rule from \"../state/Rule\";\nimport { client_state, getUserNameOrDefault } from \"../state/ClientState\";\nimport { getStickyValue } from \"./mapCommandParameters\";\nimport * as uuid from \"./uuid\";\nimport { pad } from \"../utils\";\nimport * as autoIncrement from \"../state/autoIncrement\";\nimport { getCurrentDateAndTime } from \"../calendar/current\";\nimport { jsdate_2_julian_date, julian_datetime_2_js_date } from \"../calendar/conversion\";\nimport { serializeNumber } from \"../state 2 interface/serializeNumber\";\nimport {\n\tcreateExpressionBuilder,\n\tlambda,\n\tDefaultExpressionBuilder,\n\tScalarProvider,\n\tScalarConsumer,\n} from \"../../../../../stream\";\n\nimport { Pending, Unknown, Failed, Result } from \"../Status\";\nimport * as step from \"./step\";\n\nexport type CsObject =\n\t| api_cs.Cnode\n\t| api_cs.Cstate_group__type__property\n\t| api_cs.Ccollection\n\t| api_cs.Ctext__type__property\n\t| api_cs.Cnumber__type__property\n\t| api_cs.Cfile__type__property;\ntype CsProperty =\n\t| api_cs.Ctext__type__property\n\t| api_cs.Cnumber__type__property\n\t| api_cs.Cfile__type__property\n\t| api_cs.Cgroup__type__property\n\t| api_cs.Cstate_group__type__property\n\t| api_cs.Ccollection;\n\nexport type Style =\n\t| [\n\t\t\t\"fixed\",\n\t\t\t{\n\t\t\t\tstyle: api_app.Tui_style[\"style\"];\n\t\t\t}\n\t ]\n\t| [\n\t\t\t\"color\",\n\t\t\t{\n\t\t\t\tvalue: string;\n\t\t\t}\n\t ];\nexport type StateChoice = api_app.Cstates__state_group;\nexport type FileToken = {\n\ttoken: string;\n\textension: string;\n};\nexport type StringLike = string | { toString: () => string };\ntype ScalarValue = StringLike | number | Style | StateChoice | FileToken;\ntype ScalarValueExpressionTarget = api_cs.Cproperty | undefined;\n\nexport type UIContext = [Result, Variable | null, ScalarValueExpressionTarget?];\n\nfunction property_step(root: api_app.Cproperty_step): DefaultExpressionBuilder, Result> {\n\tconst $type = root.properties.property.ref.properties.type.state;\n\tswitch ($type.name) {\n\t\tcase \"text\":\n\t\t\treturn step.property($type.node);\n\t\tcase \"number\":\n\t\t\treturn step.property($type.node);\n\t\tcase \"file\":\n\t\t\treturn step.property($type.node);\n\t\tcase \"group\":\n\t\t\treturn step.groupNode($type.node);\n\t\tcase \"state group\":\n\t\t\treturn step.property($type.node);\n\t\tcase \"collection\":\n\t\t\treturn step.property($type.node);\n\t}\n}\n\nfunction dependency_step(\n\troot: api_app.Cdependency_step\n): DefaultExpressionBuilder, Result> {\n\tconst $type = root.properties.type.state;\n\tswitch ($type.name) {\n\t\tcase \"reference\":\n\t\t\treturn step.reference($type.node.properties.property.inferences.has_reference());\n\t\tcase \"reference rule\":\n\t\tcase \"state context rule\":\n\t\t\treturn step.rule($type.node.properties.rule.properties.rule.ref);\n\t}\n}\n\nexport function context_object_step(\n\troot: api_app.Ccontext_object_step\n): DefaultExpressionBuilder | Variable | undefined, Result> {\n\tswitch (root.properties.context.state.name) {\n\t\tcase \"this\":\n\t\t\treturn createExpressionBuilder>();\n\t\tcase \"variable\": {\n\t\t\tconst variable_step = root.properties.context.state.node;\n\t\t\tconst $name = variable_step.properties.step.properties.name.state;\n\t\t\tswitch ($name.name) {\n\t\t\t\tcase \"explicit\":\n\t\t\t\t\treturn lambda(\n\t\t\t\t\t\t(variable: Variable) =>\n\t\t\t\t\t\t\tancestor_named_object_path($name.node.properties.head, variable).value as api_cs.Cnode\n\t\t\t\t\t);\n\t\t\t\tcase \"implicit\":\n\t\t\t\t\treturn lambda((variable: Variable) => variable.value as api_cs.Cnode);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"dynamic user\":\n\t\t\treturn dynamicUser();\n\t}\n}\n\nexport function ancestor_node_path(\n\troot: api_app.Cancestor_node_path\n): DefaultExpressionBuilder, Result> {\n\tconst $has_steps = root.properties.has_steps.state;\n\tswitch ($has_steps.name) {\n\t\tcase \"no\":\n\t\t\treturn createExpressionBuilder();\n\t\tcase \"yes\":\n\t\t\treturn step.parent().pipe(ancestor_node_path($has_steps.node.properties.tail));\n\t}\n}\n\nexport function entry_reference_definition(\n\troot: api_app.Centry_reference_definition\n): DefaultExpressionBuilder, Result> {\n\tconst collection_stream = context_object_step(root.properties.collection_path.properties.head).pipe(\n\t\tobject_path_tail(root.properties.collection_path.properties.path)\n\t);\n\tswitch (root.properties.type.state.name) {\n\t\tcase \"sibling\":\n\t\t\treturn (collection_stream as DefaultExpressionBuilder, Result>)\n\t\t\t\t.pipe(step.parent())\n\t\t\t\t.pipe(step.property(root.properties.type.state.node.output.collection()));\n\t\tcase \"simple\":\n\t\t\treturn collection_stream as DefaultExpressionBuilder, Result>;\n\t}\n}\n\nexport function object_path_tail(\n\troot: api_app.Cobject_path_tail\n): DefaultExpressionBuilder, Result> {\n\tconst $has_steps = root.properties.has_steps.state;\n\tswitch ($has_steps.name) {\n\t\tcase \"no\":\n\t\t\treturn createExpressionBuilder();\n\t\tcase \"yes\": {\n\t\t\tconst $type = $has_steps.node.properties.type.state;\n\t\t\tswitch ($type.name) {\n\t\t\t\tcase \"parent\":\n\t\t\t\t\treturn step.parent().pipe(object_path_tail($has_steps.node.properties.tail));\n\t\t\t\tcase \"property value\":\n\t\t\t\t\treturn property_step($type.node.properties.property).pipe(object_path_tail($has_steps.node.properties.tail));\n\t\t\t\tcase \"dependency\":\n\t\t\t\t\treturn dependency_step($type.node.properties.dependency).pipe(\n\t\t\t\t\t\tobject_path_tail($has_steps.node.properties.tail)\n\t\t\t\t\t);\n\t\t\t\tcase \"reference set\":\n\t\t\t\t\tthrow new Error(\"Unsupported 'Reference set' step\");\n\t\t\t\tcase \"state\":\n\t\t\t\t\treturn step.state($type.node.properties.state.ref).pipe(object_path_tail($has_steps.node.properties.tail));\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function descendant_object_path(\n\troot: api_app.Cdescendant_object_path\n): DefaultExpressionBuilder, Result> {\n\treturn object_path_tail(root.properties.path);\n}\n\nexport function where_rule_context(): DefaultExpressionBuilder {\n\treturn lambda((rule: api_cs.Crules) => rule.parent.input.definer().variant.definition.component_root);\n}\n\nexport function where_rule_variable_context(\n\tdefiner: api_app.Cwhere_rules_definer\n): DefaultExpressionBuilder> {\n\tswitch (definer.variant.name) {\n\t\tcase \"text\": {\n\t\t\tconst $has_assignment = definer.variant.definition.properties.assignment.properties.has_assignment.state;\n\t\t\tswitch ($has_assignment.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\tthrow new Error(\"Unexpected where rule variable context\");\n\t\t\t\tcase \"yes\":\n\t\t\t\t\treturn lambda((rule: api_cs.Crules) =>\n\t\t\t\t\t\tcreateExpressionBuilder(iReference(rule.parent.input.definer().cast(\"reference\")).referencedNode).pipe(\n\t\t\t\t\t\t\tstep.sync((node) => variable_assignment($has_assignment.node.properties.assignment, null, node))\n\t\t\t\t\t\t)()\n\t\t\t\t\t);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state\":\n\t\t\tthrow new Error(\"Unexpected where rule variable context\");\n\t}\n}\n\nexport function where_rule_object_path(\n\troot: api_app.Cwhere_rule_object_path\n): DefaultExpressionBuilder> {\n\tconst $context = root.properties.context.state;\n\tswitch ($context.name) {\n\t\tcase \"this\": {\n\t\t\tconst $step = $context.node.properties.head;\n\t\t\tswitch ($step.properties.context.state.name) {\n\t\t\t\tcase \"this\":\n\t\t\t\t\treturn where_rule_context().pipe(object_path_tail(root.properties.path));\n\t\t\t\tcase \"variable\": {\n\t\t\t\t\tconst variable_step = $step.properties.context.state.node;\n\t\t\t\t\tconst $name = variable_step.properties.step.properties.name.state;\n\t\t\t\t\tswitch ($name.name) {\n\t\t\t\t\t\tcase \"explicit\":\n\t\t\t\t\t\t\treturn where_rule_variable_context(root.input.definer())\n\t\t\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\t\t\tstep.sync(\n\t\t\t\t\t\t\t\t\t\t(variable) => ancestor_named_object_path($name.node.properties.head, variable).value as api_cs.Cnode\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.pipe(object_path_tail(root.properties.path));\n\t\t\t\t\t\tcase \"implicit\":\n\t\t\t\t\t\t\treturn where_rule_variable_context(root.input.definer())\n\t\t\t\t\t\t\t\t.pipe(step.sync((variable) => variable.value as api_cs.Cnode))\n\t\t\t\t\t\t\t\t.pipe(object_path_tail(root.properties.path));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"dynamic user\":\n\t\t\t\t\treturn dynamicUser().pipe(object_path_tail(root.properties.path));\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"sibling rule\":\n\t\t\treturn lambda((rule: api_cs.Crules) => {\n\t\t\t\tconst sibling = rule.parent.properties.rules.get($context.node.properties.rule.entry)!;\n\t\t\t\treturn Rule.node(sibling);\n\t\t\t}).pipe(object_path_tail(root.properties.path));\n\t}\n}\n\nfunction descendant_base_property_path(\n\troot: api_app.Cdescendant_base_property_path,\n\tdef: api_app.Ccollection__type__property\n): DefaultExpressionBuilder, Result>;\nfunction descendant_base_property_path(\n\troot: api_app.Cdescendant_base_property_path\n): DefaultExpressionBuilder, Result>;\nfunction descendant_base_property_path(\n\troot: api_app.Cdescendant_base_property_path\n): DefaultExpressionBuilder, Result> {\n\tconst type = root.properties.property.ref.properties.type;\n\treturn (\n\t\tobject_path_tail(root.properties.head) as DefaultExpressionBuilder, Result>\n\t).pipe(step.property(type.state.node));\n}\n\nfunction node_step(\n\troot: api_app.Cnode_step__application\n): DefaultExpressionBuilder, Result> {\n\tconst type = root.properties.type.state;\n\tswitch (type.name) {\n\t\tcase \"parent\":\n\t\t\treturn step.parent();\n\t\tcase \"group\":\n\t\t\treturn step.groupNode(type.node.properties.group.ref);\n\t\tcase \"reference\":\n\t\t\treturn step.reference(type.node.properties.text.inferences.reference());\n\t\tcase \"state\":\n\t\t\treturn step.property(type.node.properties.state_group.ref).pipe(step.state(type.node.properties.state.ref));\n\t\tcase \"property rule\":\n\t\t\treturn step.rule(type.node.properties.rule.ref);\n\t\tcase \"state context rule\":\n\t\t\treturn step.rule(type.node.properties.rule.ref);\n\t}\n}\n\nexport function node_path_tail(\n\troot: api_app.Cnode_path_tail\n): DefaultExpressionBuilder, Result> {\n\tconst has_steps = root.properties.has_steps.state;\n\tswitch (has_steps.name) {\n\t\tcase \"no\":\n\t\t\treturn createExpressionBuilder();\n\t\tcase \"yes\":\n\t\t\treturn node_step(has_steps.node.properties.step).pipe(node_path_tail(has_steps.node.properties.tail));\n\t}\n}\n\nexport function dynamicUser(): DefaultExpressionBuilder> {\n\tconst app_root = client_state.input.application;\n\tconst user_name = getUserNameOrDefault();\n\tif (user_name !== undefined) {\n\t\tswitch (app_root.properties.has_dynamic_users.state.name) {\n\t\t\tcase \"no\":\n\t\t\t\treturn lambda(() => Unknown);\n\t\t\tcase \"yes\": {\n\t\t\t\tconst dynamic_users = app_root.properties.has_dynamic_users.state.node;\n\t\t\t\treturn createExpressionBuilder().pipe(() =>\n\t\t\t\t\tdescendant_base_property_path(\n\t\t\t\t\t\tdynamic_users.properties.users_collection_path,\n\t\t\t\t\t\tdynamic_users.properties.users_collection_path.inferences.collection()\n\t\t\t\t\t).pipe(step.entry(user_name))(client_state.properties.root)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn lambda(() => Unknown);\n\t}\n}\n\nfunction context_node_path(\n\troot: api_app.Ccontext_node_path\n): DefaultExpressionBuilder> {\n\tconst $context = root.properties.context.state;\n\tswitch ($context.name) {\n\t\tcase \"this\":\n\t\t\treturn createExpressionBuilder().pipe(([this_node]) => this_node);\n\t\tcase \"dynamic user\":\n\t\t\treturn dynamicUser();\n\t\tcase \"variable\": {\n\t\t\tconst $name = $context.node.properties.name.state;\n\t\t\tswitch ($name.name) {\n\t\t\t\tcase \"explicit\":\n\t\t\t\t\treturn lambda(\n\t\t\t\t\t\t([, variable]) => ancestor_variable_path($name.node.properties.head, variable!).value as api_cs.Cnode\n\t\t\t\t\t);\n\t\t\t\tcase \"implicit\":\n\t\t\t\t\treturn lambda(([, variable]) => variable!.value as api_cs.Cnode);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function node_path(root: api_app.Cnode_path): DefaultExpressionBuilder> {\n\treturn context_node_path(root.properties.head).pipe(node_path_tail(root.properties.tail));\n}\n\nexport function singular_node_path(\n\troot: api_app.Csingular_node_path\n): DefaultExpressionBuilder> {\n\treturn node_path(root.properties.path);\n}\n\nfunction conditional_node_path(\n\troot: api_app.Cconditional_node_path\n): DefaultExpressionBuilder> {\n\treturn node_path(root.properties.path);\n}\n\nexport function ui_node_path(root: api_app.Cui_node_path): DefaultExpressionBuilder> {\n\treturn node_path(root.properties.path);\n}\n\nexport function ui_parametrized_node_path(\n\troot: api_app.Cui_parametrized_node_path\n): DefaultExpressionBuilder> {\n\treturn node_path(root.properties.path.properties.path);\n}\n\nexport function node_expression(\n\troot: api_app.Cnode_expression\n): DefaultExpressionBuilder> {\n\tconst $type = root.properties.type.state;\n\tswitch ($type.name) {\n\t\tcase \"equality\":\n\t\t\treturn lambda(($) =>\n\t\t\t\tconditional_node_path(root.properties.node_path)\n\t\t\t\t\t.and(conditional_node_path($type.node.properties.expected_node_path)($))\n\t\t\t\t\t.pipe(([left_node, right_node]) => {\n\t\t\t\t\t\tif (left_node === Failed || right_node === Failed) {\n\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t} else if (left_node === Pending || right_node === Pending) {\n\t\t\t\t\t\t\treturn Pending;\n\t\t\t\t\t\t} else if (left_node === Unknown || right_node === Unknown) {\n\t\t\t\t\t\t\treturn Unknown;\n\t\t\t\t\t\t} else if (left_node.is(right_node)) {\n\t\t\t\t\t\t\treturn left_node;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t}\n\t\t\t\t\t})($)\n\t\t\t);\n\t\tcase \"existence\":\n\t\t\treturn conditional_node_path(root.properties.node_path);\n\t\tcase \"containment\": {\n\t\t\tconst key_stream = conditional_node_path($type.node.properties.key_path.properties.path).pipe(\n\t\t\t\tstep.textValue($type.node.properties.key_path.properties.text.ref)\n\t\t\t);\n\t\t\treturn lambda(($) =>\n\t\t\t\tconditional_node_path(root.properties.node_path)\n\t\t\t\t\t.pipe(step.property($type.node.properties.collection.ref))\n\t\t\t\t\t.pipe(step.entry(key_stream($)))($)\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport function ui_scalar_default(\n\troot: api_app.Cui_scalar_default\n): DefaultExpressionBuilder> {\n\tlet fallback: DefaultExpressionBuilder>;\n\tswitch (root.properties.has_fallback.state.name) {\n\t\tcase \"yes\":\n\t\t\tfallback = ui_scalar_default(root.properties.has_fallback.state.node.properties.fallback);\n\t\t\tbreak;\n\t\tcase \"no\":\n\t\t\tfallback = lambda(() => Failed);\n\t}\n\treturn createExpressionBuilder().pipe(($) =>\n\t\tui_expression(root.properties.expression).pipe((value) => {\n\t\t\tif (value === Pending) {\n\t\t\t\treturn Pending;\n\t\t\t} else if (value === Failed || value === Unknown) {\n\t\t\t\treturn fallback($);\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t})($)\n\t);\n}\n\nexport function ui_expression(\n\troot: api_app.Cui_expression\n): DefaultExpressionBuilder> {\n\tconst $operation = root.properties.operation.state;\n\tswitch ($operation.name) {\n\t\tcase \"state switch\":\n\t\t\treturn lambda(($) =>\n\t\t\t\tui_parametrized_node_path($operation.node.properties.path.properties.path)\n\t\t\t\t\t.pipe(step.selectedState($operation.node.properties.path.properties.stategroup.ref))\n\t\t\t\t\t.pipe(\n\t\t\t\t\t\tstep.sync((state) => {\n\t\t\t\t\t\t\tconst state_switch = $operation.node.properties.states.get(state.key.entry)!;\n\t\t\t\t\t\t\treturn ui_expression(state_switch.properties.expression)([\n\t\t\t\t\t\t\t\t$[0],\n\t\t\t\t\t\t\t\toptional_variable_assignment(state_switch.properties.variable_assignment, $[1], state.properties.node),\n\t\t\t\t\t\t\t\t$[2],\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t})\n\t\t\t\t\t)($)\n\t\t\t);\n\t\tcase \"node switch\":\n\t\t\treturn lambda(($) => {\n\t\t\t\treturn node_expression($operation.node.properties.expression).pipe((node) => {\n\t\t\t\t\tswitch (node) {\n\t\t\t\t\t\tcase Pending:\n\t\t\t\t\t\t\treturn Pending;\n\t\t\t\t\t\tcase Unknown:\n\t\t\t\t\t\t\treturn Unknown;\n\t\t\t\t\t\tcase Failed:\n\t\t\t\t\t\t\treturn ui_expression($operation.node.properties.cases.properties.none_case.properties.expression)($);\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn ui_expression($operation.node.properties.cases.properties.node_case.properties.expression)([\n\t\t\t\t\t\t\t\t$[0],\n\t\t\t\t\t\t\t\toptional_variable_assignment(\n\t\t\t\t\t\t\t\t\t$operation.node.properties.cases.properties.node_case.properties.variable_assignment,\n\t\t\t\t\t\t\t\t\t$[1],\n\t\t\t\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t$[2],\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t}\n\t\t\t\t})($);\n\t\t\t});\n\t\tcase \"walk\":\n\t\t\tthrow new Error(\"unexpected expression operation\");\n\t\tcase \"update properties\":\n\t\t\tthrow new Error(\"unexpected expression operation\");\n\t\tcase \"execute operation\":\n\t\t\tthrow new Error(\"unexpected expression operation\");\n\t\tcase \"produce value\":\n\t\t\tswitch ($operation.node.properties.value.state.name) {\n\t\t\t\tcase \"object\":\n\t\t\t\t\tthrow new Error(\"unexpected expression operation\");\n\t\t\t\tcase \"state\":\n\t\t\t\t\tthrow new Error(\"unexpected expression operation\");\n\t\t\t\tcase \"scalar\":\n\t\t\t\t\treturn ui_scalar_value_expression($operation.node.properties.value.state.node.properties.expression);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"entry list\":\n\t\t\tthrow new Error(\"unexpected expression operation\");\n\t\tcase \"entry\":\n\t\t\tthrow new Error(\"unexpected expression operation\");\n\t\tcase \"ignore\":\n\t\t\treturn lambda(() => Unknown);\n\t}\n}\n\nfunction singular_conversions(conversion: api_app.Csingular_conversions, value: number): number {\n\treturn conversion.properties.type.switch({\n\t\tfactor: ($) => {\n\t\t\tconst factor = $.properties.factor.value * Math.pow($.properties.base.value, $.properties.exponent.value);\n\t\t\treturn $.properties.invert.switch({\n\t\t\t\tno: value * factor,\n\t\t\t\tyes: value / factor,\n\t\t\t});\n\t\t},\n\t\tbase: ($) => {\n\t\t\tconst new_value =\n\t\t\t\tvalue + $.properties.offset.value * Math.pow($.properties.base.value, $.properties.exponent.value);\n\t\t\treturn $.properties.unit_conversion.switch({\n\t\t\t\tno: () => new_value,\n\t\t\t\tyes: ($) => singular_conversions($.properties.conversion_rule.ref, new_value),\n\t\t\t});\n\t\t},\n\t});\n}\n\nexport function ui_scalar_value_expression(\n\troot: api_app.Cui_scalar_value_expression\n): DefaultExpressionBuilder> {\n\tswitch (root.properties.type.state.name) {\n\t\tcase \"text\": {\n\t\t\tconst text__type = root.properties.type.state.node;\n\t\t\tswitch (text__type.properties.type.state.name) {\n\t\t\t\tcase \"static\": {\n\t\t\t\t\tconst value = text__type.properties.type.state.node.properties.value as T;\n\t\t\t\t\treturn lambda(() => value);\n\t\t\t\t}\n\t\t\t\tcase \"guid\":\n\t\t\t\t\treturn lambda(() => ({ toString: () => uuid.generate() } as T));\n\t\t\t\tcase \"auto increment\": {\n\t\t\t\t\tconst $ = text__type.properties.type.state.node;\n\t\t\t\t\treturn lambda(([this_node]) => this_node).pipe(\n\t\t\t\t\t\tstep.sync((node) => autoIncrement.property($, node) as ScalarProvider>)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcase \"number to text\": {\n\t\t\t\t\tconst $ = text__type.properties.type.state.node;\n\t\t\t\t\treturn ui_scalar_value_expression($.properties.expression).pipe(\n\t\t\t\t\t\tstep.sync((result) => {\n\t\t\t\t\t\t\tconst serialized_value = serializeNumber(\n\t\t\t\t\t\t\t\tresult,\n\t\t\t\t\t\t\t\t0, //TODO: the number should take number conversion into account\n\t\t\t\t\t\t\t\t$.properties.numerical_type.ref,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn $.properties.pad.switch({\n\t\t\t\t\t\t\t\tno: serialized_value,\n\t\t\t\t\t\t\t\tyes: ($) => pad(serialized_value, $.properties.size.value, $.properties.character),\n\t\t\t\t\t\t\t}) as T;\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcase \"concatenation\": {\n\t\t\t\t\tconst $ = text__type.properties.type.state.node;\n\t\t\t\t\treturn ui_scalar_value_expression_list($.properties.list).pipe(\n\t\t\t\t\t\tstep.sync((values) => ({ toString: () => values.map((val) => val.toString()).join(\"\") } as T))\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"number\": {\n\t\t\tconst number__type = root.properties.type.state.node;\n\t\t\tswitch (number__type.properties.type.state.name) {\n\t\t\t\tcase \"constant\": {\n\t\t\t\t\tconst value = number__type.properties.type.state.node.properties.value.properties.value.value as T;\n\t\t\t\t\treturn lambda(() => value);\n\t\t\t\t}\n\t\t\t\tcase \"now in seconds\":\n\t\t\t\t\treturn lambda(() => getCurrentDateAndTime() as T);\n\t\t\t\tcase \"unary expression\": {\n\t\t\t\t\tconst unary_expression = number__type.properties.type.state.node;\n\t\t\t\t\treturn ui_scalar_value_expression(unary_expression.properties.expression).pipe(\n\t\t\t\t\t\tstep.sync((expression_result) => {\n\t\t\t\t\t\t\tlet value: number;\n\t\t\t\t\t\t\tswitch (unary_expression.properties.type.state.name) {\n\t\t\t\t\t\t\t\tcase \"absolute value\":\n\t\t\t\t\t\t\t\t\tvalue = Math.abs(expression_result);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"numerical type conversion\": {\n\t\t\t\t\t\t\t\t\tconst $ = unary_expression.properties.type.state.node;\n\t\t\t\t\t\t\t\t\tswitch ($.properties.representation_based.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\tconst to_numerical_type = $.properties.conversion.ref.parent;\n\t\t\t\t\t\t\t\t\t\t\tswitch (to_numerical_type.properties.ui.properties.represent_as.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"date\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue = Math.floor(singular_conversions($.properties.conversion.ref, expression_result));\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"date and time\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue = Math.round(singular_conversions($.properties.conversion.ref, expression_result));\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"model\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue = Math.round(singular_conversions($.properties.conversion.ref, expression_result));\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"custom type\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue = Math.round(singular_conversions($.properties.conversion.ref, expression_result));\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"duration\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue = Math.round(singular_conversions($.properties.conversion.ref, expression_result));\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"ui date and time\":\n\t\t\t\t\t\t\t\t\t\t\t// Remove the time part of the date\n\t\t\t\t\t\t\t\t\t\t\tvalue = jsdate_2_julian_date(julian_datetime_2_js_date(expression_result));\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"sign inversion\":\n\t\t\t\t\t\t\t\t\tvalue = -expression_result;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn value as T;\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcase \"binary expression\": {\n\t\t\t\t\tconst binary_expression = number__type.properties.type.state.node;\n\t\t\t\t\tconst value_function = binary_expression.properties.operation.switch({\n\t\t\t\t\t\tdivision: ($) =>\n\t\t\t\t\t\t\t$.properties.rounding.switch({\n\t\t\t\t\t\t\t\tordinary: () => (left: number, right: number) => Math.round(left / right),\n\t\t\t\t\t\t\t\tceil: () => (left: number, right: number) => Math.ceil(left / right),\n\t\t\t\t\t\t\t\tfloor: () => (left: number, right: number) => Math.floor(left / right),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tremainder: () => (left: number, right: number) => left % right,\n\t\t\t\t\t});\n\t\t\t\t\treturn lambda(($) =>\n\t\t\t\t\t\tui_scalar_value_expression(binary_expression.properties.expressions.properties.left)\n\t\t\t\t\t\t\t.and(ui_scalar_value_expression(binary_expression.properties.expressions.properties.right)($))\n\t\t\t\t\t\t\t.pipe(([left, right]) => {\n\t\t\t\t\t\t\t\tif (left === Failed || right === Failed) {\n\t\t\t\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t\t\t\t} else if (left === Pending || right === Pending) {\n\t\t\t\t\t\t\t\t\treturn Pending;\n\t\t\t\t\t\t\t\t} else if (left === Unknown || right === Unknown) {\n\t\t\t\t\t\t\t\t\treturn Unknown;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\treturn value_function(left, right) as T;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})($)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcase \"list expression\": {\n\t\t\t\t\tconst $ = number__type.properties.type.state.node;\n\t\t\t\t\tconst value_function = $.properties.operation.switch({\n\t\t\t\t\t\tsum: () => (values: number[]) => values.reduce((result, value) => result + value) as T,\n\t\t\t\t\t\tminimum: () => (values: number[]) => values.reduce((result, value) => Math.min(result, value)) as T,\n\t\t\t\t\t\tmaximum: () => (values: number[]) => values.reduce((result, value) => Math.max(result, value)) as T,\n\t\t\t\t\t\tproduct: () => (values: number[]) => values.reduce((result, value) => result * value) as T,\n\t\t\t\t\t});\n\t\t\t\t\treturn ui_scalar_value_expression_list($.properties.value).pipe(step.sync(value_function));\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst state = root.properties.type.state.node.properties.state.ref.switch({\n\t\t\t\tstate: ($) => $ as T,\n\t\t\t});\n\t\t\treturn lambda(() => state);\n\t\t}\n\t\tcase \"style\": {\n\t\t\tconst $ = root.properties.type.state.node;\n\t\t\tswitch ($.properties.type.state.name) {\n\t\t\t\tcase \"fixed\": {\n\t\t\t\t\tconst fixed = $.properties.type.state.node;\n\t\t\t\t\tconst value = [\n\t\t\t\t\t\t\"fixed\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstyle: fixed.properties.style.properties.style.state.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t] as T;\n\t\t\t\t\treturn lambda(() => value);\n\t\t\t\t}\n\t\t\t\tcase \"property\": {\n\t\t\t\t\tconst property = $.properties.type.state.node;\n\t\t\t\t\treturn ui_scalar_value_expression(property.properties.expression).pipe(\n\t\t\t\t\t\tstep.sync((result) => {\n\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: result.toString(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] as T;\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"dynamic\": {\n\t\t\tconst $ = root.properties.type.state.node;\n\t\t\tconst property_value = $.properties.property.inferences.value().cast(\"property value\").variant;\n\t\t\tswitch (property_value.name) {\n\t\t\t\tcase \"number\":\n\t\t\t\t\treturn ui_parametrized_node_path($.properties.path).pipe(\n\t\t\t\t\t\tstep.numberValue(property_value.definition.cast(\"number property\"))\n\t\t\t\t\t) as DefaultExpressionBuilder>;\n\t\t\t\tcase \"text\":\n\t\t\t\t\treturn ui_parametrized_node_path($.properties.path).pipe(\n\t\t\t\t\t\tstep.textValue(property_value.definition.cast(\"text property\"))\n\t\t\t\t\t) as DefaultExpressionBuilder>;\n\t\t\t\tcase \"state choice\":\n\t\t\t\t\treturn ui_parametrized_node_path($.properties.path)\n\t\t\t\t\t\t.pipe(step.selectedState(property_value.definition.cast(\"state node choice\")))\n\t\t\t\t\t\t.pipe(step.sync((state) => state.key.ref as T));\n\t\t\t\tcase \"file\":\n\t\t\t\t\treturn ui_parametrized_node_path($.properties.path).pipe(\n\t\t\t\t\t\tstep.fileValue(property_value.definition)\n\t\t\t\t\t) as DefaultExpressionBuilder>;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"sticky\":\n\t\t\treturn lambda(([, , target]) => {\n\t\t\t\tif (target instanceof api_cs.Cproperty) {\n\t\t\t\t\tconst $type = target.properties.type.state;\n\t\t\t\t\tswitch ($type.name) {\n\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\tthrow new Error(\"Unexpected context\");\n\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\tthrow new Error(\"Unexpected context\");\n\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\tthrow new Error(\"Unexpected context\");\n\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\treturn new StickyProvider(\n\t\t\t\t\t\t\t\t() => (getStickyValue($type.node.inferences.number_type()) as T | undefined) ?? Failed\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\treturn new StickyProvider(() => {\n\t\t\t\t\t\t\t\tconst sticky_value = getStickyValue($type.node.inferences.state_group_type());\n\t\t\t\t\t\t\t\tif (sticky_value === undefined) return Failed;\n\t\t\t\t\t\t\t\treturn ($type.node.properties.states.get(sticky_value)?.key.ref as T | undefined) ?? Failed;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\treturn new StickyProvider(\n\t\t\t\t\t\t\t\t() => (getStickyValue($type.node.inferences.text_type()) as T | undefined) ?? Failed\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"Unexpected context\");\n\t\t\t\t}\n\t\t\t});\n\t}\n}\n\nclass StickyProvider extends ScalarProvider {\n\tconstructor(private fn: () => T | Failed) {\n\t\tsuper();\n\t}\n\tget value() {\n\t\treturn this.fn();\n\t}\n\tsubscribe(subscriber: ScalarConsumer): typeof subscriber {\n\t\tsubscriber.update(this.value);\n\t\treturn subscriber;\n\t}\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tunsubscribe() {}\n}\n\nfunction ui_scalar_value_expression_list(\n\troot: api_app.Cui_scalar_value_expression_list\n): DefaultExpressionBuilder> {\n\treturn lambda(($) =>\n\t\tui_scalar_value_expression(root.properties.value).pipe(\n\t\t\tstep.sync((result) => {\n\t\t\t\tswitch (root.properties.has_tail.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\treturn [result];\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst tail = root.properties.has_tail.state.node.properties.tail;\n\t\t\t\t\t\treturn ui_scalar_value_expression_list(tail).pipe(\n\t\t\t\t\t\t\tstep.sync((tail_values) => {\n\t\t\t\t\t\t\t\treturn [result, ...tail_values];\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)($);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t)($)\n\t);\n}\n","import { api_configuration } from \"../../common\";\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\n\nexport default function (query: api_views.Cqueries): string {\n\treturn query.path;\n}\n","import { api_configuration } from \"../../common\";\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\n\nexport function isKeyProperty(definition: api_app.Ctext__type__property): boolean {\n\treturn definition.parent.parent.parent.input.location().switch({\n\t\troot: () => false,\n\t\tcollection: ($) => $.properties.key_property.ref === definition,\n\t\tgroup: () => false,\n\t\tstate: () => false,\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport { getGuiText, getGuiNumber, getGuiStategroup } from \"../guiModel\";\n\nconst stickyvalues: Record = {};\nconst isStickyProperties: Record = {};\n\nexport function getStickyValue(property: api_app.Ctext__type__property): string | undefined;\nexport function getStickyValue(property: api_app.Cnumber__type__property): number | undefined;\nexport function getStickyValue(property: api_app.Cstate_group): string | undefined;\nexport function getStickyValue(\n\tproperty: api_app.Cstate_group | api_app.Ctext__type__property | api_app.Cnumber__type__property\n): string | number | undefined {\n\treturn stickyvalues[property.path];\n}\n\nfunction setStickyValue(property: api_app.Ctext__type__property, value: string): void;\nfunction setStickyValue(property: api_app.Cnumber__type__property, value: number): void;\nfunction setStickyValue(property: api_app.Cstate_group, value: string): void;\nfunction setStickyValue(\n\tproperty: api_app.Cstate_group | api_app.Ctext__type__property | api_app.Cnumber__type__property,\n\tvalue: string | number\n): void {\n\tstickyvalues[property.path] = value;\n}\n\nfunction isSticky(\n\tproperty: api_app.Cstate_group | api_app.Ctext__type__property | api_app.Cnumber__type__property\n): boolean {\n\treturn isStickyProperties[property.path];\n}\n\nexport function setStickyTextValue(text_definition: api_app.Ctext__type__property, value: string): void {\n\tconst gui_text = getGuiText(text_definition);\n\tif (!gui_text) return;\n\tlet is_sticky = isSticky(text_definition);\n\tif (is_sticky === undefined) {\n\t\tlet new_sticky: boolean;\n\t\tswitch (gui_text.properties.default_.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\tnew_sticky = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = gui_text.properties.default_.state.node;\n\t\t\t\tnew_sticky = false;\n\t\t\t\tswitch ($.properties.source.state.name) {\n\t\t\t\t\tcase \"auto select only candidate\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"current user\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"expression\": {\n\t\t\t\t\t\tconst expression = $.properties.source.state.node;\n\t\t\t\t\t\tnew_sticky = analyseDefaultForStickyness(expression.inferences.text_with_default().properties.default_);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"guid\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"select source\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.source.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(gui_text.properties.default_.state);\n\t\t}\n\t\tis_sticky = new_sticky;\n\t}\n\tif (is_sticky) {\n\t\tsetStickyValue(text_definition, value);\n\t}\n}\nexport function setStickyNumberValue(number_definition: api_app.Cnumber__type__property, value: number): void {\n\tconst gui_number = getGuiNumber(number_definition);\n\tif (!gui_number) return;\n\tlet is_sticky = isSticky(number_definition);\n\tif (is_sticky === undefined) {\n\t\tlet new_sticky: boolean;\n\t\tswitch (gui_number.properties.default_.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\tnew_sticky = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = gui_number.properties.default_.state.node;\n\t\t\t\tnew_sticky = false;\n\t\t\t\tswitch ($.properties.value.state.name) {\n\t\t\t\t\tcase \"now\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"one\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"zero\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"today\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"expression\": {\n\t\t\t\t\t\tconst expression = $.properties.value.state.node;\n\t\t\t\t\t\tnew_sticky = analyseDefaultForStickyness(expression.inferences.model_expression().properties.default_);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.value.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(gui_number.properties.default_.state);\n\t\t}\n\t\tis_sticky = new_sticky;\n\t}\n\tif (is_sticky) {\n\t\tsetStickyValue(number_definition, value);\n\t}\n}\nexport function setStickyStateGroupValue(stategroup_definition: api_app.Cstate_group, value: string): void {\n\tconst gui_stategroup = getGuiStategroup(stategroup_definition);\n\tif (!gui_stategroup) return;\n\tlet is_sticky = isSticky(stategroup_definition);\n\tif (is_sticky === undefined) {\n\t\tlet new_sticky: boolean;\n\t\tswitch (gui_stategroup.properties.default_.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\tnew_sticky = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = gui_stategroup.properties.default_.state.node;\n\t\t\t\tnew_sticky = false;\n\t\t\t\tswitch ($.properties.source.state.name) {\n\t\t\t\t\tcase \"state\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"state switch\": {\n\t\t\t\t\t\tconst expression = $.properties.source.state.node;\n\t\t\t\t\t\tnew_sticky = analyseDefaultForStickyness(expression.inferences.model_state_switch().properties.default_);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.source.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(gui_stategroup.properties.default_.state);\n\t\t}\n\t\tis_sticky = new_sticky;\n\t}\n\tif (is_sticky) {\n\t\tsetStickyValue(stategroup_definition, value);\n\t}\n}\n\nfunction analyseDefaultForStickyness(default_: api_app.Cui_scalar_default): boolean {\n\tif (analyseExpressionForStickyness(default_.properties.expression)) {\n\t\treturn true;\n\t}\n\tswitch (default_.properties.has_fallback.state.name) {\n\t\tcase \"no\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = default_.properties.has_fallback.state.node;\n\t\t\treturn analyseDefaultForStickyness($.properties.fallback);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(default_.properties.has_fallback.state);\n\t}\n}\n\nfunction analyseExpressionForStickyness(expression: api_app.Cui_expression): boolean {\n\tswitch (expression.properties.operation.state.name) {\n\t\tcase \"entry\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"entry list\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"execute operation\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"ignore\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"node switch\": {\n\t\t\tconst $ = expression.properties.operation.state.node;\n\t\t\treturn (\n\t\t\t\tanalyseExpressionForStickyness($.properties.cases.properties.node_case.properties.expression) ||\n\t\t\t\tanalyseExpressionForStickyness($.properties.cases.properties.none_case.properties.expression)\n\t\t\t);\n\t\t}\n\t\tcase \"produce value\": {\n\t\t\tconst $ = expression.properties.operation.state.node;\n\t\t\tswitch ($.properties.value.state.name) {\n\t\t\t\tcase \"object\": {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tcase \"scalar\": {\n\t\t\t\t\tconst scalar = $.properties.value.state.node;\n\t\t\t\t\treturn analyseScalarValueExpression(scalar.properties.expression);\n\t\t\t\t}\n\t\t\t\tcase \"state\": {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState($.properties.value.state);\n\t\t\t}\n\t\t}\n\t\tcase \"state switch\": {\n\t\t\tconst $ = expression.properties.operation.state.node;\n\t\t\tfor (const state of $.properties.states) {\n\t\t\t\tif (analyseExpressionForStickyness(state[1].properties.expression)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tcase \"update properties\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"walk\": {\n\t\t\tconst $ = expression.properties.operation.state.node;\n\t\t\treturn analyseExpressionForStickyness($.properties.expression);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(expression.properties.operation.state);\n\t}\n}\n\nfunction analyseScalarValueExpression(expression: api_app.Cui_scalar_value_expression): boolean {\n\tswitch (expression.properties.type.state.name) {\n\t\tcase \"dynamic\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"number\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"state\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"sticky\": {\n\t\t\treturn true;\n\t\t}\n\t\tcase \"style\": {\n\t\t\treturn false;\n\t\t}\n\t\tcase \"text\": {\n\t\t\treturn false;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(expression.properties.type.state);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport client_request = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport client_reply = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_reply.alan_api;\nimport client_state = api_configuration.types.client_state.alan_api;\n\nfunction doMapClientRequest(id: client_request.Cid_path__client_request, builder: IdPathBuilder): IdPathBuilder {\n\tswitch (id.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\treturn builder;\n\t\tcase \"yes\": {\n\t\t\tconst tail = id.properties.has_steps.state.node.properties.tail;\n\t\t\tconst type = id.properties.has_steps.state.node.properties.type;\n\t\t\tswitch (type.state.name) {\n\t\t\t\tcase \"collection entry\":\n\t\t\t\t\treturn doMapClientRequest(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\tbuilder.collectionEntry(type.state.node.properties.collection.entry, type.state.node.properties.id)\n\t\t\t\t\t);\n\t\t\t\tcase \"group\":\n\t\t\t\t\treturn doMapClientRequest(tail, builder.group(type.state.node.properties.group.entry));\n\t\t\t\tcase \"state\":\n\t\t\t\t\treturn doMapClientRequest(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\tbuilder.state(type.state.node.properties.state_group.entry, type.state.node.properties.state.entry)\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(type.state);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn unexpectedState(id.properties.has_steps.state);\n\t}\n}\n\nfunction doMapClientReply(id: client_reply.Cid_path__client_reply, builder: IdPathBuilder): IdPathBuilder {\n\tswitch (id.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\treturn builder;\n\t\tcase \"yes\": {\n\t\t\tconst tail = id.properties.has_steps.state.node.properties.tail;\n\t\t\tconst type = id.properties.has_steps.state.node.properties.type;\n\t\t\tswitch (type.state.name) {\n\t\t\t\tcase \"collection entry\":\n\t\t\t\t\treturn doMapClientReply(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\tbuilder.collectionEntry(type.state.node.properties.collection.entry, type.state.node.properties.id)\n\t\t\t\t\t);\n\t\t\t\tcase \"group\":\n\t\t\t\t\treturn doMapClientReply(tail, builder.group(type.state.node.properties.group.entry));\n\t\t\t\tcase \"state\":\n\t\t\t\t\treturn doMapClientReply(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\tbuilder.state(type.state.node.properties.state_group.entry, type.state.node.properties.state.entry)\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(type.state);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn unexpectedState(id.properties.has_steps.state);\n\t}\n}\n\nfunction doMapClientState(id: client_state.Cid_path, builder: IdPathBuilder): IdPathBuilder {\n\tswitch (id.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\treturn builder;\n\t\tcase \"yes\": {\n\t\t\tconst tail = id.properties.has_steps.state.node.properties.tail;\n\t\t\tconst type = id.properties.has_steps.state.node.properties.type;\n\t\t\tswitch (type.state.name) {\n\t\t\t\tcase \"collection entry\":\n\t\t\t\t\treturn doMapClientState(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\tbuilder.collectionEntry(type.state.node.properties.collection.entry, type.state.node.properties.id)\n\t\t\t\t\t);\n\t\t\t\tcase \"group\":\n\t\t\t\t\treturn doMapClientState(tail, builder.group(type.state.node.properties.group.entry));\n\t\t\t\tcase \"state\":\n\t\t\t\t\treturn doMapClientState(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\tbuilder.state(type.state.node.properties.state_group.entry, type.state.node.properties.state.entry)\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(type.state);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn unexpectedState(id.properties.has_steps.state);\n\t}\n}\n\nexport function fromClientRequest(id: client_request.Cid_path__client_request): IdPathBuilder {\n\treturn doMapClientRequest(id, IdPathBuilder.create());\n}\n\nexport function fromClientReply(id: client_reply.Cid_path__client_reply): IdPathBuilder {\n\treturn doMapClientReply(id, IdPathBuilder.create());\n}\n\nexport function fromClientState(id: client_state.Cid_path): IdPathBuilder {\n\treturn doMapClientState(id, IdPathBuilder.create());\n}\n","import { api_configuration } from \"../../common\";\nimport api_widget = api_configuration.libraries.gui_definition_lib.types.widget;\nimport api_modifications = api_configuration.types.modifications;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport csr = api_configuration.types.client_state.alan_api;\nimport { client_state } from \"./ClientState\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport DestructorTree from \"../DestructorTree\";\n\nexport function storeNumber(\n\tnode: csr.Cnode,\n\tnumber_property: api_views.Cnumber__type__configuration,\n\tvalue: number,\n\tentry_keys: string[]\n): void {\n\tstoreWidgetNumber(\n\t\tnode,\n\t\tnumber_property.parent.parent.input.gui_widget_configuration_node(),\n\t\tnumber_property.inferences.number(),\n\t\tvalue,\n\t\tentry_keys\n\t);\n}\nexport function storeWidgetNumber(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\tnumber_property: api_widget.alan_api.Cnumber__type__configuration__type__attributes__widget_configuration_node,\n\tvalue: number,\n\tentry_keys: string[]\n): void {\n\tconst local_value = initializeNumberValue(node, gui_context, number_property, entry_keys);\n\tlocal_value.value = value;\n\tfor (const observer of local_value.observer) {\n\t\tobserver(value);\n\t}\n\tnumber_property.properties.persistence.properties.persist.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\tconst storageId = propertyIdentification(\n\t\t\t\t$.properties.per_entry.switch({\n\t\t\t\t\tyes: node,\n\t\t\t\t\tno: null,\n\t\t\t\t}),\n\t\t\t\tgui_context,\n\t\t\t\tnumber_property,\n\t\t\t\tentry_keys\n\t\t\t);\n\t\t\t$.properties.per_session.switch({\n\t\t\t\tno: () => {\n\t\t\t\t\twindow.localStorage.setItem(storageId, value.toString());\n\t\t\t\t},\n\t\t\t\tyes: () => {\n\t\t\t\t\tsession_storage[storageId] = value;\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n}\nexport function getNumber(\n\tnode: csr.Cnode,\n\tnumber_property: api_views.Cnumber__type__configuration,\n\tentry_keys: string[]\n): ConfigurationValue {\n\treturn getWidgetNumber(\n\t\tnode,\n\t\tnumber_property.parent.parent.input.gui_widget_configuration_node(),\n\t\tnumber_property.inferences.number(),\n\t\tentry_keys\n\t);\n}\nexport function getWidgetNumber(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\tnumber_property: api_widget.alan_api.Cnumber__type__configuration__type__attributes__widget_configuration_node,\n\tentry_keys: string[]\n): ConfigurationValue {\n\tconst local_value = initializeNumberValue(node, gui_context, number_property, entry_keys);\n\tlet number_value = local_value.value;\n\tif (number_value === undefined) {\n\t\tconst persist = number_property.properties.persistence.properties.persist;\n\t\tswitch (persist.state.name) {\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = persist.state.node;\n\t\t\t\tconst storageId = propertyIdentification(\n\t\t\t\t\t$.properties.per_entry.switch({\n\t\t\t\t\t\tno: null,\n\t\t\t\t\t\tyes: node,\n\t\t\t\t\t}),\n\t\t\t\t\tgui_context,\n\t\t\t\t\tnumber_property,\n\t\t\t\t\tentry_keys\n\t\t\t\t);\n\t\t\t\tswitch ($.properties.per_session.state.name) {\n\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\tconst string_value = window.localStorage.getItem(storageId);\n\t\t\t\t\t\tnumber_value = string_value !== null ? Number.parseInt(string_value) : undefined;\n\t\t\t\t\t\tnumber_value = number_value !== undefined && isNaN(number_value) ? undefined : number_value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tnumber_value = session_storage[storageId];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.per_session.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(persist.state);\n\t\t}\n\t}\n\treturn new ConfigurationValue(local_value.observer, number_value);\n}\nexport function registerNumberDestructor(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\tnumber_property: api_widget.alan_api.Cnumber__type__configuration__type__attributes__widget_configuration_node,\n\tdestructor: DestructorTree,\n\tentry_keys: string[]\n): void {\n\tconst persist = number_property.properties.persistence.properties.persist;\n\tswitch (persist.state.name) {\n\t\tcase \"no\": {\n\t\t\tdestructor.onDestroy(() => {\n\t\t\t\tdeinitializeNumberValue(node, gui_context, number_property, entry_keys);\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(persist.state);\n\t}\n}\n\nexport function storeText(\n\tnode: csr.Cnode,\n\ttext_property: api_views.Ctext__type__configuration,\n\tvalue: string,\n\tentry_keys: string[]\n): void {\n\tstoreWidgetText(\n\t\tnode,\n\t\ttext_property.parent.parent.input.gui_widget_configuration_node(),\n\t\ttext_property.inferences.text(),\n\t\tvalue,\n\t\tentry_keys\n\t);\n}\nexport function getText(\n\tnode: csr.Cnode,\n\ttext_property: api_views.Ctext__type__configuration,\n\tentry_keys: string[]\n): ConfigurationValue {\n\treturn getWidgetText(\n\t\tnode,\n\t\ttext_property.parent.parent.input.gui_widget_configuration_node(),\n\t\ttext_property.inferences.text(),\n\t\tentry_keys\n\t);\n}\nexport function storeWidgetText(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\ttext_property: api_widget.alan_api.Ctext__type__configuration__type__attributes__widget_configuration_node,\n\tvalue: string,\n\tentry_keys: string[]\n): void {\n\tconst local_calue = initializeTextValue(node, gui_context, text_property, entry_keys);\n\tlocal_calue.value = value;\n\tfor (const observer of local_calue.observer) {\n\t\tobserver(value);\n\t}\n\ttext_property.properties.persistence.properties.persist.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\tconst storageId = propertyIdentification(\n\t\t\t\t$.properties.per_entry.switch({\n\t\t\t\t\tno: null,\n\t\t\t\t\tyes: node,\n\t\t\t\t}),\n\t\t\t\tgui_context,\n\t\t\t\ttext_property,\n\t\t\t\tentry_keys\n\t\t\t);\n\t\t\t$.properties.per_session.switch({\n\t\t\t\tno: () => {\n\t\t\t\t\twindow.localStorage.setItem(storageId, value);\n\t\t\t\t},\n\t\t\t\tyes: () => {\n\t\t\t\t\tsession_storage[storageId] = value;\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n}\nexport function getWidgetText(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\ttext_property: api_widget.alan_api.Ctext__type__configuration__type__attributes__widget_configuration_node,\n\tentry_keys: string[]\n): ConfigurationValue {\n\tconst local_value = initializeTextValue(node, gui_context, text_property, entry_keys);\n\tlet text_value = local_value.value;\n\tif (text_value === undefined) {\n\t\tconst persist = text_property.properties.persistence.properties.persist;\n\t\tswitch (persist.state.name) {\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = persist.state.node;\n\t\t\t\tconst storageId = propertyIdentification(\n\t\t\t\t\t$.properties.per_entry.switch({\n\t\t\t\t\t\tno: null,\n\t\t\t\t\t\tyes: node,\n\t\t\t\t\t}),\n\t\t\t\t\tgui_context,\n\t\t\t\t\ttext_property,\n\t\t\t\t\tentry_keys\n\t\t\t\t);\n\t\t\t\tswitch ($.properties.per_session.state.name) {\n\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\ttext_value = window.localStorage.getItem(storageId) || undefined;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\ttext_value = session_storage[storageId];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.per_session.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(persist.state);\n\t\t}\n\t}\n\treturn new ConfigurationValue(local_value.observer, text_value);\n}\nexport function registerTextDestructor(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\ttext_property: api_widget.alan_api.Ctext__type__configuration__type__attributes__widget_configuration_node,\n\tdestructor: DestructorTree,\n\tentry_keys: string[]\n): void {\n\tconst persist = text_property.properties.persistence.properties.persist;\n\tswitch (persist.state.name) {\n\t\tcase \"no\": {\n\t\t\tdestructor.onDestroy(() => {\n\t\t\t\tdeinitializeTextValue(node, gui_context, text_property, entry_keys);\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(persist.state);\n\t}\n}\nexport function setState(\n\tnode: csr.Cnode,\n\tstate_group_property: api_views.Cstate_group__type__configuration,\n\tselected_state: string,\n\tconfiguration: api_modifications.alan_api.Tconfiguration_node,\n\tentry_keys: string[]\n): void {\n\tsetWidgetState(\n\t\tnode,\n\t\tstate_group_property.parent.parent.input.gui_widget_configuration_node(),\n\t\tstate_group_property.inferences.state_group(),\n\t\tselected_state,\n\t\tconfiguration,\n\t\tentry_keys\n\t);\n}\nexport function setWidgetState(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\tstate_group_property: api_widget.alan_api.Cstate_group__type__configuration__type__attributes__widget_configuration_node,\n\tselected_state: string,\n\tconfiguration: api_modifications.alan_api.Tconfiguration_node,\n\tentry_keys: string[]\n): void {\n\tconst widget_configuration = state_group_property.parent.parent.parent;\n\tconst modification = api_modifications.alan_api.Cmodifications.create(\n\t\t{\n\t\t\twidget: widgetName(widget_configuration),\n\t\t\tpath: createPathToWidgetRoot(widget_configuration, { \"has steps\": [\"no\", {}] }),\n\t\t\t\"state group\": state_group_property.parent.parent.key,\n\t\t\t\"selected state\": selected_state,\n\t\t\tconfiguration: configuration,\n\t\t},\n\t\t{\n\t\t\twidget: client_state.input.widget,\n\t\t}\n\t);\n\n\tconst local_value = initializeStategroupValue(node, gui_context, state_group_property, entry_keys);\n\tlocal_value.value = modification;\n\tfor (const observer of local_value.observer) {\n\t\tobserver(local_value.value);\n\t}\n\tstate_group_property.properties.persistence.properties.persist.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\tconst storageId = propertyIdentification(\n\t\t\t\t$.properties.per_entry.switch({\n\t\t\t\t\tno: null,\n\t\t\t\t\tyes: node,\n\t\t\t\t}),\n\t\t\t\tgui_context,\n\t\t\t\tstate_group_property,\n\t\t\t\tentry_keys\n\t\t\t);\n\t\t\tmodification.key = storageId;\n\t\t\tstoreState(modification);\n\t\t},\n\t});\n}\nexport function storeState(modification: api_modifications.alan_api.Cmodifications): void {\n\tconst state_group_property = modification.properties.state_group.ref;\n\tconst persist_property = state_group_property.properties.persistence.properties.persist;\n\tswitch (persist_property.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst $ = persist_property.state.node;\n\t\t\tconst storageId = modification.key!;\n\t\t\tconst serialized_configuration = api_modifications.serializer_json.serialize(modification);\n\t\t\t$.properties.per_session.switch({\n\t\t\t\tno: () => {\n\t\t\t\t\twindow.localStorage.setItem(storageId, JSON.stringify(serialized_configuration));\n\t\t\t\t},\n\t\t\t\tyes: () => {\n\t\t\t\t\tsession_storage[storageId] = serialized_configuration;\n\t\t\t\t},\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(persist_property.state);\n\t}\n}\nexport function getState(\n\tnode: csr.Cnode,\n\tstate_group: api_views.Cstate_group__type__configuration,\n\tentry_keys: string[]\n): ConfigurationValue {\n\treturn getWidgetState(\n\t\tnode,\n\t\tstate_group.parent.parent.input.gui_widget_configuration_node(),\n\t\tstate_group.inferences.state_group(),\n\t\tentry_keys\n\t);\n}\nexport function getWidgetState(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\tstate_group: api_widget.alan_api.Cstate_group__type__configuration__type__attributes__widget_configuration_node,\n\tentry_keys: string[]\n): ConfigurationValue {\n\tconst local_value = initializeStategroupValue(node, gui_context, state_group, entry_keys);\n\tlet modification = local_value.value;\n\tif (modification === undefined) {\n\t\tconst persist = state_group.properties.persistence.properties.persist;\n\t\tswitch (persist.state.name) {\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tcase \"yes\": {\n\t\t\t\tconst $ = persist.state.node;\n\t\t\t\tconst storageId = propertyIdentification(\n\t\t\t\t\t$.properties.per_entry.switch({\n\t\t\t\t\t\tno: null,\n\t\t\t\t\t\tyes: node,\n\t\t\t\t\t}),\n\t\t\t\t\tgui_context,\n\t\t\t\t\tstate_group,\n\t\t\t\t\tentry_keys\n\t\t\t\t);\n\t\t\t\tlet value: any | null = null;\n\t\t\t\tswitch ($.properties.per_session.state.name) {\n\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\tconst string_value = window.localStorage.getItem(storageId);\n\t\t\t\t\t\tif (string_value === null) {\n\t\t\t\t\t\t\tvalue = null;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tvalue = JSON.parse(string_value);\n\t\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t\twindow.localStorage.removeItem(storageId);\n\t\t\t\t\t\t\t\tvalue = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tvalue = session_storage[storageId] || null;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.per_session.state);\n\t\t\t\t}\n\t\t\t\tif (value !== null) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmodification = api_modifications.alan_api.Cmodifications.create(value, {\n\t\t\t\t\t\t\twidget: client_state.input.widget,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tmodification.key = storageId;\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tswitch ($.properties.per_session.state.name) {\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\twindow.localStorage.removeItem(storageId);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState($.properties.per_session.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(persist.state);\n\t\t}\n\t}\n\treturn new ConfigurationValue(local_value.observer, modification);\n}\nexport function registerStateDestructor(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\tstate_group: api_widget.alan_api.Cstate_group__type__configuration__type__attributes__widget_configuration_node,\n\tdestructor: DestructorTree,\n\tentry_keys: string[]\n): void {\n\tconst persist = state_group.properties.persistence.properties.persist;\n\tswitch (persist.state.name) {\n\t\tcase \"no\": {\n\t\t\tdestructor.onDestroy(() => {\n\t\t\t\tdeinitializeStategroupValue(node, gui_context, state_group, entry_keys);\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(persist.state);\n\t}\n}\nexport class ConfigurationValue {\n\tconstructor(private observers: Set<(value: T) => void>, public readonly value: T | undefined) {}\n\tsubscribe(callback: (value: T) => void): { unsubscribe: () => void } {\n\t\tthis.observers.add(callback);\n\t\treturn {\n\t\t\tunsubscribe: () => {\n\t\t\t\tthis.observers.delete(callback);\n\t\t\t},\n\t\t};\n\t}\n}\n\ntype Subscription = Map<\n\tapi_views.Cgui_widget_configuration_node,\n\tMap<\n\t\tP,\n\t\tMap<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tobserver: Set<(new_value: R) => void>;\n\t\t\t\tvalue: R | undefined;\n\t\t\t\tcheck_local_storage: boolean;\n\t\t\t}\n\t\t>\n\t>\n>;\n\nconst session_storage: Record = {};\nconst text_values = new Map<\n\tcsr.Cnode,\n\tSubscription\n>();\nconst number_values = new Map<\n\tcsr.Cnode,\n\tSubscription\n>();\nconst stategroup_values = new Map<\n\tcsr.Cnode,\n\tSubscription<\n\t\tapi_widget.alan_api.Cstate_group__type__configuration__type__attributes__widget_configuration_node,\n\t\tapi_modifications.alan_api.Cmodifications\n\t>\n>();\nfunction initializeValue(\n\tnode: csr.Cnode,\n\tcontext: api_views.Cgui_widget_configuration_node,\n\tproperty: P,\n\tentry_keys: string[],\n\tvalues: Map>\n) {\n\tlet n = values.get(node);\n\tif (n === undefined) {\n\t\tnode.onDestroy(() => values.delete(node));\n\t\tn = values.set(node, new Map()).get(node)!;\n\t}\n\tlet pp = n!.get(context);\n\tif (pp === undefined) {\n\t\tpp = n.set(context, new Map()).get(context)!;\n\t}\n\tlet p = pp!.get(property);\n\tif (p === undefined) {\n\t\tp = pp.set(property, new Map()).get(property)!;\n\t}\n\tconst entry_string = entry_keys.join(\" \");\n\tlet e = p.get(entry_string);\n\tif (e === undefined) {\n\t\te = p\n\t\t\t.set(entry_string, {\n\t\t\t\tobserver: new Set(),\n\t\t\t\tvalue: undefined,\n\t\t\t\tcheck_local_storage: true,\n\t\t\t})\n\t\t\t.get(entry_string)!;\n\t} else {\n\t\te.check_local_storage = false;\n\t}\n\treturn e;\n}\nfunction initializeNumberValue(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\tproperty: api_widget.alan_api.Cnumber__type__configuration__type__attributes__widget_configuration_node,\n\tentry_keys: string[]\n) {\n\treturn initializeValue(node, gui_context, property, entry_keys, number_values);\n}\nfunction initializeTextValue(\n\tnode: csr.Cnode,\n\tcontext: api_views.Cgui_widget_configuration_node,\n\tproperty: api_widget.alan_api.Ctext__type__configuration__type__attributes__widget_configuration_node,\n\tentry_keys: string[]\n) {\n\treturn initializeValue(node, context, property, entry_keys, text_values);\n}\nfunction initializeStategroupValue(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\tproperty: api_widget.alan_api.Cstate_group__type__configuration__type__attributes__widget_configuration_node,\n\tentry_keys: string[]\n) {\n\treturn initializeValue(node, gui_context, property, entry_keys, stategroup_values);\n}\n\nfunction deinitializeValue(\n\tnode: csr.Cnode,\n\tcontext: api_views.Cgui_widget_configuration_node,\n\tproperty: P,\n\tvalues: Map>,\n\tentry_keys: string[]\n) {\n\tconst node_values = values.get(node);\n\tconst context_values = node_values?.get(context);\n\tconst property_values = context_values?.get(property);\n\tproperty_values?.delete(entry_keys.join(\" \"));\n\tif (property_values?.size === 0) {\n\t\tcontext_values?.delete(property);\n\t}\n\tif (context_values?.size === 0) {\n\t\tnode_values?.delete(context);\n\t}\n\tif (node_values?.size === 0) {\n\t\tvalues.delete(node);\n\t}\n}\nfunction deinitializeNumberValue(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\tproperty: api_widget.alan_api.Cnumber__type__configuration__type__attributes__widget_configuration_node,\n\tentry_keys: string[]\n) {\n\treturn deinitializeValue(node, gui_context, property, number_values, entry_keys);\n}\nfunction deinitializeTextValue(\n\tnode: csr.Cnode,\n\tcontext: api_views.Cgui_widget_configuration_node,\n\tproperty: api_widget.alan_api.Ctext__type__configuration__type__attributes__widget_configuration_node,\n\tentry_keys: string[]\n) {\n\treturn deinitializeValue(node, context, property, text_values, entry_keys);\n}\nfunction deinitializeStategroupValue(\n\tnode: csr.Cnode,\n\tgui_context: api_views.Cgui_widget_configuration_node,\n\tproperty: api_widget.alan_api.Cstate_group__type__configuration__type__attributes__widget_configuration_node,\n\tentry_keys: string[]\n) {\n\treturn deinitializeValue(node, gui_context, property, stategroup_values, entry_keys);\n}\n\nfunction propertyIdentification(\n\tnode: csr.Cnode | null,\n\tparent_context: api_views.Cgui_widget_configuration_node,\n\tproperty: { parent: api_widget.alan_api.Cconfiguration__type__attributes__widget_configuration_node; path: string },\n\tentry_keys: string[]\n) {\n\tconst view_id = parent_context.root.key;\n\tconst entry_id = node === null ? \"\" : IdPathBuilder.serialize(createIdPathBuilderFromNode(node));\n\tconst parent_path = parent_context?.path ?? \"\";\n\tconst property_path = property.path;\n\tconst serialized_entry_keys = entry_keys.filter(dont_equal_entries).join(\",\");\n\treturn `${view_id}-${entry_id}-${parent_path}-${property_path}-${serialized_entry_keys}`;\n}\nfunction widgetName(configuration: api_widget.alan_api.Cwidget_configuration_node): string {\n\treturn configuration.input.location().switch({\n\t\twidget: ($) => $.key as string,\n\t\tbinding: ($) => widgetName($.parent.parent),\n\t\t\"configuration list\": ($) => widgetName($.parent.parent.parent),\n\t\t\"configuration state\": ($) => widgetName($.parent.parent.parent.parent),\n\t\twindow: ($) => widgetName($.parent.parent),\n\t});\n}\nfunction createPathToWidgetRoot(\n\tconfiguration: api_widget.alan_api.Cwidget_configuration_node,\n\ttail: api_modifications.alan_api.Twidget_configuration_path\n): api_modifications.alan_api.Twidget_configuration_path {\n\treturn configuration.input.location().switch({\n\t\twidget: () => tail,\n\t\tbinding: ($) =>\n\t\t\tcreatePathToWidgetRoot($.parent.parent, {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\tattribute: $.parent.key,\n\t\t\t\t\t\ttype: [\"binding\", {}],\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t\"configuration list\": ($) =>\n\t\t\tcreatePathToWidgetRoot($.parent.parent.parent, {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\tattribute: $.parent.parent.key,\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"configuration\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: [\"list\", {}],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t\"configuration state\": ($) =>\n\t\t\tcreatePathToWidgetRoot($.parent.parent.parent.parent, {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\tattribute: $.parent.parent.parent.key,\n\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\"configuration\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\t\"state\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tstate: $.key,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\twindow: ($) =>\n\t\t\tcreatePathToWidgetRoot($.parent.parent, {\n\t\t\t\t\"has steps\": [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\tattribute: $.parent.key,\n\t\t\t\t\t\ttype: [\"window\", {}],\n\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t});\n}\nfunction dont_equal_entries(key: string): boolean {\n\t//Do not equal entries, because this changes over time.\n\treturn !key.startsWith(\"entries:\");\n}\n","import { api_configuration } from \"../../common\";\nimport api_gui = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { gregorian_datetime_2_julian_datetime, gregorian_date_2_julian_date } from \"../calendar/conversion\";\nimport Gregorian_Date from \"../calendar/Gregorian_Date\";\nimport Gregorian_Datetime from \"../calendar/Gregorian_Datetime\";\nimport Hour_Time from \"../calendar/Hour_Time\";\nimport { ui_expression } from \"./expressions\";\nimport { getGuiNumber } from \"../guiModel\";\nimport * as Status from \"../Status\";\nimport { Scalar } from \"../../../../../stream\";\n\nfunction getNumberLimit(number_limit: api_gui.Cnumber_limit): number {\n\tconst type = number_limit.properties.type.state;\n\tswitch (type.name) {\n\t\tcase \"dynamic\": {\n\t\t\tconst d = new Date();\n\t\t\tconst greg_date = new Gregorian_Date(d.getFullYear(), d.getMonth() + 1, d.getDate());\n\t\t\tconst base = type.node.properties.base.switch({\n\t\t\t\tnow: () =>\n\t\t\t\t\tgregorian_datetime_2_julian_datetime(\n\t\t\t\t\t\tnew Gregorian_Datetime(greg_date, new Hour_Time(d.getHours(), d.getMinutes(), d.getSeconds()))\n\t\t\t\t\t),\n\t\t\t\ttoday: () => gregorian_date_2_julian_date(greg_date),\n\t\t\t});\n\t\t\tconst offset = type.node.properties.with_offset.switch({\n\t\t\t\tno: () => 0,\n\t\t\t\tyes: ($) => $.properties.offset.value,\n\t\t\t});\n\t\t\treturn base + offset;\n\t\t}\n\t\tcase \"static\":\n\t\t\treturn type.node.properties.limit.value;\n\t}\n}\n\nexport function getUpperLimit(property: api_cs.Cnumber__type__property): Scalar | undefined {\n\treturn getGuiNumber(property.inferences.number_type())?.properties.validation.properties.has_maximum.switch({\n\t\tno: () => undefined,\n\t\tyes: ($) => getNumberLimit($.properties.maximum),\n\t\texpression: ($) =>\n\t\t\tui_expression($.inferences.model_expression().properties.maximum).pipe((result) =>\n\t\t\t\t!Status.isResolved(result) ? Number.MAX_SAFE_INTEGER : result\n\t\t\t)([property.component_root, null, property.parent]),\n\t});\n}\n\nexport function getLowerLimit(property: api_cs.Cnumber__type__property): Scalar | undefined {\n\treturn getGuiNumber(property.inferences.number_type())?.properties.validation.properties.has_minimum.switch({\n\t\tno: () => undefined,\n\t\tyes: ($) => getNumberLimit($.properties.minimum),\n\t\texpression: ($) =>\n\t\t\tui_expression($.inferences.model_expression().properties.minimum).pipe((result) =>\n\t\t\t\t!Status.isResolved(result) ? Number.MIN_SAFE_INTEGER : result\n\t\t\t)([property.component_root, null, property.parent]),\n\t});\n}\n\nexport function mustBePositive(property: api_cs.Cnumber__type__property): boolean {\n\treturn property.inferences.number_type().properties.set_type.switch({\n\t\tinteger: false,\n\t\tpositive: true,\n\t});\n}\n","import DestructorTree from \"../DestructorTree\";\nimport { api_configuration } from \"../../common\";\nimport { createLocalNode } from \"./addClientState\";\nimport cs = api_configuration.types.client_state.alan_api;\nimport { applyOperationDefaults } from \"./defaults\";\nimport { registerNewNode } from \"./registerClientState\";\nimport { nodeValid } from \"../state/subscribeToNodePropertyValid\";\n\nexport function startOperation(\n\toperation: cs.Coperation__type__attributes,\n\tdestructor: DestructorTree\n): cs.Cyes__started {\n\tconst result = operation.properties.started.switch({\n\t\tyes: ($) => {\n\t\t\tconst $2 = patchDependencyCount($);\n\t\t\t$2.dependency_count += 1;\n\t\t\treturn $;\n\t\t},\n\t\tno: () => {\n\t\t\tconst started_operation = patchDependencyCount(\n\t\t\t\toperation.properties.started.set(\"yes\", {\n\t\t\t\t\t\"is valid\": [\"yes\", {}],\n\t\t\t\t\tnode: createLocalNode(operation.properties.type.state.node.output.parameter_definition(), [\"local\", {}]),\n\t\t\t\t\texecuting: [\n\t\t\t\t\t\t\"no\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"last result\": [\"not invoked\", {}],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\texecutable: \"no\",\n\t\t\t\t})\n\t\t\t);\n\t\t\tconst started_operation_destructor = new DestructorTree();\n\t\t\tstarted_operation.onDestroy(() => {\n\t\t\t\tstarted_operation_destructor.destroy();\n\t\t\t});\n\t\t\tstarted_operation.sub = nodeValid(started_operation.properties.node).subscribe({\n\t\t\t\tupdate: (valid) => {\n\t\t\t\t\tstarted_operation.properties.is_valid.ensure(valid ? \"yes\" : \"no\", {});\n\t\t\t\t},\n\t\t\t});\n\t\t\toperation.root.transact(() => registerNewNode(started_operation.properties.node, started_operation_destructor));\n\t\t\tstarted_operation.dependency_count = 1;\n\t\t\tapplyOperationDefaults(started_operation);\n\t\t\tsubscribeExecutableStatus(started_operation);\n\t\t\treturn started_operation;\n\t\t},\n\t});\n\tdestructor.onDestroy(() => {\n\t\tif (operation.destroyed) {\n\t\t\treturn;\n\t\t}\n\t\tconst o = patchDependencyCount(result);\n\t\to.dependency_count -= 1;\n\t\tif (o.dependency_count === 0) {\n\t\t\tnodeValid(o.properties.node).unsubscribe(o.sub);\n\t\t\tstopOperation(operation);\n\t\t}\n\t});\n\treturn result;\n}\n\nfunction patchDependencyCount(started_operation: cs.Cyes__started) {\n\treturn started_operation as any as cs.Cyes__started & {\n\t\tdependency_count: number;\n\t\tsub: { update: (valid: boolean) => void };\n\t};\n}\n\nfunction stopOperation(operation: cs.Coperation__type__attributes): void {\n\tif (operation.destroyed) return;\n\toperation.properties.started.set(\"no\", {});\n}\n\nfunction subscribeExecutableStatus(operation: cs.Cyes__started): void {\n\tlet command_exeute_permitted = true;\n\tconst is_executable = (): boolean => {\n\t\tlet executable = command_exeute_permitted;\n\t\tif (!executable) {\n\t\t\treturn executable;\n\t\t}\n\t\tswitch (operation.properties.is_valid.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\texecutable = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"yes\": {\n\t\t\t\texecutable = executable && true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(operation.properties.is_valid.state);\n\t\t}\n\t\tif (!executable) {\n\t\t\treturn executable;\n\t\t}\n\t\tswitch (operation.properties.executing.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\texecutable = executable && true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"yes\": {\n\t\t\t\texecutable = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(operation.properties.executing.state);\n\t\t}\n\t\treturn executable;\n\t};\n\tconst update_executable = () => {\n\t\tconst executable = is_executable();\n\t\tswitch (operation.properties.executable.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\tif (executable) {\n\t\t\t\t\toperation.properties.executable.set(\"yes\", {});\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"yes\": {\n\t\t\t\tif (!executable) {\n\t\t\t\t\toperation.properties.executable.set(\"no\", {});\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(operation.properties.executable.state);\n\t\t}\n\t};\n\tswitch (operation.parent.properties.type.state.name) {\n\t\tcase \"action\": {\n\t\t\tbreak;\n\t\t}\n\t\tcase \"command\": {\n\t\t\tconst $ = operation.parent.properties.type.state.node;\n\t\t\tconst permission_subscription = $.properties.execute_permitted.subscribe({\n\t\t\t\ton_update: () => {\n\t\t\t\t\tswitch ($.properties.execute_permitted.state.name) {\n\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\tcommand_exeute_permitted = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tcommand_exeute_permitted = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState($.properties.execute_permitted.state);\n\t\t\t\t\t}\n\t\t\t\t\tupdate_executable();\n\t\t\t\t},\n\t\t\t});\n\t\t\toperation.onDestroy(() => permission_subscription.unsubscribe());\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(operation.parent.properties.type.state);\n\t}\n\toperation.properties.is_valid.subscribe({\n\t\ton_update: update_executable,\n\t});\n\toperation.properties.executing.subscribe({\n\t\ton_update: update_executable,\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport api_application = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport { addMessage } from \"../front/messages\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\n\nexport function isPasswordProperty(text_property: api_application.Ctext__type__property): boolean {\n\tconst application_model = text_property.root;\n\treturn application_model.properties.has_dynamic_users.switch({\n\t\tyes: ($) =>\n\t\t\t$.properties.has_password_authentication.switch({\n\t\t\t\tyes: ($) => text_property === $.properties.password_text_path.inferences.text(),\n\t\t\t\tno: false,\n\t\t\t}),\n\t\tno: false,\n\t});\n}\n\nexport function resetPassword(text_property: api_client_state.Ctext__type__property): void {\n\tif (isPasswordProperty(text_property.inferences.text_type())) {\n\t\tconst password_entry = text_property.parent.parent.parent.input.entity().cast(\"entry\");\n\t\ttext_property.properties.is_editable.switch({\n\t\t\tno: () => {\n\t\t\t\taddMessage(\"warning\", \"No permission to reset password.\");\n\t\t\t},\n\t\t\tyes: (editable) => {\n\t\t\t\tpassword_entry.properties.key.ref.properties.backend_known.switch({\n\t\t\t\t\tno: () => {\n\t\t\t\t\t\taddMessage(\"warning\", \"Can not reset password.\", { body: \"Username is unknown.\" });\n\t\t\t\t\t},\n\t\t\t\t\tyes: async (backend_known) => {\n\t\t\t\t\t\tconst username = backend_known.properties.value;\n\t\t\t\t\t\tconst result = await DatastoreProxy.instance.resetPassword(username);\n\t\t\t\t\t\tresult.properties.user_context.switch({\n\t\t\t\t\t\t\t\"does not exist\": () => {\n\t\t\t\t\t\t\t\taddMessage(\"warning\", \"Could not reset password\");\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"permission denied\": () => {\n\t\t\t\t\t\t\t\taddMessage(\"warning\", \"Could not reset password\");\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\texists: (existing_user_context) =>\n\t\t\t\t\t\t\t\texisting_user_context.properties.result.switch({\n\t\t\t\t\t\t\t\t\tsuccess: (success) => {\n\t\t\t\t\t\t\t\t\t\tconst temporary_password = success.properties.temporary_password;\n\t\t\t\t\t\t\t\t\t\tconst mutable_password = text_property;\n\t\t\t\t\t\t\t\t\t\tmutable_password.properties.backend_known.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\tvalue: temporary_password,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tmutable_password.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\ttext: temporary_password,\n\t\t\t\t\t\t\t\t\t\t\tby: [\"engine\", {}],\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\teditable.properties.modified.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tfailure: () => {\n\t\t\t\t\t\t\t\t\t\taddMessage(\"warning\", \"Could not reset password\");\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t} else {\n\t\taddMessage(\"warning\", \"Could not reset password\");\n\t}\n}\n\nfunction getPasswordToken(\n\ttext_property: api_client_state.Ctext__type__property,\n\tinclude_source: boolean,\n\tcallback: (reset_link: string) => void\n) {\n\tconst collection_entry = text_property.parent.parent.parent.input.entity().cast(\"entry\");\n\tif (isPasswordProperty(text_property.inferences.text_type())) {\n\t\tcollection_entry.properties.key.ref.properties.backend_known.switch({\n\t\t\tno: () => {\n\t\t\t\taddMessage(\"warning\", \"Can not send password\", { body: \"Username is unknown.\" });\n\t\t\t},\n\t\t\tyes: (user_known) => {\n\t\t\t\ttext_property.properties.backend_known.switch({\n\t\t\t\t\tno: () => {\n\t\t\t\t\t\taddMessage(\"warning\", \"Can not send password\", { body: \"Reset the password.\" });\n\t\t\t\t\t},\n\t\t\t\t\tyes: (password_token_known) => {\n\t\t\t\t\t\tDatastoreProxy.instance.connection.getAuthenticationUri().then((uri) => {\n\t\t\t\t\t\t\tconst params = new URLSearchParams({\n\t\t\t\t\t\t\t\taction: \"reset\",\n\t\t\t\t\t\t\t\tuname: user_known.properties.value,\n\t\t\t\t\t\t\t\ttoken: password_token_known.properties.value,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (include_source) {\n\t\t\t\t\t\t\t\tparams.append(\"source\", window.location.href);\n\t\t\t\t\t\t\t\t// params.append(\"symnam\": \"\"); //TODO: this should be set to the 'application name' from the settings\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst reset_uri = uri + \"#\" + params.toString();\n\t\t\t\t\t\t\tcallback(reset_uri);\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t}\n}\n\nexport function mailPasswordToken(text_property: api_client_state.Ctext__type__property): void {\n\tgetPasswordToken(text_property, false, (uri) => {\n\t\twindow.open(\"mailto:?subject=password reset&body=\" + encodeURIComponent(uri), \"_blank\");\n\t});\n}\n\n// Type declarations for Clipboard API\n// https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API\ninterface Clipboard {\n\twriteText(newClipText: string): Promise;\n}\n\ninterface NavigatorClipboard {\n\treadonly clipboard?: Clipboard;\n}\n\ntype Navigator = NavigatorClipboard;\n\nexport function copyPasswordTokenToClipboard(text_property: api_client_state.Ctext__type__property): void {\n\tconst clipboard = (navigator as Navigator).clipboard;\n\tif (clipboard) {\n\t\tgetPasswordToken(text_property, true, (uri) => {\n\t\t\tclipboard.writeText(uri).then(\n\t\t\t\tfunction () {\n\t\t\t\t\taddMessage(\"success\", \"Password reset link copied to clipboard\", { key: \"Password copied to clipboard\" });\n\t\t\t\t},\n\t\t\t\tfunction () {\n\t\t\t\t\taddMessage(\"warning\", \"Can't copy password\", { body: \"Failed to write to the clipboard.\" });\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\t} else {\n\t\taddMessage(\"warning\", \"Can't copy password\", { body: \"Clipboard is not supported.\" });\n\t}\n}\n","import DestructorTree from \"../DestructorTree\";\nimport { client_state } from \"./ClientState\";\nimport { lambda } from \"../../../../../stream\";\nimport { toStream } from \"../toStream\";\n\nexport function subscribeToTranslation(\n\tphrase: string,\n\tdestructor: DestructorTree,\n\tcallback: (translation: string) => void,\n\treturnInitialValue = true\n) {\n\tdestructor.subscribeToText(\n\t\tclient_state,\n\t\t\"subscribe_selected_language\",\n\t\t() => {\n\t\t\tcallback(getTranslation(phrase));\n\t\t},\n\t\treturnInitialValue\n\t);\n}\n\nexport function getTranslation(phrase: string): string {\n\treturn (\n\t\tclient_state.properties.selected_language.ref.key.ref.properties.translations.get(phrase)?.properties.translation ??\n\t\tphrase\n\t);\n}\n\nexport const translate = lambda((phrase: string) =>\n\ttoStream(client_state, \"selected_language\").pipe(() => getTranslation(phrase))()\n);\n","import { api_configuration } from \"../../common\";\nimport api_gui = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_app_id = api_configuration.types.application_identifier.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport { client_state } from \"./ClientState\";\nimport * as SubscriptionManager from \"../state 2 interface/SubscriptionManager\";\nimport { IdPathBuilder, stepsAreEqual, Raw_Id_Path_Head } from \"../navigation/IdPathBuilder\";\nimport DestructorTree from \"../DestructorTree\";\nimport ReferenceCounter from \"../ReferenceCounter\";\nimport garbageCollector from \"../state/GarbageCollector\";\nimport {\n\taddTextAttribute,\n\taddNumberAttribute,\n\taddFileAttribute,\n\taddGroupAttribute,\n\taddStategroupAttribute,\n\taddCollectionAttribute,\n\taddCommandAttribute,\n\taddActionAttribute,\n\taddRemoteEntry,\n} from \"../state/addClientState\";\nimport createIdPathBuilderFromClientIdPath from \"../navigation/createIdPathBuilderFromClientIdPath\";\nimport createClientIdPathFromNode from \"../navigation/createClientIdPathFromNode\";\nimport { applyCollectionJoin } from \"./CollectionJoin\";\nimport * as Collection from \"../state/Collection\";\nimport { iReference } from \"../state/Reference\";\nimport { addChild, DestructorSet } from \"../../../../../destructables\";\nimport {\n\tScalar,\n\tScalarProvider,\n\tWeakCache,\n\tScalarConsumer,\n\tonScalarValue,\n\tcreateVariable,\n\tcreateExpressionBuilder,\n} from \"../../../../../stream\";\nimport { toStream } from \"../toStream\";\nimport { Failed, Pending, isResolved } from \"../Status\";\nimport { createIdPathFromNode } from \"../navigation/createIdPathFromNode\";\nimport * as step from \"../state/step\";\nimport * as Query from \"../state/Query\";\nimport { iEntry } from \"../state/Entry\";\n\nexport type RegistrationStatus = \"unsubscribed\" | \"not subscribable\" | \"pending\" | \"failed\" | \"subscribed\";\n\nexport const isSubscribable = WeakCache>((node) => {\n\treturn createVariable(\n\t\ttoStream(node.properties.location).stateSwitch({\n\t\t\tlocal: () => false,\n\t\t\tremote: () =>\n\t\t\t\ttoStream(node.properties.read_permitted).stateSwitch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: () => true,\n\t\t\t\t})(),\n\t\t})(),\n\t\tfalse\n\t);\n});\n\nclass RegistrationVariable extends ScalarProvider {\n\tprivate readonly _subscribers = new Set>();\n\tprivate _subscription?: ScalarConsumer;\n\tprivate _counter_subscription?: api_cs.Subscription;\n\tprivate _destructor: DestructorTree | undefined;\n\tprivate _value: RegistrationStatus;\n\n\tconstructor(private readonly object: SubscribableObject) {\n\t\tsuper();\n\t\tobject.onDestroy(() => this.destroy());\n\t}\n\n\tget value() {\n\t\tif (this._subscribers.size > 0) return this._value;\n\t\treturn asRegisterable(this.object).__subscriptions?.value ?? 0 > 0 ? \"subscribed\" : \"unsubscribed\";\n\t}\n\n\tprivate update(value: RegistrationStatus) {\n\t\tif (this._value === value) return;\n\t\tthis._value = value;\n\t\tfor (const subscriber of this._subscribers) {\n\t\t\tsubscriber.update(value);\n\t\t}\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer) {\n\t\tif (this.object.destroyed) return subscriber;\n\t\tif (this._subscribers.size === 0) {\n\t\t\tthis._destructor = new DestructorTree();\n\t\t\tregister(this.object, this._destructor);\n\t\t\tthis._subscription = isSubscribable(this.object.component_root).subscribe({\n\t\t\t\tupdate: (subscribable) => {\n\t\t\t\t\tswitch (subscribable) {\n\t\t\t\t\t\tcase false:\n\t\t\t\t\t\t\tthis.update(\"not subscribable\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase true: {\n\t\t\t\t\t\t\tthis.update(\"pending\");\n\t\t\t\t\t\t\tthis._counter_subscription?.unsubscribe();\n\t\t\t\t\t\t\tthis._counter_subscription = getSubscriptionCounter(this.object).subscribe((num_subs) => {\n\t\t\t\t\t\t\t\tif (num_subs > 0) {\n\t\t\t\t\t\t\t\t\tthis.update(\"subscribed\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tthis._subscribers.add(subscriber);\n\t\tsubscriber.update(this.value);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tthis._subscribers.delete(subscriber);\n\t\tthis.destroy();\n\t}\n\n\tdestroy() {\n\t\tif (this._subscribers.size === 0) {\n\t\t\tthis._value = \"unsubscribed\";\n\t\t\tthis._destructor?.destroy();\n\t\t\tthis._destructor = undefined;\n\t\t\tthis._counter_subscription?.unsubscribe();\n\t\t\tthis._counter_subscription = undefined;\n\t\t\tif (this._subscription) {\n\t\t\t\tisSubscribable(this.object.component_root).unsubscribe(this._subscription);\n\t\t\t\tthis._subscription = undefined;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport const getRegistrationStatus = WeakCache>(\n\t(object) => new RegistrationVariable(object)\n);\n\nexport function registrationDone(\n\tobject: SubscribableObject,\n\ton_registration_done: (subscribed: boolean) => Scalar\n) {\n\treturn createExpressionBuilder(getRegistrationStatus(object)).pipe((registration_status) => {\n\t\tswitch (registration_status) {\n\t\t\tcase \"unsubscribed\":\n\t\t\t\treturn Pending;\n\t\t\tcase \"pending\":\n\t\t\t\treturn Pending;\n\t\t\tcase \"failed\":\n\t\t\t\treturn Failed;\n\t\t\tcase \"not subscribable\":\n\t\t\t\treturn on_registration_done(false);\n\t\t\tcase \"subscribed\":\n\t\t\t\treturn on_registration_done(true);\n\t\t}\n\t});\n}\n\nexport function subscriptionPending(object: SubscribableObject) {\n\treturn createExpressionBuilder(getRegistrationStatus(object)).pipe((status) => {\n\t\tswitch (status) {\n\t\t\tcase \"not subscribable\":\n\t\t\t\treturn false;\n\t\t\tcase \"unsubscribed\":\n\t\t\t\treturn true;\n\t\t\tcase \"pending\":\n\t\t\t\treturn true;\n\t\t\tcase \"failed\":\n\t\t\t\treturn false;\n\t\t\tcase \"subscribed\":\n\t\t\t\treturn false;\n\t\t}\n\t});\n}\n\nabstract class CollectionRegistrationType {\n\tconstructor(public readonly collection: api_cs.Ccollection) {}\n\tget component_root(): api_cs.Cnode {\n\t\treturn this.collection.component_root;\n\t}\n\tonDestroy(destruction_observer: () => void) {\n\t\tthis.collection.onDestroy(destruction_observer);\n\t}\n\tget destroyed() {\n\t\treturn this.collection.destroyed;\n\t}\n}\nexport class CollectionKeyRegistration extends CollectionRegistrationType {}\nclass CollectionUpdatesRegistration extends CollectionRegistrationType {}\nclass CollectionEntriesRegistration extends CollectionRegistrationType {\n\tnode = new Map();\n}\nclass EntriesRegistrationCommand extends CollectionRegistrationType {}\nclass EntriesRegistrationText extends CollectionRegistrationType {\n\treference = false;\n}\nclass EntriesRegistrationNumber extends CollectionRegistrationType {}\nclass EntriesRegistrationFile extends CollectionRegistrationType {}\nclass EntriesRegistrationGroup extends CollectionRegistrationType {\n\tnode = new Map();\n}\nclass EntriesRegistrationStategroup extends CollectionRegistrationType {\n\tstates = new Map();\n\tconstructor(collection: api_cs.Ccollection, public def: api_app.Cstate_group) {\n\t\tsuper(collection);\n\t}\n}\nclass EntriesRegistrationCollection extends CollectionRegistrationType {\n\tupdates: CollectionUpdatesRegistration;\n\tentries: CollectionEntriesRegistration;\n\tconstructor(collection: api_cs.Ccollection) {\n\t\tsuper(collection);\n\t\tthis.updates = new CollectionUpdatesRegistration(collection);\n\t\tthis.entries = new CollectionEntriesRegistration(collection);\n\t}\n}\ntype EntriesRegistrationAttribute =\n\t| [\"command\", EntriesRegistrationCommand]\n\t| [\"text\", EntriesRegistrationText]\n\t| [\"number\", EntriesRegistrationNumber]\n\t| [\"file\", EntriesRegistrationFile]\n\t| [\"group\", EntriesRegistrationGroup]\n\t| [\"stategroup\", EntriesRegistrationStategroup]\n\t| [\"collection\", EntriesRegistrationCollection];\nexport type EntriesRegistrationNode = Map;\n\ntype CollectionRegistrations = {\n\tkeys: Map;\n\tentries: CollectionEntriesRegistration;\n\tupdates: CollectionUpdatesRegistration;\n};\n\nexport type SubscribableObject =\n\t| api_cs.Ccommand\n\t| api_cs.Ctext__type__property\n\t| api_cs.Cnumber__type__property\n\t| api_cs.Cfile__type__property\n\t| api_cs.Cgroup__type__property\n\t| api_cs.Cstate_group__type__property\n\t| CollectionKeyRegistration\n\t| CollectionEntriesRegistration\n\t| CollectionUpdatesRegistration\n\t| EntriesRegistrationCommand\n\t| EntriesRegistrationText\n\t| EntriesRegistrationNumber\n\t| EntriesRegistrationFile\n\t| EntriesRegistrationGroup\n\t| EntriesRegistrationStategroup;\nexport type CountableObject =\n\t| SubscribableObject\n\t| EntriesRegistrationCollection\n\t| api_cs.Cyes__initialized__query_entry_status\n\t| api_cs.Cyes__joined\n\t| api_cs.Caction\n\t| api_cs.Centries__collection;\n\ntype Registerable = {\n\t__references?: ReferenceCounter;\n\t__subscriptions?: ReferenceCounter;\n\t__needs_subscription?: boolean;\n};\n\nexport function asRegisterable(object: CountableObject): Registerable {\n\treturn object as any as Registerable;\n}\n\nexport async function registrationInitialized(object: SubscribableObject): Promise {\n\tconst registration = asRegisterable(object);\n\treturn new Promise((resolve) => {\n\t\tif (!registration.__subscriptions || !registration.__references) return resolve();\n\t\tregistration.__references.await((value) => value <= 0).then(() => resolve());\n\t\tregistration.__subscriptions.onDestroy(() => resolve());\n\t\tregistration.__subscriptions.await((value) => value > 0).then(() => resolve());\n\t});\n}\n\nfunction initReferenceCounter(): ReferenceCounter {\n\tconst counter = new ReferenceCounter();\n\tcounter.onEmpty(\n\t\t() => {\n\t\t\tgarbageCollector.queue();\n\t\t},\n\t\t/*persist=*/ true,\n\t\t/*skip_first=*/ true\n\t);\n\treturn counter;\n}\n\nexport function getReferenceCounter(object: CountableObject) {\n\tconst countable = asRegisterable(object);\n\tif (!countable.__references) {\n\t\tcountable.__references = initReferenceCounter();\n\t}\n\treturn countable.__references!;\n}\n\nexport function getSubscriptionCounter(object: SubscribableObject): ReferenceCounter {\n\tconst registration = asRegisterable(object);\n\tif (registration.__subscriptions === undefined) {\n\t\tregistration.__subscriptions = new ReferenceCounter();\n\t\tregistration.__subscriptions.onEmpty(\n\t\t\t() => {\n\t\t\t\tif (registration.__references && registration.__references.count > 0) {\n\t\t\t\t\tregistration.__needs_subscription = true;\n\t\t\t\t\tSubscriptionManager.queue(object);\n\t\t\t\t}\n\t\t\t},\n\t\t\t/*persist=*/ true,\n\t\t\t/*skip_first=*/ false\n\t\t);\n\t\tregistration.__references?.onEmpty(\n\t\t\t() => {\n\t\t\t\tinitializedObjects.delete(object);\n\t\t\t\tregistration.__subscriptions?.destroy();\n\t\t\t\tregistration.__needs_subscription = false;\n\t\t\t\tregistration.__subscriptions = undefined;\n\t\t\t},\n\t\t\t/*persist=*/ false,\n\t\t\t/*skip_first=*/ true\n\t\t);\n\t\tregistration.__needs_subscription = true;\n\t}\n\treturn registration.__subscriptions!;\n}\n\nexport function registerSubscription(object: SubscribableObject, destructor: DestructorTree): void {\n\tgetSubscriptionCounter(object).add_registration(destructor);\n\tasRegisterable(object).__needs_subscription = false;\n}\n\nexport function removeSubscriptionCounter(object: SubscribableObject): void {\n\tconst registration = asRegisterable(object);\n\tif (registration.__subscriptions) {\n\t\tregistration.__subscriptions.destroy();\n\t\tregistration.__needs_subscription = false;\n\t\tregistration.__subscriptions = undefined;\n\t}\n}\n\nexport function isRegisteredOrSubscribed(object: SubscribableObject): boolean {\n\tconst registration = asRegisterable(object);\n\treturn (\n\t\t(registration.__references !== undefined && registration.__references.count > 0) ||\n\t\t(registration.__subscriptions !== undefined && registration.__subscriptions.count > 0)\n\t);\n}\n\nexport function isRegistered(object: CountableObject): boolean {\n\tconst registration = asRegisterable(object);\n\treturn registration.__references !== undefined && registration.__references.count > 0;\n}\n\nexport function needsToBeSubscribed(object: SubscribableObject): boolean {\n\tconst registration = asRegisterable(object);\n\treturn !!registration.__needs_subscription;\n}\n\nexport function getCollectionRegistrations(collection: api_cs.Ccollection): CollectionRegistrations {\n\tconst patched_collection = collection as any as { __registrations?: CollectionRegistrations };\n\tif (patched_collection.__registrations === undefined) {\n\t\tpatched_collection.__registrations = {\n\t\t\tkeys: new Map(),\n\t\t\tentries: new CollectionEntriesRegistration(collection),\n\t\t\tupdates: new CollectionUpdatesRegistration(collection),\n\t\t};\n\t}\n\treturn patched_collection.__registrations!;\n}\n\nexport function getCollectionEntriesRegistration(collection: api_cs.Ccollection): CollectionEntriesRegistration {\n\tconst collection_registrations = getCollectionRegistrations(collection);\n\treturn collection_registrations.entries;\n}\n\nexport function getCollectionUpdatesRegistration(collection: api_cs.Ccollection): CollectionUpdatesRegistration {\n\tconst collection_registrations = getCollectionRegistrations(collection);\n\treturn collection_registrations.updates;\n}\n\nexport function getCollectionKeyRegistration(collection: api_cs.Ccollection, key: string): CollectionKeyRegistration {\n\tconst collection_registrations = getCollectionRegistrations(collection);\n\tif (!collection_registrations.keys.has(key)) {\n\t\tcollection_registrations.keys.set(key, new CollectionKeyRegistration(collection));\n\t}\n\treturn collection_registrations.keys.get(key)!;\n}\n\nexport function initializeKeySubscription(entry: api_cs.Centries__collection, key: string, destructor: DestructorTree) {\n\tconst collection = entry.parent;\n\tregisterSubscription(getCollectionKeyRegistration(collection, key), destructor);\n\tregister(entry, destructor);\n}\n\nexport function register(obj: CountableObject, destructor: DestructorTree): void {\n\tgetReferenceCounter(obj).add_registration(destructor);\n}\n\nconst initializedObjects = new WeakSet();\nfunction initializeSubscribableObject(\n\tobject: SubscribableObject,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): void {\n\tregister(object, destructor);\n\tif (initializedObjects.has(object)) return;\n\tinitializedObjects.add(object);\n\tisSubscribable(node).subscribe({\n\t\tupdate: (subscribable) => {\n\t\t\tswitch (subscribable) {\n\t\t\t\tcase false:\n\t\t\t\t\tremoveSubscriptionCounter(object);\n\t\t\t\t\tbreak;\n\t\t\t\tcase true:\n\t\t\t\t\tgetSubscriptionCounter(object);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t});\n}\n\nexport function registerText(\n\tdefinition: api_app.Ctext__type__property,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): api_cs.Ctext__type__property {\n\tconst text = addTextAttribute(definition, node);\n\tinitializeSubscribableObject(text, node, destructor);\n\treturn text;\n}\n\nexport function registerNumber(\n\tdefinition: api_app.Cnumber__type__property,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): api_cs.Cnumber__type__property {\n\tconst number = addNumberAttribute(definition, node);\n\tinitializeSubscribableObject(number, node, destructor);\n\treturn number;\n}\n\nexport function registerFile(\n\tdefinition: api_app.Cfile,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): api_cs.Cfile__type__property {\n\tconst file = addFileAttribute(definition, node);\n\tinitializeSubscribableObject(file, node, destructor);\n\treturn file;\n}\n\nexport function registerGroup(\n\tdefinition: api_app.Cgroup__type__property,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): api_cs.Cgroup__type__property {\n\tconst group = addGroupAttribute(definition, node);\n\tinitializeSubscribableObject(group, node, destructor);\n\treturn group;\n}\n\nexport function registerStategroup(\n\tdefinition: api_app.Cstate_group,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree,\n\tremote_state?: api_app.Cstates__state_group\n): api_cs.Cstate_group__type__property {\n\tconst stategroup = addStategroupAttribute(definition, node, remote_state);\n\tinitializeSubscribableObject(stategroup, node, destructor);\n\treturn stategroup;\n}\n\nexport function registerCollection(\n\tdefinition: api_app.Ccollection__type__property,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): api_cs.Ccollection {\n\tconst collection = addCollectionAttribute(definition, node);\n\tregisterCollectionUpdates(collection, destructor);\n\treturn collection;\n}\n\nexport function registerCollectionEntries(collection: api_cs.Ccollection, destructor: DestructorTree): void {\n\tconst registration = getCollectionEntriesRegistration(collection);\n\tinitializeSubscribableObject(registration, collection.parent.parent.parent, destructor);\n}\n\nexport function registerCollectionUpdates(collection: api_cs.Ccollection, destructor: DestructorTree): void {\n\tconst registration = getCollectionUpdatesRegistration(collection);\n\tinitializeSubscribableObject(registration, collection.parent.parent.parent, destructor);\n}\n\nconst joinedCollections = new WeakMap>();\nexport function registerJoin(\n\tcollection: api_cs.Ccollection,\n\tregistering_destructor: DestructorTree\n): api_cs.Cyes__joined {\n\tlet destructor_set = joinedCollections.get(collection);\n\tdestructor_set?.add(registering_destructor);\n\n\tlet joined: api_cs.Cyes__joined;\n\tswitch (collection.properties.joined.state.name) {\n\t\tcase \"no\": {\n\t\t\tdestructor_set?.destroy();\n\t\t\tdestructor_set = new DestructorSet(false);\n\t\t\tjoinedCollections.set(collection, destructor_set);\n\t\t\tdestructor_set.add(registering_destructor);\n\t\t\tconst destructor = new DestructorTree();\n\t\t\taddChild(destructor_set, destructor);\n\n\t\t\tcollection.properties.joined.set(\"yes\", {\n\t\t\t\t\"amount of entries\": 0,\n\t\t\t\t\"is empty\": \"yes\",\n\t\t\t\t\"joined collection\": \"unresolved\",\n\t\t\t\tentries: {},\n\t\t\t});\n\t\t\tjoined = collection.properties.joined.cast(\"yes\");\n\t\t\tconst application_collection = collection.inferences.collection_type();\n\t\t\tconst has_reference = application_collection.properties.key_property.ref.properties.has_reference.cast(\"yes\");\n\t\t\tconst referenced_collection = has_reference.properties.expression.output.collection();\n\t\t\tconst target_collection = Collection.resolveMatrixSourceCollection(\n\t\t\t\tcollection,\n\t\t\t\thas_reference.properties.expression\n\t\t\t).pipe(\n\t\t\t\tstep.sync((context, source_destructor) => {\n\t\t\t\t\tregisterCollectionEntries(context, source_destructor);\n\t\t\t\t\tjoined.properties.joined_collection.set(\"resolved\", {\n\t\t\t\t\t\t\"referenced node\": createClientIdPathFromNode(context.component_root),\n\t\t\t\t\t\tcollection: referenced_collection.parent.parent.key_value,\n\t\t\t\t\t});\n\t\t\t\t\treturn context;\n\t\t\t\t})\n\t\t\t)();\n\t\t\tonScalarValue(\n\t\t\t\ttarget_collection,\n\t\t\t\t(context) => {\n\t\t\t\t\tif (!isResolved(context)) {\n\t\t\t\t\t\tswitch (joined.properties.joined_collection.state.name) {\n\t\t\t\t\t\t\tcase \"resolved\": {\n\t\t\t\t\t\t\t\tfor (const [key, entry] of joined.properties.entries) {\n\t\t\t\t\t\t\t\t\tswitch (entry.properties.referenced_entry.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\t\t\t\t\t\tswitch (entry.properties.collection_entry.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"entry\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.properties.referenced_entry.set(\"none\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"none\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tjoined.properties.entries.delete(key);\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"none\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tjoined.properties.joined_collection.set(\"unresolved\", {});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"unresolved\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t(registration, subscription) => destructor.onDestroy(() => registration.unsubscribe(subscription))\n\t\t\t);\n\t\t\tapplyCollectionJoin(joined, destructor);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\":\n\t\t\tjoined = collection.properties.joined.state.node;\n\t\t\tbreak;\n\t}\n\tgetReferenceCounter(joined).add_registration(registering_destructor);\n\treturn joined;\n}\n\nexport function registerCommand(\n\tdefinition: api_app.Cglobal,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): api_cs.Coperation__type__attributes {\n\tconst command = addCommandAttribute(definition, node);\n\tinitializeSubscribableObject(command.properties.type.cast(\"command\"), node, destructor);\n\treturn command;\n}\n\nexport function registerAction(\n\tdefinition: api_app.Caction,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): api_cs.Coperation__type__attributes {\n\tconst action = addActionAttribute(definition, node);\n\tgetReferenceCounter(action.properties.type.cast(\"action\")).add_registration(destructor);\n\treturn action;\n}\n\nexport function registerEntry(entry: api_cs.Centries__collection, destructor: DestructorTree): void {\n\tregister(entry, destructor);\n\tiEntry(entry).register(destructor);\n}\n\nfunction walkIdPath(id_path: api_app_id.Cid_path, node: api_cs.Cnode, destructor: DestructorTree): api_cs.Cnode {\n\tswitch (id_path.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\treturn node;\n\t\tcase \"yes\": {\n\t\t\tconst has_steps = id_path.properties.has_steps.state.node;\n\t\t\tconst node_type = node.input.node_type();\n\t\t\tlet tail_node: api_cs.Cnode;\n\t\t\tswitch (has_steps.properties.type.state.name) {\n\t\t\t\tcase \"collection entry\": {\n\t\t\t\t\tconst type = has_steps.properties.type.state.node;\n\t\t\t\t\tconst definition = node_type.properties.attributes\n\t\t\t\t\t\t.get(type.properties.collection)!\n\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t.properties.type.cast(\"collection\");\n\t\t\t\t\tconst collection = registerCollection(definition, node, destructor);\n\t\t\t\t\tconst entry = addRemoteEntry(collection, type.properties.id);\n\t\t\t\t\tregisterEntry(entry, destructor);\n\t\t\t\t\ttail_node = entry.properties.node;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"group\": {\n\t\t\t\t\tconst type = has_steps.properties.type.state.node;\n\t\t\t\t\tconst definition = node_type.properties.attributes\n\t\t\t\t\t\t.get(type.properties.group)!\n\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t.properties.type.cast(\"group\");\n\t\t\t\t\tconst group_property = registerGroup(definition, node, destructor);\n\t\t\t\t\ttail_node = group_property.properties.node;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state\": {\n\t\t\t\t\tconst type = has_steps.properties.type.state.node;\n\t\t\t\t\tconst state_name = type.properties.state;\n\t\t\t\t\tconst definition = node_type.properties.attributes\n\t\t\t\t\t\t.get(type.properties.state_group)!\n\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t.properties.type.cast(\"state group\");\n\t\t\t\t\tconst remote_state = definition.properties.states.get(state_name)!;\n\t\t\t\t\tconst stategroup_property = registerStategroup(definition, node, destructor, remote_state);\n\t\t\t\t\ttail_node = stategroup_property.properties.states.get(state_name)!.properties.node;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(has_steps.properties.type.state);\n\t\t\t}\n\t\t\treturn walkIdPath(has_steps.properties.tail, tail_node, destructor);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(id_path.properties.has_steps.state);\n\t}\n}\n\nexport function registerNewNode(node: api_cs.Cnode, destructor: DestructorTree): void {\n\tconst node_type = node.input.node_type();\n\tfor (const gui_attribute of node_type.properties.attributes.values()) {\n\t\tswitch (gui_attribute.properties.type.state.name) {\n\t\t\tcase \"reference set\":\n\t\t\t\tbreak;\n\t\t\tcase \"action\":\n\t\t\t\tbreak;\n\t\t\tcase \"command\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property_type = gui_attribute.properties.type.state.node;\n\t\t\t\tconst kind = property_type.properties.type.state.node.output.value_source();\n\t\t\t\tswitch (kind.variant.name) {\n\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"base\":\n\t\t\t\t\t\tswitch (property_type.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\tconst text_def = property_type.properties.type.state.node;\n\t\t\t\t\t\t\t\tregisterText(text_def, node, destructor);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\tconst number_def = property_type.properties.type.state.node;\n\t\t\t\t\t\t\t\tregisterNumber(number_def, node, destructor);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\t\t\tconst file_def = property_type.properties.type.state.node;\n\t\t\t\t\t\t\t\tregisterFile(file_def, node, destructor);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\t\t\tconst group_def = property_type.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst group_property = registerGroup(group_def, node, destructor);\n\t\t\t\t\t\t\t\tregisterNewNode(group_property.properties.node, destructor);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\tconst stategroup_def = property_type.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst stategroup_property = registerStategroup(stategroup_def, node, destructor);\n\t\t\t\t\t\t\t\tfor (const state of stategroup_property.properties.states.values()) {\n\t\t\t\t\t\t\t\t\tregisterNewNode(state.properties.node, destructor);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\t\tconst collection_def = property_type.properties.type.state.node;\n\t\t\t\t\t\t\t\taddCollectionAttribute(collection_def, node);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(property_type.properties.type.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(kind.variant);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(gui_attribute.properties.type.state);\n\t\t}\n\t}\n}\n\nexport function registerIdPath(id_path_builder: IdPathBuilder, destructor: DestructorTree): api_cs.Cnode {\n\tconst decorated_id_path = api_app_id.Capplication_identifier.create({\n\t\tpath: id_path_builder.build(),\n\t}).properties.path;\n\treturn walkIdPath(decorated_id_path, client_state.properties.root, destructor);\n}\n\nfunction backtrackCommonAncestorInIdPathAndNode(\n\tnode: api_cs.Cnode,\n\tid_path_builder: IdPathBuilder\n): [api_cs.Cnode, Raw_Id_Path_Head] {\n\tlet id_path = id_path_builder.build();\n\tlet result_id_path: Raw_Id_Path_Head = id_path;\n\tlet node_id_path = createIdPathFromNode(node);\n\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tswitch (node_id_path[\"has steps\"][0]) {\n\t\t\tcase \"no\":\n\t\t\t\treturn [node, result_id_path];\n\t\t\tcase \"yes\": {\n\t\t\t\tconst node_step = node_id_path[\"has steps\"][1];\n\t\t\t\tswitch (id_path[\"has steps\"][0]) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tnode = node.input.position().input.parent().cast(\"node\");\n\t\t\t\t\t\tnode_id_path = node_step.tail;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst id_step = id_path[\"has steps\"][1];\n\t\t\t\t\t\tif (stepsAreEqual(id_step, node_step)) {\n\t\t\t\t\t\t\tnode_id_path = node_step.tail;\n\t\t\t\t\t\t\tid_path = id_step.tail;\n\t\t\t\t\t\t\tresult_id_path = id_path;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult_id_path = id_path;\n\t\t\t\t\t\t\tid_path = { \"has steps\": [\"no\", {}] };\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function registerRelativeIdPath(\n\tid_path_builder: IdPathBuilder,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): api_cs.Cnode {\n\tconst [ancestor_node, id_path_from_ancestor] = backtrackCommonAncestorInIdPathAndNode(node, id_path_builder);\n\treturn walkIdPath(\n\t\tapi_app_id.Capplication_identifier.create({ path: id_path_from_ancestor }).properties.path,\n\t\tancestor_node,\n\t\tdestructor\n\t);\n}\n\nexport function registerNodeContext(node: api_cs.Cnode, destructor: DestructorTree): void {\n\tconst position = node.input.position();\n\tswitch (position.variant.name) {\n\t\tcase \"root\":\n\t\t\tbreak;\n\t\tcase \"group\": {\n\t\t\tconst group = position.variant.definition;\n\t\t\tconst definition = group.inferences.group_type();\n\t\t\tconst node = group.component_root;\n\t\t\tregisterNodeContext(node, destructor);\n\t\t\tregisterGroup(definition, node, destructor);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst state = position.variant.definition;\n\t\t\tconst definition = state.parent.inferences.state_group_type();\n\t\t\tconst node = state.component_root;\n\t\t\tregisterNodeContext(node, destructor);\n\t\t\tregisterStategroup(definition, node, destructor);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"entity\": {\n\t\t\tconst entity = position.variant.definition;\n\t\t\tswitch (entity.variant.name) {\n\t\t\t\tcase \"root\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"entry\": {\n\t\t\t\t\tconst entry = entity.variant.definition;\n\t\t\t\t\tconst node = entry.component_root;\n\t\t\t\t\tregisterNodeContext(node, destructor);\n\t\t\t\t\tregisterEntry(entry, destructor);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(entity.variant);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(position.variant);\n\t}\n}\n\n//TODO use expressions.ts function instead of this\nexport function registerObjectPathTail(\n\tpath: api_app.Cobject_path_tail,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): api_cs.Cnode {\n\tlet stategroup: api_cs.Cstate_group__type__property | undefined;\n\twhile (path.properties.has_steps.state.name === \"yes\") {\n\t\tconst has_steps = path.properties.has_steps.state.node;\n\t\tswitch (has_steps.properties.type.state.name) {\n\t\t\tcase \"property value\": {\n\t\t\t\tconst $ = has_steps.properties.type.state.node;\n\t\t\t\tswitch ($.properties.property.properties.property.ref.properties.type.state.name) {\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst group_type = $.properties.property.properties.property.ref.properties.type.state.node;\n\t\t\t\t\t\tconst group = registerGroup(group_type, node, destructor);\n\t\t\t\t\t\tnode = group.properties.node;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst stategroup_type = $.properties.property.properties.property.ref.properties.type.state.node;\n\t\t\t\t\t\tstategroup = registerStategroup(stategroup_type, node, destructor);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step in object path tail\");\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step in object path tail\");\n\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step in object path tail\");\n\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step in object path tail\");\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.property.properties.property.ref.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state\":\n\t\t\t\tif (stategroup !== undefined) {\n\t\t\t\t\tconst state_name = has_steps.properties.type.state.node.properties.state.entry;\n\t\t\t\t\tnode = stategroup.properties.states.get(state_name)!.properties.node;\n\t\t\t\t\tstategroup = undefined;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"unexpected step in object path tail\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"parent\":\n\t\t\t\tthrow new Error(\"unexpected step in object path tail\");\n\t\t\tcase \"dependency\":\n\t\t\t\tthrow new Error(\"unexpected step in object path tail\");\n\t\t\tcase \"reference set\":\n\t\t\t\tthrow new Error(\"unexpected step in object path tail\");\n\t\t\tdefault:\n\t\t\t\tunexpectedState(has_steps.properties.type.state);\n\t\t}\n\t\tpath = has_steps.properties.tail;\n\t}\n\treturn node;\n}\n\nexport function registerModelBindingPropertyPath(\n\tpath: api_views.Cmodel_binding_property_path,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): api_cs.Cnode {\n\tlet has_steps = path.properties.has_steps.state;\n\twhile (has_steps.name === \"yes\") {\n\t\tconst type = has_steps.node.properties.type.state;\n\t\tswitch (type.name) {\n\t\t\tcase \"group\":\n\t\t\t\tnode = registerGroup(type.node.properties.group.ref.inferences.group(), node, destructor).properties.node;\n\t\t\t\tbreak;\n\t\t\tcase \"parent\":\n\t\t\t\tnode = node.input.position().output.parent().cast(\"node\");\n\t\t\t\tbreak;\n\t\t\tcase \"state group\":\n\t\t\t\tnode = registerStategroup(\n\t\t\t\t\ttype.node.properties.state_group.ref.inferences.state_group(),\n\t\t\t\t\tnode,\n\t\t\t\t\tdestructor\n\t\t\t\t).properties.states.get(type.node.properties.state.entry)!.properties.node;\n\t\t}\n\t\thas_steps = has_steps.node.properties.tail.properties.has_steps.state;\n\t}\n\treturn node;\n}\n\nexport function registerQueryEntry(\n\tquery_entry_status: api_cs.Cquery_entry_status,\n\tdestructor: DestructorTree\n): api_cs.Cnode {\n\tlet node: api_cs.Cnode;\n\tconst query = query_entry_status.input.query();\n\tconst configuration = (query as any).__configuration as api_views.Cgui_widget_configuration_node;\n\tswitch (query_entry_status.properties.initialized.state.name) {\n\t\tcase \"unknown\":\n\t\t\tthrow new Error(\"Can not register query entry with unknown location\");\n\t\tcase \"no\": {\n\t\t\tconst $ = query_entry_status.properties.initialized.state.node;\n\t\t\tconst id_path_builder = createIdPathBuilderFromClientIdPath($.properties.referenced_node);\n\t\t\tconst entry_destructor = new DestructorTree();\n\t\t\tnode = registerIdPath(id_path_builder, entry_destructor);\n\t\t\tregisterGuiWidgetConfigurationNode(configuration, node, entry_destructor);\n\t\t\tquery_entry_status.properties.initialized.set(\"yes\", {\n\t\t\t\t\"referenced node\": createClientIdPathFromNode(node),\n\t\t\t});\n\t\t\tQuery.storeEntryId(query_entry_status, id_path_builder);\n\t\t\tconst reference_counter = getReferenceCounter(query_entry_status.properties.initialized.cast(\"yes\"));\n\t\t\treference_counter.add_registration(destructor);\n\t\t\treference_counter.onEmpty(() => {\n\t\t\t\tentry_destructor.destroy();\n\t\t\t\tif (!query_entry_status.destroyed) {\n\t\t\t\t\tquery_entry_status.properties.initialized.set(\"no\", {\n\t\t\t\t\t\t\"referenced node\": Query.getEntryId(query_entry_status).build(),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t\tnode.onDestroy(() => {\n\t\t\t\tentry_destructor.destroy();\n\t\t\t\tif (!query_entry_status.destroyed) {\n\t\t\t\t\tquery_entry_status.properties.initialized.set(\"no\", {\n\t\t\t\t\t\t\"referenced node\": Query.getEntryId(query_entry_status).build(),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = query_entry_status.properties.initialized.state.node;\n\t\t\tconst reference_counter = getReferenceCounter($);\n\t\t\tnode = $.properties.referenced_node.output.result_node();\n\t\t\tif (reference_counter.value <= 0) {\n\t\t\t\tconst entry_destructor = new DestructorTree();\n\t\t\t\tregisterNodeContext(node, entry_destructor);\n\t\t\t\treference_counter.onEmpty(() => entry_destructor.destroy(), /*persist=*/ false, /*skip_first=*/ true);\n\t\t\t}\n\t\t\treference_counter.add_registration(destructor);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(query_entry_status.properties.initialized.state);\n\t}\n\treturn node;\n}\n\ntype StategroupRegistrant = [\"stategroup\", { def: api_app.Cstate_group; states: Map }];\ntype AttributeRegistrant =\n\t| [\"command\", { def: api_app.Cglobal }]\n\t| [\"action\", { def: api_app.Caction }]\n\t| [\n\t\t\t\"text\",\n\t\t\t{\n\t\t\t\tdef: api_app.Ctext__type__property;\n\t\t\t\treference?: Set;\n\t\t\t}\n\t ]\n\t| [\"number\", { def: api_app.Cnumber__type__property }]\n\t| [\"file\", { def: api_app.Cfile }]\n\t| [\"group\", { def: api_app.Cgroup__type__property; node: Registrant }]\n\t| StategroupRegistrant\n\t| [\n\t\t\t\"collection\",\n\t\t\t{\n\t\t\t\tdef: api_app.Ccollection__type__property;\n\t\t\t\tentries?: Set;\n\t\t\t\tjoin: boolean;\n\t\t\t}\n\t ];\n\nclass Registrant {\n\tattributes = new Map();\n\tparent: Registrant | undefined;\n\tentity: boolean;\n}\n\nconst gui_widget_configuration_node_registrants = new Map();\n\nfunction applyRegistrant(registrant: Registrant, node: api_cs.Cnode, destructor: DestructorTree): void {\n\tfor (const att of registrant.attributes.values()) {\n\t\tswitch (att[0]) {\n\t\t\tcase \"command\": {\n\t\t\t\tconst def = att[1].def;\n\t\t\t\tregisterCommand(def, node, destructor);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"action\": {\n\t\t\t\tconst def = att[1].def;\n\t\t\t\tregisterAction(def, node, destructor);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"text\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tconst text = registerText($.def, node, destructor);\n\t\t\t\tif ($.reference) {\n\t\t\t\t\tswitch (text.properties.navigable.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst configurations = $.reference;\n\t\t\t\t\t\t\tconst reference = text.properties.navigable.state.node;\n\t\t\t\t\t\t\tlet referenced_node_destructor: DestructorTree | undefined;\n\t\t\t\t\t\t\tconst referenced_node = iReference(reference).referencedNode;\n\t\t\t\t\t\t\tconst subscription = referenced_node.subscribe({\n\t\t\t\t\t\t\t\tupdate: (referenced_node) => {\n\t\t\t\t\t\t\t\t\tif (referenced_node instanceof api_cs.Cnode) {\n\t\t\t\t\t\t\t\t\t\treferenced_node_destructor?.destroy();\n\t\t\t\t\t\t\t\t\t\treferenced_node_destructor = new DestructorTree();\n\t\t\t\t\t\t\t\t\t\tconst entity = referenced_node.input.entity().output.node();\n\t\t\t\t\t\t\t\t\t\tfor (const config of configurations) {\n\t\t\t\t\t\t\t\t\t\t\tregisterGuiWidgetConfigurationNode(config, entity, referenced_node_destructor);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tdestructor.onDestroy(() => referenced_node.unsubscribe(subscription));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"number\": {\n\t\t\t\tconst def = att[1].def;\n\t\t\t\tregisterNumber(def, node, destructor);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"file\": {\n\t\t\t\tconst def = att[1].def;\n\t\t\t\tregisterFile(def, node, destructor);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"group\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tconst group = registerGroup($.def, node, destructor);\n\t\t\t\tapplyRegistrant($.node, group.properties.node, destructor);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"stategroup\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tconst stategroup = registerStategroup($.def, node, destructor);\n\t\t\t\tfor (const [state_name, state_tree] of $.states) {\n\t\t\t\t\tapplyRegistrant(state_tree, stategroup.properties.states.get(state_name)!.properties.node, destructor);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"collection\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tconst collection = registerCollection($.def, node, destructor);\n\t\t\t\tif ($.entries) {\n\t\t\t\t\tconst configurations = $.entries;\n\t\t\t\t\tconst entries_registration = getCollectionEntriesRegistration(collection);\n\t\t\t\t\tfor (const config of configurations) {\n\t\t\t\t\t\tapplyEntriesRegistrant(\n\t\t\t\t\t\t\tgetGuiWidgetConfigurationNodeRegistrant(config),\n\t\t\t\t\t\t\tentries_registration.node,\n\t\t\t\t\t\t\tcollection,\n\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tdestructor.subscribeToCollection(\n\t\t\t\t\t\tcollection.properties.entries,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ton_add: (entry, destructor) => {\n\t\t\t\t\t\t\t\tfor (const config of configurations) {\n\t\t\t\t\t\t\t\t\tregisterGuiWidgetConfigurationNode(config, entry.properties.node, destructor);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t/*init=*/ true\n\t\t\t\t\t);\n\t\t\t\t\tif ($.join) {\n\t\t\t\t\t\tregisterCollectionEntries(collection, destructor);\n\t\t\t\t\t\tregisterJoin(collection, destructor);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (registrant.parent) {\n\t\tapplyRegistrant(registrant.parent, node.input.position().output.parent().cast(\"node\"), destructor);\n\t}\n\tif (registrant.entity) {\n\t\tconst entity = node.input.entity();\n\t\tswitch (entity.variant.name) {\n\t\t\tcase \"entry\": {\n\t\t\t\tconst entry = entity.variant.definition;\n\t\t\t\tregisterEntry(entry, destructor);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"root\":\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\nfunction applyEntriesRegistrant(\n\tregistrant: Registrant,\n\tentries_registration_node: EntriesRegistrationNode,\n\tcollection: api_cs.Ccollection,\n\tdestructor: DestructorTree\n): void {\n\tfor (const [name, att] of registrant.attributes) {\n\t\tswitch (att[0]) {\n\t\t\tcase \"command\": {\n\t\t\t\tlet entries_registration_attribute = entries_registration_node.get(name);\n\t\t\t\tif (!entries_registration_attribute) {\n\t\t\t\t\tentries_registration_attribute = [\"command\", new EntriesRegistrationCommand(collection)];\n\t\t\t\t\tentries_registration_node.set(name, entries_registration_attribute);\n\t\t\t\t}\n\t\t\t\tconst entries_registration_command = entries_registration_attribute[1] as EntriesRegistrationGroup;\n\t\t\t\tinitializeSubscribableObject(entries_registration_command, collection.parent.parent.parent, destructor);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"action\":\n\t\t\t\tbreak;\n\t\t\tcase \"text\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tlet entries_registration_attribute = entries_registration_node.get(name);\n\t\t\t\tif (!entries_registration_attribute) {\n\t\t\t\t\tentries_registration_attribute = [\"text\", new EntriesRegistrationText(collection)];\n\t\t\t\t\tentries_registration_node.set(name, entries_registration_attribute);\n\t\t\t\t}\n\t\t\t\tconst entries_registration_text = entries_registration_attribute[1] as EntriesRegistrationText;\n\t\t\t\tinitializeSubscribableObject(entries_registration_text, collection.parent.parent.parent, destructor);\n\t\t\t\tif (!entries_registration_text.reference && $.reference !== undefined) {\n\t\t\t\t\tentries_registration_text.reference = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"number\": {\n\t\t\t\tlet entries_registration_attribute = entries_registration_node.get(name);\n\t\t\t\tif (!entries_registration_attribute) {\n\t\t\t\t\tentries_registration_attribute = [\"number\", new EntriesRegistrationNumber(collection)];\n\t\t\t\t\tentries_registration_node.set(name, entries_registration_attribute);\n\t\t\t\t}\n\t\t\t\tconst entries_registration_number = entries_registration_attribute[1] as EntriesRegistrationGroup;\n\t\t\t\tinitializeSubscribableObject(entries_registration_number, collection.parent.parent.parent, destructor);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"file\": {\n\t\t\t\tlet entries_registration_attribute = entries_registration_node.get(name);\n\t\t\t\tif (!entries_registration_attribute) {\n\t\t\t\t\tentries_registration_attribute = [\"file\", new EntriesRegistrationFile(collection)];\n\t\t\t\t\tentries_registration_node.set(name, entries_registration_attribute);\n\t\t\t\t}\n\t\t\t\tconst entries_registration_file = entries_registration_attribute[1] as EntriesRegistrationGroup;\n\t\t\t\tinitializeSubscribableObject(entries_registration_file, collection.parent.parent.parent, destructor);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"group\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tlet entries_registration_attribute = entries_registration_node.get(name);\n\t\t\t\tif (!entries_registration_attribute) {\n\t\t\t\t\tentries_registration_attribute = [\"group\", new EntriesRegistrationGroup(collection)];\n\t\t\t\t\tentries_registration_node.set(name, entries_registration_attribute);\n\t\t\t\t}\n\t\t\t\tconst entries_registration_group = entries_registration_attribute[1] as EntriesRegistrationGroup;\n\t\t\t\tinitializeSubscribableObject(entries_registration_group, collection.parent.parent.parent, destructor);\n\t\t\t\tapplyEntriesRegistrant($.node, entries_registration_group.node, collection, destructor);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"stategroup\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tlet entries_registration_attribute = entries_registration_node.get(name);\n\t\t\t\tif (!entries_registration_attribute) {\n\t\t\t\t\tentries_registration_attribute = [\"stategroup\", new EntriesRegistrationStategroup(collection, $.def)];\n\t\t\t\t\tentries_registration_node.set(name, entries_registration_attribute);\n\t\t\t\t}\n\t\t\t\tconst entries_registration_stategroup = entries_registration_attribute[1] as EntriesRegistrationStategroup;\n\t\t\t\tinitializeSubscribableObject(entries_registration_stategroup, collection.parent.parent.parent, destructor);\n\t\t\t\tfor (const [state_name, state_registrant] of $.states) {\n\t\t\t\t\tlet entries_registration_state = entries_registration_stategroup.states.get(state_name);\n\t\t\t\t\tif (!entries_registration_state) {\n\t\t\t\t\t\tentries_registration_state = new Map();\n\t\t\t\t\t\tentries_registration_stategroup.states.set(state_name, entries_registration_state);\n\t\t\t\t\t}\n\t\t\t\t\tapplyEntriesRegistrant(state_registrant, entries_registration_state, collection, destructor);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"collection\": {\n\t\t\t\tconst $ = att[1];\n\t\t\t\tlet entries_registration_attribute = entries_registration_node.get(name);\n\t\t\t\tif (!entries_registration_attribute) {\n\t\t\t\t\tentries_registration_attribute = [\"collection\", new EntriesRegistrationCollection(collection)];\n\t\t\t\t\tentries_registration_node.set(name, entries_registration_attribute);\n\t\t\t\t}\n\t\t\t\tgetReferenceCounter(entries_registration_attribute[1]).add_registration(destructor);\n\t\t\t\tconst entries_registration_collection = entries_registration_attribute[1] as EntriesRegistrationCollection;\n\t\t\t\tif ($.entries) {\n\t\t\t\t\tinitializeSubscribableObject(\n\t\t\t\t\t\tentries_registration_collection.entries,\n\t\t\t\t\t\tcollection.parent.parent.parent,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tfor (const config of $.entries) {\n\t\t\t\t\t\tapplyEntriesRegistrant(\n\t\t\t\t\t\t\tgetGuiWidgetConfigurationNodeRegistrant(config),\n\t\t\t\t\t\t\tentries_registration_collection.entries.node,\n\t\t\t\t\t\t\tcollection,\n\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tinitializeSubscribableObject(\n\t\t\t\t\t\tentries_registration_collection.updates,\n\t\t\t\t\t\tcollection.parent.parent.parent,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(att[0]);\n\t\t}\n\t}\n}\n\nexport function registerGuiWidgetConfigurationNode(\n\tconfiguration: api_views.Cgui_widget_configuration_node,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree\n): void {\n\tconst registrant = getGuiWidgetConfigurationNodeRegistrant(configuration);\n\tapplyRegistrant(registrant, node, destructor);\n}\n\nfunction getGuiWidgetConfigurationNodeRegistrant(configuration: api_views.Cgui_widget_configuration_node): Registrant {\n\tlet registrant = gui_widget_configuration_node_registrants.get(configuration);\n\tif (!registrant) {\n\t\tregistrant = createGuiWidgetConfigurationNodeRegistrant(configuration, new Registrant());\n\t\tgui_widget_configuration_node_registrants.set(configuration, registrant);\n\t}\n\treturn registrant;\n}\n\nfunction createModelBindingPropertyPathRegistrant(\n\tpath: api_views.Cmodel_binding_property_path,\n\tregistrant: Registrant\n): Registrant {\n\tlet has_steps = path.properties.has_steps.state;\n\twhile (has_steps.name === \"yes\") {\n\t\tconst type = has_steps.node.properties.type.state;\n\t\tswitch (type.name) {\n\t\t\tcase \"group\":\n\t\t\t\tregistrant = createGroupRegistrant(type.node.properties.group.ref.inferences.group(), registrant);\n\t\t\t\tbreak;\n\t\t\tcase \"parent\":\n\t\t\t\tregistrant = createParentRegistrant(registrant);\n\t\t\t\tbreak;\n\t\t\tcase \"state group\":\n\t\t\t\tregistrant = createStateRegistrant(\n\t\t\t\t\ttype.node.properties.state_group.ref.inferences.state_group(),\n\t\t\t\t\ttype.node.properties.state.entry,\n\t\t\t\t\tregistrant\n\t\t\t\t);\n\t\t}\n\t\thas_steps = has_steps.node.properties.tail.properties.has_steps.state;\n\t}\n\treturn registrant;\n}\n\nfunction createQueryPathStepRegistrant(path: api_views.Cquery_path_step, registrant: Registrant): Registrant {\n\twhile (path.properties.has_steps.state.name === \"yes\") {\n\t\tconst yes = path.properties.has_steps.state.node;\n\t\tswitch (yes.properties.type.state.name) {\n\t\t\tcase \"group\": {\n\t\t\t\tconst $ = yes.properties.type.state.node;\n\t\t\t\tregistrant = createGroupRegistrant($.properties.group.ref.inferences.group(), registrant);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state\": {\n\t\t\t\tconst $ = yes.properties.type.state.node;\n\t\t\t\tregistrant = createStateRegistrant(\n\t\t\t\t\t$.properties.state_group.ref.inferences.state_group(),\n\t\t\t\t\t$.properties.state.entry,\n\t\t\t\t\tregistrant\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn unexpectedState(yes.properties.type.state);\n\t\t}\n\t\tpath = yes.properties.tail;\n\t}\n\treturn registrant;\n}\n\nfunction createObjectPathTailRegistrant(path: api_app.Cobject_path_tail, registrant: Registrant): Registrant {\n\tlet stategroup: api_app.Cstate_group | undefined;\n\twhile (path.properties.has_steps.state.name === \"yes\") {\n\t\tconst has_steps = path.properties.has_steps.state.node;\n\t\tswitch (has_steps.properties.type.state.name) {\n\t\t\tcase \"property value\": {\n\t\t\t\tconst $ = has_steps.properties.type.state.node;\n\t\t\t\tswitch ($.properties.property.properties.property.ref.properties.type.state.name) {\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst group = $.properties.property.properties.property.ref.properties.type.state.node;\n\t\t\t\t\t\tregistrant = createGroupRegistrant(group, registrant);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\tstategroup = $.properties.property.properties.property.ref.properties.type.state.node;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.property.properties.property.ref.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state\":\n\t\t\t\tif (stategroup !== undefined) {\n\t\t\t\t\tconst state_name = has_steps.properties.type.state.node.properties.state.entry;\n\t\t\t\t\tregistrant = createStateRegistrant(stategroup, state_name, registrant);\n\t\t\t\t\tstategroup = undefined;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"parent\":\n\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\tcase \"dependency\":\n\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\tcase \"reference set\":\n\t\t\t\tthrow new Error(\"unexpected step for conditional path\");\n\t\t\tdefault:\n\t\t\t\tunexpectedState(has_steps.properties.type.state);\n\t\t}\n\t\tpath = has_steps.properties.tail;\n\t}\n\treturn registrant;\n}\n\nfunction createTextRegistrant(def: api_app.Ctext__type__property, registrant: Registrant, reference: false): void;\nfunction createTextRegistrant(\n\tdef: api_app.Ctext__type__property,\n\tregistrant: Registrant,\n\treference: true,\n\treference_config?: api_views.Cgui_widget_configuration_node\n): void;\nfunction createTextRegistrant(\n\tdef: api_app.Ctext__type__property,\n\tregistrant: Registrant,\n\treference: boolean,\n\treference_config?: api_views.Cgui_widget_configuration_node\n): void {\n\tconst text_registrant = registrant.attributes.get(def.parent.parent.key);\n\tif (text_registrant && text_registrant[0] === \"text\") {\n\t\tif (reference) {\n\t\t\tif (!text_registrant[1].reference) {\n\t\t\t\ttext_registrant[1].reference = new Set();\n\t\t\t}\n\t\t\tif (reference_config) {\n\t\t\t\ttext_registrant[1].reference.add(reference_config);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (reference) {\n\t\t\tregistrant.attributes.set(def.parent.parent.key, [\n\t\t\t\t\"text\",\n\t\t\t\t{ def: def, reference: new Set(reference_config ? [reference_config] : []) },\n\t\t\t]);\n\t\t} else {\n\t\t\tregistrant.attributes.set(def.parent.parent.key, [\"text\", { def: def }]);\n\t\t}\n\t}\n}\n\nfunction createStategroupRegistrant(def: api_app.Cstate_group, registrant: Registrant): StategroupRegistrant {\n\tlet stategroup_registrant = registrant.attributes.get(def.parent.parent.key);\n\tif (!stategroup_registrant || stategroup_registrant[0] !== \"stategroup\") {\n\t\tstategroup_registrant = [\"stategroup\", { def: def, states: new Map() }];\n\t\tregistrant.attributes.set(def.parent.parent.key, stategroup_registrant);\n\t}\n\treturn stategroup_registrant;\n}\n\nfunction createStateRegistrant(def: api_app.Cstate_group, state_name: string, registrant: Registrant): Registrant {\n\tconst stategroup_registrant = createStategroupRegistrant(def, registrant);\n\tlet state_registrant = stategroup_registrant[1].states.get(state_name);\n\tif (!state_registrant) {\n\t\tstate_registrant = new Registrant();\n\t\tstategroup_registrant[1].states.set(state_name, state_registrant);\n\t}\n\treturn state_registrant;\n}\n\nfunction createGroupRegistrant(def: api_app.Cgroup__type__property, registrant: Registrant): Registrant {\n\tlet group_registrant = registrant.attributes.get(def.parent.parent.key);\n\tif (!group_registrant || group_registrant[0] !== \"group\") {\n\t\tgroup_registrant = [\"group\", { def: def, node: new Registrant() }];\n\t\tregistrant.attributes.set(def.parent.parent.key, group_registrant);\n\t}\n\treturn group_registrant[1].node;\n}\n\nfunction createCollectionRegistrant(\n\tdef: api_app.Ccollection__type__property,\n\tregistrant: Registrant,\n\tjoin: boolean,\n\tentries_config?: api_views.Cgui_widget_configuration_node\n) {\n\tconst collection_name = def.parent.parent.key;\n\tconst collection_registrant = registrant.attributes.get(collection_name);\n\tif (collection_registrant && collection_registrant[0] === \"collection\") {\n\t\tif (entries_config) {\n\t\t\tif (!collection_registrant[1].entries) {\n\t\t\t\tcollection_registrant[1].entries = new Set();\n\t\t\t}\n\t\t\tcollection_registrant[1].entries.add(entries_config);\n\t\t}\n\t\tif (join === true) {\n\t\t\tcollection_registrant[1].join = true;\n\t\t}\n\t} else {\n\t\tif (entries_config) {\n\t\t\tregistrant.attributes.set(collection_name, [\n\t\t\t\t\"collection\",\n\t\t\t\t{ def: def, entries: new Set([entries_config]), join: join },\n\t\t\t]);\n\t\t} else {\n\t\t\tregistrant.attributes.set(collection_name, [\"collection\", { def: def, join: join }]);\n\t\t}\n\t}\n}\n\nfunction createParentRegistrant(registrant: Registrant): Registrant {\n\tlet parent = registrant.parent;\n\tif (parent === undefined) {\n\t\tparent = new Registrant();\n\t\tregistrant.parent = parent;\n\t}\n\treturn parent;\n}\n\nfunction createGuiWidgetConfigurationNodeRegistrant(\n\tconfiguration: api_views.Cgui_widget_configuration_node,\n\tregistrant: Registrant\n): Registrant {\n\tfor (const $ of configuration.properties.configuration.values()) {\n\t\tconst attribute = $.properties.attribute;\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"configuration\": {\n\t\t\t\tconst configuration = attribute.properties.type.state.node;\n\t\t\t\tswitch (configuration.properties.type.state.name) {\n\t\t\t\t\tcase \"list\": {\n\t\t\t\t\t\tconst $ = configuration.properties.type.state.node;\n\t\t\t\t\t\tlet widget_list = $.properties.list;\n\t\t\t\t\t\twhile (widget_list.properties.has_steps.state.name === \"yes\") {\n\t\t\t\t\t\t\tconst $ = widget_list.properties.has_steps.state.node;\n\t\t\t\t\t\t\tcreateGuiWidgetConfigurationNodeRegistrant($.properties.configuration, registrant);\n\t\t\t\t\t\t\twidget_list = $.properties.tail;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst $ = configuration.properties.type.state.node;\n\t\t\t\t\t\tcreateGuiWidgetConfigurationNodeRegistrant($.properties.configuration, registrant);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"states list\": {\n\t\t\t\t\t\tconst $ = configuration.properties.type.state.node;\n\t\t\t\t\t\tfor (const state of $.properties.states) {\n\t\t\t\t\t\t\tcreateGuiWidgetConfigurationNodeRegistrant(state[1].properties.configuration, registrant);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(configuration.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"model binding\": {\n\t\t\t\tconst model_binding = attribute.properties.type.state.node;\n\t\t\t\tswitch (model_binding.properties.type.state.name) {\n\t\t\t\t\tcase \"action\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tconst action_context_registrant = createModelBindingPropertyPathRegistrant(\n\t\t\t\t\t\t\t$.properties.property_path,\n\t\t\t\t\t\t\tregistrant\n\t\t\t\t\t\t);\n\t\t\t\t\t\taction_context_registrant.attributes.set($.properties.action.entry, [\n\t\t\t\t\t\t\t\"action\",\n\t\t\t\t\t\t\t{ def: $.properties.action.ref.inferences.action_type() },\n\t\t\t\t\t\t]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tlet join: boolean;\n\t\t\t\t\t\tswitch ($.properties.join.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tjoin = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tjoin = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState($.properties.join.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst definition = $.properties.collection.ref.inferences.collection();\n\t\t\t\t\t\tconst collection_context_registrant = createModelBindingPropertyPathRegistrant(\n\t\t\t\t\t\t\t$.properties.property_path,\n\t\t\t\t\t\t\tregistrant\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcreateCollectionRegistrant(definition, collection_context_registrant, join, $.properties.configuration);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"command\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tconst command_context_registrant = createModelBindingPropertyPathRegistrant(\n\t\t\t\t\t\t\t$.properties.property_path,\n\t\t\t\t\t\t\tregistrant\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcommand_context_registrant.attributes.set($.properties.command.entry, [\n\t\t\t\t\t\t\t\"command\",\n\t\t\t\t\t\t\t{ def: $.properties.command.ref.inferences.global_type() },\n\t\t\t\t\t\t]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"current node\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tconst current_node_context_registrant = createModelBindingPropertyPathRegistrant(\n\t\t\t\t\t\t\t$.properties.property_path,\n\t\t\t\t\t\t\tregistrant\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcreateGuiWidgetConfigurationNodeRegistrant($.properties.configuration, current_node_context_registrant);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"entity\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tregistrant.entity = true;\n\t\t\t\t\t\tcreateGuiWidgetConfigurationNodeRegistrant($.properties.configuration, registrant);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tconst definition = $.properties.property.ref.inferences.file();\n\t\t\t\t\t\tconst file_context_registrant = createModelBindingPropertyPathRegistrant(\n\t\t\t\t\t\t\t$.properties.property_path,\n\t\t\t\t\t\t\tregistrant\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfile_context_registrant.attributes.set($.properties.property.entry, [\"file\", { def: definition }]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tconst definition = $.properties.group.ref.inferences.group();\n\t\t\t\t\t\tcreateGuiWidgetConfigurationNodeRegistrant(\n\t\t\t\t\t\t\t$.properties.configuration,\n\t\t\t\t\t\t\tcreateGroupRegistrant(definition, registrant)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tconst definition = $.properties.property.ref.inferences.number();\n\t\t\t\t\t\tconst number_context_registrant = createModelBindingPropertyPathRegistrant(\n\t\t\t\t\t\t\t$.properties.property_path,\n\t\t\t\t\t\t\tregistrant\n\t\t\t\t\t\t);\n\t\t\t\t\t\tnumber_context_registrant.attributes.set($.properties.property.entry, [\"number\", { def: definition }]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"ordered graph\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tconst ordered_graph =\n\t\t\t\t\t\t\t$.properties.ordered_graph.ref.key.inferences.ordered_graph().properties.ordering_property_path;\n\t\t\t\t\t\tconst ordering_state_group_definition =\n\t\t\t\t\t\t\tordered_graph.properties.ordering_state_group_path.inferences.state_group();\n\t\t\t\t\t\tconst edge_state_name = ordered_graph.properties.ordering_states.properties.edge_state.entry;\n\t\t\t\t\t\tconst edge_reference_definition =\n\t\t\t\t\t\t\tordered_graph.properties.ordering_states.properties.edge_reference.ref.parent;\n\n\t\t\t\t\t\tconst ordering_context_registrant = createObjectPathTailRegistrant(\n\t\t\t\t\t\t\tordered_graph.properties.ordering_state_group_path.properties.head,\n\t\t\t\t\t\t\tregistrant\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst edge_state_registrant = createStateRegistrant(\n\t\t\t\t\t\t\tordering_state_group_definition,\n\t\t\t\t\t\t\tedge_state_name,\n\t\t\t\t\t\t\tordering_context_registrant\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcreateTextRegistrant(edge_reference_definition, edge_state_registrant, true);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"query\": {\n\t\t\t\t\t\tconst query_binding = model_binding.properties.type.state.node;\n\t\t\t\t\t\tswitch (query_binding.properties.query_context.state.name) {\n\t\t\t\t\t\t\tcase \"candidates\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"node\": {\n\t\t\t\t\t\t\t\tconst $node = query_binding.properties.query_context.state.node;\n\t\t\t\t\t\t\t\tswitch ($node.properties.switch_.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"current node\": {\n\t\t\t\t\t\t\t\t\t\tconst $current_node = $node.properties.switch_.state.node;\n\t\t\t\t\t\t\t\t\t\tconst query_path = $current_node.properties.query.inferences.query().parent.properties.path;\n\t\t\t\t\t\t\t\t\t\tswitch (query_path.properties.has_steps.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst $ = query_path.properties.has_steps.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\t// check if there is only one collection step\n\t\t\t\t\t\t\t\t\t\t\t\tswitch ($.properties.tail.properties.has_steps.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst query_context_registrant = createQueryPathStepRegistrant(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.head,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreateModelBindingPropertyPathRegistrant(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$current_node.properties.property_path,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tregistrant\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreateCollectionRegistrant(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.collection.ref.inferences.collection(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tquery_context_registrant,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState($.properties.tail.properties.has_steps.state);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(query_path.properties.has_steps.state);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"root\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tunexpectedState($node.properties.switch_.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(query_binding.properties.query_context.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"query file\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"query number\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"query stategroup\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"query text\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"report\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"report number parameter\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"report text parameter\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"sort property\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"state\": {\n\t\t\t\t\t\tconst state_binding = model_binding.properties.type.state.node;\n\t\t\t\t\t\tlet state: api_gui.Cstates__state_group__type__property__type__attributes;\n\t\t\t\t\t\tswitch (state_binding.properties.state_group_context.state.name) {\n\t\t\t\t\t\t\tcase \"state group binding\": {\n\t\t\t\t\t\t\t\tconst $ = state_binding.properties.state_group_context.state.node;\n\t\t\t\t\t\t\t\tstate = $.properties.state.ref;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"states list\": {\n\t\t\t\t\t\t\t\tconst $ = state_binding.properties.state_group_context.state.node;\n\t\t\t\t\t\t\t\tstate = $.inferences.state_context().key.ref;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(state_binding.properties.state_group_context.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst state_registrant = createStateRegistrant(state.key.ref.parent, state.key.entry, registrant);\n\t\t\t\t\t\tcreateGuiWidgetConfigurationNodeRegistrant(state_binding.properties.configuration, state_registrant);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tconst stategroup_definition = $.properties.state_group.ref.inferences.state_group();\n\t\t\t\t\t\tconst property_context_registrant = createModelBindingPropertyPathRegistrant(\n\t\t\t\t\t\t\t$.properties.property_path,\n\t\t\t\t\t\t\tregistrant\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcreateStategroupRegistrant(stategroup_definition, property_context_registrant);\n\t\t\t\t\t\tcreateGuiWidgetConfigurationNodeRegistrant($.properties.configuration, property_context_registrant);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state rule\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst $ = model_binding.properties.type.state.node;\n\t\t\t\t\t\tconst property_context_registrant = createModelBindingPropertyPathRegistrant(\n\t\t\t\t\t\t\t$.properties.property_path,\n\t\t\t\t\t\t\tregistrant\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst text_definition = $.properties.property.ref.inferences.text();\n\t\t\t\t\t\tswitch (text_definition.properties.has_reference.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tcreateTextRegistrant(text_definition, property_context_registrant, false);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tcreateTextRegistrant(text_definition, property_context_registrant, true, $.properties.configuration);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(text_definition.properties.has_reference.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"window\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"joined entry\": {\n\t\t\t\t\t\t//TODO register the widget configuration of the joined entry?\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"user\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(model_binding.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"view\":\n\t\t\t\tbreak;\n\t\t\tcase \"widget\": {\n\t\t\t\tconst $ = attribute.properties.type.state.node;\n\t\t\t\tcreateWidgetExpressionRegistrant($.properties.instance, registrant);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"window\": {\n\t\t\t\tconst $ = attribute.properties.type.state.node;\n\t\t\t\tcreateGuiWidgetConfigurationNodeRegistrant($.properties.configuration, registrant);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t}\n\t}\n\treturn registrant;\n}\n\nfunction createWidgetExpressionRegistrant(expression: api_views.Cwidget_expression, registrant: Registrant) {\n\tswitch (expression.properties.type.state.name) {\n\t\tcase \"group\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tcreateWidgetExpressionRegistrant(\n\t\t\t\t$.properties.next,\n\t\t\t\tcreateGroupRegistrant($.properties.group.ref.inferences.group(), registrant)\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tcreateWidgetExpressionRegistrant(\n\t\t\t\t$.properties.next,\n\t\t\t\tcreateStateRegistrant(\n\t\t\t\t\t$.properties.state_group.ref.inferences.state_group(),\n\t\t\t\t\t$.properties.state.entry,\n\t\t\t\t\tregistrant\n\t\t\t\t)\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"switch\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tfor (const state of $.properties.states.values()) {\n\t\t\t\tcreateWidgetExpressionRegistrant(\n\t\t\t\t\tstate.properties.next,\n\t\t\t\t\tcreateStateRegistrant($.properties.state_group.ref.inferences.state_group(), state.key.entry, registrant)\n\t\t\t\t);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"parent\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tcreateWidgetExpressionRegistrant($.properties.next, createParentRegistrant(registrant));\n\t\t\tbreak;\n\t\t}\n\t\tcase \"widget\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tswitch ($.properties.lazy.state.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\tcreateGuiWidgetConfigurationNodeRegistrant($.properties.widget.properties.configuration, registrant);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"yes\":\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($.properties.lazy.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"reference\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tcreateTextRegistrant($.properties.text.ref.inferences.text(), registrant, true);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"reference rule\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tcreateTextRegistrant($.properties.text.ref.inferences.text(), registrant, true);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state context rule\": {\n\t\t\tbreak;\n\t\t}\n\t\tcase \"view\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(expression.properties.type.state);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport { shouldResetModifiedState } from \"./SaveModifiedStatus\";\nimport api_cs = api_configuration.types.client_state.alan_api;\n\nexport default function resetModifiedState(node: api_cs.Cnode, reset_collection: boolean): void {\n\tnode.properties.is_busy_saving.ensure(\"no\", {});\n\tfor (const attribute of node.properties.attributes.values()) {\n\t\tconst $att_type = attribute.properties.type.state;\n\t\tswitch ($att_type.name) {\n\t\t\tcase \"operation\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst $property = $att_type.node.properties.type.state;\n\t\t\t\tswitch ($property.name) {\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tswitch ($property.node.properties.is_editable.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst yes = $property.node.properties.is_editable.state.node;\n\t\t\t\t\t\t\t\tswitch (yes.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tconst yes_modified = yes.properties.modified.state.node;\n\t\t\t\t\t\t\t\t\t\tif (shouldResetModifiedState(yes_modified)) {\n\t\t\t\t\t\t\t\t\t\t\t$property.node.properties.is_editable.state.node.properties.modified.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\tswitch ($property.node.properties.is_editable.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst yes = $property.node.properties.is_editable.state.node;\n\t\t\t\t\t\t\t\tswitch (yes.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tconst yes_modified = yes.properties.modified.state.node;\n\t\t\t\t\t\t\t\t\t\tif (shouldResetModifiedState(yes_modified)) {\n\t\t\t\t\t\t\t\t\t\t\t$property.node.properties.is_editable.state.node.properties.modified.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\tswitch ($property.node.properties.backend_known.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t$property.node.properties.is_set.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\tswitch ($property.node.properties.is_editable.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst yes = $property.node.properties.is_editable.state.node;\n\t\t\t\t\t\t\t\tswitch (yes.properties.modified.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\tconst yes_modified = yes.properties.modified.state.node;\n\t\t\t\t\t\t\t\t\t\tif (shouldResetModifiedState(yes_modified)) {\n\t\t\t\t\t\t\t\t\t\t\t$property.node.properties.is_editable.state.node.properties.modified.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\tresetModifiedState($property.node.properties.node, reset_collection);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\tswitch ($property.node.properties.is_modified.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tconst yes_is_modified = $property.node.properties.is_modified.state.node;\n\t\t\t\t\t\t\t\t\tif (shouldResetModifiedState(yes_is_modified)) {\n\t\t\t\t\t\t\t\t\t\t$property.node.properties.is_modified.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (const state of $property.node.properties.states.values()) {\n\t\t\t\t\t\t\tresetModifiedState(state.properties.node, reset_collection);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\tif (reset_collection) {\n\t\t\t\t\t\t\tresetCollectionModifiedState($property.node, reset_collection);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function resetCollectionModifiedState(collection: api_cs.Ccollection, reset_collection: boolean): void {\n\tfor (const entry of collection.properties.entries.values()) {\n\t\tresetModifiedState(entry.properties.node, reset_collection);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport gui_definition_types = api_configuration.libraries.gui_definition_lib.types;\nimport api_control_library = api_configuration.libraries.gui_definition_lib.libraries.control_bundle_lib.libraries.controls_lib.types.control_library.alan_api;\nimport api_model = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_client_bindings = api_configuration.libraries.gui_definition_lib.libraries.client_lib.types.client_bindings.alan_api;\n\nexport type DecoratedSchemas = {\n\tmain: gui_definition_types.main.alan_api.Cmain;\n\tsettings: gui_definition_types.settings.alan_api.Csettings;\n\twidgets: Record;\n\tgui_model: gui_definition_types.gui_model.alan_api.Cgui_model;\n\tviews: Record;\n\tphrases: gui_definition_types.phrases.alan_api.Cphrases;\n\tclient_bindings: api_client_bindings.Cclient_bindings;\n\tcontrols: Record;\n\ttranslations: Record;\n\treports: Record;\n};\n\nexport function decorate(\n\traw_schemas: {\n\t\tmain: any;\n\t\tsettings: any;\n\t\twidgets: { [key: string]: any };\n\t\tgui_model: any;\n\t\tviews: { [name: string]: any };\n\t\tphrases: any;\n\t\tclient_bindings: any;\n\t\tcontrols: { [name: string]: any };\n\t\ttranslations: { [name: string]: any };\n\t\treports: { [name: string]: any };\n\t},\n\tapplication_model: api_model.Capplication\n): DecoratedSchemas {\n\tconst client_bindings =\n\t\tapi_configuration.libraries.gui_definition_lib.libraries.client_lib.types.client_bindings.alan_api.Cclient_bindings.create(\n\t\t\traw_schemas.client_bindings\n\t\t);\n\n\tconst controls: Record = {};\n\tObject.keys(raw_schemas.controls).forEach((control_name) => {\n\t\tObject.defineProperty(controls, control_name, {\n\t\t\tget: function () {\n\t\t\t\tdelete controls[control_name];\n\t\t\t\tconst control = api_control_library.Ccontrol_library.create(raw_schemas.controls[control_name], {\n\t\t\t\t\tcontrols: controls,\n\t\t\t\t});\n\t\t\t\tcontrols[control_name] = control;\n\t\t\t\tcontrol.key = control_name;\n\t\t\t\treturn control;\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t});\n\tconst phrases = gui_definition_types.phrases.alan_api.Cphrases.create(raw_schemas.phrases);\n\tconst widgets = Object.keys(raw_schemas.widgets).reduce<{\n\t\t[key: string]: api_configuration.libraries.gui_definition_lib.types.widget.alan_api.Cwidget;\n\t}>(function (obj, widget_name) {\n\t\tobj[widget_name] = gui_definition_types.widget.alan_api.Cwidget.create(raw_schemas.widgets[widget_name], {\n\t\t\tclient_bindings: client_bindings,\n\t\t\tcontrol_library: controls,\n\t\t\tphrases: phrases,\n\t\t});\n\t\tobj[widget_name].key = widget_name;\n\t\treturn obj;\n\t}, {});\n\tconst translations = Object.keys(raw_schemas.translations).reduce<{\n\t\t[key: string]: gui_definition_types.translations.alan_api.Ctranslations;\n\t}>(function (obj, language_name) {\n\t\tobj[language_name] = gui_definition_types.translations.alan_api.Ctranslations.create(\n\t\t\traw_schemas.translations[language_name],\n\t\t\t{\n\t\t\t\tphrases: phrases,\n\t\t\t}\n\t\t);\n\t\treturn obj;\n\t}, {});\n\tconst reports = Object.keys(raw_schemas.reports).reduce<{\n\t\t[name: string]: gui_definition_types.parameters.alan_api.Cparameters;\n\t}>((obj, report_name) => {\n\t\tobj[report_name] = gui_definition_types.parameters.alan_api.Cparameters.create(raw_schemas.reports[report_name], {\n\t\t\tapplication: application_model,\n\t\t});\n\t\treturn obj;\n\t}, {});\n\tconst settings = gui_definition_types.settings.alan_api.Csettings.create(raw_schemas.settings, {\n\t\tapplication: application_model,\n\t\tlanguages: translations,\n\t\tphrases: phrases,\n\t});\n\tconst views: { [name: string]: gui_definition_types.views.alan_api.Cviews } = {};\n\tconst views_proxy = new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, view_name: string) => {\n\t\t\t\tlet view = views[view_name];\n\t\t\t\tif (view !== undefined) return view;\n\t\t\t\tview = views[view_name] = gui_definition_types.views.alan_api.Cviews.create(raw_schemas.views[view_name], {\n\t\t\t\t\tapplication: application_model,\n\t\t\t\t\tclient_bindings: client_bindings,\n\t\t\t\t\twidgets: widgets,\n\t\t\t\t\tgui_model: gui_model,\n\t\t\t\t\tphrases: phrases,\n\t\t\t\t\tsettings: settings,\n\t\t\t\t\tviews: views_proxy,\n\t\t\t\t\treports: reports,\n\t\t\t\t});\n\t\t\t\tview.key = view_name;\n\t\t\t\treturn view;\n\t\t\t},\n\t\t}\n\t);\n\tconst gui_model = gui_definition_types.gui_model.alan_api.Cgui_model.create(raw_schemas.gui_model, {\n\t\tapplication: application_model,\n\t});\n\tconst main = api_configuration.libraries.gui_definition_lib.types.main.alan_api.Cmain.create(raw_schemas.main, {\n\t\tsettings: settings,\n\t\tviews: views_proxy,\n\t\tgui_model: gui_model,\n\t});\n\n\treturn {\n\t\tmain: main,\n\t\tsettings: settings,\n\t\twidgets: widgets,\n\t\tgui_model: gui_model,\n\t\tviews: views,\n\t\tphrases: phrases,\n\t\tclient_bindings: client_bindings,\n\t\tcontrols: controls,\n\t\ttranslations: translations,\n\t\treports: reports,\n\t};\n}\n","import { api_configuration } from \"../../common\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport { subscribeToCollectionEntry } from \"./Query\";\nimport createClientIdPathFromNode from \"../navigation/createClientIdPathFromNode\";\nimport { registerQueryEntry } from \"../state/registerClientState\";\nimport DestructorTree from \"../DestructorTree\";\n\n//TODO use guids?\nlet sel_id = 0;\nfunction generateSelectionId(): string {\n\tsel_id += 1;\n\treturn sel_id.toString();\n}\n\nexport function selectEntry(non_selected_entry: api_client_state.Cno__is_selected__entries): void {\n\tconst has_selected_entries = non_selected_entry.parent.parent.parent.properties.has_selected_entries.switch({\n\t\tno: () => {\n\t\t\tnon_selected_entry.parent.parent.parent.properties.has_selected_entries.set(\"yes\", {\n\t\t\t\t\"selected entries\": {},\n\t\t\t\t\"number of selected entries\": 0,\n\t\t\t\t\"number of editable selected entries\": 0,\n\t\t\t});\n\t\t\treturn non_selected_entry.parent.parent.parent.properties.has_selected_entries.cast(\"yes\");\n\t\t},\n\t\tyes: ($) => $,\n\t});\n\tconst selection_id = generateSelectionId();\n\n\tconst selected_entry = has_selected_entries.properties.selected_entries.create(selection_id, {\n\t\t\"entry status\": {\n\t\t\tinitialized: non_selected_entry.parent.properties.entry_status.properties.initialized.switch<\n\t\t\t\tapi_client_state.Tquery_entry_status[\"initialized\"]\n\t\t\t>({\n\t\t\t\tunknown: \"unknown\",\n\t\t\t\tyes: ($) => [\n\t\t\t\t\t\"yes\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"referenced node\": createClientIdPathFromNode($.properties.referenced_node.output.result_node()),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tno: ($) => [\n\t\t\t\t\t\"no\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"referenced node\": mapClientIdPath($.properties.referenced_node),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t},\n\t\t\"is editable\": non_selected_entry.parent.properties.is_editable.switch({\n\t\t\tno: [\"no\", {}],\n\t\t\tyes: [\"yes\", {}],\n\t\t}),\n\t});\n\tconst destructor = new DestructorTree();\n\tselected_entry.onDestroy(() => destructor.destroy());\n\tregisterQueryEntry(selected_entry.properties.entry_status, destructor);\n\tsubscribeToCollectionEntry(selected_entry.properties.entry_status);\n\tnon_selected_entry.parent.properties.is_selected.set(\"yes\", {\n\t\t\"selected entry\": selection_id,\n\t});\n\tupdateEntriesSelection(non_selected_entry.parent.parent.parent);\n}\n\nexport function deselectEntry(selected_entry: api_client_state.Cselected_entries): void {\n\tconst selected_entries = selected_entry.parent;\n\tselected_entry.parent.parent.properties.has_result.switch({\n\t\tno: undefined,\n\t\tyes: (has_result) => {\n\t\t\thas_result.properties.entries.forEach((q_entry) => {\n\t\t\t\tq_entry.properties.is_selected.switch({\n\t\t\t\t\tno: undefined,\n\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\tif ($.properties.selected_entry.ref === selected_entry) {\n\t\t\t\t\t\t\tq_entry.properties.is_selected.set(\"no\", {});\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t});\n\t\t},\n\t});\n\tselected_entries.properties.selected_entries.delete(selected_entry.key);\n\tupdateEntriesSelection(selected_entry.parent.parent);\n}\n\nexport function updateEntriesSelection(query: api_client_state.Cquery__client_state): void {\n\tquery.properties.has_selected_entries.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\tif ($.properties.selected_entries.size <= 0) {\n\t\t\t\tquery.properties.has_selected_entries.set(\"no\", {});\n\t\t\t} else {\n\t\t\t\t$.set_number_of_selected_entries($.properties.selected_entries.size);\n\t\t\t\t$.set_number_of_editable_selected_entries(\n\t\t\t\t\t$.properties.selected_entries\n\t\t\t\t\t\t.toArray()\n\t\t\t\t\t\t.reduce((t, $) => t + $[1].properties.is_editable.switch({ no: 0, yes: 1 }), 0)\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t});\n\n\tquery.properties.has_result.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\tlet has_selected_entries = false;\n\t\t\tlet has_unselected_entries = false;\n\t\t\t$.properties.entries.forEach((entry) => {\n\t\t\t\tentry.properties.is_selected.switch({\n\t\t\t\t\tno: () => {\n\t\t\t\t\t\thas_unselected_entries = true;\n\t\t\t\t\t},\n\t\t\t\t\tyes: () => {\n\t\t\t\t\t\thas_selected_entries = true;\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t});\n\t\t\tif (has_selected_entries) {\n\t\t\t\tif (has_unselected_entries) {\n\t\t\t\t\t$.properties.selected_entries.set(\"some\", {});\n\t\t\t\t} else {\n\t\t\t\t\t$.properties.selected_entries.set(\"all\", {});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$.properties.selected_entries.set(\"none\", {});\n\t\t\t}\n\t\t},\n\t});\n}\n\nfunction mapClientIdPath(id_path: api_client_state.Cid_path): api_client_state.Tid_path {\n\treturn {\n\t\t\"has steps\": id_path.properties.has_steps.switch({\n\t\t\tno: \"no\",\n\t\t\tyes: ($) => [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\ttype: $.properties.type.switch({\n\t\t\t\t\t\t\"collection entry\": ($) => [\n\t\t\t\t\t\t\t\"collection entry\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcollection: $.properties.collection.entry,\n\t\t\t\t\t\t\t\tid: $.properties.id,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tgroup: ($) => [\n\t\t\t\t\t\t\t\"group\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tgroup: $.properties.group.entry,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tstate: ($) => [\n\t\t\t\t\t\t\t\"state\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"state group\": $.properties.state_group.entry,\n\t\t\t\t\t\t\t\tstate: $.properties.state.entry,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t\ttail: mapClientIdPath($.properties.tail),\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t};\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { iReference } from \"../state/Reference\";\nimport { Unknown } from \"../Status\";\n\nexport function setNodeLocationToRemote(node: api_cs.Cnode): void {\n\tconst was_local = node.properties.location.switch({ local: true, remote: false });\n\tnode.properties.location.ensure(\"remote\", {\n\t\t\"edit mode\": [\"off\", {}],\n\t});\n\tfor (const attribute of node.properties.attributes.values()) {\n\t\tconst type = attribute.properties.type.state;\n\t\tswitch (type.name) {\n\t\t\tcase \"operation\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property_type = type.node.properties.type.state;\n\t\t\t\tswitch (property_type.name) {\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tswitch (property_type.node.properties.is_key.state.name) {\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst value = property_type.node.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\tno: () => \"\",\n\t\t\t\t\t\t\t\t\tyes: ($) => $.properties.text,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tproperty_type.node.properties.backend_known.ensure(\"yes\", { value: value }).set_value(value);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tswitch (property_type.node.properties.is_set.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\tswitch (property_type.node.properties.backend_known.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst modified = property_type.node.properties.is_editable.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\t\t\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.modified.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\tif (!modified) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tproperty_type.node.properties.is_set.set(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\tsetNodeLocationToRemote(property_type.node.properties.node);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst is_set = property_type.node.properties.is_set.state;\n\t\t\t\t\t\tswitch (is_set.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tis_set.node.properties.state.ref.properties.location.ensure(\"remote\", {});\n\t\t\t\t\t\t\t\tsetNodeLocationToRemote(is_set.node.properties.state.ref.properties.node);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\tif (was_local) {\n\t\t\t\t\t\t\tsetCollectionLocationToRemote(property_type.node);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction setNodeLocationToLocal(\n\tnode: api_cs.Cnode,\n\tparent_location: api_cs.Tlocal__location__node[\"parent location\"]\n): void {\n\tnode.properties.location.ensure(\"local\", {\n\t\t\"parent location\": parent_location,\n\t});\n\tfor (const attribute of node.properties.attributes.values()) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"operation\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst text = property.properties.type.state.node;\n\t\t\t\t\t\ttext.properties.backend_known.set(\"no\", {});\n\t\t\t\t\t\ttext.properties.navigable.switch({\n\t\t\t\t\t\t\tno: () => undefined,\n\t\t\t\t\t\t\tyes: (reference) => iReference(reference).setServerValue(Unknown),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst number = property.properties.type.state.node;\n\t\t\t\t\t\tnumber.properties.backend_known.set(\"no\", {});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\tconst file = property.properties.type.state.node;\n\t\t\t\t\t\tfile.properties.backend_known.set(\"no\", {});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst group = property.properties.type.state.node;\n\t\t\t\t\t\tsetNodeLocationToLocal(group.properties.node, parent_location);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst stategroup = property.properties.type.state.node;\n\t\t\t\t\t\tstategroup.properties.initialized.set(\"no\", {});\n\t\t\t\t\t\tfor (const state of stategroup.properties.states.values()) {\n\t\t\t\t\t\t\tsetStateLocationToLocal(state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\tconst collection = property.properties.type.state.node;\n\t\t\t\t\t\tfor (const entry of collection.properties.entries.values()) {\n\t\t\t\t\t\t\tsetEntryLocationToLocal(entry);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t}\n\t}\n}\n\nexport function setStateLocationToLocal(state: api_cs.Cstates__state_group__type__property): void {\n\tconst parent_location = state.parent.parent.parent.parent.properties.location.switch({\n\t\tlocal: ($) => $.properties.parent_location.state.name,\n\t\tremote: \"remote\",\n\t});\n\tstate.properties.location.ensure(\"local\", {});\n\tsetNodeLocationToLocal(state.properties.node, parent_location);\n}\n\nexport function setEntryLocationToRemote(entry: api_cs.Centries__collection): void {\n\tswitch (entry.properties.location.state.name) {\n\t\tcase \"local\":\n\t\t\tentry.properties.location.set(\"remote\", {\n\t\t\t\t\"marked for deletion\": [\"no\", {}],\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"remote\":\n\t}\n\tsetNodeLocationToRemote(entry.properties.node);\n}\n\nfunction setCollectionLocationToRemote(collection: api_cs.Ccollection): void {\n\tfor (const entry of collection.properties.entries.values()) {\n\t\tsetEntryLocationToRemote(entry);\n\t}\n}\n\nfunction setEntryLocationToLocal(entry: api_cs.Centries__collection): void {\n\tentry.properties.location.ensure(\"local\", {\n\t\t\"modified by\": [\"engine\", {}],\n\t});\n\tconst parent_location = entry.parent.parent.parent.parent.properties.location.state.name;\n\tsetNodeLocationToLocal(entry.properties.node, parent_location);\n}\n\nexport function setNodeContextToLocal(node: api_cs.Cnode): void {\n\tconst position = node.input.position();\n\tswitch (position.variant.name) {\n\t\tcase \"root\":\n\t\t\tsetNodeLocationToLocal(node, \"remote\");\n\t\t\tbreak;\n\t\tcase \"group\": {\n\t\t\tconst $ = position.variant.definition;\n\t\t\tsetNodeContextToLocal($.parent.parent.parent);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst $ = position.variant.definition;\n\t\t\tsetStateLocationToLocal($);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"entity\": {\n\t\t\tconst $ = position.variant.definition;\n\t\t\tswitch ($.variant.name) {\n\t\t\t\tcase \"entry\": {\n\t\t\t\t\tconst entry = $.variant.definition;\n\t\t\t\t\tsetEntryLocationToLocal(entry);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"root\":\n\t\t\t\t\tsetNodeLocationToLocal(node, \"remote\");\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($.variant);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(position.variant);\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport api_gui_model = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport * as expressions from \"../state/expressions\";\nimport * as Text from \"../state/Text\";\nimport * as Number from \"../state/Number\";\nimport * as Stategroup from \"../state/Stategroup\";\nimport DestructorTree from \"../DestructorTree\";\nimport { fromClientState } from \"./mapToIdPathBuilder\";\nimport { registerIdPath, registerText, registerNumber, registerStategroup } from \"../state/registerClientState\";\nimport * as Status from \"../Status\";\nimport * as microtaskQueue from \"../microtaskQueue\";\nimport { onScalarValue } from \"../../../../../stream\";\nimport { ScalarConsumer, ScalarProvider, createVariable } from \"../../../../../stream\";\n\ntype Sorting = string[];\n\nexport class ExpressionProvider extends ScalarProvider {\n\tprivate _subscriber: ScalarConsumer | undefined;\n\tprivate _value: Type | undefined;\n\tprivate _destructor: DestructorTree | undefined;\n\n\tconstructor(private readonly fn: (destructor: DestructorTree, callback: (value: Type) => void) => void) {\n\t\tsuper();\n\t}\n\n\tget value(): Type {\n\t\tif (this._value === undefined) {\n\t\t\tthrow new Error(\"not supported\");\n\t\t} else {\n\t\t\treturn this._value;\n\t\t}\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer): typeof subscriber {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tthis._destructor = new DestructorTree();\n\t\tthis.fn(this._destructor, (value) => {\n\t\t\tthis._value = value;\n\t\t\tsubscriber.update(value);\n\t\t});\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tthis._destructor?.destroy();\n\t}\n}\n\nconst sortableCollections = new WeakMap, ScalarProvider>();\n\nexport function patchCollection(collection: api_client_state.Ccollection): void {\n\tconst ui_sort = collection.inferences.collection_type().properties.ui.properties.sort;\n\tswitch (ui_sort.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst has_sorting = ui_sort.state.node;\n\t\t\tconst col = collection.properties.entries;\n\t\t\tsortableCollections.set(\n\t\t\t\tcol,\n\t\t\t\tcreateVariable(\n\t\t\t\t\tnew ExpressionProvider((destructor, callback) =>\n\t\t\t\t\t\tsubscribeToSortCriteriaForDefault(col, (e) => e.properties.node, has_sorting, destructor, callback)\n\t\t\t\t\t),\n\t\t\t\t\tfalse\n\t\t\t\t)\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tbreak;\n\t}\n}\n\nexport function patchQuery(query: api_client_state.Cyes__has_result): void {\n\tconst view_query = query.parent.properties.definition.ref;\n\tconst has_sorting = view_query.properties.context.switch({\n\t\tcandidates: ($) => {\n\t\t\tconst app_collection = $.properties.property.ref.inferences.reference().properties.expression.output.collection();\n\t\t\tswitch (app_collection.properties.ui.properties.sort.state.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\treturn undefined;\n\t\t\t\tcase \"yes\":\n\t\t\t\t\treturn app_collection.properties.ui.properties.sort.state.node;\n\t\t\t}\n\t\t},\n\t\tnode: ($) => {\n\t\t\tconst collection = getCollectionFromQueryPath($.properties.path);\n\t\t\tif (collection) {\n\t\t\t\treturn collection.inferences.collection().properties.ui.properties.sort.switch({\n\t\t\t\t\tno: () => undefined,\n\t\t\t\t\tyes: ($) => $,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t});\n\tif (has_sorting !== undefined) {\n\t\tconst col = query.properties.entries;\n\t\tsortableCollections.set(\n\t\t\tcol,\n\t\t\tcreateVariable(\n\t\t\t\tnew ExpressionProvider((destructor, callback) =>\n\t\t\t\t\tsubscribeToSortCriteriaForDefault(\n\t\t\t\t\t\tcol,\n\t\t\t\t\t\t(entry, destructor) =>\n\t\t\t\t\t\t\tentry.properties.entry_status.properties.initialized.switch({\n\t\t\t\t\t\t\t\tyes: ($) => $.properties.referenced_node.output.result_node(),\n\t\t\t\t\t\t\t\tno: ($) => registerIdPath(fromClientState($.properties.referenced_node), destructor),\n\t\t\t\t\t\t\t\tunknown: () => undefined,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\thas_sorting,\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tcallback\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tfalse\n\t\t\t)\n\t\t);\n\t}\n}\n\nfunction getCollectionFromQueryPath(\n\tpath: api_views.Cquery_path,\n\tcollection?: api_gui_model.Ccollection__type__property\n): api_gui_model.Ccollection__type__property | undefined {\n\treturn path.properties.has_steps.switch({\n\t\tno: collection,\n\t\tyes: ($) => getCollectionFromQueryPath($.properties.tail, $.properties.collection.ref),\n\t});\n}\n\nexport function subscribeToDefaultSorting(collection: api_client_state.AlanDictionary):\n\t| undefined\n\t| {\n\t\t\tsubscribe: (destructor: DestructorTree, callback: (sorting: Sorting) => void) => void;\n\t } {\n\tconst collection_with_sorting = sortableCollections.get(collection);\n\tif (collection_with_sorting !== undefined) {\n\t\treturn {\n\t\t\tsubscribe: (destructor, callback) => {\n\t\t\t\tconst subscriber = collection_with_sorting.subscribe({ update: (sorting) => callback(sorting) });\n\t\t\t\tdestructor.onDestroy(() => collection_with_sorting.unsubscribe(subscriber));\n\t\t\t},\n\t\t};\n\t} else {\n\t\treturn undefined;\n\t}\n}\n\nfunction subscribeToSortCriteriaForDefault(\n\tcollection: api_client_state.AlanDictionary<{ node: T; init: any }, any>,\n\tgetEntryContext: (entry: T, destructor: DestructorTree) => api_client_state.Cnode | undefined,\n\tdefinition: api_app.Cyes__sort,\n\tdestructor: DestructorTree,\n\tcallback: (sorting: Sorting) => void\n): void {\n\tconst scalar_value = definition.properties.property.inferences.scalar_value();\n\tlet value_type: \"text\" | \"number\";\n\tlet value_map: Map | Map;\n\tconst update = () => {\n\t\tif (destructor.destroyed) return;\n\t\tcallback(sort(value_type, value_map, definition.properties.direction.state.name));\n\t};\n\n\tlet on_property: (key: string, context_node: api_client_state.Cnode, destructor: DestructorTree) => void;\n\n\tswitch (scalar_value.variant.name) {\n\t\tcase \"text\": {\n\t\t\tconst text_app = scalar_value.variant.definition;\n\t\t\tvalue_map = new Map();\n\t\t\tvalue_type = \"text\";\n\n\t\t\ton_property = (key, context_node, destructor) => {\n\t\t\t\tconst text = registerText(text_app, context_node, destructor);\n\t\t\t\tText.subscribeToValue(text, destructor, (value) => {\n\t\t\t\t\t(>value_map).set(key, value);\n\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t});\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase \"number\": {\n\t\t\tconst number_app = scalar_value.variant.definition.cast(\"number property\");\n\t\t\tvalue_map = new Map();\n\t\t\tvalue_type = \"number\";\n\n\t\t\ton_property = (key, context_node, destructor) => {\n\t\t\t\tconst number = registerNumber(number_app, context_node, destructor);\n\t\t\t\tNumber.subscribeToValue(number, destructor, (value) => {\n\t\t\t\t\t(>value_map).set(key, value);\n\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t});\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state choice\": {\n\t\t\tconst stategroup_app = scalar_value.variant.definition;\n\t\t\tvalue_map = new Map();\n\t\t\tvalue_type = \"text\";\n\n\t\t\ton_property = (key, context_node, destructor) => {\n\t\t\t\tconst stategroup = registerStategroup(stategroup_app, context_node, destructor);\n\t\t\t\tStategroup.subscribeToSelectedState(stategroup, destructor, (value) => {\n\t\t\t\t\t(>value_map).set(key, value?.key.entry);\n\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t});\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tdestructor.subscribeToCollection(\n\t\tcollection,\n\t\t{\n\t\t\ton_add: (entry, destructor) => {\n\t\t\t\tconst key = entry.key_value;\n\t\t\t\tconst entry_context = getEntryContext(entry, destructor);\n\t\t\t\tif (entry_context !== undefined) {\n\t\t\t\t\tconst expression = expressions.ui_node_path(definition.properties.path)([entry_context, null]);\n\t\t\t\t\tlet c_destructor: DestructorTree | undefined;\n\t\t\t\t\tonScalarValue(\n\t\t\t\t\t\texpression,\n\t\t\t\t\t\t(node) => {\n\t\t\t\t\t\t\tif (!Status.isResolved(node)) {\n\t\t\t\t\t\t\t\tvalue_map.set(key, undefined);\n\t\t\t\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tc_destructor?.destroy();\n\t\t\t\t\t\t\t\tc_destructor = destructor.addChild();\n\t\t\t\t\t\t\t\ton_property(key, node, destructor);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t(scalar, subscription) => destructor.onDestroy(() => scalar.unsubscribe(subscription))\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\ton_remove: (key) => {\n\t\t\t\tvalue_map.delete(key);\n\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t},\n\t\t},\n\t\t/*init=*/ true\n\t);\n\n\tdestructor.onDestroy(() => {\n\t\tmicrotaskQueue.remove(update);\n\t});\n\n\tupdate();\n}\n\nfunction subscribeToModelBindingPropertyPath(\n\tpath: api_views.Cmodel_binding_property_path,\n\tnode: api_client_state.Cnode,\n\tdestructor: DestructorTree,\n\tcallback: (node: api_client_state.Cnode | undefined, destructor: DestructorTree) => void\n) {\n\tswitch (path.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\tcallback(node, destructor);\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst $yes = path.properties.has_steps.state.node;\n\t\t\tswitch ($yes.properties.type.state.name) {\n\t\t\t\tcase \"parent\": {\n\t\t\t\t\tconst parent_node = node.input.position().input.parent().cast(\"node\");\n\t\t\t\t\tsubscribeToModelBindingPropertyPath($yes.properties.tail, parent_node, destructor, callback);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"group\": {\n\t\t\t\t\tconst $group = $yes.properties.type.state.node;\n\t\t\t\t\tdestructor.subscribeToEntry(node.properties.attributes, $group.properties.group.entry, {\n\t\t\t\t\t\ton_add: (attribute, destructor) => {\n\t\t\t\t\t\t\tconst group = attribute.properties.type.cast(\"property\").properties.type.cast(\"group\");\n\t\t\t\t\t\t\tsubscribeToModelBindingPropertyPath($yes.properties.tail, group.properties.node, destructor, callback);\n\t\t\t\t\t\t},\n\t\t\t\t\t\ton_remove: () => callback(undefined, destructor),\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state group\": {\n\t\t\t\t\tconst $state = $yes.properties.type.state.node;\n\t\t\t\t\tdestructor.subscribeToEntry(node.properties.attributes, $state.properties.state_group.entry, {\n\t\t\t\t\t\ton_add: (attribute, destructor) => {\n\t\t\t\t\t\t\tconst state_group = attribute.properties.type.cast(\"property\").properties.type.cast(\"state group\");\n\t\t\t\t\t\t\tconst state = state_group.properties.states.get($state.properties.state.entry)!;\n\t\t\t\t\t\t\tdestructor.subscribeToStategroup(state.properties.is_selected, (destructor) => {\n\t\t\t\t\t\t\t\tswitch (state.properties.is_selected.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\tcallback(undefined, destructor);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\tsubscribeToModelBindingPropertyPath(\n\t\t\t\t\t\t\t\t\t\t\t$yes.properties.tail,\n\t\t\t\t\t\t\t\t\t\t\tstate.properties.node,\n\t\t\t\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\t\t\t\tcallback\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t\ton_remove: () => callback(undefined, destructor),\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nexport function subscribeToSortCriteriaForProperty(\n\tcollection: api_client_state.Ccollection,\n\tsort_property: api_views.Csort_property,\n\tdestructor: DestructorTree,\n\tdirection: \"ascending\" | \"descending\",\n\tcallback: (sorting: Sorting) => void\n): void {\n\tlet value_type: \"text\" | \"number\";\n\tlet value_map: Map | Map;\n\tconst update = () => {\n\t\tif (destructor.destroyed) return;\n\t\tcallback(sort(value_type, value_map, direction));\n\t};\n\tlet on_property: (key: string, context_node: api_client_state.Cnode, destructor: DestructorTree) => void;\n\n\tswitch (sort_property.properties.on.state.name) {\n\t\tcase \"text\": {\n\t\t\tconst $ = sort_property.properties.on.state.node;\n\t\t\tconst text_app = $.inferences.state_group().inferences.text();\n\t\t\tvalue_type = \"text\";\n\t\t\tvalue_map = new Map();\n\n\t\t\ton_property = (key, context_node, destructor) => {\n\t\t\t\tconst text = registerText(text_app, context_node, destructor);\n\t\t\t\tText.subscribeToValue(text, destructor, (value) => {\n\t\t\t\t\t(>value_map).set(key, value);\n\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t});\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase \"number\": {\n\t\t\tconst $ = sort_property.properties.on.state.node;\n\t\t\tconst number_app = $.inferences.state_group().inferences.number();\n\t\t\tvalue_type = \"number\";\n\t\t\tvalue_map = new Map();\n\n\t\t\ton_property = (key, context_node, destructor) => {\n\t\t\t\tconst number = registerNumber(number_app, context_node, destructor);\n\t\t\t\tNumber.subscribeToValue(number, destructor, (value) => {\n\t\t\t\t\t(>value_map).set(key, value);\n\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t});\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state group\": {\n\t\t\tconst $ = sort_property.properties.on.state.node;\n\t\t\tconst stategroup_app = $.inferences.state_group().inferences.state_group();\n\t\t\tvalue_type = \"text\";\n\t\t\tvalue_map = new Map();\n\n\t\t\ton_property = (key, context_node, destructor) => {\n\t\t\t\tconst stategroup = registerStategroup(stategroup_app, context_node, destructor);\n\t\t\t\tStategroup.subscribeToSelectedState(stategroup, destructor, (value) => {\n\t\t\t\t\t(>value_map).set(key, value?.key.entry);\n\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t});\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tdestructor.subscribeToCollection(\n\t\tcollection.properties.entries,\n\t\t{\n\t\t\ton_add: (entry, destructor) => {\n\t\t\t\tconst key = entry.key;\n\t\t\t\tconst node = entry.properties.node;\n\t\t\t\tsubscribeToModelBindingPropertyPath(\n\t\t\t\t\tsort_property.properties.property_path,\n\t\t\t\t\tnode,\n\t\t\t\t\tdestructor,\n\t\t\t\t\t(context_node, destructor) => {\n\t\t\t\t\t\tif (context_node === undefined) {\n\t\t\t\t\t\t\tvalue_map.set(key, undefined);\n\t\t\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ton_property(key, context_node, destructor);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t\ton_remove: (key) => {\n\t\t\t\tvalue_map.delete(key);\n\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t},\n\t\t},\n\t\t/*init=*/ true\n\t);\n\n\tdestructor.onDestroy(() => {\n\t\tmicrotaskQueue.remove(update);\n\t});\n}\n\nexport function subscribToSortCriteriaForQueryProperty(\n\tcolumn:\n\t\t| api_client_state.Ctext__type__columns\n\t\t| api_client_state.Cnumber__type__columns\n\t\t| api_client_state.Cstate_group__type__columns,\n\tdestructor: DestructorTree,\n\tdirection: \"ascending\" | \"descending\",\n\tcallback: (sorting: Sorting) => void\n): void {\n\tlet on_change: () => void;\n\tconst update = () => {\n\t\tif (destructor.destroyed) return;\n\t\ton_change();\n\t};\n\tlet value_type: \"text\" | \"number\" = \"text\";\n\n\tlet on_property: (key: string, entry: api_client_state.Centries__yes__has_result, destructor: DestructorTree) => void;\n\tconst value_map = new Map();\n\n\tif (column instanceof api_client_state.Ctext__type__columns) {\n\t\ton_property = (key, entry, destructor) => {\n\t\t\tconst cell = entry.properties.cells.get(column.parent.key_value)?.properties.type.cast(\"text\");\n\t\t\tif (cell !== undefined) {\n\t\t\t\tdestructor.subscribeToStategroup(cell.properties.is_set, (is_set_destructor) => {\n\t\t\t\t\tswitch (cell.properties.is_set.state.name) {\n\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\tvalue_map.set(key, undefined);\n\t\t\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst is_set = cell.properties.is_set.state.node;\n\t\t\t\t\t\t\tis_set_destructor.subscribeToText(\n\t\t\t\t\t\t\t\tis_set,\n\t\t\t\t\t\t\t\t\"subscribe_text\",\n\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\tvalue_map.set(key, is_set.properties.text);\n\t\t\t\t\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(cell.properties.is_set.state);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t} else if (column instanceof api_client_state.Cnumber__type__columns) {\n\t\tvalue_type = \"number\";\n\t\ton_property = (key, entry, destructor) => {\n\t\t\tconst cell = entry.properties.cells.get(column.parent.key_value)?.properties.type.cast(\"number\");\n\t\t\tif (cell !== undefined) {\n\t\t\t\tdestructor.subscribeToStategroup(cell.properties.is_set, (is_set_destructor) => {\n\t\t\t\t\tswitch (cell.properties.is_set.state.name) {\n\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\tvalue_map.set(key, undefined);\n\t\t\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst is_set = cell.properties.is_set.state.node;\n\t\t\t\t\t\t\tis_set_destructor.subscribeToNumber(\n\t\t\t\t\t\t\t\tis_set,\n\t\t\t\t\t\t\t\t\"subscribe_number\",\n\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\tvalue_map.set(key, is_set.properties.number.value);\n\t\t\t\t\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(cell.properties.is_set.state);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t} else if (column instanceof api_client_state.Cstate_group__type__columns) {\n\t\ton_property = (key, entry, destructor) => {\n\t\t\tconst cell = entry.properties.cells.get(column.parent.key_value)?.properties.type.cast(\"state group\");\n\t\t\tif (cell !== undefined) {\n\t\t\t\tdestructor.subscribeToStategroup(cell.properties.is_set, (is_set_destructor) => {\n\t\t\t\t\tswitch (cell.properties.is_set.state.name) {\n\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\tvalue_map.set(key, undefined);\n\t\t\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst is_set = cell.properties.is_set.state.node;\n\t\t\t\t\t\t\tis_set_destructor.subscribeToText(\n\t\t\t\t\t\t\t\tis_set,\n\t\t\t\t\t\t\t\t\"subscribe_state\",\n\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\tvalue_map.set(key, is_set.properties.state);\n\t\t\t\t\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(cell.properties.is_set.state);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t}\n\n\tconst query = column.parent.parent;\n\tdestructor.subscribeToStategroup(query.properties.has_result, (has_result_destructor) => {\n\t\tswitch (query.properties.has_result.state.name) {\n\t\t\tcase \"no\": {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"yes\": {\n\t\t\t\tconst has_result = query.properties.has_result.state.node;\n\t\t\t\ton_change = () => {\n\t\t\t\t\tcallback(sort(value_type, value_map, direction));\n\t\t\t\t};\n\t\t\t\thas_result_destructor.subscribeToCollection(\n\t\t\t\t\thas_result.properties.entries,\n\t\t\t\t\t{\n\t\t\t\t\t\ton_add: (entry, entry_destructor) => {\n\t\t\t\t\t\t\ton_property(entry.key, entry, entry_destructor);\n\t\t\t\t\t\t},\n\t\t\t\t\t\ton_remove: (key) => {\n\t\t\t\t\t\t\tvalue_map.delete(key);\n\t\t\t\t\t\t\tmicrotaskQueue.add(update);\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\ttrue\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(query.properties.has_result.state);\n\t\t}\n\t});\n}\n\nexport function sort(\n\ttype: \"text\" | \"number\",\n\tvalue_map: Map,\n\tdirection: \"ascending\" | \"descending\"\n): Sorting {\n\tlet sorting: Sorting;\n\tswitch (type) {\n\t\tcase \"text\": {\n\t\t\tsorting = [...(value_map as Map)]\n\t\t\t\t.filter((x): x is [string, string] => x[1] !== undefined)\n\t\t\t\t.sort((a, b) =>\n\t\t\t\t\ta[1].localeCompare(b[1], undefined, {\n\t\t\t\t\t\tnumeric: true,\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t\t.map((x) => x[0]);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"number\": {\n\t\t\tsorting = [...(value_map as Map)]\n\t\t\t\t.filter((x) => x[1] !== undefined)\n\t\t\t\t.sort((a, b) => a[1]! - b[1]!)\n\t\t\t\t.map((x) => x[0]);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (direction === \"descending\") {\n\t\tsorting.reverse();\n\t}\n\tconst tail = [...value_map].filter((x) => x[1] === undefined).map((x) => x[0]);\n\tsorting = sorting.concat(tail);\n\treturn sorting;\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport DestructorTree from \"../DestructorTree\";\nimport * as Text from \"../state/Text\";\nimport * as Number from \"../state/Number\";\nimport { iReference } from \"../state/Reference\";\nimport * as Rule from \"../state/Rule\";\nimport { iState, iStategroup } from \"../state/Stategroup\";\nimport * as Collection from \"../state/Collection\";\nimport {\n\tregisterText,\n\tregisterNumber,\n\tregisterFile,\n\tregisterGroup,\n\tregisterStategroup,\n\tregisterCollection,\n\tregistrationDone,\n} from \"../state/registerClientState\";\nimport {\n\tcreateExpressionBuilder,\n\tDefaultExpressionBuilder,\n\tScalar,\n\tScalarConsumer,\n\tScalarProvider,\n\tscalarValue,\n\tgetSourceOriginFromStacktrace,\n} from \"../../../../../stream\";\nimport { Pending, Unknown, Failed, Result, isResolved } from \"../Status\";\nimport { FileToken } from \"./expressions\";\n\nexport type CsProperty =\n\t| api_cs.Ctext__type__property\n\t| api_cs.Cnumber__type__property\n\t| api_cs.Cfile__type__property\n\t| api_cs.Cgroup__type__property\n\t| api_cs.Cstate_group__type__property\n\t| api_cs.Ccollection;\nexport type AppProperty =\n\t| api_app.Ctext__type__property\n\t| api_app.Cnumber__type__property\n\t| api_app.Cfile\n\t| api_app.Cgroup__type__property\n\t| api_app.Cstate_group\n\t| api_app.Ccollection__type__property;\n\nexport class Sync extends ScalarProvider> implements ScalarConsumer> {\n\tprivate _subscriber: ScalarConsumer> | undefined;\n\tprivate _value: Scalar> | undefined;\n\tprivate _destructor: DestructorTree | undefined;\n\n\tconstructor(\n\t\treadonly source: Scalar>,\n\t\tprivate readonly fn: ($: Result, destructor: DestructorTree) => Scalar>,\n\t\treadonly __origin?: string\n\t) {\n\t\tsuper();\n\t}\n\n\tget value() {\n\t\tif (this._subscriber === undefined) {\n\t\t\tconst value = scalarValue(this.source);\n\t\t\tif (isResolved(value)) {\n\t\t\t\tconst destructor = new DestructorTree();\n\t\t\t\tconst result = this.fn(scalarValue(this.source), destructor);\n\t\t\t\tdestructor.destroy();\n\t\t\t\treturn scalarValue(result);\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t} else {\n\t\t\treturn scalarValue(this._value!);\n\t\t}\n\t}\n\n\tupdate(value: Result) {\n\t\tthis._destructor?.destroy();\n\t\tthis._destructor = new DestructorTree();\n\t\tconst new_value = isResolved(value) ? this.fn(value, this._destructor) : value;\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.unsubscribe(this._subscriber!);\n\t\t}\n\t\tthis._value = new_value;\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.subscribe(this._subscriber!);\n\t\t} else {\n\t\t\tthis._subscriber!.update(this._value);\n\t\t}\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer): typeof subscriber {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tif (this.source instanceof ScalarProvider) {\n\t\t\tthis.source.subscribe(this);\n\t\t} else {\n\t\t\tthis.update(this.source);\n\t\t}\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tif (this.source instanceof ScalarProvider) {\n\t\t\tthis.source.unsubscribe(this);\n\t\t}\n\t\tif (this._value instanceof ScalarProvider) {\n\t\t\tthis._value.unsubscribe(subscriber);\n\t\t}\n\t\tthis._value = undefined;\n\t\tthis._destructor?.destroy();\n\t}\n}\n\nexport function sync(fn: (x: X, destructor: DestructorTree) => Scalar) {\n\tconst origin = (global)?.alan_debug ? getSourceOriginFromStacktrace(new Error(), 2) : undefined;\n\tconst builder = createExpressionBuilder>();\n\t(builder as any).steps.push((source: Scalar) => new Sync(source, fn, origin));\n\treturn builder as DefaultExpressionBuilder, Result>;\n}\n\nexport function property(\n\tproperty_type: api_app.Ctext__type__property\n): DefaultExpressionBuilder, Result>;\nexport function property(\n\tproperty_type: api_app.Cnumber__type__property\n): DefaultExpressionBuilder, Result>;\nexport function property(\n\tproperty_type: api_app.Cfile\n): DefaultExpressionBuilder, Result>;\nexport function property(\n\tproperty_type: api_app.Cgroup__type__property\n): DefaultExpressionBuilder, Result>;\nexport function property(\n\tproperty_type: api_app.Cstate_group\n): DefaultExpressionBuilder, Result>;\nexport function property(\n\tproperty_type: api_app.Ccollection__type__property\n): DefaultExpressionBuilder, Result>;\nexport function property(\n\tproperty_type: AppProperty\n): DefaultExpressionBuilder, Result>;\nexport function property(\n\tproperty_type: AppProperty\n): DefaultExpressionBuilder, Result> {\n\tconst $type = property_type.parent.properties.type.state;\n\tswitch ($type.name) {\n\t\tcase \"text\":\n\t\t\treturn sync((node: api_cs.Cnode, destructor) =>\n\t\t\t\tnode.destroyed ? Unknown : registerText($type.node, node, destructor)\n\t\t\t);\n\t\tcase \"number\":\n\t\t\treturn sync((node: api_cs.Cnode, destructor) =>\n\t\t\t\tnode.destroyed ? Unknown : registerNumber($type.node, node, destructor)\n\t\t\t);\n\t\tcase \"file\":\n\t\t\treturn sync((node: api_cs.Cnode, destructor) =>\n\t\t\t\tnode.destroyed ? Unknown : registerFile($type.node, node, destructor)\n\t\t\t);\n\t\tcase \"group\":\n\t\t\treturn sync((node: api_cs.Cnode, destructor) =>\n\t\t\t\tnode.destroyed ? Unknown : registerGroup($type.node, node, destructor)\n\t\t\t);\n\t\tcase \"state group\":\n\t\t\treturn sync((node: api_cs.Cnode, destructor) =>\n\t\t\t\tnode.destroyed ? Unknown : registerStategroup($type.node, node, destructor)\n\t\t\t);\n\t\tcase \"collection\":\n\t\t\treturn sync((node: api_cs.Cnode, destructor) =>\n\t\t\t\tnode.destroyed ? Unknown : registerCollection($type.node, node, destructor)\n\t\t\t);\n\t}\n}\n\nexport function groupNode(\n\tgroup_type: api_app.Cgroup__type__property\n): DefaultExpressionBuilder, Result> {\n\treturn property(group_type).pipe(sync((group) => group.properties.node));\n}\n\nexport function state(\n\tdef: api_app.Cstates__state_group\n): DefaultExpressionBuilder, Result> {\n\treturn sync((stategroup) => {\n\t\tconst state = stategroup.properties.states.get(def.key_value)!;\n\t\treturn registrationDone(stategroup, () => iState(state).is_selected)();\n\t});\n}\n\nexport function selectedState(\n\tdef: api_app.Cstate_group\n): DefaultExpressionBuilder, Result> {\n\treturn property(def).pipe(\n\t\tsync((stategroup) => registrationDone(stategroup, () => iStategroup(stategroup).selected_state)())\n\t);\n}\n\nexport function parent(): DefaultExpressionBuilder, Result> {\n\treturn sync((node: api_cs.Cnode) => node.input.position().input.parent().cast(\"node\"));\n}\n\nexport function reference(\n\tdef: api_app.Cyes__has_reference\n): DefaultExpressionBuilder, Result> {\n\treturn property(def.parent).pipe(sync((text) => iReference(text.properties.navigable.cast(\"yes\")).referencedNode));\n}\n\nexport function textValue(\n\tdef: api_app.Ctext__type__property\n): DefaultExpressionBuilder, Result> {\n\treturn property(def).pipe(sync((text) => registrationDone(text, () => Text.value(text))()));\n}\n\nexport function numberValue(\n\tdef: api_app.Cnumber__type__property\n): DefaultExpressionBuilder, Result> {\n\treturn property(def).pipe(sync((number) => registrationDone(number, () => Number.value(number))()));\n}\n\nexport function fileValue(def: api_app.Cfile): DefaultExpressionBuilder, Result> {\n\treturn property(def).pipe(\n\t\tsync((file) =>\n\t\t\tregistrationDone(file, () => {\n\t\t\t\tswitch (file.properties.is_set.state.name) {\n\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\treturn Failed;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst yes_is_set = file.properties.is_set.state.node;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttoken: yes_is_set.properties.token,\n\t\t\t\t\t\t\textension: yes_is_set.properties.extension,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})()\n\t\t)\n\t);\n}\n\nexport function rule(def: api_app.Crules): DefaultExpressionBuilder, Result> {\n\tconst $definer = def.parent.input.definer().variant;\n\tswitch ($definer.name) {\n\t\tcase \"text\":\n\t\t\treturn property($definer.definition.parent).pipe(\n\t\t\t\tsync((text) => Rule.node(text.properties.navigable.cast(\"yes\").properties.rules.properties.rules.get(def.key)!))\n\t\t\t);\n\t\tcase \"state\":\n\t\t\treturn sync((node: api_cs.Cnode) =>\n\t\t\t\tRule.node(node.input.position().cast(\"state\").properties.rules.properties.rules.get(def.key)!)\n\t\t\t);\n\t}\n}\n\nexport function entry(\n\tkey: Scalar>\n): DefaultExpressionBuilder, Result> {\n\treturn createExpressionBuilder>()\n\t\t.and(key)\n\t\t.pipe(([collection, key]) => {\n\t\t\tif (collection === Failed || key === Failed) {\n\t\t\t\treturn Failed;\n\t\t\t} else if (collection === Unknown || key === Unknown) {\n\t\t\t\treturn Unknown;\n\t\t\t} else if (collection === Pending || key === Pending) {\n\t\t\t\treturn Pending;\n\t\t\t} else {\n\t\t\t\treturn [collection, key] as Result<[api_cs.Ccollection, string]>;\n\t\t\t}\n\t\t})\n\t\t.pipe(\n\t\t\tsync(([collection, key]: [api_cs.Ccollection, string], destructor) =>\n\t\t\t\tCollection.openEntry(collection, key, destructor).pipe(sync((entry) => entry.properties.node))()\n\t\t\t)\n\t\t);\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_cr = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_reply.alan_api;\nimport { serializeNumber, getDecimalsFromNumericalTypeProperties } from \"../state 2 interface/serializeNumber\";\nimport reQuery = require(\"../state 2 interface/reQuery\");\nimport SubscriptionBuilder from \"../state 2 interface/SubscriptionBuilder\";\nimport * as mapToIdPathBuilder from \"../state/mapToIdPathBuilder\";\nimport { IdPathBuilder } from \"../navigation/IdPathBuilder\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport DestructorTree from \"../DestructorTree\";\nimport * as Cell from \"../state/Cell\";\nimport { getTranslation } from \"./phrases\";\nimport { entryPermissionChecked } from \"../state 2 interface/permissions\";\n\nfunction walkNodePath(\n\tpath: api_views.Cnode_path,\n\ton_great_succes: (build: () => SubscriptionBuilder, column_lookup: string[]) => void,\n\tbuild: () => SubscriptionBuilder,\n\tcolumn_lookup: string[]\n): void {\n\tpath.properties.has_steps.switch({\n\t\tno: () => {\n\t\t\ton_great_succes(build, column_lookup);\n\t\t},\n\t\tyes: ($) => {\n\t\t\tconst tail = $.properties.tail;\n\t\t\t$.properties.type.switch({\n\t\t\t\tparent: undefined,\n\t\t\t\tgroup: ($) => {\n\t\t\t\t\tconst group_name = $.properties.group.ref.parent.parent.key.ref.key;\n\t\t\t\t\twalkNodePath(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\ton_great_succes,\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tconst subscription_builder = build();\n\t\t\t\t\t\t\treturn subscription_builder.group(group_name);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcolumn_lookup.concat(group_name)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\treference: undefined,\n\t\t\t\t\"reference rule\": undefined,\n\t\t\t\t\"state rule\": undefined,\n\t\t\t\tstate: ($) => {\n\t\t\t\t\tconst state_group_name = $.properties.state_group.ref.parent.parent.key.ref.key;\n\t\t\t\t\tconst state_name = $.properties.state.ref.key.ref.key;\n\t\t\t\t\treturn walkNodePath(\n\t\t\t\t\t\ttail,\n\t\t\t\t\t\ton_great_succes,\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tconst subscription_builder = build();\n\t\t\t\t\t\t\treturn subscription_builder.state(\n\t\t\t\t\t\t\t\tstate_group_name,\n\t\t\t\t\t\t\t\tstate_name,\n\t\t\t\t\t\t\t\t$.properties.state_group.ref.inferences.state_group()\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcolumn_lookup.concat([state_group_name, state_name])\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t\"collection entry\": undefined,\n\t\t\t});\n\t\t},\n\t});\n}\n\ntype ColumnLookup = {\n\tproperties: Map;\n\tcolumns: string[];\n};\n\nfunction AddColumnToLookup(current_lookup: ColumnLookup, column: string, column_properties: string[]) {\n\tfor (let i = 0; i < column_properties.length; i++) {\n\t\tconst column_property = column_properties[i];\n\t\tif (!current_lookup.properties.has(column_property)) {\n\t\t\tcurrent_lookup.properties.set(column_property, { properties: new Map(), columns: [] });\n\t\t}\n\t\tcurrent_lookup = current_lookup.properties.get(column_property)!;\n\t}\n\tcurrent_lookup.columns.push(column);\n\treturn current_lookup;\n}\n\nfunction setToIsSetNo(column_lookup: ColumnLookup, entry: api_cs.Centries__yes__has_result) {\n\tfor (const prop of column_lookup.properties.values()) {\n\t\tsetToIsSetNo(prop, entry);\n\t}\n\tcolumn_lookup.columns.forEach(function (column_name) {\n\t\tconst cell = entry.properties.cells.get(column_name)!;\n\t\tcell.properties.type.switch({\n\t\t\tfile: function ($) {\n\t\t\t\t$.properties.is_set.set(\"no\", {});\n\t\t\t},\n\t\t\tnumber: function ($) {\n\t\t\t\t$.properties.is_set.set(\"no\", {});\n\t\t\t},\n\t\t\t\"state group\": function ($) {\n\t\t\t\t$.properties.is_set.set(\"no\", {});\n\t\t\t},\n\t\t\ttext: function ($) {\n\t\t\t\t$.properties.is_set.set(\"no\", {});\n\t\t\t},\n\t\t\twidget: undefined,\n\t\t});\n\t});\n}\n\nfunction updateEntryBasedOnInitializationData(\n\tinitializationData: api_cr.Csubscription_result_data,\n\tentry: api_cs.Centries__yes__has_result,\n\tcolumn_lookup: ColumnLookup\n) {\n\tswitch (initializationData.properties.read_permitted.state.name) {\n\t\tcase \"no\":\n\t\t\tsetToIsSetNo(column_lookup, entry);\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst $ = initializationData.properties.read_permitted.state.node;\n\t\t\tfor (const [attribute_name, read_permitted] of $.properties.attributes) {\n\t\t\t\tswitch (read_permitted.properties.type.state.name) {\n\t\t\t\t\tcase \"command\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"property\": {\n\t\t\t\t\t\tconst property = read_permitted.properties.type.state.node;\n\t\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tfor (const column_name of column_lookup.properties.get(attribute_name)!.columns) {\n\t\t\t\t\t\t\t\t\tconst cell = entry.properties.cells.get(column_name)!.properties.type.cast(\"text\");\n\t\t\t\t\t\t\t\t\tconst text_value = $.properties.value;\n\t\t\t\t\t\t\t\t\tcell.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\tno: function () {\n\t\t\t\t\t\t\t\t\t\t\tcell.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\t\t\ttext: text_value,\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: function ($) {\n\t\t\t\t\t\t\t\t\t\t\t$.set_text(text_value);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tfor (const column_name of column_lookup.properties.get(attribute_name)!.columns) {\n\t\t\t\t\t\t\t\t\tconst cell = entry.properties.cells.get(column_name)!.properties.type.cast(\"number\");\n\t\t\t\t\t\t\t\t\tconst number_value = $.properties.value;\n\t\t\t\t\t\t\t\t\tcell.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\tnumber: number_value.value,\n\t\t\t\t\t\t\t\t\t\t\"textual representation\": serializeNumber(\n\t\t\t\t\t\t\t\t\t\t\tnumber_value.value,\n\t\t\t\t\t\t\t\t\t\t\tgetDecimalsFromNumericalTypeProperties(cell.properties.numerical_type_properties),\n\t\t\t\t\t\t\t\t\t\t\tcell.inferences.column_type().inferences.number_type().properties.number.ref.properties\n\t\t\t\t\t\t\t\t\t\t\t\t.numerical_type.ref.key.ref\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tfor (const column_name of column_lookup.properties.get(attribute_name)!.columns) {\n\t\t\t\t\t\t\t\t\tconst cell = entry.properties.cells.get(column_name)!.properties.type.cast(\"file\");\n\t\t\t\t\t\t\t\t\tcell.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\ttoken: $.properties.token,\n\t\t\t\t\t\t\t\t\t\textension: $.properties.extension,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tupdateEntryBasedOnInitializationData(\n\t\t\t\t\t\t\t\t\t$.properties.node_data,\n\t\t\t\t\t\t\t\t\tentry,\n\t\t\t\t\t\t\t\t\tcolumn_lookup.properties.get(attribute_name)!\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t\t\tconst state_name = $.properties.state.entry;\n\t\t\t\t\t\t\t\tfor (const column_name of column_lookup.properties.get(attribute_name)!.columns) {\n\t\t\t\t\t\t\t\t\tconst cell = entry.properties.cells.get(column_name)!.properties.type.cast(\"state group\");\n\t\t\t\t\t\t\t\t\tCell.updateStategroup(cell, getTranslation(state_name));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tupdateEntryBasedOnInitializationData(\n\t\t\t\t\t\t\t\t\t$.properties.node_data,\n\t\t\t\t\t\t\t\t\tentry,\n\t\t\t\t\t\t\t\t\tcolumn_lookup.properties.get(attribute_name)!.properties.get(state_name)!\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(read_permitted.properties.type.state);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(initializationData.properties.read_permitted.state);\n\t}\n}\n\nfunction updateEntryBasedOnNotificationData(\n\tnotificationData: api_cr.Cnotification_data,\n\tentry: api_cs.Centries__yes__has_result,\n\tcolumn_lookup: ColumnLookup\n) {\n\tnotificationData.properties.properties.forEach(function ($) {\n\t\tconst property_name = $.key_value;\n\t\t$.properties.type.switch({\n\t\t\tcollection: undefined,\n\t\t\tfile: function ($) {\n\t\t\t\tcolumn_lookup.properties.get(property_name)!.columns.forEach(function (column_name) {\n\t\t\t\t\tconst cell = entry.properties.cells.get(column_name)!.properties.type.cast(\"file\");\n\t\t\t\t\tcell.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\ttoken: $.properties.token,\n\t\t\t\t\t\textension: $.properties.extension,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tgroup: function ($) {\n\t\t\t\tupdateEntryBasedOnNotificationData(\n\t\t\t\t\t$.properties.notification_data,\n\t\t\t\t\tentry,\n\t\t\t\t\tcolumn_lookup.properties.get(property_name)!\n\t\t\t\t);\n\t\t\t},\n\t\t\tnumber: function ($) {\n\t\t\t\tcolumn_lookup.properties.get(property_name)!.columns.forEach(function (column_name) {\n\t\t\t\t\tconst cell = entry.properties.cells.get(column_name)!.properties.type.cast(\"number\");\n\t\t\t\t\tconst number_value = $.properties.value.value;\n\t\t\t\t\tcell.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\tnumber: number_value,\n\t\t\t\t\t\t\"textual representation\": serializeNumber(\n\t\t\t\t\t\t\tnumber_value,\n\t\t\t\t\t\t\tgetDecimalsFromNumericalTypeProperties(cell.properties.numerical_type_properties),\n\t\t\t\t\t\t\tcell.inferences.column_type().inferences.number_type().properties.number.ref.properties.numerical_type.ref\n\t\t\t\t\t\t\t\t.key.ref\n\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"state group\": function ($) {\n\t\t\t\tconst state_name = $.properties.state.ref.key.ref.key;\n\t\t\t\tcolumn_lookup.properties.get(property_name)!.columns.forEach(function (column_name) {\n\t\t\t\t\tconst cell = entry.properties.cells.get(column_name)!.properties.type.cast(\"state group\");\n\t\t\t\t\tCell.updateStategroup(cell, getTranslation(state_name));\n\t\t\t\t});\n\t\t\t\tfor (const [name, state] of column_lookup.properties.get(property_name)!.properties) {\n\t\t\t\t\tif (name !== state_name) {\n\t\t\t\t\t\tsetToIsSetNo(state, entry);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$.properties.type.switch({\n\t\t\t\t\tset: function ($) {\n\t\t\t\t\t\tupdateEntryBasedOnInitializationData(\n\t\t\t\t\t\t\t$.properties.initialization_data,\n\t\t\t\t\t\t\tentry,\n\t\t\t\t\t\t\tcolumn_lookup.properties.get(property_name)!.properties.get(state_name)!\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\tupdate: function ($) {\n\t\t\t\t\t\tupdateEntryBasedOnNotificationData(\n\t\t\t\t\t\t\t$.properties.notification_data,\n\t\t\t\t\t\t\tentry,\n\t\t\t\t\t\t\tcolumn_lookup.properties.get(property_name)!.properties.get(state_name)!\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t\ttext: function ($) {\n\t\t\t\tcolumn_lookup.properties.get(property_name)!.columns.forEach(function (column_name) {\n\t\t\t\t\t$.properties.value_update.switch({\n\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\tconst cell = entry.properties.cells.get(column_name)!.properties.type.cast(\"text\");\n\t\t\t\t\t\t\tconst text_value = $.properties.value;\n\t\t\t\t\t\t\tcell.properties.is_set.switch({\n\t\t\t\t\t\t\t\tno: function () {\n\t\t\t\t\t\t\t\t\tcell.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\t\t\t\t\ttext: text_value,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tyes: function ($) {\n\t\t\t\t\t\t\t\t\t$.set_text(text_value);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t});\n}\n\nexport default function (entry: api_cs.Centries__yes__has_result, destructor: DestructorTree): void {\n\tconst query = entry.parent.parent;\n\tlet id_path: IdPathBuilder | undefined;\n\tconst initialized = entry.properties.entry_status.properties.initialized.state;\n\tswitch (initialized.name) {\n\t\tcase \"no\":\n\t\t\tid_path = mapToIdPathBuilder.fromClientState(initialized.node.properties.referenced_node);\n\t\t\tbreak;\n\t\tcase \"yes\":\n\t\t\tid_path = createIdPathBuilderFromNode(initialized.node.properties.referenced_node.output.result_node());\n\t\t\tbreak;\n\t\tcase \"unknown\":\n\t}\n\tif (id_path === undefined) return;\n\tconst subscriptionBuilder = SubscriptionBuilder.create();\n\tconst column_lookup: ColumnLookup = { properties: new Map(), columns: [] };\n\tquery.properties.definition.ref.properties.columns.forEach(($) => {\n\t\tconst column_name = $.key;\n\t\t//Only add subscriptions to cells that do not contain out of context steps (like collection parent)\n\t\twalkNodePath(\n\t\t\t$.properties.path,\n\t\t\t(builder, column_properties) => {\n\t\t\t\t$.properties.type.switch({\n\t\t\t\t\tfile: ($) => {\n\t\t\t\t\t\tconst attribute = $.properties.file.entry;\n\t\t\t\t\t\tAddColumnToLookup(column_lookup, column_name, column_properties.concat(attribute));\n\t\t\t\t\t\tbuilder().file(attribute);\n\t\t\t\t\t},\n\t\t\t\t\tnumber: ($) => {\n\t\t\t\t\t\tconst attribute = $.properties.number.entry;\n\t\t\t\t\t\tAddColumnToLookup(column_lookup, column_name, column_properties.concat(attribute));\n\t\t\t\t\t\tbuilder().number(attribute);\n\t\t\t\t\t},\n\t\t\t\t\t\"state group\": ($) => {\n\t\t\t\t\t\tconst attribute = $.properties.state_group.entry;\n\t\t\t\t\t\tconst state_group_lookup = AddColumnToLookup(\n\t\t\t\t\t\t\tcolumn_lookup,\n\t\t\t\t\t\t\tcolumn_name,\n\t\t\t\t\t\t\tcolumn_properties.concat(attribute)\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$.properties.state_group.ref.properties.states.forEach((state) => {\n\t\t\t\t\t\t\tif (!state_group_lookup.properties.has(state.key.entry)) {\n\t\t\t\t\t\t\t\tstate_group_lookup.properties.set(state.key.entry, { properties: new Map(), columns: [] });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbuilder().state_group(attribute, $.properties.state_group.ref.inferences.state_group());\n\t\t\t\t\t},\n\t\t\t\t\ttext: ($) => {\n\t\t\t\t\t\tconst attribute_name = $.properties.text.entry;\n\t\t\t\t\t\tAddColumnToLookup(column_lookup, column_name, column_properties.concat(attribute_name));\n\t\t\t\t\t\t$.properties.text.ref.properties.navigable.switch({\n\t\t\t\t\t\t\tno: () => builder().text(attribute_name),\n\t\t\t\t\t\t\tyes: () => builder().constrained_text(attribute_name),\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\twidget: undefined,\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => subscriptionBuilder,\n\t\t\t[]\n\t\t);\n\t});\n\tif (shouldSubscribeEntry(entry)) {\n\t\tentryPermissionChecked(entry);\n\t\tconst datastore_subscription = DatastoreProxy.instance.subscribe(\n\t\t\t{\n\t\t\t\t\"context node\": id_path.build(),\n\t\t\t\t\"node subscription\": {\n\t\t\t\t\tattributes: subscriptionBuilder.properties,\n\t\t\t\t},\n\t\t\t\t\"mutation permissions\": [\"include\", {}],\n\t\t\t},\n\t\t\t(result) => {\n\t\t\t\tif (entry.destroyed) {\n\t\t\t\t\tdatastore_subscription.unsubscribe();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tresult.properties.context.switch({\n\t\t\t\t\t\"does not exist\": () => entry.properties.is_editable.set(\"no\", {}),\n\t\t\t\t\texists: ($) =>\n\t\t\t\t\t\t$.properties.delete_permitted.properties.permitted.switch({\n\t\t\t\t\t\t\tno: () => entry.properties.is_editable.set(\"no\", {}),\n\t\t\t\t\t\t\tyes: () => entry.properties.is_editable.set(\"yes\", {}),\n\t\t\t\t\t\t}),\n\t\t\t\t\t\"permission denied\": () => entry.properties.is_editable.set(\"no\", {}),\n\t\t\t\t});\n\t\t\t},\n\t\t\tfunction (subscription_notification) {\n\t\t\t\tif (entry.destroyed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsubscription_notification.properties.context.switch({\n\t\t\t\t\texists: function ($) {\n\t\t\t\t\t\tconst notificationData = $.properties.notification_data;\n\t\t\t\t\t\tupdateEntryBasedOnNotificationData(notificationData, entry, column_lookup);\n\t\t\t\t\t},\n\t\t\t\t\t\"permission denied\": undefined,\n\t\t\t\t\t\"does not exist\": () => reQuery.query(query),\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t\tdestructor.onDestroy(() => datastore_subscription.unsubscribe());\n\t}\n}\n\nfunction shouldSubscribeEntry(entry: api_cs.Centries__yes__has_result) {\n\tif ((entry.component_root as any)._refresh_interval === true) {\n\t\treturn false;\n\t}\n\tswitch (entry.properties.entry_status.properties.initialized.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst intialized = entry.properties.entry_status.properties.initialized.state.node;\n\t\t\tconst node = intialized.properties.referenced_node.output.result_node();\n\t\t\tswitch (node.input.location().variant.name) {\n\t\t\t\tcase \"local\":\n\t\t\t\t\treturn false;\n\t\t\t\tcase \"remote\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"unknown\":\n\t\t\tbreak;\n\t}\n\treturn true;\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { createExpressionBuilder, ScalarProvider, WeakCache, createVariable } from \"../../../../../stream\";\nimport { toStream } from \"../toStream\";\nimport { iText } from \"../state/Text\";\nimport { iCollection } from \"../state/Collection\";\n\nconst numberModified = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.is_editable).stateSwitch({\n\t\t\tyes: ($) =>\n\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: () => true,\n\t\t\t\t})(),\n\t\t\tno: () => false,\n\t\t})(),\n\t\tfalse\n\t)\n);\nconst fileModified = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.is_editable).stateSwitch({\n\t\t\tyes: ($) =>\n\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: () => true,\n\t\t\t\t})(),\n\t\t\tno: () => false,\n\t\t})(),\n\t\tfalse\n\t)\n);\nconst stategroupModified = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.is_modified)\n\t\t\t.stateSwitch({\n\t\t\t\tyes: () => true,\n\t\t\t\tno: () => false,\n\t\t\t})\n\t\t\t.and(\n\t\t\t\ttoStream(property.properties.is_set).stateSwitch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: ($) => nodeModified($.properties.state.ref.properties.node),\n\t\t\t\t})()\n\t\t\t)\n\t\t\t.pipe(([stategroup_modified, state_modified]) => stategroup_modified || state_modified)(),\n\t\tfalse\n\t)\n);\nconst anyEntryModified = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.entries)\n\t\t\t.map(([, entry]) =>\n\t\t\t\ttoStream(entry.properties.location).stateSwitch({\n\t\t\t\t\tlocal: () => nodeModified(entry.properties.node),\n\t\t\t\t\tremote: ($) =>\n\t\t\t\t\t\ttoStream($.properties.marked_for_deletion).stateSwitch({\n\t\t\t\t\t\t\tno: () => nodeModified(entry.properties.node),\n\t\t\t\t\t\t\tyes: () => false,\n\t\t\t\t\t\t})(),\n\t\t\t\t})()\n\t\t\t)\n\t\t\t.reduce((acc, $) => acc || $, false)(),\n\t\tfalse\n\t)\n);\n\nexport const nodeModified: (node: api_cs.Cnode) => ScalarProvider = WeakCache<\n\tapi_cs.Cnode,\n\tScalarProvider\n>((node) =>\n\tcreateVariable(\n\t\ttoStream(node.properties.attributes)\n\t\t\t.map(([, attribute]) => {\n\t\t\t\tconst attribute_type = attribute.properties.type.state;\n\t\t\t\tswitch (attribute_type.name) {\n\t\t\t\t\tcase \"operation\":\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tcase \"property\": {\n\t\t\t\t\t\tconst property_type = attribute_type.node.properties.type.state;\n\t\t\t\t\t\tswitch (\n\t\t\t\t\t\t\tattribute_type.node.inferences.property_type().properties.type.state.node.output.value_source().variant\n\t\t\t\t\t\t\t\t.name\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\tcase \"base\": {\n\t\t\t\t\t\t\t\tswitch (property_type.name) {\n\t\t\t\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\t\t\t\treturn iText(property_type.node).modified;\n\t\t\t\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\t\t\t\treturn numberModified(property_type.node);\n\t\t\t\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\t\t\t\treturn fileModified(property_type.node);\n\t\t\t\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\t\t\t\treturn nodeModified(property_type.node.properties.node);\n\t\t\t\t\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\t\t\t\t\treturn stategroupModified(property_type.node);\n\t\t\t\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\t\t\t\tconst size =\n\t\t\t\t\t\t\t\t\t\t\tproperty_type.node.inferences.collection_type().properties.ui.properties.size.state.name;\n\t\t\t\t\t\t\t\t\t\treturn createExpressionBuilder(iCollection(property_type.node).modified)\n\t\t\t\t\t\t\t\t\t\t\t.and(anyEntryModified(property_type.node))\n\t\t\t\t\t\t\t\t\t\t\t.pipe(([collection_modified, any_entry_modified]) => {\n\t\t\t\t\t\t\t\t\t\t\t\tswitch (size) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"small\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn collection_modified || any_entry_modified;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"large\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t})();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t.reduce((acc, $) => acc || $, false)\n\t\t\t.pipe((modified) => {\n\t\t\t\tnode.properties.modified.ensure(modified ? \"yes\" : \"no\", {});\n\t\t\t\treturn modified;\n\t\t\t})(),\n\t\tfalse\n\t)\n);\n\n// const anyChangesOnStategroup = WeakCache>((property) => {\n// \treturn createVariable(\n// \t\ttoStream(property.properties.is_modified)\n// \t\t\t.stateSwitch({\n// \t\t\t\tyes: () => true,\n// \t\t\t\tno: () => false,\n// \t\t\t})\n// \t\t\t.and(\n// \t\t\t\ttoStream(property.properties.is_set).stateSwitch({\n// \t\t\t\t\tno: () => false,\n// \t\t\t\t\tyes: ($) => anyChangesOnNode($.properties.state.ref.properties.node),\n// \t\t\t\t})()\n// \t\t\t)\n// \t\t\t.pipe(([stategroup_modified, state_modified]) => stategroup_modified || state_modified)(),\n// \t\tfalse\n// \t);\n// });\n// const anyChangesOnEntries = WeakCache>((property) => {\n// \treturn createVariable(\n// \t\ttoStream(property.properties.entries)\n// \t\t\t.map(([, entry]) =>\n// \t\t\t\tcreateExpressionBuilder(anyChangesOnNode(entry.properties.node)).pipe((any_changes) =>\n// \t\t\t\t\ttoStream(entry.properties.location).stateSwitch({\n// \t\t\t\t\t\tlocal: () => false,\n// \t\t\t\t\t\tremote: ($) =>\n// \t\t\t\t\t\t\ttoStream($.properties.marked_for_deletion).stateSwitch({\n// \t\t\t\t\t\t\t\tno: () => any_changes,\n// \t\t\t\t\t\t\t\tyes: () => false,\n// \t\t\t\t\t\t\t})(),\n// \t\t\t\t\t})()\n// \t\t\t\t)()\n// \t\t\t)\n// \t\t\t.reduce((acc, $) => acc || $, false)(),\n// \t\tfalse\n// \t);\n// });\n// export const anyChangesOnNode: (node: api_cs.Cnode) => ScalarProvider = WeakCache<\n// \tapi_cs.Cnode,\n// \tScalarProvider\n// >((node) => {\n// \treturn createVariable(\n// \t\ttoStream(node.properties.attributes)\n// \t\t\t.map(([, attribute]) => {\n// \t\t\t\tconst attribute_type = attribute.properties.type.state;\n// \t\t\t\tswitch (attribute_type.name) {\n// \t\t\t\t\tcase \"operation\":\n// \t\t\t\t\t\treturn false;\n// \t\t\t\t\tcase \"property\": {\n// \t\t\t\t\t\tconst property_type = attribute_type.node.properties.type.state;\n// \t\t\t\t\t\tswitch (\n// \t\t\t\t\t\t\tattribute_type.node.inferences.property_type().properties.type.state.node.output.value_source().variant\n// \t\t\t\t\t\t\t\t.name\n// \t\t\t\t\t\t) {\n// \t\t\t\t\t\t\tcase \"derived\":\n// \t\t\t\t\t\t\t\treturn false;\n// \t\t\t\t\t\t\tcase \"base\": {\n// \t\t\t\t\t\t\t\tswitch (property_type.name) {\n// \t\t\t\t\t\t\t\t\tcase \"text\":\n// \t\t\t\t\t\t\t\t\t\treturn textModified(property_type.node);\n// \t\t\t\t\t\t\t\t\tcase \"number\":\n// \t\t\t\t\t\t\t\t\t\treturn numberModified(property_type.node);\n// \t\t\t\t\t\t\t\t\tcase \"file\":\n// \t\t\t\t\t\t\t\t\t\treturn fileModified(property_type.node);\n// \t\t\t\t\t\t\t\t\tcase \"group\":\n// \t\t\t\t\t\t\t\t\t\treturn anyChangesOnNode(property_type.node.properties.node);\n// \t\t\t\t\t\t\t\t\tcase \"state group\":\n// \t\t\t\t\t\t\t\t\t\treturn anyChangesOnStategroup(property_type.node);\n// \t\t\t\t\t\t\t\t\tcase \"collection\":\n// \t\t\t\t\t\t\t\t\t\treturn createExpressionBuilder(collectionModified(property_type.node))\n// \t\t\t\t\t\t\t\t\t\t\t.and(anyChangesOnEntries(property_type.node))\n// \t\t\t\t\t\t\t\t\t\t\t.pipe(\n// \t\t\t\t\t\t\t\t\t\t\t\t([collection_modified, any_changes_on_entries]) => collection_modified || any_changes_on_entries\n// \t\t\t\t\t\t\t\t\t\t\t)();\n// \t\t\t\t\t\t\t\t}\n// \t\t\t\t\t\t\t\tbreak;\n// \t\t\t\t\t\t\t}\n// \t\t\t\t\t\t}\n// \t\t\t\t\t}\n// \t\t\t\t}\n// \t\t\t})\n// \t\t\t.reduce((acc, $) => acc || $, false)(),\n// \t\tfalse\n// \t);\n// });\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { iEntry } from \"../state/Entry\";\nimport { iReference } from \"../state/Reference\";\nimport * as Rule from \"../state/Rule\";\nimport * as Status from \"../Status\";\nimport { toStream, toVariable } from \"../toStream\";\nimport { Scalar, ScalarProvider, WeakCache, createVariable, createExpressionBuilder } from \"../../../../../stream\";\nimport { validateText, getFileExtensionValidationPattern, getTextValidationPattern } from \"../state/textValidation\";\nimport { getUpperLimit, getLowerLimit, mustBePositive } from \"../state/numberLimit\";\nimport { iCollection } from \"../state/Collection\";\n\nexport const Indirect = Symbol.for(\"indirect\");\nexport type Indirect = typeof Indirect;\n\nconst ruleValid = WeakCache>((rule) => {\n\tif (!Rule.isMandatory(rule)) return true;\n\treturn createVariable(\n\t\tcreateExpressionBuilder(Rule.synchronized(rule)).pipe((synchronized) => {\n\t\t\tswitch (synchronized) {\n\t\t\t\tcase Status.Pending:\n\t\t\t\tcase Status.Unknown:\n\t\t\t\tcase \"yes\":\n\t\t\t\t\trule.properties.is_valid.ensure(\"yes\", {});\n\t\t\t\t\treturn true;\n\t\t\t\tcase Status.Failed:\n\t\t\t\t\treturn createExpressionBuilder(Rule.node(rule)).pipe((node) => {\n\t\t\t\t\t\tif (Status.isResolved(node)) {\n\t\t\t\t\t\t\trule.properties.is_valid.ensure(\"yes\", {});\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trule.properties.is_valid.ensure(\"no\", {});\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t})();\n\t\t\t}\n\t\t})(),\n\t\tfalse\n\t);\n});\nconst rulesValid = WeakCache>((rules) =>\n\tcreateVariable(\n\t\ttoStream(rules.properties.rules)\n\t\t\t.map(([, rule]) => ruleValid(rule))\n\t\t\t.reduce((rules_valid, rule_valid) => rules_valid && rule_valid, true)(),\n\t\tfalse\n\t)\n);\n\nconst textDoesNotMatchPattern = WeakCache>((property) => {\n\tconst validation_pattern = getTextValidationPattern(property);\n\tif (!validation_pattern) return false;\n\treturn createVariable(\n\t\ttoStream(property.properties.is_editable).stateSwitch({\n\t\t\tyes: ($) =>\n\t\t\t\ttoStream(property.component_root.properties.location).stateSwitch({\n\t\t\t\t\tremote: () =>\n\t\t\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\tyes: ($) => toStream($, \"value\").pipe((value) => !validateText(value, validation_pattern))(),\n\t\t\t\t\t\t})(),\n\t\t\t\t\tlocal: () =>\n\t\t\t\t\t\ttoStream(property.properties.is_set)\n\t\t\t\t\t\t\t.stateSwitch({\n\t\t\t\t\t\t\t\tno: () => \"\",\n\t\t\t\t\t\t\t\tyes: ($) => toVariable($, \"text\"),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.pipe((value) => !validateText(value, validation_pattern))(),\n\t\t\t\t})(),\n\t\t\tno: () => false,\n\t\t})(),\n\t\tfalse\n\t);\n});\nconst textKeyIsNotUnique = WeakCache>((property) => {\n\tconst is_key = property.properties.is_key.state;\n\tswitch (is_key.name) {\n\t\tcase \"no\":\n\t\t\treturn false;\n\t\tcase \"yes\":\n\t\t\treturn createVariable(\n\t\t\t\tcreateExpressionBuilder(iEntry(is_key.node.inferences.entry()).keyUnique).pipe((unique) =>\n\t\t\t\t\tunique === \"no\" ? true : false\n\t\t\t\t)(),\n\t\t\t\tfalse\n\t\t\t);\n\t}\n});\nconst textReferenceIsResolved = WeakCache>((property) => {\n\tconst navigable = property.properties.navigable.state;\n\tswitch (navigable.name) {\n\t\tcase \"no\":\n\t\t\treturn true;\n\t\tcase \"yes\":\n\t\t\tif (!iReference(navigable.node).isMandatory) return true;\n\t\t\treturn createVariable(\n\t\t\t\tcreateExpressionBuilder(iReference(navigable.node).synchronized).pipe((synchronized) => {\n\t\t\t\t\tswitch (synchronized) {\n\t\t\t\t\t\tcase Status.Pending:\n\t\t\t\t\t\tcase Status.Unknown:\n\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\tcase Status.Failed:\n\t\t\t\t\t\t\treturn createExpressionBuilder(iReference(navigable.node).expression).pipe((node) =>\n\t\t\t\t\t\t\t\tStatus.isResolved(node)\n\t\t\t\t\t\t\t)();\n\t\t\t\t\t}\n\t\t\t\t})(),\n\t\t\t\tfalse\n\t\t\t);\n\t}\n});\nconst textReferencedNodeValid = WeakCache>((property) => {\n\tconst navigable = property.properties.navigable.state;\n\tswitch (navigable.name) {\n\t\tcase \"no\":\n\t\t\treturn true;\n\t\tcase \"yes\":\n\t\t\tif (!iReference(navigable.node).isMandatory) return true;\n\t\t\treturn createVariable(\n\t\t\t\tcreateExpressionBuilder(iReference(navigable.node).synchronized).pipe((synchronized) => {\n\t\t\t\t\tswitch (synchronized) {\n\t\t\t\t\t\tcase Status.Pending:\n\t\t\t\t\t\tcase Status.Unknown:\n\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\tcase Status.Failed:\n\t\t\t\t\t\t\treturn createExpressionBuilder(iReference(navigable.node).referencedEntry).pipe((entry) => {\n\t\t\t\t\t\t\t\tif (!Status.isResolved(entry)) return true;\n\t\t\t\t\t\t\t\treturn toStream(entry.properties.location).stateSwitch({\n\t\t\t\t\t\t\t\t\tlocal: () =>\n\t\t\t\t\t\t\t\t\t\tcreateExpressionBuilder(nodeValid(entry.properties.node)).pipe((valid) =>\n\t\t\t\t\t\t\t\t\t\t\tvalid === false ? false : true\n\t\t\t\t\t\t\t\t\t\t)(),\n\t\t\t\t\t\t\t\t\tremote: () => true,\n\t\t\t\t\t\t\t\t})();\n\t\t\t\t\t\t\t})();\n\t\t\t\t\t}\n\t\t\t\t})(),\n\t\t\t\tfalse\n\t\t\t);\n\t}\n});\nconst textRulesValid = WeakCache>((property) => {\n\tconst navigable = property.properties.navigable.state;\n\tswitch (navigable.name) {\n\t\tcase \"no\":\n\t\t\treturn true;\n\t\tcase \"yes\":\n\t\t\treturn createVariable(createExpressionBuilder(rulesValid(navigable.node.properties.rules))(), false);\n\t}\n});\nconst textValid = WeakCache>((property) =>\n\tcreateVariable(\n\t\tcreateExpressionBuilder(textDoesNotMatchPattern(property))\n\t\t\t.and(textKeyIsNotUnique(property))\n\t\t\t.and(textReferenceIsResolved(property))\n\t\t\t.and(textReferencedNodeValid(property))\n\t\t\t.and(textRulesValid(property))\n\t\t\t.pipe(\n\t\t\t\t([\n\t\t\t\t\t[[[text_does_not_match_pattern, key_is_not_unique], reference_is_resolved], referenced_node_valid],\n\t\t\t\t\trules_valid,\n\t\t\t\t]) => {\n\t\t\t\t\tconst direct_invalid =\n\t\t\t\t\t\ttext_does_not_match_pattern || key_is_not_unique || !reference_is_resolved || !rules_valid;\n\t\t\t\t\tif (direct_invalid || !referenced_node_valid) {\n\t\t\t\t\t\tconst invalid = property.properties.is_valid.ensure(\"no\", {\n\t\t\t\t\t\t\t\"text does not match pattern\": [\"no\", {}],\n\t\t\t\t\t\t\t\"key is not unique\": [\"no\", {}],\n\t\t\t\t\t\t\t\"reference not resolved\": [\"no\", {}],\n\t\t\t\t\t\t\t\"referenced node not valid\": [\"no\", {}],\n\t\t\t\t\t\t\t\"invalid rules\": [\"no\", {}],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (text_does_not_match_pattern) {\n\t\t\t\t\t\t\tinvalid.properties.text_does_not_match_pattern.ensure(\"yes\", {\n\t\t\t\t\t\t\t\tpattern: getTextValidationPattern(property)!.properties.regular_expression,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tinvalid.properties.text_does_not_match_pattern.ensure(\"no\", {});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinvalid.properties.key_is_not_unique.ensure(key_is_not_unique ? \"yes\" : \"no\", {});\n\t\t\t\t\t\tinvalid.properties.reference_not_resolved.ensure(reference_is_resolved ? \"no\" : \"yes\", {});\n\t\t\t\t\t\tinvalid.properties.referenced_node_not_valid.ensure(referenced_node_valid ? \"no\" : \"yes\", {});\n\t\t\t\t\t\tinvalid.properties.invalid_rules.ensure(rules_valid ? \"no\" : \"yes\", {});\n\t\t\t\t\t\tif (!direct_invalid) {\n\t\t\t\t\t\t\treturn Indirect;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tproperty.properties.is_valid.ensure(\"yes\", {});\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t)(),\n\t\tfalse\n\t)\n);\n\nconst numberNotSet = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.is_editable).stateSwitch({\n\t\t\tyes: ($) =>\n\t\t\t\ttoStream(property.component_root.properties.location).stateSwitch({\n\t\t\t\t\tremote: () => false,\n\t\t\t\t\tlocal: () =>\n\t\t\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\t\t\tno: () => true,\n\t\t\t\t\t\t\tyes: () => false,\n\t\t\t\t\t\t})(),\n\t\t\t\t})(),\n\t\t\tno: () => false,\n\t\t})(),\n\t\tfalse\n\t)\n);\nconst numberExceedsMaximum = WeakCache>((property) => {\n\tconst limit = getUpperLimit(property);\n\tif (limit === undefined) return false;\n\treturn createVariable(\n\t\ttoStream(property.properties.is_editable).stateSwitch({\n\t\t\tyes: ($) =>\n\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\tno: () => false as false | number,\n\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\tcreateExpressionBuilder(limit)\n\t\t\t\t\t\t\t.and(toVariable($, \"number\"))\n\t\t\t\t\t\t\t.pipe(([maximum, value]) => (value > maximum ? maximum : false))(),\n\t\t\t\t})(),\n\t\t\tno: () => false as false | number,\n\t\t})(),\n\t\tfalse\n\t);\n});\nconst numberExceedsMinimum = WeakCache>((property) => {\n\tconst limit = getLowerLimit(property);\n\tif (limit === undefined) return false;\n\treturn createVariable(\n\t\ttoStream(property.properties.is_editable).stateSwitch({\n\t\t\tyes: ($) =>\n\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\tno: () => false as false | number,\n\t\t\t\t\tyes: ($) =>\n\t\t\t\t\t\tcreateExpressionBuilder(limit)\n\t\t\t\t\t\t\t.and(toVariable($, \"number\"))\n\t\t\t\t\t\t\t.pipe(([minimum, value]) => (value < minimum ? minimum : false))(),\n\t\t\t\t})(),\n\t\t\tno: () => false as false | number,\n\t\t})(),\n\t\tfalse\n\t);\n});\nconst numberShouldBePositive = WeakCache>((property) => {\n\tif (!mustBePositive(property)) return false;\n\treturn createVariable(\n\t\ttoStream(property.properties.is_editable).stateSwitch({\n\t\t\tyes: ($) =>\n\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: ($) => toStream($, \"number\").pipe((value) => value <= 0)(),\n\t\t\t\t})(),\n\t\t\tno: () => false,\n\t\t})(),\n\t\tfalse\n\t);\n});\nconst numberValid = WeakCache>((property) =>\n\tcreateVariable(\n\t\tcreateExpressionBuilder(numberNotSet(property))\n\t\t\t.and(numberExceedsMaximum(property))\n\t\t\t.and(numberExceedsMinimum(property))\n\t\t\t.and(numberShouldBePositive(property))\n\t\t\t.pipe(([[[not_set, exceeds_maximum], exceeds_minimum], should_be_positive]) => {\n\t\t\t\tif (not_set || exceeds_maximum !== false || exceeds_minimum !== false || should_be_positive) {\n\t\t\t\t\tconst invalid = property.properties.is_valid.ensure(\"no\", {\n\t\t\t\t\t\t\"not set\": [\"no\", {}],\n\t\t\t\t\t\t\"exceeds maximum\": [\"no\", {}],\n\t\t\t\t\t\t\"exceeds minimum\": [\"no\", {}],\n\t\t\t\t\t\t\"should be positive\": [\"no\", {}],\n\t\t\t\t\t\t\"not a number\": [\"no\", {}],\n\t\t\t\t\t});\n\t\t\t\t\tif (exceeds_maximum !== false) {\n\t\t\t\t\t\tinvalid.properties.exceeds_maximum.ensure(\"yes\", {\n\t\t\t\t\t\t\tmaximum: exceeds_maximum,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinvalid.properties.exceeds_maximum.ensure(\"no\", {});\n\t\t\t\t\t}\n\t\t\t\t\tif (exceeds_minimum !== false) {\n\t\t\t\t\t\tinvalid.properties.exceeds_minimum.ensure(\"yes\", {\n\t\t\t\t\t\t\tminimum: exceeds_minimum,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinvalid.properties.exceeds_minimum.ensure(\"no\", {});\n\t\t\t\t\t}\n\t\t\t\t\tinvalid.properties.not_set.ensure(not_set ? \"yes\" : \"no\", {});\n\t\t\t\t\tinvalid.properties.should_be_positive.ensure(should_be_positive ? \"yes\" : \"no\", {});\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\tproperty.properties.is_valid.ensure(\"yes\", {});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t})(),\n\t\tfalse\n\t)\n);\n\nconst fileNotSet = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.is_editable).stateSwitch({\n\t\t\tyes: ($) =>\n\t\t\t\ttoStream(property.component_root.properties.location).stateSwitch({\n\t\t\t\t\tremote: () => false,\n\t\t\t\t\tlocal: () =>\n\t\t\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\t\t\tno: () => true,\n\t\t\t\t\t\t\tyes: () => false,\n\t\t\t\t\t\t})(),\n\t\t\t\t})(),\n\t\t\tno: () => false,\n\t\t})(),\n\t\tfalse\n\t)\n);\nconst fileExtensionNotValid = WeakCache>((property) => {\n\tconst validation_pattern = getFileExtensionValidationPattern(property);\n\tif (!validation_pattern) return false;\n\treturn createVariable(\n\t\ttoStream(property.properties.is_editable).stateSwitch({\n\t\t\tyes: ($) =>\n\t\t\t\ttoStream($.properties.modified).stateSwitch({\n\t\t\t\t\tno: () => false,\n\t\t\t\t\tyes: ($) => toStream($, \"extension\").pipe((extension) => !validateText(extension, validation_pattern))(),\n\t\t\t\t})(),\n\t\t\tno: () => false,\n\t\t})(),\n\t\tfalse\n\t);\n});\nconst fileValid = WeakCache>((property) =>\n\tcreateVariable(\n\t\tcreateExpressionBuilder(fileNotSet(property))\n\t\t\t.and(fileExtensionNotValid(property))\n\t\t\t.pipe(([not_set, extension_not_valid]) => {\n\t\t\t\tif (not_set || extension_not_valid) {\n\t\t\t\t\tconst invalid = property.properties.is_valid.ensure(\"no\", {\n\t\t\t\t\t\t\"not set\": [\"no\", {}],\n\t\t\t\t\t\t\"extension not valid\": [\"no\", {}],\n\t\t\t\t\t});\n\t\t\t\t\tinvalid.properties.not_set.ensure(not_set ? \"yes\" : \"no\", {});\n\t\t\t\t\tif (extension_not_valid) {\n\t\t\t\t\t\tinvalid.properties.extension_not_valid.ensure(\"yes\", {\n\t\t\t\t\t\t\tpattern: getFileExtensionValidationPattern(property)!.properties.regular_expression,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinvalid.properties.extension_not_valid.ensure(\"no\", {});\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\tproperty.properties.is_valid.ensure(\"yes\", {});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t})(),\n\t\tfalse\n\t)\n);\n\nconst stategroupNoStateSelected = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.is_set).stateSwitch({\n\t\t\tyes: () => false,\n\t\t\tno: () =>\n\t\t\t\ttoStream(property.component_root.properties.location).stateSwitch({\n\t\t\t\t\tremote: () =>\n\t\t\t\t\t\ttoStream(property.properties.is_modified).stateSwitch({\n\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\tyes: () => true,\n\t\t\t\t\t\t})(),\n\t\t\t\t\tlocal: () => true,\n\t\t\t\t})(),\n\t\t})(),\n\t\tfalse\n\t)\n);\nconst stategroupInvalidRules = WeakCache>((property) =>\n\tcreateVariable(\n\t\ttoStream(property.properties.is_set).stateSwitch({\n\t\t\tno: () => false,\n\t\t\tyes: ($) =>\n\t\t\t\tcreateExpressionBuilder(rulesValid($.properties.state.ref.properties.rules)).pipe((valid) => !valid)(),\n\t\t})(),\n\t\tfalse\n\t)\n);\nconst stategroupStateNodeValid = WeakCache>(\n\t(property) =>\n\t\tcreateVariable(\n\t\t\ttoStream(property.properties.is_set).stateSwitch({\n\t\t\t\tno: () => true,\n\t\t\t\tyes: ($) => createExpressionBuilder(nodeValid($.properties.state.ref.properties.node))(),\n\t\t\t})(),\n\t\t\tfalse\n\t\t)\n);\nconst stategroupValid = WeakCache>((property) =>\n\tcreateVariable(\n\t\tcreateExpressionBuilder(stategroupNoStateSelected(property))\n\t\t\t.and(stategroupInvalidRules(property))\n\t\t\t.and(stategroupStateNodeValid(property))\n\t\t\t.pipe(([[no_state_selected, invalid_rules], state_node_valid]) => {\n\t\t\t\tconst direct_invalid = no_state_selected || invalid_rules || state_node_valid === false;\n\t\t\t\tconst indirect_invalid = state_node_valid === Indirect;\n\t\t\t\tif (direct_invalid || indirect_invalid) {\n\t\t\t\t\tconst invalid = property.properties.is_valid.ensure(\"no\", {\n\t\t\t\t\t\t\"no state selected\": [\"no\", {}],\n\t\t\t\t\t\t\"invalid rules\": [\"no\", {}],\n\t\t\t\t\t});\n\t\t\t\t\tinvalid.properties.no_state_selected.ensure(no_state_selected ? \"yes\" : \"no\", {});\n\t\t\t\t\tinvalid.properties.invalid_rules.ensure(invalid_rules ? \"yes\" : \"no\", {});\n\t\t\t\t\tif (!direct_invalid) {\n\t\t\t\t\t\treturn Indirect;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\tproperty.properties.is_valid.ensure(\"yes\", {});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t})(),\n\t\tfalse\n\t)\n);\n\nexport function reduceValid(accumulator: boolean | Indirect, value: boolean | Indirect) {\n\treturn value === false || accumulator === false\n\t\t? false\n\t\t: value === Indirect || accumulator === Indirect\n\t\t? Indirect\n\t\t: true;\n}\nexport const nodeValid: (node: api_cs.Cnode) => ScalarProvider = WeakCache<\n\tapi_cs.Cnode,\n\tScalarProvider\n>((node) =>\n\tcreateVariable(\n\t\ttoStream(node.properties.attributes)\n\t\t\t.map(([, attribute]) => {\n\t\t\t\tconst attribute_type = attribute.properties.type.state;\n\t\t\t\tswitch (attribute_type.name) {\n\t\t\t\t\tcase \"operation\":\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tcase \"property\": {\n\t\t\t\t\t\tconst property_type = attribute_type.node.properties.type.state;\n\t\t\t\t\t\tswitch (\n\t\t\t\t\t\t\tattribute_type.node.inferences.property_type().properties.type.state.node.output.value_source().variant\n\t\t\t\t\t\t\t\t.name\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcase \"derived\":\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\tcase \"base\": {\n\t\t\t\t\t\t\t\tswitch (property_type.name) {\n\t\t\t\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\t\t\t\treturn textValid(property_type.node);\n\t\t\t\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\t\t\t\treturn numberValid(property_type.node);\n\t\t\t\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\t\t\t\treturn fileValid(property_type.node);\n\t\t\t\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\t\t\t\treturn nodeValid(property_type.node.properties.node);\n\t\t\t\t\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\t\t\t\t\treturn stategroupValid(property_type.node);\n\t\t\t\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\t\t\t\tconst size =\n\t\t\t\t\t\t\t\t\t\t\tproperty_type.node.inferences.collection_type().properties.ui.properties.size.state.name;\n\t\t\t\t\t\t\t\t\t\treturn createExpressionBuilder(iCollection(property_type.node).isValid).pipe((collection_valid) => {\n\t\t\t\t\t\t\t\t\t\t\tswitch (size) {\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"small\":\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn collection_valid;\n\t\t\t\t\t\t\t\t\t\t\t\tcase \"large\":\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn toStream(node.properties.location).stateSwitch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocal: () => collection_valid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tremote: () => true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t})();\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t})();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t.reduce(reduceValid, true)\n\t\t\t.pipe((valid) => {\n\t\t\t\tnode.properties.is_valid.ensure(valid === true ? \"yes\" : \"no\", {});\n\t\t\t\treturn valid;\n\t\t\t})(),\n\t\tfalse\n\t)\n);\n","import { api_configuration } from \"../../common\";\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\n\nexport default function supportsSelfReference(root: api_app.Centry_reference_definition): boolean {\n\tswitch (root.properties.type.state.name) {\n\t\tcase \"simple\":\n\t\t\treturn false;\n\t\tcase \"sibling\": {\n\t\t\tconst $ = root.properties.type.state.node;\n\t\t\tswitch ($.properties.definition.properties.graph_participation.state.name) {\n\t\t\t\tcase \"no\": {\n\t\t\t\t\tconst $$ = $.properties.definition.properties.graph_participation.state.node;\n\t\t\t\t\tswitch ($$.properties.support_self_reference.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState($$.properties.support_self_reference.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"yes\":\n\t\t\t\t\treturn false;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($.properties.definition.properties.graph_participation.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(root.properties.type.state);\n\t}\n}\n","import * as SubscriptionManager from \"../state 2 interface/SubscriptionManager\";\nimport { onFinishedApplyingDefaults, applyingDefaults } from \"./defaults\";\nimport { referencesResolved, resolvingReferences } from \"../state 2 interface/referenceResolver\";\nimport * as microtaskQueue from \"../microtaskQueue\";\nimport * as queryQueue from \"../queryQueue\";\n\nexport default async function clientWorkIsDone() {\n\tdo {\n\t\tawait onFinishedApplyingDefaults();\n\t\tawait referencesResolved();\n\t\tawait SubscriptionManager.finishedAndInitialized();\n\t\tawait microtaskQueue.done();\n\t\tawait queryQueue.done();\n\t} while (\n\t\tapplyingDefaults.size.value > 0 ||\n\t\tresolvingReferences.size.value > 0 ||\n\t\tSubscriptionManager.size() > 0 ||\n\t\tmicrotaskQueue.size() > 0 ||\n\t\tqueryQueue.size() > 0\n\t);\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_gui = api_configuration.libraries.gui_definition_lib.types.gui_model.alan_api;\nimport { getGuiText, getGuiFile } from \"../guiModel\";\n\nexport function getTextValidationPattern(text_property: api_cs.Ctext__type__property) {\n\treturn getGuiText(text_property.inferences.text_type())?.properties.validation.switch({\n\t\tnone: () => undefined as api_app.Cui_text_validation | api_gui.Ctext_validation | undefined,\n\t\tcustom: (custom) => custom.properties.rules,\n\t\tmodel: (model) => model.inferences.text_with_validation().properties.rules,\n\t});\n}\n\nexport function getFileExtensionValidationPattern(\n\tproperty: api_cs.Cfile__type__property\n): api_gui.Ctext_validation | undefined {\n\treturn getGuiFile(property.inferences.file_type())?.properties.has_extension_validation.switch({\n\t\tno: () => undefined,\n\t\tyes: ($) => $.properties.rules,\n\t});\n}\n\nexport function validateText(\n\tvalue: string,\n\ttext_validation: api_app.Cui_text_validation | api_gui.Ctext_validation\n): boolean {\n\tlet regexp;\n\ttry {\n\t\tregexp = new RegExp(`^${text_validation.properties.regular_expression}$`);\n\t} catch (e) {\n\t\tconsole.warn(\n\t\t\t`Invalid model regular expression: \"${text_validation.properties.regular_expression}\" in ${text_validation.path}`\n\t\t);\n\t\treturn true;\n\t}\n\tif (regexp.test(value)) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport cs = api_configuration.types.client_state.alan_api;\nimport api_collation_table = api_configuration.libraries.gui_definition_lib.types.collation_table.alan_api;\nimport serializerNumber = require(\"../state 2 interface/serializeNumber\");\nimport serializeNumber = serializerNumber.serializeNumber;\nimport { updateEntriesSelection } from \"./selection\";\nimport { on_node_update } from \"./events\";\nimport DestructorTree from \"../DestructorTree\";\nimport {\n\taddResultEntry,\n\tremoveResultEntry,\n\thasResult,\n\tgetIndexedResultEntries,\n\tlocalQueryEntry,\n\tgetQueryEntryIndexForEntry,\n\tsetSubscribed,\n\tgetPropertyForCell,\n} from \"./Query\";\nimport walkNodePath from \"../navigation/walkNodePath\";\nimport * as Cell from \"../state/Cell\";\nimport { iReference } from \"../state/Reference\";\nimport * as Entry from \"../state/Entry\";\nimport supportsSelfReference from \"../state/supportsSelfReference\";\nimport * as ClientState from \"../state/ClientState\";\nimport * as Status from \"../Status\";\nimport { getTranslation } from \"./phrases\";\nimport * as reQuery from \"../state 2 interface/reQuery\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport * as Query from \"../state/Query\";\n\nfunction getCharacterAlternatives(character: api_collation_table.Ccharacters): Record> {\n\tconst type = character.properties.type.state;\n\tswitch (type.name) {\n\t\tcase \"alternative\":\n\t\t\treturn global.collation_table_inverse[type.node.properties.for_.inferences.for_().parent.key];\n\t\tcase \"primary\":\n\t\t\treturn global.collation_table_inverse[type.node.parent.key];\n\t}\n}\n\nfunction createRegexFromString(value: string): string {\n\tlet regex = \"\";\n\tif (value.length === 0) return regex;\n\n\tfor (let i = 0, character: string; (character = value[i]), i < value.length; i++) {\n\t\tif (character === \"*\") {\n\t\t\tregex = regex + \".*\";\n\t\t} else {\n\t\t\tconst entry: api_collation_table.Ccharacters = global.collation_table.properties.characters.get(character);\n\t\t\tif (entry !== undefined) {\n\t\t\t\tregex = regex + \"[\" + Object.keys(getCharacterAlternatives(entry)).join() + \"]\";\n\t\t\t} else {\n\t\t\t\tregex = regex + character;\n\t\t\t}\n\t\t}\n\t}\n\treturn regex;\n}\n\nfunction createRegexFromFilter(filter: cs.Cyes__has_filter__text) {\n\tswitch (filter.properties.operation.state.name) {\n\t\tcase \"contains\":\n\t\t\treturn \"^.*\" + createRegexFromString(filter.properties.value) + \".*$\";\n\t\tcase \"starts with\":\n\t\t\treturn \"^\" + createRegexFromString(filter.properties.value) + \".*$\";\n\t\tcase \"ends with\":\n\t\t\treturn \"^.*\" + createRegexFromString(filter.properties.value) + \"$\";\n\t\tcase \"equals\":\n\t\t\treturn \"^\" + createRegexFromString(filter.properties.value) + \"$\";\n\t}\n}\n\nfunction filter_text(filter: cs.Cyes__has_filter__text, value: string) {\n\treturn value.match(createRegexFromFilter(filter)) !== null;\n}\n\nfunction checkFilter(node: cs.Cnode, query: cs.Cquery__client_state): boolean {\n\tlet valid = true;\n\tquery.properties.columns.forEach(function (column) {\n\t\tcolumn.properties.type.switch({\n\t\t\ttext: function (text) {\n\t\t\t\ttext.properties.has_filter.switch({\n\t\t\t\t\tno: undefined,\n\t\t\t\t\tyes: function (has_filter) {\n\t\t\t\t\t\thas_filter.properties.filter_set.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: function () {\n\t\t\t\t\t\t\t\tconst text_context = walkNodePath(text.parent.key.ref.properties.path, node);\n\t\t\t\t\t\t\t\tvalid =\n\t\t\t\t\t\t\t\t\tvalid &&\n\t\t\t\t\t\t\t\t\t(text_context?.properties.attributes.switchOnEntryExists(\n\t\t\t\t\t\t\t\t\t\ttext.inferences.text_type().properties.text.entry,\n\t\t\t\t\t\t\t\t\t\t($) => {\n\t\t\t\t\t\t\t\t\t\t\tconst text_property = $.properties.type.cast(\"property\").properties.type.cast(\"text\");\n\t\t\t\t\t\t\t\t\t\t\treturn text_property.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\t\t\tno: false,\n\t\t\t\t\t\t\t\t\t\t\t\tyes: (is_set) => filter_text(has_filter, is_set.properties.text),\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t() => false\n\t\t\t\t\t\t\t\t\t) ??\n\t\t\t\t\t\t\t\t\t\ttrue);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t\tfile: undefined,\n\t\t\tnumber: function (number) {\n\t\t\t\tnumber.properties.has_filter.switch({\n\t\t\t\t\tno: undefined,\n\t\t\t\t\tyes: function (has_filter) {\n\t\t\t\t\t\thas_filter.properties.filter_set.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: function () {\n\t\t\t\t\t\t\t\thas_filter.properties.criteria_is_valid.switch({\n\t\t\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\t\t\tyes: function (criteria_valid) {\n\t\t\t\t\t\t\t\t\t\tvalid =\n\t\t\t\t\t\t\t\t\t\t\tvalid &&\n\t\t\t\t\t\t\t\t\t\t\t(walkNodePath(\n\t\t\t\t\t\t\t\t\t\t\t\tnumber.parent.key.ref.properties.path,\n\t\t\t\t\t\t\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t\t\t\t\t)?.properties.attributes.switchOnEntryExists(\n\t\t\t\t\t\t\t\t\t\t\t\tnumber.inferences.number_type().properties.number.ref.parent.parent.key.ref.key,\n\t\t\t\t\t\t\t\t\t\t\t\t($) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.type\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.cast(\"property\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.properties.type.cast(\"number\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: (is_set) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thas_filter.properties.operator_selected.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: () => undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: (operator_selected) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toperator_selected.properties.operator.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"smaller than\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis_set.properties.number.value < criteria_valid.properties.criteria.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"smaller than or equal to\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis_set.properties.number.value <= criteria_valid.properties.criteria.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"equal to\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis_set.properties.number.value === criteria_valid.properties.criteria.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis_set.properties.number.value > criteria_valid.properties.criteria.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than or equal to\": () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis_set.properties.number.value >= criteria_valid.properties.criteria.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t() => undefined\n\t\t\t\t\t\t\t\t\t\t\t) ??\n\t\t\t\t\t\t\t\t\t\t\t\ttrue);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"state group\": function (state_group) {\n\t\t\t\tstate_group.properties.has_filter.switch({\n\t\t\t\t\tno: undefined,\n\t\t\t\t\tyes: function (has_filter) {\n\t\t\t\t\t\thas_filter.properties.filter_enabled.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: function () {\n\t\t\t\t\t\t\t\tvalid =\n\t\t\t\t\t\t\t\t\tvalid &&\n\t\t\t\t\t\t\t\t\t(walkNodePath(\n\t\t\t\t\t\t\t\t\t\tstate_group.parent.key.ref.properties.path,\n\t\t\t\t\t\t\t\t\t\tnode\n\t\t\t\t\t\t\t\t\t)?.properties.attributes.switchOnEntryExists(\n\t\t\t\t\t\t\t\t\t\tstate_group.inferences.state_group_type().properties.state_group.ref.parent.parent.key.ref.key,\n\t\t\t\t\t\t\t\t\t\t($) =>\n\t\t\t\t\t\t\t\t\t\t\t$.properties.type\n\t\t\t\t\t\t\t\t\t\t\t\t.cast(\"property\")\n\t\t\t\t\t\t\t\t\t\t\t\t.properties.type.cast(\"state group\")\n\t\t\t\t\t\t\t\t\t\t\t\t.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\t\t\t\t\t\t\tyes: (is_set) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thas_filter.properties.states\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.get(is_set.properties.state.entry)!\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.properties.is_selected.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: () => false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: () => undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t() => undefined\n\t\t\t\t\t\t\t\t\t) ??\n\t\t\t\t\t\t\t\t\t\ttrue);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t\twidget: undefined,\n\t\t});\n\t});\n\treturn valid;\n}\n\nfunction updateEntryFromCollectionEntry(target: cs.Centries__yes__has_result, source: cs.Centries__collection) {\n\tconst is_new_entry = source.properties.location.switch({\n\t\tlocal: true,\n\t\tremote: false,\n\t});\n\n\tQuery.storeEntryId(target.properties.entry_status, createIdPathBuilderFromNode(source.properties.node));\n\n\tfor (const cell of target.properties.cells.values()) {\n\t\tconst cell_type = cell.properties.type.state;\n\t\tswitch (cell_type.name) {\n\t\t\tcase \"text\": {\n\t\t\t\tconst text_cell = cell_type.node;\n\t\t\t\tconst text_property = getPropertyForCell(source, text_cell);\n\t\t\t\tif (text_property) {\n\t\t\t\t\tswitch (text_property.properties.is_set.state.name) {\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst property_is_set = text_property.properties.is_set.state.node;\n\t\t\t\t\t\t\tconst source_value = property_is_set.properties.text;\n\t\t\t\t\t\t\tCell.updateText(text_cell, source_value);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tif (is_new_entry && text_cell.properties.is_set.state.name === \"yes\") {\n\t\t\t\t\t\t\t\ttext_cell.properties.is_set.set(\"no\", {});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"number\": {\n\t\t\t\tconst number_cell = cell_type.node;\n\t\t\t\tconst number_property = getPropertyForCell(source, number_cell);\n\t\t\t\tif (number_property) {\n\t\t\t\t\tswitch (number_property.properties.is_set.state.name) {\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst property_is_set = number_property.properties.is_set.state.node;\n\t\t\t\t\t\t\tconst source_value = property_is_set.properties.number.value;\n\t\t\t\t\t\t\tconst source_textual_representation = serializeNumber(\n\t\t\t\t\t\t\t\tsource_value,\n\t\t\t\t\t\t\t\tserializerNumber.getDecimalsFromNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\tnumber_cell.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tnumber_cell.inferences.column_type().inferences.number_type().properties.number.ref.properties\n\t\t\t\t\t\t\t\t\t.numerical_type.ref.key.ref\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tCell.updateNumber(number_cell, source_value, source_textual_representation);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tif (is_new_entry && number_cell.properties.is_set.state.name === \"yes\") {\n\t\t\t\t\t\t\t\tnumber_cell.properties.is_set.set(\"no\", {});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"file\": {\n\t\t\t\tconst file_cell = cell_type.node;\n\t\t\t\tconst file_property = getPropertyForCell(source, file_cell);\n\t\t\t\tif (file_property !== undefined) {\n\t\t\t\t\tswitch (file_property.properties.backend_known.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst $ = file_property.properties.backend_known.state.node;\n\t\t\t\t\t\t\tswitch ($.properties.is_readable.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\tconst readable_file = $.properties.is_readable.state.node;\n\t\t\t\t\t\t\t\t\tCell.updateFile(file_cell, readable_file.properties.token, readable_file.properties.extension);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state group\": {\n\t\t\t\tconst state_group_cell = cell_type.node;\n\t\t\t\tconst state_group_property = getPropertyForCell(source, state_group_cell);\n\t\t\t\tif (state_group_property) {\n\t\t\t\t\tswitch (state_group_property.properties.is_set.state.name) {\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst property_is_set = state_group_property.properties.is_set.state.node;\n\t\t\t\t\t\t\tconst source_value = property_is_set.properties.state.entry;\n\t\t\t\t\t\t\tCell.updateStategroup(state_group_cell, getTranslation(source_value));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tif (is_new_entry && state_group_cell.properties.is_set.state.name === \"yes\") {\n\t\t\t\t\t\t\t\tstate_group_cell.properties.is_set.set(\"no\", {});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"widget\":\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\nexport default function updateQueryFromCollection(query: cs.Cquery__client_state): void {\n\tswitch (query.properties.use_for.state.name) {\n\t\tcase \"query\": {\n\t\t\tswitch (query.properties.entries_are_editable.state.name) {\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst editable = query.properties.entries_are_editable.state.node;\n\t\t\t\t\tswitch (editable.properties.can_create_entry.state.name) {\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst can_create_entry = editable.properties.can_create_entry.state.node;\n\t\t\t\t\t\t\tconst destructor = setSubscribed(query);\n\t\t\t\t\t\t\tif (destructor) {\n\t\t\t\t\t\t\t\tconst collection = can_create_entry.properties.in_.cast(\"query\").properties.collection.ref;\n\t\t\t\t\t\t\t\tsubscribeToCollection(query, collection, destructor);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"no\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"candidates\": {\n\t\t\tconst for_candidates = query.properties.use_for.state.node;\n\t\t\tconst destructor = setSubscribed(query);\n\t\t\tif (destructor) {\n\t\t\t\tconst reference = for_candidates.inferences.reference_property().parent;\n\t\t\t\tconst collection_context = iReference(reference).collectionContext;\n\t\t\t\tlet c_destructor: DestructorTree | undefined;\n\t\t\t\tconst subscription = collection_context.subscribe({\n\t\t\t\t\tupdate: (collection) => {\n\t\t\t\t\t\treQuery.candidates(reference);\n\t\t\t\t\t\tif (Status.isResolved(collection)) {\n\t\t\t\t\t\t\tc_destructor?.destroy();\n\t\t\t\t\t\t\tc_destructor = destructor.addChild();\n\t\t\t\t\t\t\tconst blacklist = new Set();\n\t\t\t\t\t\t\tswitch (reference.parent.properties.is_key.state.name) {\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\tconst key_property = reference.parent.properties.is_key.state.node;\n\t\t\t\t\t\t\t\t\tgetLocalEntriesBlacklist(key_property, blacklist);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst self_reference_allowed = supportsSelfReference(\n\t\t\t\t\t\t\t\treference.inferences.is_navigable().properties.expression\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (!self_reference_allowed) {\n\t\t\t\t\t\t\t\tconst self_entity = reference.component_root.input.entity();\n\t\t\t\t\t\t\t\tswitch (self_entity.variant.name) {\n\t\t\t\t\t\t\t\t\tcase \"root\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\t\t\t\t\tconst self_value = Entry.getKeyValue(self_entity.variant.definition);\n\t\t\t\t\t\t\t\t\t\tif (self_value !== undefined) {\n\t\t\t\t\t\t\t\t\t\t\tblacklist.add(self_value);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsubscribeToCollection(query, collection, c_destructor, blacklist);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tdestructor.onDestroy(() => collection_context.unsubscribe(subscription));\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nfunction getLocalEntriesBlacklist(this_key_property: cs.Cyes__is_key, blacklist: Set): Set {\n\tconst collection = this_key_property.inferences.entry().parent;\n\tfor (const entry of collection.properties.entries.values()) {\n\t\tconst key = Entry.getKeyValue(entry);\n\t\tif (key === undefined) break;\n\t\tswitch (entry.properties.location.state.name) {\n\t\t\tcase \"remote\":\n\t\t\t\tbreak;\n\t\t\tcase \"local\": {\n\t\t\t\tconst that_key_property = entry.properties.key.ref;\n\t\t\t\tif (that_key_property !== this_key_property.parent) {\n\t\t\t\t\tblacklist.add(key);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(entry.properties.location.state);\n\t\t}\n\t}\n\treturn blacklist;\n}\n\nconst updateQueue = new Map }>();\nlet update_queued = false;\n\nfunction updateQueries() {\n\tif (!update_queued) {\n\t\tupdate_queued = true;\n\t\trequestAnimationFrame(() => {\n\t\t\tClientState.onTransactionEnds(() => {\n\t\t\t\tupdate_queued = false;\n\t\t\t\tfor (const [query, { collection, blacklist }] of updateQueue) {\n\t\t\t\t\tif (query.destroyed || collection.destroyed) continue;\n\t\t\t\t\tupdateEntries(query, collection, blacklist);\n\t\t\t\t}\n\t\t\t\tupdateQueue.clear();\n\t\t\t});\n\t\t});\n\t}\n}\n\nfunction subscribeToCollection(\n\tquery: cs.Cquery__client_state,\n\tcollection: cs.Ccollection,\n\tdestructor: DestructorTree,\n\tblacklist: Set = new Set()\n): void {\n\tdestructor.onDestroy(() => updateQueue.delete(query));\n\n\tdestructor.subscribeToStategroup(query.properties.has_result, (has_result_destructor) => {\n\t\tswitch (query.properties.has_result.state.name) {\n\t\t\tcase \"yes\": {\n\t\t\t\tconst result = query.properties.has_result.state.node;\n\t\t\t\thas_result_destructor.subscribeToCollection(result.properties.entries, {\n\t\t\t\t\ton_change: () => {\n\t\t\t\t\t\tupdateQueue.set(query, { collection, blacklist });\n\t\t\t\t\t\tupdateQueries();\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t}\n\t});\n\n\tdestructor.subscribeToCollection(\n\t\tcollection.properties.entries,\n\t\t{\n\t\t\ton_add: (entry, destructor) => {\n\t\t\t\tconst node_subscription = on_node_update(entry.properties.node, () => {\n\t\t\t\t\tupdateQueue.set(query, { collection, blacklist });\n\t\t\t\t\tupdateQueries();\n\t\t\t\t});\n\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\tnode_subscription.unsubscribe();\n\t\t\t\t});\n\t\t\t\tupdateQueue.set(query, { collection, blacklist });\n\t\t\t\tupdateQueries();\n\t\t\t},\n\t\t},\n\t\t/*init=*/ true\n\t);\n}\n\nfunction localOrModified(entry: cs.Centries__collection): boolean {\n\tconst is_local = entry.properties.node.properties.location.switch({\n\t\tlocal: true,\n\t\tremote: false,\n\t});\n\tconst is_modified = entry.properties.node.properties.modified.switch({\n\t\tno: false,\n\t\tyes: true,\n\t});\n\treturn is_local || is_modified;\n}\n\nfunction updateEntries(query: cs.Cquery__client_state, collection: cs.Ccollection, blacklist: Set) {\n\tconst has_result = hasResult(query);\n\n\tconst entries_indexed = getIndexedResultEntries(has_result);\n\tfor (const entry of collection.properties.entries.values()) {\n\t\tconst entry_index = getQueryEntryIndexForEntry(query, entry);\n\t\tif (entry_index !== undefined) {\n\t\t\tconst query_entry = entries_indexed.get(entry_index);\n\t\t\tconst key = Entry.getKeyValue(entry);\n\t\t\tconst blacklisted = key !== undefined ? blacklist.has(key) : false;\n\t\t\tconst filtered = blacklisted || (localOrModified(entry) && !checkFilter(entry.properties.node, query));\n\t\t\tif (query_entry) {\n\t\t\t\tif (filtered) {\n\t\t\t\t\thas_result.set_total_amount_of_entries(has_result.properties.total_amount_of_entries.value - 1);\n\t\t\t\t\tremoveResultEntry(query_entry);\n\t\t\t\t} else {\n\t\t\t\t\tupdateEntryFromCollectionEntry(query_entry, entry);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (!filtered && localOrModified(entry)) {\n\t\t\t\t\thas_result.set_total_amount_of_entries(has_result.properties.total_amount_of_entries.value + 1);\n\t\t\t\t\tconst query_entry = addResultEntry(has_result, localQueryEntry(entry));\n\t\t\t\t\tentry.onDestroy(() => {\n\t\t\t\t\t\tif (query_entry.destroyed) return;\n\t\t\t\t\t\tremoveResultEntry(query_entry);\n\t\t\t\t\t\treQuery.query(query);\n\t\t\t\t\t});\n\t\t\t\t\tupdateEntryFromCollectionEntry(query_entry, entry);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tupdateEntriesSelection(query);\n}\n","function setupGenerator() {\n\tif (window.crypto?.randomUUID) {\n\t\treturn () => window.crypto.randomUUID();\n\t} else {\n\t\t// Use a fallback if crypto is not available.\n\n\t\t/**\n\t\t * Fast UUID generator, RFC4122 version 4 compliant.\n\t\t * @author Jeff Ward (jcward.com).\n\t\t * @license MIT license\n\t\t * @link http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\n\t\t **/\n\n\t\tlet i;\n\t\tconst lut: string[] = [];\n\t\tfor (i = 0; i < 256; i += 1) {\n\t\t\tlut[i] = (i < 16 ? \"0\" : \"\") + i.toString(16);\n\t\t}\n\n\t\treturn function () {\n\t\t\tconst d0 = (Math.random() * 0xffffffff) | 0;\n\t\t\tconst d1 = (Math.random() * 0xffffffff) | 0;\n\t\t\tconst d2 = (Math.random() * 0xffffffff) | 0;\n\t\t\tconst d3 = (Math.random() * 0xffffffff) | 0;\n\t\t\treturn (\n\t\t\t\tlut[d0 & 0xff] +\n\t\t\t\tlut[(d0 >> 8) & 0xff] +\n\t\t\t\tlut[(d0 >> 16) & 0xff] +\n\t\t\t\tlut[(d0 >> 24) & 0xff] +\n\t\t\t\t\"-\" +\n\t\t\t\tlut[d1 & 0xff] +\n\t\t\t\tlut[(d1 >> 8) & 0xff] +\n\t\t\t\t\"-\" +\n\t\t\t\tlut[((d1 >> 16) & 0x0f) | 0x40] +\n\t\t\t\tlut[(d1 >> 24) & 0xff] +\n\t\t\t\t\"-\" +\n\t\t\t\tlut[(d2 & 0x3f) | 0x80] +\n\t\t\t\tlut[(d2 >> 8) & 0xff] +\n\t\t\t\t\"-\" +\n\t\t\t\tlut[(d2 >> 16) & 0xff] +\n\t\t\t\tlut[(d2 >> 24) & 0xff] +\n\t\t\t\tlut[d3 & 0xff] +\n\t\t\t\tlut[(d3 >> 8) & 0xff] +\n\t\t\t\tlut[(d3 >> 16) & 0xff] +\n\t\t\t\tlut[(d3 >> 24) & 0xff]\n\t\t\t);\n\t\t};\n\t}\n}\n\nexport const generate = setupGenerator();\n","import { api_configuration } from \"../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_modifications = api_configuration.types.modifications.alan_api;\nimport { KeysOfType } from \"./types\";\nimport {\n\tScalarProvider,\n\tScalarConsumer,\n\tcreateExpressionBuilder,\n\tcreateStategroupExpressionBuilder,\n\tcreateDictionaryExpressionBuilder,\n\tDictionaryProvider,\n\tDictionaryConsumer,\n\tMutableVariable,\n\tInitializedDynamicDefaultExpressionBuilder,\n\tInitializedDynamicStategroupExpressionBuilder,\n\tInitializedStaticDictionaryExpressionBuilder,\n\tScalar,\n\tWeakCache,\n} from \"../../../../stream\";\nimport { OnDemandEvaluatedMap } from \"../../../../destructables\";\nimport { Pending } from \"./Status\";\n\nclass ScalarAlanPropertyVariable<\n\tN extends (api_cs.AlanNode | api_modifications.AlanNode) & { properties: Record },\n\tT extends string | number\n> extends ScalarProvider {\n\tprivate readonly _subscribers = new Set>();\n\tprivate _subscription?: api_cs.Subscription;\n\n\tconstructor(\n\t\tprivate alan_node: N,\n\t\tprivate property_name: KeysOfType>\n\t) {\n\t\tsuper();\n\t}\n\n\tprotected receive(value: T): void {\n\t\t((this.alan_node as any)[`set_${String(this.property_name)}`] as (value: T) => void)(value);\n\t}\n\n\tset(value: T): void {\n\t\tthis.receive(value);\n\t}\n\n\tget value() {\n\t\tconst property: string | api_cs.AlanInteger | api_cs.Reference =\n\t\t\tthis.alan_node.properties[String(this.property_name)];\n\t\tif (property instanceof api_cs.AlanInteger) {\n\t\t\treturn property.value as T;\n\t\t}\n\t\tif (property instanceof api_cs.Reference) {\n\t\t\treturn property.entry as T;\n\t\t}\n\t\treturn property as T;\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer) {\n\t\tif (this.alan_node.destroyed) return subscriber;\n\t\tif (this._subscribers.has(subscriber)) throw new Error(\"unexpected\");\n\t\tif (this._subscribers.size === 0) {\n\t\t\tthis._subscription = (\n\t\t\t\t(this.alan_node as any)[`subscribe_${String(this.property_name)}`] as (\n\t\t\t\t\tobserver: api_cs.TextObserver | api_cs.NumberObserver\n\t\t\t\t) => any\n\t\t\t)({\n\t\t\t\ton_update: () => {\n\t\t\t\t\tfor (const subscriber of this._subscribers) {\n\t\t\t\t\t\tsubscriber.update(this.value);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tthis._subscribers.add(subscriber);\n\t\tsubscriber.update(this.value);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && !this._subscribers.has(subscriber)) throw new Error(\"unexpected\");\n\t\tthis._subscribers.delete(subscriber);\n\t\tif (this._subscribers.size === 0) {\n\t\t\tthis._subscription?.unsubscribe();\n\t\t\tthis._subscription = undefined;\n\t\t}\n\t}\n}\n\nconst scalarStreamCache = new OnDemandEvaluatedMap<\n\tapi_cs.IAlanObject,\n\tOnDemandEvaluatedMap>\n>((node) => {\n\treturn new OnDemandEvaluatedMap>((property_name) => {\n\t\treturn new ScalarAlanPropertyVariable(node as any, property_name);\n\t});\n});\nfunction getScalarStream(\n\tnode: api_cs.IAlanObject,\n\tproperty_name: string\n): ScalarAlanPropertyVariable {\n\treturn scalarStreamCache.get(node).get(property_name);\n}\n\ntype StateOf = T extends api_cs.StateGroup ? STATE : never;\ntype StateType = State extends { name: infer Tag; node: infer ValueType }\n\t? { tag: Tag; value: ValueType }\n\t: never;\n\nclass AlanStategroupVariable> extends ScalarProvider>> {\n\tprivate readonly _subscribers = new Set>>>();\n\tprivate _subscription?: api_cs.Subscription;\n\n\tconstructor(private stategroup: T) {\n\t\tsuper();\n\t}\n\n\tget value() {\n\t\tconst state = this.stategroup.state;\n\t\treturn { tag: state.name, value: state.node } as StateType>;\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer>>) {\n\t\tif (this.stategroup.destroyed) return subscriber;\n\t\tif (this._subscribers.has(subscriber)) throw new Error(\"unexpected\");\n\t\tif (this._subscribers.size === 0) {\n\t\t\t/* to remedy unsubscribing during first evaluation. Note that this is exceptional and an antipattern */\n\t\t\tthis._subscription = this.stategroup.subscribe({\n\t\t\t\ton_update: () => {\n\t\t\t\t\tfor (const subscriber of this._subscribers) {\n\t\t\t\t\t\tsubscriber.update(this.value);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tthis._subscribers.add(subscriber);\n\t\tsubscriber.update(this.value);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer>>) {\n\t\tif ((global)?.alan_strict && !this._subscribers.has(subscriber)) throw new Error(\"unexpected\");\n\t\tthis._subscribers.delete(subscriber);\n\t\tif (this._subscribers.size === 0) {\n\t\t\tthis._subscription?.unsubscribe();\n\t\t\tthis._subscription = undefined;\n\t\t}\n\t}\n}\n\nconst getStategroupStream = WeakCache, AlanStategroupVariable>(\n\t(stategroup) => new AlanStategroupVariable(stategroup)\n);\n\nclass AlanDictionaryVariable extends DictionaryProvider {\n\tprivate readonly _subscribers = new Set>();\n\tprivate _subscription?: api_cs.Subscription;\n\tprivate _values = new Map();\n\n\tconstructor(private _dictionary: api_cs.AlanDictionary<{ node: E; init: I }, any>) {\n\t\tsuper();\n\t}\n\n\tadd(key: string, value: E) {\n\t\tif (this._values.has(key)) return;\n\t\tthis._values.set(key, value);\n\t\tfor (const subscriber of this._subscribers) {\n\t\t\tsubscriber.add(key, value);\n\t\t}\n\t\tthis._size?.ensure(this._dictionary.size);\n\t}\n\n\tremove(key: string) {\n\t\tthis._values.delete(key);\n\t\tfor (const subscriber of this._subscribers) {\n\t\t\tsubscriber.remove(key);\n\t\t}\n\t\tthis._size?.ensure(this._dictionary.size);\n\t}\n\n\tsubscribe(subscriber: DictionaryConsumer) {\n\t\tif (this._dictionary.destroyed) throw new Error(\"unexpected\");\n\t\tif (this._subscribers.has(subscriber)) throw new Error(\"unexpected\");\n\t\tif (this._subscribers.size === 0) {\n\t\t\tthis._subscription = this._dictionary.subscribe({\n\t\t\t\ton_add: (entry) => this.add(entry.key_value, entry),\n\t\t\t\ton_remove: (key) => this.remove(key),\n\t\t\t});\n\t\t\tfor (const entry of this._dictionary) this.add(...entry);\n\t\t}\n\t\tthis._subscribers.add(subscriber);\n\t\tfor (const entry of this._values) subscriber.add(...entry);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: DictionaryConsumer) {\n\t\tif ((global)?.alan_strict && !this._subscribers.has(subscriber)) throw new Error(\"unexpected\");\n\t\tthis._subscribers.delete(subscriber);\n\t\tif (this._subscribers.size === 0) {\n\t\t\tthis._subscription?.unsubscribe();\n\t\t\tthis._subscription = undefined;\n\t\t\tthis._values.clear();\n\t\t}\n\t}\n\n\tget entries(): ReadonlyMap {\n\t\treturn new Map([...this._dictionary.entries()]);\n\t}\n\n\tprivate _size: MutableVariable | undefined;\n\tget size(): ScalarProvider {\n\t\treturn (this._size ??= new MutableVariable(this._dictionary.size));\n\t}\n}\n\nconst getDictionaryStream = WeakCache, AlanDictionaryVariable>(\n\t(dictionary) => new AlanDictionaryVariable(dictionary)\n);\n\nexport function toVariable<\n\tN extends (api_cs.AlanNode | api_modifications.AlanNode) & { properties: Record }\n>(\n\tnode: N,\n\ttext_property_name: KeysOfType>\n): ScalarProvider;\n\nexport function toVariable<\n\tN extends (api_cs.AlanNode | api_modifications.AlanNode) & { properties: Record }\n>(node: N, number_property_name: KeysOfType): ScalarProvider;\n\nexport function toVariable>(stategroup: T): ScalarProvider>>;\n\nexport function toVariable(\n\tdictionary: api_cs.AlanDictionary<{ node: E; init: any }, any>\n): DictionaryProvider;\n\nexport function toVariable(alan_object: api_cs.IAlanObject, property_name?: string): Scalar {\n\tif (alan_object instanceof api_cs.AlanDictionary) {\n\t\treturn getDictionaryStream(alan_object);\n\t}\n\tif (alan_object instanceof api_cs.StateGroup) {\n\t\treturn getStategroupStream(alan_object);\n\t}\n\treturn getScalarStream(alan_object as any, property_name!);\n}\n\nexport function toStream<\n\tN extends (api_cs.AlanNode | api_modifications.AlanNode) & { properties: Record }\n>(\n\tnode: N,\n\ttext_property_name: KeysOfType>\n): InitializedDynamicDefaultExpressionBuilder;\n\nexport function toStream<\n\tN extends (api_cs.AlanNode | api_modifications.AlanNode) & { properties: Record }\n>(\n\tnode: N,\n\tnumber_property_name: KeysOfType\n): InitializedDynamicDefaultExpressionBuilder;\n\nexport function toStream>(\n\tstategroup: T\n): InitializedDynamicStategroupExpressionBuilder>>;\n\nexport function toStream(\n\tdictionary: api_cs.AlanDictionary<{ node: E; init: any }, any>\n): InitializedStaticDictionaryExpressionBuilder;\n\nexport function toStream(alan_object: api_cs.IAlanObject, property_name?: string): () => Scalar {\n\tif (alan_object instanceof api_cs.AlanDictionary) {\n\t\treturn createDictionaryExpressionBuilder(getDictionaryStream(alan_object));\n\t}\n\tif (alan_object instanceof api_cs.StateGroup) {\n\t\treturn createStategroupExpressionBuilder(getStategroupStream(alan_object));\n\t}\n\treturn createExpressionBuilder(getScalarStream(alan_object as any, property_name!));\n}\n\nexport class PromiseSynchronizer extends ScalarProvider implements ScalarConsumer> {\n\tprivate _subscriber: ScalarConsumer | undefined;\n\tprivate _value: Type | Pending | undefined;\n\n\tconstructor(readonly source: ScalarProvider>, readonly __origin?: string) {\n\t\tsuper();\n\t}\n\n\tget value() {\n\t\tif (this._subscriber === undefined) {\n\t\t\treturn Pending;\n\t\t} else {\n\t\t\treturn this._value!;\n\t\t}\n\t}\n\n\tupdate(promise: Promise) {\n\t\tif (this._value === undefined) {\n\t\t\tthis._value = Pending;\n\t\t\tthis._subscriber!.update(this._value);\n\t\t}\n\t\tpromise.then((value) => {\n\t\t\tthis._value = value;\n\t\t\tthis._subscriber?.update(this._value);\n\t\t});\n\t}\n\n\tsubscribe(subscriber: ScalarConsumer): typeof subscriber {\n\t\tif (this._subscriber !== undefined) throw new Error(\"unexpected\");\n\t\tthis._subscriber = subscriber;\n\t\tthis.source.subscribe(this);\n\t\treturn subscriber;\n\t}\n\n\tunsubscribe(subscriber: ScalarConsumer) {\n\t\tif ((global)?.alan_strict && this._subscriber !== subscriber) throw new Error(\"unexpected\");\n\t\tthis._subscriber = undefined;\n\t\tthis.source.unsubscribe(this);\n\t\tthis._value = undefined;\n\t}\n}\n\nexport function synchronize(source: ScalarProvider>): ScalarProvider {\n\treturn new PromiseSynchronizer(source);\n}\n","export function promiseSeries(promise_constructors: (() => Promise)[]): Promise {\n\treturn promise_constructors.reduce(async (previous_promise, next_promise) => {\n\t\tawait previous_promise;\n\t\treturn await next_promise();\n\t}, Promise.resolve());\n}\n\nexport function Throttle(): { (callback: () => void): void; cancel(): void } {\n\tlet busy = false;\n\tlet cancel = false;\n\tconst throttle = (callback: () => void) => {\n\t\tif (busy || cancel) {\n\t\t\treturn;\n\t\t}\n\t\tbusy = true;\n\t\trequestAnimationFrame(() => {\n\t\t\tbusy = false;\n\t\t\tif (!cancel) {\n\t\t\t\tcallback();\n\t\t\t}\n\t\t});\n\t};\n\tthrottle.cancel = () => {\n\t\tcancel = true;\n\t};\n\treturn throttle;\n}\n\nexport function createCSVBlob(raw_csv_string: string): Blob {\n\treturn new Blob([\"\\ufeff\" + raw_csv_string], { type: \"text/csv;charset=utf-8;\" });\n}\n\nconst numberFormatterCache = new Map();\n\nexport function numberToLocaleString(num: number): string {\n\tconst locale = window.navigator.language || window.navigator.languages[0];\n\tif (!numberFormatterCache.has(locale)) {\n\t\tnumberFormatterCache.set(\n\t\t\tlocale,\n\t\t\tIntl.NumberFormat(locale, {\n\t\t\t\tmaximumFractionDigits: 20,\n\t\t\t})\n\t\t);\n\t}\n\treturn numberFormatterCache.get(locale)!.format(num);\n}\n\nexport function pad(value: string, pad_length: number, pad_string: string): string {\n\tconst value_length = value.length;\n\tconst fill_length = pad_length - value_length;\n\tif (fill_length <= 0) {\n\t\treturn value;\n\t}\n\tconst character_length = pad_string.length;\n\tlet padded_string = \"\";\n\tfor (let i = 0; i < fill_length; i += character_length) {\n\t\tpadded_string += pad_string;\n\t}\n\treturn padded_string.slice(0, fill_length).concat(value);\n}\n\nexport function raw_state_name(raw_state: S | [S, any]): S {\n\tif (raw_state instanceof Array) {\n\t\treturn raw_state[0];\n\t}\n\treturn raw_state;\n}\n","export function isDefined(obj: T | undefined): T {\n\tif (obj === undefined) {\n\t\tthrow new Error(\"Object is undefined.\");\n\t}\n\treturn obj;\n}\n\nexport function isNonNull(obj: T | null): T {\n\tif (obj === null) {\n\t\tthrow new Error(\"Object is null.\");\n\t}\n\treturn obj;\n}\n\nexport function identity(value: T): T {\n\treturn value;\n}\n\nexport function select(predicate: boolean, when: (() => T) | T, otherwise: (() => T) | T): T {\n\tif (predicate) {\n\t\treturn typeof when === \"function\" ? (when as () => T)() : when;\n\t} else {\n\t\treturn typeof otherwise === \"function\" ? (otherwise as () => T)() : otherwise;\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function catchTyped(t: { new (): T }, reason: any): Promise {\n\tif (reason instanceof t) {\n\t\treturn Promise.resolve(reason);\n\t} else {\n\t\treturn Promise.reject(reason);\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function ensure(val: any, type: { new (...args: any): T }): T {\n\tif (!(val instanceof type)) {\n\t\tthrow new Error(\"Expected current binding context to be of type '\" + type + \"'.\");\n\t}\n\treturn val;\n}\n","import { api_configuration } from \"common\";\nimport api_controls = api_configuration.libraries.gui_definition_lib.libraries.control_bundle_lib.libraries.controls_lib.types.control_library.alan_api;\n\nexport type ControlContract = (\n\tparent_dom_node: HTMLElement,\n\tview_root: HTMLElement,\n\ton_destroy: (callback: () => void) => void,\n\tdata: any\n) => ControlProperties;\nexport interface ControlNumberProperty {\n\t(value: number): void;\n}\nexport interface ControlTextProperty {\n\t(value: string): void;\n}\nexport interface ControlCollectionProperty {\n\tinitialize: (\n\t\ton_destroy: Destructor,\n\t\tdata: CollectionData\n\t) => {\n\t\tadd: (\n\t\t\tkey: string,\n\t\t\tdestructor: Destructor,\n\t\t\tdata: ControlData\n\t\t) => {\n\t\t\tentry: ControlProperties;\n\t\t\tremove: () => void;\n\t\t};\n\t\tsort?: (sorted: string[]) => void;\n\t};\n}\nexport type ControlStateGroupProperty = Record<\n\tstring,\n\t(destructor: Destructor, data: ControlData) => ControlProperties\n>;\nexport type ControlInstructionProperty = (handler: (...args: any) => void) => void;\nexport type ControlMarkupProperty = () => HTMLElement;\nexport type ControlControlProperty = (destructor: Destructor, data: ControlData) => ControlProperties;\nexport type ControlProperty =\n\t| ControlNumberProperty\n\t| ControlTextProperty\n\t| ControlCollectionProperty\n\t| ControlStateGroupProperty\n\t| ControlInstructionProperty\n\t| ControlMarkupProperty\n\t| ControlControlProperty;\nexport type ControlProperties = Record;\nexport type Destructor = (destructed: () => void) => void;\nexport type CollectionData = {\n\tentries: Map;\n\tsort: string[];\n};\nexport type StateData = { name: string; node: ControlData };\ntype InstructionData = (...args: any) => void;\ntype PropertyData = string | number | CollectionData | StateData | InstructionData | ControlData;\nexport type ControlData = { [key: string]: PropertyData };\n\nlet control_library: Record | undefined = undefined;\nexport function loadControls(controls: Record): void {\n\tcontrol_library = controls;\n}\n\nexport function getControl(\n\tname: string,\n\tparent: HTMLElementConstructor,\n\tview_root: HTMLElementConstructor,\n\tdestructor: Destructor\n): ControlProperties {\n\tif (control_library === undefined) {\n\t\tthrow new Error(\"Control library is not initialized\");\n\t}\n\tconst control_definition = control_library[name];\n\tif (control_definition === undefined) {\n\t\tthrow new Error(`Control ${name} not found`);\n\t}\n\tconst control_implementation = global.control_implementations[name]!;\n\tconst control_initializer = new ControlWrapper(\n\t\tcontrol_implementation,\n\t\tparent,\n\t\tview_root,\n\t\tdestructor,\n\t\tcontrol_definition.properties.node\n\t);\n\treturn control_initializer.properties;\n}\n\nlet synching = false;\nfunction requestSync() {\n\tif (synching) {\n\t\treturn;\n\t}\n\tsynching = true;\n\trequestAnimationFrame(() => {\n\t\tfor (const deferred_call of deferred_control_calls) {\n\t\t\tdeferred_call.syncData();\n\t\t}\n\t\tfor (const deferred_call of deferred_control_calls) {\n\t\t\tdeferred_call.doSync();\n\t\t}\n\t\tdeferred_control_calls.clear();\n\t\tsynching = false;\n\t});\n}\n\nexport async function ControlsAreSynchronized(): Promise {\n\twhile (synching) {\n\t\tawait new Promise((resolve) => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t}\n}\n\nconst deferred_control_calls = new Set();\nfunction onSyncData(property: SynchronizedProperty) {\n\tif (synching) {\n\t\t// Synchronize the data, because new control calls can be done while synchronizing.\n\t\tproperty.syncData();\n\t}\n\tdeferred_control_calls.add(property);\n}\n\nfunction createPropertiesWrapperConstructor(\n\tnode: api_controls.Ccontrol_node\n): (data: ControlData, destructor: Destructor, getProperties: () => ControlProperties) => ControlProperties {\n\tconst contract_prototype: ControlProperties = {};\n\t//TODO const data_prototype: ControlData = {};\n\n\tconst instructions: ((\n\t\tcontract: ControlProperties,\n\t\tdata: ControlData,\n\t\tdestructor: Destructor,\n\t\tgetProperties: () => ControlProperties\n\t) => void)[] = [];\n\n\tfor (const attribute of node.properties.attributes.values()) {\n\t\tconst attribute_name = attribute.key;\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"control\": {\n\t\t\t\tconst $ = attribute.properties.type.state.node;\n\t\t\t\tcontract_prototype[attribute_name] = null as unknown as ControlProperty;\n\t\t\t\tconst control_node = $.properties.control.ref.key.ref.properties.node;\n\t\t\t\tinstructions.push((contract, data, destructor, getProperties) => {\n\t\t\t\t\tconst control_wrapper = new ControlControlWrapper(\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tcontrol_node,\n\t\t\t\t\t\tattribute_name,\n\t\t\t\t\t\tdata,\n\t\t\t\t\t\tgetProperties\n\t\t\t\t\t);\n\t\t\t\t\tcontract[attribute_name] = control_wrapper.initializer;\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"instruction\": {\n\t\t\t\tcontract_prototype[attribute_name] = noop;\n\t\t\t\tinstructions.push((contract, data, destructor, getProperties) => {\n\t\t\t\t\tlet handler: (...args: any) => void;\n\t\t\t\t\tconst sync_wrapper = new GenericSyncher(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t(getProperties()[attribute_name] as ControlInstructionProperty)(handler);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tdata[attribute_name] = handler;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tcontract[attribute_name] = (h: (...args: any) => void) => {\n\t\t\t\t\t\thandler = h;\n\t\t\t\t\t\tsync_wrapper.update();\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"markup\": {\n\t\t\t\tcontract_prototype[attribute_name] = noop;\n\t\t\t\tinstructions.push((contract, _data, _destructor, getProperties) => {\n\t\t\t\t\tcontract[attribute_name] = () => {\n\t\t\t\t\t\treturn (getProperties()[attribute_name] as ControlMarkupProperty)();\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\tcontract_prototype[attribute_name] = {};\n\t\t\t\t\t\tconst propertiesConstructor = createPropertiesWrapperConstructor($.properties.node);\n\t\t\t\t\t\tinstructions.push((contract, data, _destructor, getProperties) => {\n\t\t\t\t\t\t\tconst collection_data: CollectionData = (data[attribute_name] = {\n\t\t\t\t\t\t\t\tentries: new Map(),\n\t\t\t\t\t\t\t\tsort: [],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst wrapper = new CollectionWrapper(\n\t\t\t\t\t\t\t\tcollection_data,\n\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\treturn getProperties()[attribute_name]! as ControlCollectionProperty;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t(entry_data, entry_destructor, getEntryProperties) => {\n\t\t\t\t\t\t\t\t\treturn propertiesConstructor(entry_data, entry_destructor, getEntryProperties);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tcontract[attribute_name] = wrapper.initializer;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tcontract_prototype[attribute_name] = noop;\n\t\t\t\t\t\tinstructions.push((contract, data, destructor, getProperties) => {\n\t\t\t\t\t\t\tconst wrapper = new NumberPropertyWrapper(attribute_name, data, destructor, getProperties);\n\t\t\t\t\t\t\tconst update_function: ControlNumberProperty = (value) => {\n\t\t\t\t\t\t\t\twrapper.update(value);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tcontract[attribute_name] = update_function;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst state_group = property.properties.type.state.node;\n\t\t\t\t\t\tcontract_prototype[attribute_name] = {};\n\t\t\t\t\t\tconst state_constructors = new Map<\n\t\t\t\t\t\t\tstring,\n\t\t\t\t\t\t\t(data: ControlData, destructor: Destructor, getProperties: () => ControlProperties) => ControlProperties\n\t\t\t\t\t\t>();\n\t\t\t\t\t\tfor (const [name, state] of state_group.properties.states) {\n\t\t\t\t\t\t\t(contract_prototype[attribute_name] as ControlStateGroupProperty)[state.key] =\n\t\t\t\t\t\t\t\tnoop as unknown as ControlStateGroupProperty[1];\n\t\t\t\t\t\t\tstate_constructors.set(name, createPropertiesWrapperConstructor(state.properties.node));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinstructions.push((contract, data, _destructor, getProperties) => {\n\t\t\t\t\t\t\tlet proxy: any | undefined = undefined;\n\t\t\t\t\t\t\tObject.defineProperty(contract, attribute_name, {\n\t\t\t\t\t\t\t\tget: () => {\n\t\t\t\t\t\t\t\t\tif (proxy !== undefined) return proxy;\n\t\t\t\t\t\t\t\t\tconst local_proxy = new Proxy(\n\t\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tget: (_, name: string) => {\n\t\t\t\t\t\t\t\t\t\t\t\treturn (state_destructor: Destructor, state_data: ControlData) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst state_wrapper = new StateWrapper(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstate_destructor,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tattribute_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstate_data,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t() => getProperties()[attribute_name] as ControlStateGroupProperty\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\tstate_wrapper.set_state();\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst propertiesConstructor = state_constructors.get(name)!;\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn propertiesConstructor(state_data, state_destructor, () => state_wrapper.properties);\n\t\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tproxy = local_proxy;\n\t\t\t\t\t\t\t\t\treturn proxy;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tcontract_prototype[attribute_name] = noop;\n\t\t\t\t\t\tinstructions.push((contract, data, destructor, getProperties) => {\n\t\t\t\t\t\t\tconst wrapper = new TextPropertyWrapper(attribute_name, data, destructor, getProperties);\n\t\t\t\t\t\t\tconst func: ControlTextProperty = (value) => {\n\t\t\t\t\t\t\t\twrapper.update(value);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tcontract[attribute_name] = func;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t}\n\t}\n\n\treturn (data, destructor, getProperties) => {\n\t\tconst contract: ControlProperties = Object.create(contract_prototype);\n\t\tconst instruction_length = instructions.length;\n\t\tfor (let i = 0; i < instruction_length; i++) {\n\t\t\tinstructions[i](contract, data, destructor, getProperties);\n\t\t}\n\t\treturn contract;\n\t};\n}\n\nabstract class SynchronizedProperty {\n\tprivate sync_requested = false;\n\tprotected destroyed = false;\n\tconstructor(destructor: Destructor | undefined) {\n\t\tdestructor?.(() => {\n\t\t\tthis.destroyed = true;\n\t\t\tdeferred_control_calls.delete(this);\n\t\t});\n\t}\n\tprotected requestSync() {\n\t\tif (this.sync_requested) {\n\t\t\treturn;\n\t\t}\n\t\trequestSync();\n\t\tthis.sync_requested = true;\n\t\tonSyncData(this);\n\t}\n\tpublic doSync(): void {\n\t\tthis.sync_requested = false;\n\t\tif (!this.destroyed) {\n\t\t\tthis.sync();\n\t\t}\n\t}\n\tpublic abstract sync(): void;\n\tpublic abstract syncData(): void;\n}\n\nclass GenericSyncher extends SynchronizedProperty {\n\tconstructor(private sync_callback: () => void, private sync_data: () => void, destructor: Destructor | undefined) {\n\t\tsuper(destructor);\n\t}\n\tsync(): void {\n\t\tthis.sync_callback();\n\t}\n\tsyncData(): void {\n\t\tthis.sync_data();\n\t}\n\tupdate() {\n\t\tthis.requestSync();\n\t}\n}\n\nclass CollectionWrapper extends SynchronizedProperty {\n\tprivate initialized_collection?: ReturnType;\n\tprivate initialized_entries = new Map<\n\t\tstring,\n\t\t{\n\t\t\tentry: ControlProperties;\n\t\t\tremove: () => void;\n\t\t}\n\t>();\n\tprivate entries_to_add = new Map<\n\t\tstring,\n\t\t{\n\t\t\tdata: ControlData;\n\t\t\tcontract: ControlProperties;\n\t\t\tdestructor: Destructor;\n\t\t}\n\t>();\n\tprivate entries_to_remove = new Set();\n\tprivate sorting: string[] = [];\n\tprivate destructor: Destructor;\n\tprivate should_sort = false;\n\tconstructor(\n\t\tprivate data: CollectionData,\n\t\tprivate control_implementation: () => ControlCollectionProperty,\n\t\tprivate entryContract: (\n\t\t\tdata: ControlData,\n\t\t\tentry_destructor: Destructor,\n\t\t\tgetProperties: () => ControlProperties\n\t\t) => ControlProperties\n\t) {\n\t\tsuper(undefined);\n\t}\n\n\tget initializer(): ControlCollectionProperty {\n\t\treturn {\n\t\t\tinitialize: (destructor) => {\n\t\t\t\tdestructor(() => {\n\t\t\t\t\tdeferred_control_calls.delete(this);\n\t\t\t\t});\n\t\t\t\tthis.requestSync();\n\t\t\t\tthis.destructor = destructor;\n\t\t\t\treturn {\n\t\t\t\t\tadd: (key, entry_destructor, entry_data) => {\n\t\t\t\t\t\tthis.requestSync();\n\t\t\t\t\t\tconst entry_contract = this.entryContract(entry_data, entry_destructor, () => {\n\t\t\t\t\t\t\t//FIXME remove the sync calls or explain why it is needed\n\t\t\t\t\t\t\tthis.syncData();\n\t\t\t\t\t\t\tthis.sync();\n\t\t\t\t\t\t\treturn this.initialized_entries.get(key)!.entry;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tthis.entries_to_add.set(key, {\n\t\t\t\t\t\t\tdata: entry_data,\n\t\t\t\t\t\t\tdestructor: entry_destructor,\n\t\t\t\t\t\t\tcontract: entry_contract,\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tentry: entry_contract,\n\t\t\t\t\t\t\tremove: () => {\n\t\t\t\t\t\t\t\tthis.requestSync();\n\t\t\t\t\t\t\t\tif (this.entries_to_add.has(key)) {\n\t\t\t\t\t\t\t\t\tthis.entries_to_add.delete(key);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tthis.entries_to_remove.add(key);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t\tsort: (sorting) => {\n\t\t\t\t\t\tthis.sorting = sorting;\n\t\t\t\t\t\tthis.should_sort = true;\n\t\t\t\t\t\tthis.requestSync();\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n\tsyncData(): void {\n\t\tfor (const entry of this.entries_to_remove) {\n\t\t\tthis.data.entries.delete(entry);\n\t\t}\n\t\tfor (const [key, entry] of this.entries_to_add) {\n\t\t\tthis.data.entries.set(key, entry.data);\n\t\t}\n\t\tthis.data.sort = this.sorting ?? this.data.sort ?? [];\n\t}\n\tsync(): void {\n\t\tif (this.initialized_collection === undefined) {\n\t\t\tthis.initialized_collection = this.control_implementation().initialize(\n\t\t\t\tDestructorWrapper.wrap(this.destructor),\n\t\t\t\tthis.data\n\t\t\t);\n\t\t}\n\t\tfor (const entry of this.entries_to_remove) {\n\t\t\tconst initialized_entry = this.initialized_entries.get(entry);\n\t\t\tif (initialized_entry !== undefined) {\n\t\t\t\tinitialized_entry.remove();\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, entry] of this.entries_to_add) {\n\t\t\tconst initialized_entry = this.initialized_collection.add(\n\t\t\t\tkey,\n\t\t\t\tDestructorWrapper.wrap(entry.destructor),\n\t\t\t\tentry.data\n\t\t\t);\n\t\t\tthis.initialized_entries.set(key, initialized_entry);\n\t\t}\n\t\tif (this.should_sort === true) {\n\t\t\tthis.initialized_collection.sort?.(this.sorting);\n\t\t}\n\t\tthis.entries_to_add.clear();\n\t\tthis.entries_to_remove.clear();\n\t\tthis.should_sort = false;\n\t}\n}\n\nclass DestructorWrapper extends SynchronizedProperty {\n\tprivate callback: (() => void) | undefined = undefined;\n\tprivate should_call_callback = false;\n\tconstructor(private destructor: Destructor) {\n\t\tsuper(undefined);\n\t\tthis.destructor(() => {\n\t\t\tthis.should_call_callback = true;\n\t\t\tthis.requestSync();\n\t\t});\n\t}\n\tsync(): void {\n\t\tif (this.should_call_callback) {\n\t\t\tthis.callback?.();\n\t\t}\n\t}\n\tsyncData() {\n\t\t// nothing to synchronize.\n\t}\n\tget wrapped_destructor(): Destructor {\n\t\treturn (callback) => {\n\t\t\tif (this.should_call_callback) {\n\t\t\t\tcallback();\n\t\t\t} else {\n\t\t\t\tthis.callback = callback;\n\t\t\t}\n\t\t};\n\t}\n\n\tstatic wrap(destructor: Destructor): Destructor {\n\t\treturn new DestructorWrapper(destructor).wrapped_destructor;\n\t}\n}\n\nclass StateWrapper extends SynchronizedProperty {\n\tprivate initialized_properties: ControlProperties;\n\tconstructor(\n\t\tprivate destructor: Destructor,\n\t\tprivate state_group_name: string,\n\t\tprivate name: string,\n\t\tprivate parent_data: ControlData,\n\t\tprivate data: ControlData,\n\t\tprivate control_implementation: () => ControlStateGroupProperty\n\t) {\n\t\tsuper(destructor);\n\t}\n\tget properties() {\n\t\tif (this.initialized_properties === undefined) {\n\t\t\tthis.initialized_properties = this.control_implementation()[this.name](\n\t\t\t\tDestructorWrapper.wrap(this.destructor),\n\t\t\t\tthis.data\n\t\t\t);\n\t\t}\n\t\treturn this.initialized_properties;\n\t}\n\tset_state(): void {\n\t\tthis.requestSync();\n\t}\n\tsync(): void {\n\t\tthis.initialized_properties = this.control_implementation()[this.name](\n\t\t\tDestructorWrapper.wrap(this.destructor),\n\t\t\tthis.data\n\t\t);\n\t}\n\tsyncData() {\n\t\tthis.parent_data[this.state_group_name] = {\n\t\t\tname: this.name,\n\t\t\tnode: this.data,\n\t\t};\n\t}\n}\n\nclass TextPropertyWrapper extends SynchronizedProperty {\n\tprivate value: string;\n\tconstructor(\n\t\tprivate name: string,\n\t\tprivate data: ControlData,\n\t\tdestructor: Destructor,\n\t\tprivate getProperties: () => ControlProperties\n\t) {\n\t\tsuper(destructor);\n\t}\n\tupdate(value: string): void {\n\t\tthis.value = value;\n\t\tthis.requestSync();\n\t}\n\tsyncData(): void {\n\t\tthis.data[this.name] = this.value;\n\t}\n\tsync(): void {\n\t\t(this.getProperties()[this.name] as ControlTextProperty)(this.value);\n\t}\n}\n\nclass NumberPropertyWrapper extends SynchronizedProperty {\n\tprivate value: number;\n\tconstructor(\n\t\tprivate name: string,\n\t\tprivate data: ControlData,\n\t\tdestructor: Destructor,\n\t\tprivate getProperties: () => ControlProperties\n\t) {\n\t\tsuper(destructor);\n\t}\n\tupdate(value: number): void {\n\t\tthis.value = value;\n\t\tthis.requestSync();\n\t}\n\tsyncData(): void {\n\t\tthis.data[this.name] = this.value;\n\t}\n\tsync(): void {\n\t\t(this.getProperties()[this.name] as ControlNumberProperty)(this.value);\n\t}\n}\n\nclass ControlControlWrapper extends SynchronizedProperty {\n\tprivate initialized_control: ControlProperties;\n\tprivate property_wrappers: ControlProperties;\n\tprivate data: ControlData = {};\n\n\tconstructor(\n\t\tprivate destructor: Destructor,\n\t\tprivate node: api_controls.Ccontrol_node,\n\t\tprivate attribute_name: string,\n\t\tprivate parent_data: ControlData,\n\t\tprivate getProperties: () => ControlProperties\n\t) {\n\t\tsuper(destructor);\n\t\tthis.requestSync();\n\t\tlet properties_constructor = controlConstructors.get(this.node);\n\t\tif (properties_constructor === undefined) {\n\t\t\tproperties_constructor = createPropertiesWrapperConstructor(this.node);\n\t\t\tcontrolConstructors.set(this.node, properties_constructor);\n\t\t}\n\t\tthis.property_wrappers = properties_constructor(this.data, destructor, () => {\n\t\t\treturn this.initialized_control;\n\t\t});\n\t}\n\n\tget properties(): ControlProperties {\n\t\treturn this.property_wrappers;\n\t}\n\n\tget initializer(): ControlControlProperty {\n\t\treturn (control_destructor) => {\n\t\t\tthis.destructor = control_destructor;\n\t\t\treturn this.property_wrappers;\n\t\t};\n\t}\n\tsync(): void {\n\t\tthis.initialized_control = (this.getProperties()[this.attribute_name] as ControlControlProperty)(\n\t\t\tDestructorWrapper.wrap(this.destructor),\n\t\t\tthis.data\n\t\t);\n\t}\n\tsyncData(): void {\n\t\tthis.parent_data[this.attribute_name] = this.data;\n\t}\n}\n\ntype HTMLElementConstructor = () => HTMLElement;\n\nconst controlConstructors = new Map<\n\tapi_controls.Ccontrol_node,\n\tReturnType\n>();\n\nclass ControlWrapper extends SynchronizedProperty {\n\tprivate initialized_control: ControlProperties;\n\tprivate property_wrappers: ControlProperties;\n\tprivate data: ControlData = {};\n\n\tconstructor(\n\t\tprivate initializer: ControlContract,\n\t\tprivate parent: HTMLElementConstructor,\n\t\tprivate view_root: HTMLElementConstructor,\n\t\tprivate destructor: Destructor,\n\t\tprivate node: api_controls.Ccontrol_node\n\t) {\n\t\tsuper(destructor);\n\t\tthis.requestSync();\n\t\tlet properties_constructor = controlConstructors.get(this.node);\n\t\tif (properties_constructor === undefined) {\n\t\t\tproperties_constructor = createPropertiesWrapperConstructor(this.node);\n\t\t\tcontrolConstructors.set(this.node, properties_constructor);\n\t\t}\n\t\tthis.property_wrappers = properties_constructor(this.data, destructor, () => {\n\t\t\treturn this.initialized_control;\n\t\t});\n\t}\n\tget properties(): ControlProperties {\n\t\treturn this.property_wrappers;\n\t}\n\tsync(): void {\n\t\tif (this.initialized_control === undefined) {\n\t\t\tthis.initialized_control = this.initializer(this.parent(), this.view_root(), this.destructor, this.data);\n\t\t}\n\t}\n\tsyncData(): void {\n\t\t//noop\n\t}\n}\n\nfunction noop() {\n\t//noop\n}\n","import { api_configuration } from \"../../common\";\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_widget = api_configuration.libraries.gui_definition_lib.types.widget.alan_api;\nimport api_modification = api_configuration.types.modifications.alan_api;\nimport csr = api_configuration.types.client_state.alan_api;\nimport { PropertiesBinding, CollectionPropertyBinding, StateGroupBinding } from \"./ClientBinderTypes\";\nimport { isDefined } from \"../validation\";\nimport { NumberConverter } from \"./number_converter\";\nimport DestructorTree from \"../DestructorTree\";\n\ntype ApiNode = csr.AlanObject & {\n\tproperties: Record;\n};\nexport type WidgetConfigurationNode =\n\t| api_views.Cgui_widget_configuration_node\n\t| api_modification.Cconfiguration_node\n\t| api_widget.Cwidget_configuration_node;\nexport default class ImplementationVisitorContext {\n\tprivate _explicit_context: ImplementationVisitorContext | undefined;\n\n\tconstructor(\n\t\texplicit_context: ImplementationVisitorContext | undefined,\n\t\tpublic readonly widget_configuration: WidgetConfigurationNode,\n\t\tprivate _model_binding: api_views.Cmodel_binding | undefined,\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\t\tprivate _client_state_binder: any,\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\t\tprivate _current_binding_context: any,\n\t\tprivate _parent_widget_implementation_context: ImplementationVisitorContext | undefined,\n\t\tprivate _view_root: () => HTMLElement,\n\t\tprivate _client_view: csr.Copen_views,\n\t\tprivate _view_context_node: csr.Cnode,\n\t\tprivate _entry_keys: string[],\n\t\tpublic readonly last_gui_widget_configuration: api_views.Cgui_widget_configuration_node,\n\t\tpublic readonly number_converter: NumberConverter | undefined,\n\t\tpublic id_generator = createIdGenerator()\n\t) {\n\t\tif (_client_state_binder === undefined) {\n\t\t\tthrow new Error(\"parameter client state binder can not be undefined\");\n\t\t}\n\t\tthis._explicit_context = explicit_context;\n\t}\n\n\tstatic create(\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\t\tbinding_context: any,\n\t\tgui_widget_configuration: api_views.Cgui_widget_configuration_node,\n\t\tgui_model_binding: api_views.Cmodel_binding | undefined,\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\t\tclient_state_binder: any,\n\t\tview_root: () => HTMLElement,\n\t\tclient_view: csr.Copen_views,\n\t\tentry_keys: string[]\n\t): ImplementationVisitorContext {\n\t\treturn new ImplementationVisitorContext(\n\t\t\tundefined,\n\t\t\tgui_widget_configuration,\n\t\t\tgui_model_binding,\n\t\t\tclient_state_binder,\n\t\t\tbinding_context,\n\t\t\tundefined,\n\t\t\tview_root,\n\t\t\tclient_view,\n\t\t\tclient_view.properties.view_context.output.result_node(),\n\t\t\tentry_keys.slice(),\n\t\t\tgui_widget_configuration,\n\t\t\tundefined,\n\t\t\tundefined\n\t\t);\n\t}\n\n\tget explicit_context(): ImplementationVisitorContext {\n\t\treturn this._explicit_context ?? this;\n\t}\n\n\tget current_binding_context(): ApiNode {\n\t\treturn this._current_binding_context;\n\t}\n\n\tget clientStateAsNode(): csr.Cnode {\n\t\tif (!(this._current_binding_context instanceof csr.Cnode)) {\n\t\t\tthrow new Error(\"Expected client state to be of type Cnode\");\n\t\t}\n\t\treturn this._current_binding_context;\n\t}\n\n\tget gui_widget_configuration(): api_views.Cgui_widget_configuration_node {\n\t\treturn this.widget_configuration as api_views.Cgui_widget_configuration_node;\n\t}\n\n\tget model_binding(): api_views.Cmodel_binding {\n\t\treturn isDefined(this._model_binding);\n\t}\n\n\tget raw_model_binding(): api_views.Cmodel_binding | undefined {\n\t\treturn this._model_binding;\n\t}\n\n\tget client_state_binder_AsPropertiesBinding(): PropertiesBinding {\n\t\treturn this._client_state_binder;\n\t}\n\n\tget client_state_binder(): any {\n\t\treturn this._client_state_binder;\n\t}\n\n\tget entry_keys(): string[] {\n\t\treturn this._entry_keys;\n\t}\n\n\tget_view_root(): () => HTMLElement {\n\t\treturn this._view_root;\n\t}\n\n\tget_client_view(): csr.Copen_views {\n\t\treturn this._client_view;\n\t}\n\n\tget view_context_node(): csr.Cnode {\n\t\treturn this._view_context_node;\n\t}\n\n\tget_client_state_binder_AsStateGroupBinding(property: string): StateGroupBinding {\n\t\tif (this._client_state_binder.properties[property] === undefined) {\n\t\t\tthrow new Error(\"Property '\" + property + \"' does not exist\");\n\t\t}\n\t\treturn this._client_state_binder.properties[property];\n\t}\n\n\tget_client_state_binder_AsCollectionBinding(property: string): CollectionPropertyBinding {\n\t\tif (this._client_state_binder.properties[property] === undefined) {\n\t\t\tthrow new Error(\"Property '\" + property + \"' does not exist\");\n\t\t}\n\t\treturn this._client_state_binder.properties[property];\n\t}\n\n\tget parent_widget_implementation_context(): ImplementationVisitorContext {\n\t\treturn isDefined(this._parent_widget_implementation_context);\n\t}\n\n\tget root_widget_implementation_context(): ImplementationVisitorContext {\n\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\tlet candidate: ImplementationVisitorContext = this;\n\t\twhile (candidate._parent_widget_implementation_context !== undefined) {\n\t\t\tcandidate = candidate._parent_widget_implementation_context;\n\t\t}\n\t\treturn candidate;\n\t}\n\n\tswitchGuiWidgetConfiguration(new_gui_widget_configuration: WidgetConfigurationNode): ImplementationVisitorContext {\n\t\treturn this.changeState({ new_widget_configuration: new_gui_widget_configuration });\n\t}\n\n\tswitchGuiModelBinding(new_gui_model_binding: api_views.Cmodel_binding): ImplementationVisitorContext {\n\t\treturn this.changeState({\n\t\t\tnew_model_binding: new_gui_model_binding,\n\t\t});\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tswitchBindingContext(new_binding_context: any): ImplementationVisitorContext {\n\t\tif (new_binding_context === this._current_binding_context) {\n\t\t\treturn this;\n\t\t} else {\n\t\t\treturn this.changeState({\n\t\t\t\tnew_binding_context: new_binding_context,\n\t\t\t});\n\t\t}\n\t}\n\n\tswitchClientStateBinderToProperty(property_name: string, destructor: DestructorTree): ImplementationVisitorContext {\n\t\tconst property_binding = (this._client_state_binder as PropertiesBinding).properties[property_name];\n\t\treturn property_binding!.onContext?.(this, destructor) ?? this;\n\t}\n\n\tswitchClientStateBinder(new_client_state_binder: PropertiesBinding): ImplementationVisitorContext {\n\t\treturn this.changeState({ new_client_state_binder: new_client_state_binder });\n\t}\n\n\tchangeState(new_state: {\n\t\tnew_explicit_context?: ImplementationVisitorContext;\n\t\tnew_client_state_binder?: PropertiesBinding;\n\t\tnew_binding_context?: any;\n\t\tnew_model_binding?: api_views.Cmodel_binding;\n\t\tnew_widget_configuration?: WidgetConfigurationNode;\n\t\tnew_last_gui_widget_configuration?: api_views.Cgui_widget_configuration_node;\n\t\tentry_key?: string | string[];\n\t\tnew_number_converter?: NumberConverter;\n\t\tid_generator?: () => IdGenerator;\n\t}): ImplementationVisitorContext {\n\t\tif (new_state.new_client_state_binder !== undefined && !new_state.new_client_state_binder) {\n\t\t\tthrow new Error(\"client state binder can not be changed to null.\");\n\t\t}\n\t\tif (new_state.new_binding_context !== undefined && !new_state.new_binding_context) {\n\t\t\tthrow new Error(\"new binding context can not be changed to null.\");\n\t\t}\n\t\tconst new_last_gui_widget_configuration =\n\t\t\tnew_state.new_widget_configuration instanceof api_views.Cgui_widget_configuration_node\n\t\t\t\t? new_state.new_widget_configuration\n\t\t\t\t: new_state.new_last_gui_widget_configuration ?? this.last_gui_widget_configuration;\n\t\tconst new_id_generator =\n\t\t\tnew_state.id_generator ||\n\t\t\t(this.id_generator === undefined\n\t\t\t\t? undefined\n\t\t\t\t: new_state.new_widget_configuration === undefined\n\t\t\t\t? this.id_generator\n\t\t\t\t: undefined);\n\n\t\treturn new ImplementationVisitorContext(\n\t\t\tnew_state.new_explicit_context ?? this.explicit_context,\n\t\t\tnew_state.new_widget_configuration || this.widget_configuration,\n\t\t\tnew_state.new_model_binding || this._model_binding,\n\t\t\tnew_state.new_client_state_binder || this._client_state_binder,\n\t\t\tnew_state.new_binding_context || this._current_binding_context,\n\t\t\tthis._parent_widget_implementation_context,\n\t\t\tthis._view_root,\n\t\t\tthis._client_view,\n\t\t\tthis._view_context_node,\n\t\t\tnew_state.entry_key !== undefined\n\t\t\t\t? typeof new_state.entry_key === \"string\"\n\t\t\t\t\t? this.entry_keys.concat(new_state.entry_key)\n\t\t\t\t\t: new_state.entry_key\n\t\t\t\t: this.entry_keys.slice(),\n\t\t\tnew_last_gui_widget_configuration,\n\t\t\tnew_state.new_number_converter ?? this.number_converter,\n\t\t\tnew_id_generator\n\t\t);\n\t}\n\n\tthen(handler: (context: ImplementationVisitorContext) => ImplementationVisitorContext): ImplementationVisitorContext {\n\t\treturn handler(this);\n\t}\n\n\tpush_widget_implementation_frame(): ImplementationVisitorContext {\n\t\treturn new ImplementationVisitorContext(\n\t\t\tundefined,\n\t\t\tthis.widget_configuration,\n\t\t\tthis._model_binding,\n\t\t\tthis._client_state_binder,\n\t\t\tthis._current_binding_context,\n\t\t\tthis.explicit_context,\n\t\t\tthis._view_root,\n\t\t\tthis._client_view,\n\t\t\tthis._view_context_node,\n\t\t\tthis._entry_keys.slice(),\n\t\t\tthis.last_gui_widget_configuration,\n\t\t\tthis.number_converter,\n\t\t\tthis.id_generator\n\t\t);\n\t}\n\n\tuniqueId(context: api_widget.Cunique_id): string {\n\t\treturn this.id_generator().generate(context);\n\t}\n}\n\nlet next_id = 0;\nclass IdGenerator {\n\tprivate ids = new Map();\n\n\tgenerate(context: api_widget.Cunique_id): string {\n\t\tlet id = this.ids.get(context);\n\t\tif (id === undefined) {\n\t\t\tid = \"id:\" + next_id;\n\t\t\tnext_id += 1;\n\t\t\tthis.ids.set(context, id);\n\t\t}\n\t\treturn id;\n\t}\n}\n\nfunction createIdGenerator(): () => IdGenerator {\n\tlet generator: IdGenerator | undefined;\n\treturn () => {\n\t\tif (generator === undefined) {\n\t\t\tgenerator = new IdGenerator();\n\t\t}\n\t\treturn generator;\n\t};\n}\n","import { api_configuration } from \"../../common\";\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport client_state_api = api_configuration.types.client_state.alan_api;\nimport addQueryIfNotExistsAndGet = require(\"../state/addQueryIfNotExistsAndGet\");\nimport reQuery = require(\"../state 2 interface/reQuery\");\nimport getQueryInstanceKey from \"../state/getQueryInstanceKey\";\nimport DestructorTree from \"../DestructorTree\";\nimport { resetFilters } from \"./instructions/queryFilter\";\nimport { subscribeToTranslation } from \"../state/phrases\";\nimport { toStream } from \"../toStream\";\n\nexport function initializeQueryWithModelBinding(\n\tcontext_node: client_state_api.Cnode,\n\tnode_type: api_views.Cnode__query_context,\n\tdestructor: DestructorTree\n): client_state_api.Cquery__client_state {\n\tconst query_definition = node_type.parent.properties.query_context.state.node.output.query();\n\tconst query_context = addQueryIfNotExistsAndGet.forQuery(context_node, query_definition, (query_context) => {\n\t\tconst query_expression = toStream(query_context.properties.delay_query).stateSwitch({\n\t\t\tno: () =>\n\t\t\t\ttoStream(context_node.properties.location).pipe((location) => {\n\t\t\t\t\tquery_expression.unsubscribe(subscription);\n\t\t\t\t\tdestruction_subscription.unsubscribe();\n\t\t\t\t\tswitch (location.tag) {\n\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"remote\":\n\t\t\t\t\t\t\tquery_context.properties.has_result.set(\"no\", {});\n\t\t\t\t\t\t\tresetFilters(query_context);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\treturn undefined;\n\t\t\t\t})(),\n\t\t\tyes: () => undefined,\n\t\t})();\n\t\tconst subscription = query_expression.subscribe({ update: () => undefined });\n\t\tconst destruction_subscription = destructor.onDestroy(() => query_expression.unsubscribe(subscription));\n\t\tfor (const [, column] of query_context.properties.columns) {\n\t\t\tsubscribeToTranslation(column.key.ref.properties.name.entry, destructor, (translation) => {\n\t\t\t\tcolumn.set_name(translation);\n\t\t\t});\n\t\t\tswitch (column.properties.type.state.name) {\n\t\t\t\tcase \"file\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"number\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"state group\": {\n\t\t\t\t\tconst state_group = column.properties.type.state.node;\n\t\t\t\t\tswitch (state_group.properties.has_filter.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst $ = state_group.properties.has_filter.state.node;\n\t\t\t\t\t\t\tfor (const [name, state] of $.properties.states) {\n\t\t\t\t\t\t\t\tsubscribeToTranslation(name, destructor, (translation) => {\n\t\t\t\t\t\t\t\t\tstate.set_name(translation);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(state_group.properties.has_filter.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"text\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"widget\":\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(column.properties.type.state);\n\t\t\t}\n\t\t}\n\n\t\t(query_context as any).__configuration = node_type.parent.properties.configuration;\n\t});\n\n\ttype QueryDependencyCounter = { dependency_count: number };\n\tconst query_patch = query_context as any as QueryDependencyCounter;\n\tif (query_patch.dependency_count === undefined) {\n\t\tquery_patch.dependency_count = 1;\n\t} else {\n\t\tquery_patch.dependency_count += 1;\n\t}\n\tdestructor.onDestroy(() => {\n\t\tif (query_context.destroyed) {\n\t\t\treturn;\n\t\t}\n\t\tquery_patch.dependency_count = query_patch.dependency_count - 1;\n\t\tif (query_patch.dependency_count <= 0) {\n\t\t\tconst query_instance_name = getQueryInstanceKey(query_definition);\n\t\t\tcontext_node.properties.queries.delete(query_instance_name);\n\t\t}\n\t});\n\n\ttype RefreshingQuery = { _refresh_interval?: boolean };\n\tconst query_as_refresh = query_context as unknown as RefreshingQuery;\n\tif (query_as_refresh._refresh_interval !== true) {\n\t\tswitch (node_type.parent.properties.has_refresh_interval.state.name) {\n\t\t\tcase \"yes\": {\n\t\t\t\tquery_as_refresh._refresh_interval = true;\n\t\t\t\tconst yes_has_refresh_interval = node_type.parent.properties.has_refresh_interval.state.node;\n\t\t\t\tconst execute_query = () => {\n\t\t\t\t\tswitch (query_context.properties.delay_query.state.name) {\n\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\treQuery.execute(query_context);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(query_context.properties.delay_query.state);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\texecute_query();\n\t\t\t\tconst timer = setInterval(() => {\n\t\t\t\t\texecute_query();\n\t\t\t\t}, yes_has_refresh_interval.properties.interval.value * 1000);\n\t\t\t\tdestructor.onDestroy(() => clearInterval(timer));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(node_type.parent.properties.has_refresh_interval.state);\n\t\t}\n\t}\n\treturn query_context;\n}\n","import { api_configuration } from \"../../common\";\nimport {\n\tjsdate_2_julian_date,\n\tjsdate_2_julian_datetime,\n\tjulian_datetime_2_gregorian_datetime,\n\tjulian_datetime_2_js_date,\n\tjulian_date_2_js_date,\n\tparseHtmlDate,\n} from \"../calendar/conversion\";\nimport { translate } from \"../front/translate\";\nimport { DatastoreProxy } from \"../interface/DatastoreProxy\";\nimport { login, logout } from \"../state 2 interface/authentication\";\nimport {\n\tevaluateNumericalTypeFilter,\n\tevaluateNumericalTypeProperty,\n\tinitializedNumericalTypeProperties,\n} from \"../state 2 interface/numericalTypeProperties\";\nimport { getReferencedNode } from \"../state/ResolveStatus\";\nimport { serializeHours, serializeMinutes, serializeSeconds } from \"../state 2 interface/serializeNumber\";\nimport { evaluateStyle, initializedStyle } from \"../state 2 interface/style\";\nimport { updateTodo } from \"../state 2 interface/todos\";\nimport { cancelAction, finishAction, reinitializeOperation, continueAction } from \"../state/actions\";\nimport { client_state, getApplicationName, main } from \"../state/ClientState\";\nimport { switchOff, switchOn } from \"../state/editMode\";\nimport { copyPasswordTokenToClipboard, mailPasswordToken, resetPassword } from \"../state/password\";\nimport { deselectEntry, selectEntry } from \"../state/selection\";\nimport { registerQueryEntry, registerCollectionEntries } from \"../state/registerClientState\";\nimport { ensure } from \"../validation\";\nimport { ClientBindings, Formatters, Transformers } from \"./ClientBindings\";\nimport ImplementationVisitorContext from \"./ImplementationVisitorContext\";\nimport select_candidate from \"./instructions/select_candidate\";\nimport { makeNumberConverter } from \"./number_converter\";\nimport to_color from \"./to_color\";\nimport { openViewContext } from \"./view_context\";\nimport parserNumber = require(\"../front 2 state/parseNumber\");\nimport csr = api_configuration.types.client_state.alan_api;\nimport save = require(\"./instructions/save\");\nimport add = require(\"./instructions/add\");\nimport open = require(\"./instructions/open\");\nimport update = require(\"./instructions/update\");\nimport execute = require(\"./instructions/execute\");\nimport duplicate = require(\"./instructions/duplicate\");\nimport deeplink = require(\"./instructions/deeplink\");\nimport reports = require(\"./instructions/reports\");\nimport discard = require(\"./instructions/discard\");\nimport messages = require(\"../front/messages\");\nimport reQuery = require(\"../state 2 interface/reQuery\");\nimport queryFilter = require(\"./instructions/queryFilter\");\nimport fileUpload = require(\"./instructions/fileUpload\");\nimport cancel = require(\"./instructions/cancel\");\nimport { deleteCollectionEntry, deleteQueryEntry } from \"./instructions/delete\";\nimport csv_import = require(\"./instructions/csv_import\");\nimport Window = require(\"../widgets/dom/Window\");\nimport { iGraph } from \"../state/Graph\";\nimport DestructorTree from \"../DestructorTree\";\nimport { deleteFromFilesResource } from \"../interface/FilesResourceProxy\";\nimport { addLocalEntry } from \"../state/addClientState\";\nimport { startOperation } from \"../state/operations\";\nimport { isPasswordProperty } from \"../state/password\";\nimport { referencesResolved } from \"../state 2 interface/referenceResolver\";\nimport * as expressions from \"../state/expressions\";\nimport ReferenceCounter from \"../ReferenceCounter\";\nimport { iReference } from \"../state/Reference\";\nimport * as Rule from \"../state/Rule\";\nimport onSynchronized from \"./instructions/onSynchronized\";\nimport openLandingPage from \"../front/openLandingPage\";\nimport * as Status from \"../Status\";\nimport { sendFeedback } from \"../error-logging\";\nimport { onScalarValue } from \"../../../../../stream\";\nimport { iText } from \"../state/Text\";\nimport { iCollection } from \"../state/Collection\";\nimport { iQuery } from \"../state/Query\";\nimport { iStategroup, iState } from \"../state/Stategroup\";\nimport { checkEntryPermission } from \"../state 2 interface/permissions\";\n\nexport const binding: ClientBindings = {\n\tcollection: {\n\t\tproperties: {\n\t\t\t\"amount of entries\": {\n\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\tconst collection = ensure(implementation_context.current_binding_context, csr.Ccollection);\n\t\t\t\t\tconst subscription = iCollection(collection).amountOfEntries.subscribe({ update: () => undefined });\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\tif (collection.destroyed) return;\n\t\t\t\t\t\tiCollection(collection).amountOfEntries.unsubscribe(subscription);\n\t\t\t\t\t});\n\t\t\t\t\treturn implementation_context;\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is empty\": {\n\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\tconst collection = ensure(implementation_context.current_binding_context, csr.Ccollection);\n\t\t\t\t\tconst subscription = iCollection(collection).isEmpty.subscribe({ update: () => undefined });\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\tif (collection.destroyed) return;\n\t\t\t\t\t\tiCollection(collection).isEmpty.unsubscribe(subscription);\n\t\t\t\t\t});\n\t\t\t\t\treturn implementation_context;\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tsize: {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tmultiple: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tsingle: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"can create entry\": {\n\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\tconst collection = ensure(implementation_context.current_binding_context, csr.Ccollection);\n\t\t\t\t\tconst subscription = iCollection(collection).canCreateEntry.subscribe({ update: () => undefined });\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\tif (collection.destroyed) return;\n\t\t\t\t\t\tiCollection(collection).canCreateEntry.unsubscribe(subscription);\n\t\t\t\t\t});\n\t\t\t\t\treturn implementation_context;\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"add entry\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__can_create_entry__collection\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tadd.addCollectionEntry(client_state.parent);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"add entry with key\": (implementation_context, key) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__can_create_entry__collection\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tadd.addCollectionEntry(client_state.parent, key);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"can download files\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"download all files\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__can_download_files__collection\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfileUpload.downloadFiles(client_state.parent);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is editable\": {\n\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\tconst collection = ensure(implementation_context.current_binding_context, csr.Ccollection);\n\t\t\t\t\tconst subscription = iCollection(collection).canCreateEntry.subscribe({ update: () => undefined });\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\tif (collection.destroyed) return;\n\t\t\t\t\t\tiCollection(collection).canCreateEntry.unsubscribe(subscription);\n\t\t\t\t\t});\n\t\t\t\t\treturn implementation_context;\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"edit mode\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\toff: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch on\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Coff__edit_mode__yes__is_editable__collection\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.edit_mode.set(\"on\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.parent.properties.entries.forEach((entry) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitchOn(entry.properties.node)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\ton: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch off\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Con__edit_mode__yes__is_editable__collection\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.edit_mode.set(\"off\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.parent.properties.entries.forEach((entry) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitchOff(entry.properties.node)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tentries: {\n\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\tconst collection = ensure(implementation_context.current_binding_context, csr.Ccollection);\n\t\t\t\t\tregisterCollectionEntries(collection, destructor);\n\t\t\t\t\treturn implementation_context;\n\t\t\t\t},\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\tentry: (implementation_context) => implementation_context,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"entries are invalid\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"cardinality constraint violation\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tmodified: {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"has ordered graphs\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"last created entry\": {\n\t\t\t\tstates: {\n\t\t\t\t\tentry: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\tentry: (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Centry__last_created_entry\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\tnew_binding_context: client_state.properties.entry.ref,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tnone: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tentry: {\n\t\tproperties: {},\n\t\tbindings: {\n\t\t\tentity: (implementation_context) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__collection);\n\t\t\t\treturn implementation_context.changeState({ new_binding_context: client_state.properties.node });\n\t\t\t},\n\t\t\tstyle: (implementation_context) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__collection);\n\t\t\t\tconst style = initializedStyle(client_state.properties.style);\n\t\t\t\tconst ui = client_state.parent.inferences.collection_type().properties.ui;\n\t\t\t\tswitch (ui.properties.has_style.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst $ = ui.properties.has_style.state.node;\n\t\t\t\t\t\tevaluateStyle(style, $.properties.style_expression, client_state.properties.node);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(ui.properties.has_style.state);\n\t\t\t\t}\n\t\t\t\treturn implementation_context.changeState({ new_binding_context: style });\n\t\t\t},\n\t\t},\n\t},\n\t\"joined entry\": {\n\t\tproperties: {},\n\t\tbindings: {\n\t\t\tentity: (implementation_context) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__collection);\n\t\t\t\treturn implementation_context.changeState({ new_binding_context: client_state.properties.node });\n\t\t\t},\n\t\t\tstyle: (implementation_context) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__collection);\n\t\t\t\tconst style = initializedStyle(client_state.properties.style);\n\t\t\t\tconst ui = client_state.parent.inferences.collection_type().properties.ui;\n\t\t\t\tswitch (ui.properties.has_style.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst $ = ui.properties.has_style.state.node;\n\t\t\t\t\t\tevaluateStyle(style, $.properties.style_expression, client_state.properties.node);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(ui.properties.has_style.state);\n\t\t\t\t}\n\t\t\t\treturn implementation_context.changeState({ new_binding_context: style });\n\t\t\t},\n\t\t},\n\t},\n\tjoin: {\n\t\tproperties: {\n\t\t\t\"amount of entries\": {},\n\t\t\t\"is empty\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tsize: {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tmultiple: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tsingle: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"joined collection\": {\n\t\t\t\tstates: {\n\t\t\t\t\tresolved: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\tcollection: (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cresolved__joined_collection\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\tnew_binding_context: client_state.properties.collection.ref,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tunresolved: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\tentries: {\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\"collection entry\": {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tentry: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\t\t\t\tentry: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Centry__collection_entry\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_binding_context: client_state.properties.entry.ref,\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnone: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"referenced entry\": {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tentry: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"can create entry\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"add entry to collection\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__can_create_entry__entry\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.entry.ref.properties.key.ref.properties.is_set\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.state.name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst $ =\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.entry.ref.properties.key.ref.properties.is_set\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.state.node;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taddLocalEntry(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.parent.parent.parent,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"user\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.properties.text\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunexpectedState(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.entry.ref.properties.key.ref.properties.is_set\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.state\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\t\t\t\tentry: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Centry__referenced_entry\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_binding_context: client_state.properties.entry.ref,\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnone: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tbindings: {\n\t\t\tcollection: (implementation_context) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cyes__joined);\n\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\tnew_binding_context: client_state.parent,\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t},\n\t\"ordered graph\": {\n\t\tproperties: {\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\t\"insert before\": (implementation_context: ImplementationVisitorContext, value1: string, value2: string) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cordered_graphs);\n\t\t\t\tconst collection = client_state.parent.parent;\n\t\t\t\tconst entry_to_move = collection.properties.entries.get(value1);\n\t\t\t\tconst before_entry = collection.properties.entries.get(value2);\n\t\t\t\tif (entry_to_move !== undefined && before_entry !== undefined) {\n\t\t\t\t\tiGraph(client_state).insertBefore(entry_to_move, before_entry);\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"insert after\": (implementation_context: ImplementationVisitorContext, value1: string, value2: string) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cordered_graphs);\n\t\t\t\tconst collection = client_state.parent.parent;\n\t\t\t\tconst entry_to_move = collection.properties.entries.get(value1);\n\t\t\t\tconst after_entry = collection.properties.entries.get(value2);\n\t\t\t\tif (entry_to_move !== undefined && after_entry !== undefined) {\n\t\t\t\t\tiGraph(client_state).insertAfter(entry_to_move, after_entry);\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"move forward\": (implementation_context: ImplementationVisitorContext, value: string) => {\n\t\t\t\tconst ordered_graph = ensure(implementation_context.current_binding_context, csr.Cordered_graphs);\n\t\t\t\tconst collection = ordered_graph.parent.parent;\n\t\t\t\tconst entry = collection.properties.entries.get(value);\n\t\t\t\tif (entry === undefined) return;\n\t\t\t\tiGraph(ordered_graph).moveForward(entry);\n\t\t\t},\n\t\t\t\"move backward\": (implementation_context: ImplementationVisitorContext, value: string) => {\n\t\t\t\tconst ordered_graph = ensure(implementation_context.current_binding_context, csr.Cordered_graphs);\n\t\t\t\tconst collection = ordered_graph.parent.parent;\n\t\t\t\tconst entry = collection.properties.entries.get(value);\n\t\t\t\tif (entry === undefined) return;\n\t\t\t\tiGraph(ordered_graph).moveBackward(entry);\n\t\t\t},\n\t\t\t\"move to sink\": (implementation_context: ImplementationVisitorContext, value: string) => {\n\t\t\t\tconst ordered_graph = ensure(implementation_context.current_binding_context, csr.Cordered_graphs);\n\t\t\t\tconst collection = ordered_graph.parent.parent;\n\t\t\t\tconst entry = collection.properties.entries.get(value);\n\t\t\t\tif (entry === undefined) return;\n\t\t\t\tiGraph(ordered_graph).moveToSink(entry);\n\t\t\t},\n\t\t\t\"move to source\": (implementation_context: ImplementationVisitorContext, value: string) => {\n\t\t\t\tconst ordered_graph = ensure(implementation_context.current_binding_context, csr.Cordered_graphs);\n\t\t\t\tconst collection = ordered_graph.parent.parent;\n\t\t\t\tconst entry = collection.properties.entries.get(value);\n\t\t\t\tif (entry === undefined) return;\n\t\t\t\tiGraph(ordered_graph).moveToSource(entry);\n\t\t\t},\n\t\t},\n\t},\n\t\"sort property\": {\n\t\tproperties: {},\n\t},\n\toperation: {\n\t\tinstruction_handlers: {\n\t\t\treset: (implementation_context) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Coperation__type__attributes);\n\t\t\t\tconst destructor = DestructorTree.create();\n\t\t\t\tconst operation = startOperation(client_state, destructor);\n\t\t\t\t// Trigger the executing state so that the defaults will be applied after resetting the node.\n\t\t\t\toperation.properties.executing.ensure(\"yes\", {\n\t\t\t\t\t\"can continue\": \"no\",\n\t\t\t\t});\n\t\t\t\treinitializeOperation(operation);\n\t\t\t\toperation.properties.executing.ensure(\"no\", {\n\t\t\t\t\t\"last result\": \"not invoked\",\n\t\t\t\t});\n\t\t\t\tdestructor.destroy();\n\t\t\t},\n\t\t},\n\t\tbindings: {\n\t\t\tparameters: (implementation_context, destructor) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Coperation__type__attributes);\n\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\tnew_binding_context: startOperation(client_state, destructor).properties.node,\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tproperties: {\n\t\t\t\"is valid\": {\n\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Coperation__type__attributes);\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: startOperation(client_state, destructor),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texecuting: {\n\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Coperation__type__attributes);\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: startOperation(client_state, destructor),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"last result\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\"not invoked\": { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tfailure: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tsuccess: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"can continue\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontinue: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__can_continue\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (client_state.parent.parent.parent.properties.type.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"action\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontinueAction(client_state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"command\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texecutable: {\n\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Coperation__type__attributes);\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: startOperation(client_state, destructor),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\texecute: (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cyes__executable);\n\t\t\t\t\t\t\t\t\tswitch (client_state.parent.parent.properties.type.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"action\": {\n\t\t\t\t\t\t\t\t\t\t\tconst view_bindings = implementation_context.model_binding.properties.type\n\t\t\t\t\t\t\t\t\t\t\t\t.cast(\"action\")\n\t\t\t\t\t\t\t\t\t\t\t\t.properties.view_bindings.map((view) => view);\n\t\t\t\t\t\t\t\t\t\t\tconst can_use_containing_view = implementation_context.model_binding.properties.type\n\t\t\t\t\t\t\t\t\t\t\t\t.cast(\"action\")\n\t\t\t\t\t\t\t\t\t\t\t\t.properties.can_use_containing_view.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tno: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\tyes: true,\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\tconst view_node_type = implementation_context.model_binding.properties.type\n\t\t\t\t\t\t\t\t\t\t\t\t.cast(\"action\")\n\t\t\t\t\t\t\t\t\t\t\t\t.parent.parent.input.view()\n\t\t\t\t\t\t\t\t\t\t\t\t.properties.node_type.output.result_gui_node()\n\t\t\t\t\t\t\t\t\t\t\t\t.input.application_node();\n\n\t\t\t\t\t\t\t\t\t\t\treturn execute.action(\n\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent,\n\t\t\t\t\t\t\t\t\t\t\t\tview_bindings,\n\t\t\t\t\t\t\t\t\t\t\t\tcan_use_containing_view,\n\t\t\t\t\t\t\t\t\t\t\t\tview_node_type\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"command\": {\n\t\t\t\t\t\t\t\t\t\t\treturn execute.command(client_state.parent);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tunexpectedState(client_state.parent.parent.properties.type.state);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\ttype: {\n\t\t\t\tstates: {\n\t\t\t\t\taction: { binding: { properties: {} } },\n\t\t\t\t\tcommand: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"execute permitted\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tuser: {\n\t\tproperties: {},\n\t\tbindings: {\n\t\t\tnode: function (implementation_context: ImplementationVisitorContext): ImplementationVisitorContext {\n\t\t\t\tensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\treturn implementation_context;\n\t\t\t},\n\t\t},\n\t},\n\t\"engine state\": {\n\t\tproperties: {\n\t\t\tversion: {},\n\t\t\treports: {\n\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\treports.list_reports();\n\t\t\t\t\treturn implementation_context.changeState({ new_binding_context: client_state });\n\t\t\t\t},\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tdefinition: {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tknown: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"of type\": {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tunknown: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpermissions: {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\"read only\": { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\twritable: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"delete template\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cwritable);\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst report_type_name = client_state.parent.properties.definition.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tknown: ($) => $.properties.of_type.entry,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tunknown: \"unknown\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconfirm(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttranslate(\"Delete template\") +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\" '\" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.key +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"' \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttranslate(\"of type\") +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\" '\" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treport_type_name +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"'?\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treports.delete_template(client_state.parent, implementation_context.view_context_node);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"report types\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\"upload template\": function (implementation_context: ImplementationVisitorContext, file_event: File) {\n\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\tcsr.Creport_types__client_state\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treports.upload_template(client_state, file_event, implementation_context.view_context_node);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tstatus: {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state.properties.session }),\n\t\t\t\tstates: {\n\t\t\t\t\tauthenticated: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"anonymous session\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"log in\": () => login(getApplicationName(), DatastoreProxy.instance.connection),\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tusername: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"user found\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cno__anonymous_session\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlet counter: ReferenceCounter | undefined = (client_state as any).__reference_counter;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (counter === undefined) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlet user_destructor = new DestructorTree();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcounter = new ReferenceCounter();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcounter.subscribeConditional(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(value) => value <= 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(empty) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (empty) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_destructor.destroy();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_destructor = new DestructorTree();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonScalarValue(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texpressions.dynamicUser()(undefined),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(user_node) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (Status.isResolved(user_node)) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.root.transact(() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst user_found = client_state.properties.user_found.ensure(\"yes\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(user_found as any).node = user_node;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.properties.user_found.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(scalar, subscription) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_destructor.onDestroy(() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.properties.user_found.ensure(\"no\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tscalar.unsubscribe(subscription);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(client_state as any).__reference_counter = counter;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcounter.add_registration(destructor);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlogout: function () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.properties.session.properties.status.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tauthenticated: function () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlogout(getApplicationName(), DatastoreProxy.instance.connection);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"not authenticated\": undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t\"not authenticated\": {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"log in\": () => login(getApplicationName(), DatastoreProxy.instance.connection),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"server connection status\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tstates: {\n\t\t\t\t\talive: { binding: { properties: {} } },\n\t\t\t\t\tdead: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"network connection status\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tstates: {\n\t\t\t\t\talive: { binding: { properties: {} } },\n\t\t\t\t\tdead: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"platform family\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tstates: {\n\t\t\t\t\tAndroid: { binding: { properties: {} } },\n\t\t\t\t\tmacOS: { binding: { properties: {} } },\n\t\t\t\t\tiOS: { binding: { properties: {} } },\n\t\t\t\t\tLinux: { binding: { properties: {} } },\n\t\t\t\t\tWindows: { binding: { properties: {} } },\n\t\t\t\t\tundetermined: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"browser family\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tstates: {\n\t\t\t\t\tEdge: { binding: { properties: {} } },\n\t\t\t\t\tSafari: { binding: { properties: {} } },\n\t\t\t\t\tChromium: { binding: { properties: {} } },\n\t\t\t\t\tundetermined: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"alt key pressed\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tstates: {\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"ctrl key pressed\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tstates: {\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"shift key pressed\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tstates: {\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"meta key pressed\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tstates: {\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"toggle key pressed\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tstates: {\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"logo url\": {},\n\t\t\t\"logo-sideways url\": {},\n\t\t\t\"selected language\": {},\n\t\t\tlanguages: {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tlabel: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\"select language\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\tconst gui_state = ensure(\n\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\tapi_configuration.types.client_state.alan_api.Clanguages\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tclient_state.set_selected_language(gui_state.key.entry);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tmessages: {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttype: {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\terror: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\twarning: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\tsuccess: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\twaiting: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttitle: {},\n\t\t\t\t\t\t\t\"has body\": {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\tbody: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\"remove message\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cmessages);\n\t\t\t\t\t\t\t\tmessages.removeMessage(client_state.key);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tmodules: {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({ new_binding_context: client_state }),\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tname: {},\n\t\t\t\t\t\t\t\"has logo\": {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\turl: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"has landing page\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"open landing page\": () => {\n\t\t\t\t\t\t\t\t\topenLandingPage(main);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\t\"send feedback\": (_, message) => {\n\t\t\t\tsendFeedback(message);\n\t\t\t},\n\t\t\t\"on synchronized\": () => onSynchronized(),\n\t\t\t\"add error message\": (_implementation_context, title, body) => {\n\t\t\t\tmessages.addRawMessage(\"error\", title, body);\n\t\t\t},\n\t\t\t\"add warning message\": (_implementation_context, title, body) => {\n\t\t\t\tmessages.addRawMessage(\"warning\", title, body);\n\t\t\t},\n\t\t\t\"add success message\": (_implementation_context, title, body) => {\n\t\t\t\tmessages.addRawMessage(\"success\", title, body);\n\t\t\t},\n\t\t},\n\t},\n\tentity: {\n\t\tbindings: {\n\t\t\tnode: function (implementation_context: ImplementationVisitorContext): ImplementationVisitorContext {\n\t\t\t\tensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\treturn implementation_context;\n\t\t\t},\n\t\t},\n\t\tproperties: {\n\t\t\t\"can be deleted\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\tdelete: (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cyes__can_be_deleted);\n\t\t\t\t\t\t\t\t\tdeleteCollectionEntry(client_state.parent.input.entity().cast(\"entry\"));\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tlocation: {\n\t\t\t\tstates: {\n\t\t\t\t\tremote: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tinitialization: {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\"not initialized\": { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tpending: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tsuccess: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tfailure: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tlocal: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"parent location\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tremote: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tlocal: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tmodified: {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is editable\": {\n\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\tconst entity = ensure(implementation_context.current_binding_context, csr.Cnode).input.entity();\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: entity.switch({\n\t\t\t\t\t\t\troot: ($) => $,\n\t\t\t\t\t\t\tentry: ($) => $.parent,\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is busy saving\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is busy discarding\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\tcancel: async function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\treturn cancel.entry(client_state);\n\t\t\t},\n\t\t\tduplicate: (implementation_context, view) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\tduplicate.entity(client_state, view.parent.properties.view.ref, view.properties.window.ref);\n\t\t\t},\n\t\t\t\"open view\": (implementation_context, view) => {\n\t\t\t\topenViewContext(view.parent, implementation_context);\n\t\t\t},\n\t\t\tsave: function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\treturn save.entity(client_state);\n\t\t\t},\n\t\t\t\"save all\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\treturn save.entity(client_state, true);\n\t\t\t},\n\t\t\t\"add entry\": (implementation_context: ImplementationVisitorContext, view) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\tadd.entryFromEntity(client_state, view.parent.properties.view.ref, view.properties.window.ref);\n\t\t\t},\n\t\t\tdiscard: function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\treturn discard.entity(client_state);\n\t\t\t},\n\t\t},\n\t},\n\twindow: {\n\t\tinstruction_handlers: {\n\t\t\t\"close all views\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cwindows);\n\t\t\t\tclient_state.properties.open_views.forEach(($) => {\n\t\t\t\t\tcancel.entry($.properties.view_context.properties.has_steps.state.node.output.result_node());\n\t\t\t\t\tWindow.getWindowInstance(client_state.key.ref.key).close_view($);\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"close all but active view\": (implementation_context: ImplementationVisitorContext) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cwindows);\n\t\t\t\tclient_state.properties.open_views.forEach(($) => {\n\t\t\t\t\tswitch ($.properties.is_active_view.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tcancel.entry($.properties.view_context.properties.has_steps.state.node.output.result_node());\n\t\t\t\t\t\t\tWindow.getWindowInstance(client_state.key.ref.key).close_view($);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tproperties: {\n\t\t\t\"open views\": {\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\tentity: function (implementation_context: ImplementationVisitorContext): ImplementationVisitorContext {\n\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Copen_views);\n\t\t\t\t\t\t\t\tconst new_client_state = client_state.properties.view_context.output.result_node();\n\t\t\t\t\t\t\t\treturn implementation_context.changeState({ new_binding_context: new_client_state });\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\tactivate: function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Copen_views);\n\t\t\t\t\t\t\t\tWindow.getWindowInstance(client_state.parent.key.ref.key).activate_view(client_state);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"close view\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Copen_views);\n\t\t\t\t\t\t\t\tWindow.getWindowInstance(client_state.parent.key.ref.key).close_view(client_state);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\"is active view\": {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"is entry view\": {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\ttitle: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"entry path\": {},\n\t\t\t\t\t\t\t\t\t\t\t\t\"entry key\": {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tfile: {\n\t\tproperties: {\n\t\t\t\"backend known\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"is readable\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\textension: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\ttoken: {},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\trevert: function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_readable__yes__backend_known__file\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdate.file_toBackendValue(client_state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is editable\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tmodified: {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\textension: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"upload status\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"not uploaded\": { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuploading: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdone: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttoken: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"edit mode\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\toff: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch on\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Coff__edit_mode__yes__is_editable__file\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.edit_mode.set(\"on\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\ton: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch off\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Con__edit_mode__yes__is_editable__file\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.edit_mode.set(\"off\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"delete file\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_editable__file\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tswitch (client_state.parent.properties.is_set.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\t\treturn deleteFromFilesResource(client_state.parent.properties.is_set.state.node.properties.token);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"not set\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"extension not valid\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tpattern: {},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is set\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\textension: {},\n\t\t\t\t\t\t\t\ttoken: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\t\"add single file\": function (implementation_context: ImplementationVisitorContext, file_event: File) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cfile__type__property);\n\t\t\t\tclient_state.properties.is_editable.switch({\n\t\t\t\t\tno: function () {\n\t\t\t\t\t\tmessages.addMessage(\"warning\", \"Cannot upload file\", {\n\t\t\t\t\t\t\tbody: \"The file can not be uploaded because the property is not editable.\",\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tyes: function ($) {\n\t\t\t\t\t\tfileUpload.addFileUploadToQueue($, file_event);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"download file\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cfile__type__property);\n\t\t\t\tfileUpload.downloadFile(client_state);\n\t\t\t},\n\t\t},\n\t},\n\tgroup: {\n\t\tbindings: {\n\t\t\tnode: function (implementation_context: ImplementationVisitorContext): ImplementationVisitorContext {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cgroup__type__property);\n\t\t\t\treturn implementation_context.changeState({ new_binding_context: client_state.properties.node });\n\t\t\t},\n\t\t},\n\t\tproperties: {},\n\t},\n\tnode: {\n\t\tbindings: {\n\t\t\tentity: function (implementation_context: ImplementationVisitorContext): ImplementationVisitorContext {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\treturn implementation_context.switchBindingContext(client_state.input.entity().input.node());\n\t\t\t},\n\t\t\tview: (implementation_context) =>\n\t\t\t\timplementation_context.switchBindingContext(implementation_context.get_client_view()),\n\t\t},\n\t\tproperties: {\n\t\t\tlocation: {\n\t\t\t\tstates: {\n\t\t\t\t\tremote: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"edit mode\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\toff: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch on\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Coff__edit_mode__remote\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitchOn(client_state.parent.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch off properties\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Coff__edit_mode__remote\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitchOff(client_state.parent.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\ton: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch off\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Con__edit_mode__remote\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tswitchOff(client_state.parent.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tlocal: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tmodified: {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"read permitted\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\ttodo: {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tfor: {\n\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cyes__todo);\n\t\t\t\t\t\t\t\t\t\tupdateTodo(client_state);\n\t\t\t\t\t\t\t\t\t\treturn implementation_context;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\"current user\": {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tand: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"no one else\": { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tothers: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\"someone else\": { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\t\"open view\": (implementation_context, view) => {\n\t\t\t\topenViewContext(view.parent, implementation_context);\n\t\t\t},\n\t\t\t\"refresh queries\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst node = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\tnode.properties.queries.forEach(function ($) {\n\t\t\t\t\t// FIXME: refresh only the queries of the current view.\n\t\t\t\t\treQuery.execute($.properties.query);\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t},\n\tnumber: {\n\t\tproperties: {\n\t\t\t\"backend known\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"is readable\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tnumber: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst number_property = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_readable__yes__backend_known__number\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t).parent.parent;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tevaluateNumericalTypeProperty(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumerical_type_properties,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.inferences.number_type(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.parent.parent.parent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_number_converter: makeNumberConverter(numerical_type_properties),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\trevert: function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_readable__yes__backend_known__number\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdate.number_toBackendValue(client_state.parent.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is editable\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tmodified: {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tnumber: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst number_property = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__modified__yes__is_editable__number\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t).parent.parent;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tevaluateNumericalTypeProperty(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumerical_type_properties,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.inferences.number_type(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.parent.parent.parent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_number_converter: makeNumberConverter(numerical_type_properties),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"edit mode\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\toff: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch on\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Coff__edit_mode__yes__is_editable__number\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.edit_mode.set(\"on\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\ton: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch off\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Con__edit_mode__yes__is_editable__number\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.edit_mode.set(\"off\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is set\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tnumber: {\n\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\tconst number_property = ensure(\n\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_set__number__type__property\n\t\t\t\t\t\t\t\t\t\t).parent;\n\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\tnumber_property.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tevaluateNumericalTypeProperty(\n\t\t\t\t\t\t\t\t\t\t\tnumerical_type_properties,\n\t\t\t\t\t\t\t\t\t\t\tnumber_property.inferences.number_type(),\n\t\t\t\t\t\t\t\t\t\t\tnumber_property.parent.parent.parent\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\tnew_number_converter: makeNumberConverter(numerical_type_properties),\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"exceeds maximum\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tmaximum: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst number_property = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__exceeds_maximum\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t).parent.parent;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tevaluateNumericalTypeProperty(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumerical_type_properties,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.inferences.number_type(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.parent.parent.parent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_number_converter: makeNumberConverter(numerical_type_properties),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"exceeds minimum\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tminimum: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst number_property = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__exceeds_minimum\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t).parent.parent;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tevaluateNumericalTypeProperty(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumerical_type_properties,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.inferences.number_type(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_property.parent.parent.parent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_number_converter: makeNumberConverter(numerical_type_properties),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"not a number\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"not set\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"should be positive\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tunit: {\n\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnumber__type__property);\n\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t\t);\n\t\t\t\t\tevaluateNumericalTypeProperty(\n\t\t\t\t\t\tnumerical_type_properties,\n\t\t\t\t\t\tclient_state.inferences.number_type(),\n\t\t\t\t\t\tclient_state.parent.parent.parent\n\t\t\t\t\t);\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: numerical_type_properties,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\tdecimals: {\n\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnumber__type__property);\n\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t\t);\n\t\t\t\t\tevaluateNumericalTypeProperty(\n\t\t\t\t\t\tnumerical_type_properties,\n\t\t\t\t\t\tclient_state.inferences.number_type(),\n\t\t\t\t\t\tclient_state.parent.parent.parent\n\t\t\t\t\t);\n\t\t\t\t\treturn implementation_context.changeState({ new_binding_context: numerical_type_properties });\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\t\"set number\": function (implementation_context: ImplementationVisitorContext, value) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnumber__type__property);\n\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t);\n\t\t\t\tevaluateNumericalTypeProperty(\n\t\t\t\t\tnumerical_type_properties,\n\t\t\t\t\tclient_state.inferences.number_type(),\n\t\t\t\t\tclient_state.parent.parent.parent\n\t\t\t\t);\n\t\t\t\tupdate.number(client_state, makeNumberConverter(numerical_type_properties).from(value), \"user\");\n\t\t\t},\n\t\t},\n\t},\n\tquery: {\n\t\tproperties: {\n\t\t\tcolumns: {\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\"column type\": {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tid: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tname: {},\n\t\t\t\t\t\t\ttype: {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tfile: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnumber: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"number column\": (context) => context,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\treference: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"has filter\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"state group\": {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"stategroup column\": (context) => context,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\ttext: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"text column\": (context) => context,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\twidget: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tfirst_entry: (client_state) => {\n\t\t\t\t\tconst collection_context = ensure(client_state, csr.Cquery__client_state);\n\t\t\t\t\treturn collection_context.properties.has_columns.switch({\n\t\t\t\t\t\tyes: ($) => $.properties.first.ref,\n\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\torder_constraint: \"column order\",\n\t\t\t},\n\t\t\t\"has selected entries\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: { properties: {} },\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"selected entries\": {\n\t\t\t\t\t\t\t\t\tentry: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\t\t\t\tnode: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cselected_entries\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst destructor = new DestructorTree();\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst node = registerQueryEntry(client_state.properties.entry_status, destructor);\n\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.properties.entry_status.onDestroy(() => destructor.destroy());\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({ new_binding_context: node });\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\tdelete: async (implementation_context: ImplementationVisitorContext) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cselected_entries\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\tswitch (client_state.properties.is_editable.state.name) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tawait deleteQueryEntry(client_state.properties.entry_status);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tdeselect: (implementation_context: ImplementationVisitorContext) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cselected_entries\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\tdeselectEntry(client_state);\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"number of selected entries\": {},\n\t\t\t\t\t\t\t\t\"number of editable selected entries\": {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"can download files\": {\n\t\t\t\tonContext: (context) => {\n\t\t\t\t\tconst query = ensure(context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\t\treQuery.stopDelayingQuery(query);\n\t\t\t\t\treturn context;\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"download all files\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__can_download_files__query\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfileUpload.downloadFilesFromQuery(client_state.parent);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"has result\": {\n\t\t\t\tonContext: (context) => {\n\t\t\t\t\tconst query = ensure(context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\t\treQuery.stopDelayingQuery(query);\n\t\t\t\t\treturn context;\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"amount of entries visible\": {},\n\t\t\t\t\t\t\t\t\"is empty\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"result size\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmultiple: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tone: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"selected entries\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tall: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tsome: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tnone: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tentries: {\n\t\t\t\t\t\t\t\t\tentry: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\t\t\t\tentry: (implementation_context) => implementation_context,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"has more entries than maximum\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"can show all\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"show all\": (implementation_context: ImplementationVisitorContext) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__can_show_all\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst query = client_state.parent.parent.parent;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tquery.properties.show_all.set(\"yes\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treQuery.execute(query);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"total amount of entries\": {},\n\t\t\t\t\t\t\t\t\"backend updates are available\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\tclear: (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst query = ensure(implementation_context.current_binding_context, csr.Cyes__has_result);\n\t\t\t\t\t\t\t\t\tquery.parent.properties.has_result.set(\"no\", {});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"entries are editable\": {\n\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\tconst query = ensure(implementation_context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\t\tonScalarValue(\n\t\t\t\t\t\tiQuery(query).entriesAreEditable,\n\t\t\t\t\t\t() => undefined,\n\t\t\t\t\t\t(scalar, subscription) =>\n\t\t\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\t\t\tif (query.destroyed) return;\n\t\t\t\t\t\t\t\tscalar.unsubscribe(subscription);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t\treturn implementation_context;\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"is importing\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"can create entry\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"add entry\": (implementation_context, view) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_context = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__can_create_entry__yes\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tadd.query_entry(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tview.parent.properties.view.ref,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tview.properties.window.ref\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"add entry with key\": (implementation_context, view, key) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_context = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__can_create_entry__yes\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tadd.query_entry(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tview.parent.properties.view.ref,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tview.properties.window.ref,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"import csv\": async function (implementation_context: ImplementationVisitorContext, file_event: File) {\n\t\t\t\t\t\t\t\t\tconst client_context = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__entries_are_editable\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tawait client_context.parent.properties.use_for.switch({\n\t\t\t\t\t\t\t\t\t\tquery: async ($) => await csv_import.forQuery($, file_event),\n\t\t\t\t\t\t\t\t\t\tcandidates: () => undefined,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is busy querying\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"request status\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tsuccess: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tfailure: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"requery needed\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\t\"reset all filters\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_context = ensure(implementation_context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\tqueryFilter.resetFilters(client_context);\n\t\t\t},\n\t\t\t\"remove all filters\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_context = ensure(implementation_context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\tqueryFilter.removeFilters(client_context);\n\t\t\t},\n\t\t\trefresh: function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_context = ensure(implementation_context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\treQuery.execute(client_context);\n\t\t\t},\n\t\t\t\"download as Excel\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst context = ensure(implementation_context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\tcontext.properties.use_for.switch({\n\t\t\t\t\tquery: function ($) {\n\t\t\t\t\t\treports.download_ad_hoc_report($);\n\t\t\t\t\t},\n\t\t\t\t\tcandidates: undefined,\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"download as Excel template\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst context = ensure(implementation_context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\tcontext.properties.use_for.switch({\n\t\t\t\t\tquery: function ($) {\n\t\t\t\t\t\treports.download_ad_hoc_import_template($);\n\t\t\t\t\t},\n\t\t\t\t\tcandidates: undefined,\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tbindings: {\n\t\t\t\"text column\": (implementation_context) => {\n\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Ctext__type__cells);\n\t\t\t\treturn implementation_context.switchBindingContext(state.inferences.column_type());\n\t\t\t},\n\t\t\t\"context node\": (implementation_context) => {\n\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\tconst position = state.input.position();\n\t\t\t\tswitch (position.variant.name) {\n\t\t\t\t\tcase \"node\": {\n\t\t\t\t\t\tconst query_definition = state.properties.definition.ref;\n\t\t\t\t\t\tswitch (query_definition.properties.context.state.name) {\n\t\t\t\t\t\t\tcase \"node\": {\n\t\t\t\t\t\t\t\tconst node_context = query_definition.properties.context.state.node;\n\t\t\t\t\t\t\t\tswitch (node_context.properties.switch_.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"root\": {\n\t\t\t\t\t\t\t\t\t\treturn implementation_context.switchBindingContext(\n\t\t\t\t\t\t\t\t\t\t\tposition.variant.definition.root.properties.root\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"current\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"candidates\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn implementation_context.switchBindingContext(position.variant.definition);\n\t\t\t\t\t}\n\t\t\t\t\tcase \"navigable text property\": {\n\t\t\t\t\t\tconst node = position.variant.definition.parent.parent.parent.parent.parent;\n\t\t\t\t\t\treturn implementation_context.switchBindingContext(node);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\t\"query entry\": {\n\t\tproperties: {\n\t\t\tcells: {\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\"column type\": {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tid: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttype: {\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tfile: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"is set\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttoken: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\textension: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"download file\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_set__file__type__cells\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfileUpload.downloadFileFromQuery(client_state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnumber: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"is set\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst number_cell = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_set__number__type__cells\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t).parent;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnumber_cell.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_number_converter: makeNumberConverter(numerical_type_properties),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"textual representation\": {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tunit: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cnumber__type__cells\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_binding_context: numerical_type_properties,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tdecimals: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cnumber__type__cells\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_binding_context: numerical_type_properties,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\t\t\t\tcolumn: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cnumber__type__cells\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.switchBindingContext(state.inferences.column_type());\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\treference: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"is set\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treference: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"state group\": {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"is set\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstate: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyle: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_set__state_group__type__cells\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//setting the style is handled by updateQueryFromCollectionQueryResult.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_binding_context: initializedStyle(client_state.properties.style),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\ttext: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\"is set\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttext: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\twidget: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tfirst_entry: (client_state) => {\n\t\t\t\t\tconst cells_context = ensure(client_state, csr.Centries__yes__has_result);\n\t\t\t\t\treturn cells_context.properties.has_cells.switch({\n\t\t\t\t\t\tyes: ($) => $.properties.first.ref,\n\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\torder_constraint: \"cell order\",\n\t\t\t},\n\t\t\t\"use for\": {\n\t\t\t\tstates: {\n\t\t\t\t\tquery: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tcandidates: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"select candidate\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Ccandidates__use_for__entries\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tselect_candidate(client_state);\n\t\t\t\t\t\t\t\t\treturn referencesResolved();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is editable\": {\n\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Centries__yes__has_result);\n\t\t\t\t\tcheckEntryPermission(state);\n\t\t\t\t\treturn implementation_context;\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"delete dictionary entry\": async function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__is_editable__entries);\n\t\t\t\t\t\t\t\t\tawait deleteQueryEntry(state.parent.properties.entry_status);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is selected\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\tselect: (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cno__is_selected__entries\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tselectEntry(client_state);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\tdeselect: (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_selected__entries\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tdeselectEntry(client_state.properties.selected_entry.ref);\n\t\t\t\t\t\t\t\t\tclient_state.parent.properties.is_selected.set(\"no\", {});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tbindings: {\n\t\t\tnode: (implementation_context) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__yes__has_result);\n\t\t\t\tconst destructor = new DestructorTree();\n\t\t\t\tconst node = registerQueryEntry(client_state.properties.entry_status, destructor);\n\t\t\t\tclient_state.properties.entry_status.onDestroy(() => destructor.destroy());\n\t\t\t\treturn implementation_context.changeState({ new_binding_context: node });\n\t\t\t},\n\t\t\tstyle: (implementation_context) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__yes__has_result);\n\t\t\t\t//setting the style is handled by updateQueryFromCollectionQueryResult.\n\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\tnew_binding_context: initializedStyle(client_state.properties.style),\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\t\"open entry\": (implementation_context, view) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__yes__has_result);\n\t\t\t\topen.entry(client_state, view.parent.properties.view.ref, view.properties.window.ref);\n\t\t\t},\n\t\t},\n\t},\n\t\"query file\": {\n\t\tproperties: {\n\t\t\t\"is set\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\textension: {},\n\t\t\t\t\t\t\t\ttoken: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t\"query stategroup column\": {\n\t\tproperties: {\n\t\t\t\"has filter\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"filter enabled\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"enable state group filter\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cno__filter_enabled\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.enableStateGroupColumn(state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"disable state group filter\": function (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context: ImplementationVisitorContext\n\t\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__filter_enabled\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.disableStateGroupColumn(state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\tentry: {\n\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\tname: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\"is selected\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"set state filter\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cno__is_selected__states__yes\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.setStateFilter(state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"unset state filter\": function (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context: ImplementationVisitorContext\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_selected__states__yes\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.unsetStateFilter(state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"has default filter\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t// \"filter\": {}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"reset filter\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__has_default_filter__yes__has_filter__state_group\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.resetStateGroupFilter(state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"remove filter\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\tconst state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__has_filter__state_group\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tqueryFilter.removeStateGroupFilter(state);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t\"query stategroup\": {\n\t\tproperties: {\n\t\t\t\"is set\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tstate: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\tstyle: (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_set__state_group__type__cells\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t//setting the style is handled by updateQueryFromCollectionQueryResult.\n\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\tnew_binding_context: initializedStyle(client_state.properties.style),\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tbindings: {\n\t\t\tcolumn: (implementation_context) => {\n\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cstate_group__type__cells);\n\t\t\t\treturn implementation_context.switchBindingContext(state.inferences.column_type());\n\t\t\t},\n\t\t},\n\t},\n\t\"query number column\": {\n\t\tproperties: {\n\t\t\t\"has filter\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"criteria is valid\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcriteria: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__criteria_is_valid__yes__has_filter\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tevaluateNumericalTypeFilter(numerical_type_properties, client_state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_number_converter: makeNumberConverter(numerical_type_properties),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"filter set\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"filter range\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\"not available\": { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"enable range\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cno__filter_range\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.enableRange(client_state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"criteria is valid\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcriteria: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__criteria_is_valid__yes__filter_range\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.parent.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_number_converter: makeNumberConverter(numerical_type_properties),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\toperator: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"or equal to\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tset: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cno__or_equal_to__greater_than\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.rangeGreaterThanOrEqualTo(client_state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunset: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__or_equal_to__greater_than\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.rangeGreaterThan(client_state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"smaller than\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"or equal to\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tset: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cno__or_equal_to__smaller_than\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.rangeSmallerThanOrEqualTo(client_state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunset: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__or_equal_to__smaller_than\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.rangeSmallerThan(client_state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"disable range\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__filter_range\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.disableRange(client_state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"filter number criteria\": (implementation_context, value: number) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__filter_range\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstate.parent.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.numberColumnRange(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmakeNumberConverter(numerical_type_properties).from(value)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"has default filter\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"reset filter\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__has_default_filter__yes__has_filter__number\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.resetNumberFilter(state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"representation type\": {\n\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\tconst number_filter = ensure(\n\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__has_filter__number\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\tnew_binding_context:\n\t\t\t\t\t\t\t\t\t\t\t\tnumber_filter.parent.inferences.number_type().properties.number.ref.properties.numerical_type\n\t\t\t\t\t\t\t\t\t\t\t\t\t.ref,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tdate: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\"date and time\": {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tmodel: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdecimal: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurrency: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tscientific: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tengineering: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tduration: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tunit: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thours: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tminutes: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tseconds: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"operator selected\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\toperator: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"equal to\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"greater than or equal to\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"smaller than\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"smaller than or equal to\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tunit: {\n\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__has_filter__number\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tevaluateNumericalTypeFilter(numerical_type_properties, client_state);\n\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\tnew_binding_context: numerical_type_properties,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdecimals: {\n\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__has_filter__number\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tevaluateNumericalTypeFilter(numerical_type_properties, client_state);\n\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\tnew_binding_context: numerical_type_properties,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"select equal to\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__number);\n\t\t\t\t\t\t\t\t\tqueryFilter.numberColumnOperator(state, \"equal to\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"select greater than\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__number);\n\t\t\t\t\t\t\t\t\tqueryFilter.numberColumnOperator(state, \"greater than\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"select greater than or equal to\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__number);\n\t\t\t\t\t\t\t\t\tqueryFilter.numberColumnOperator(state, \"greater than or equal to\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"select smaller than\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__number);\n\t\t\t\t\t\t\t\t\tqueryFilter.numberColumnOperator(state, \"smaller than\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"select smaller than or equal to\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__number);\n\t\t\t\t\t\t\t\t\tqueryFilter.numberColumnOperator(state, \"smaller than or equal to\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"filter number criteria\": function (\n\t\t\t\t\t\t\t\t\timplementation_context: ImplementationVisitorContext,\n\t\t\t\t\t\t\t\t\tvalue: number\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__number);\n\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\tstate.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tevaluateNumericalTypeFilter(numerical_type_properties, state);\n\t\t\t\t\t\t\t\t\tqueryFilter.numberColumn(state, makeNumberConverter(numerical_type_properties).from(value));\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"remove filter\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__number);\n\t\t\t\t\t\t\t\t\tqueryFilter.removeNumberFilter(state);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tsummarize: {\n\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\tconst number_column = ensure(implementation_context.current_binding_context, csr.Cnumber__type__columns);\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: number_column.inferences.number_type().properties.number.ref,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\ttotal: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t\"query number\": {\n\t\tproperties: {\n\t\t\t\"is set\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tnumber: {\n\t\t\t\t\t\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_set__number__type__cells\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.numerical_type_properties\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\tnew_number_converter: makeNumberConverter(numerical_type_properties),\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tunit: {\n\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnumber__type__cells);\n\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t\t);\n\t\t\t\t\treturn implementation_context.changeState({ new_binding_context: numerical_type_properties });\n\t\t\t\t},\n\t\t\t},\n\t\t\tdecimals: {\n\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnumber__type__cells);\n\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t\t);\n\t\t\t\t\treturn implementation_context.changeState({ new_binding_context: numerical_type_properties });\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tbindings: {\n\t\t\tcolumn: (implementation_context) => {\n\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cnumber__type__cells);\n\t\t\t\treturn implementation_context.switchBindingContext(state.inferences.column_type());\n\t\t\t},\n\t\t},\n\t},\n\t\"query text\": {\n\t\tproperties: {\n\t\t\t\"is set\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\ttext: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tbindings: {\n\t\t\t\"query text column\": (implementation_context) => {\n\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Ctext__type__cells);\n\t\t\t\treturn implementation_context.switchBindingContext(state.inferences.column_type());\n\t\t\t},\n\t\t},\n\t},\n\t\"state group\": {\n\t\tproperties: {\n\t\t\tinitialized: {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"state in backend\": {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\trevert: function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__initialized__state_group\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tiStategroup(client_state.parent).discard();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is editable\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"edit mode\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\toff: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch on\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Coff__edit_mode__yes__is_editable__state_group\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.edit_mode.set(\"on\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\ton: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch off\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Con__edit_mode__yes__is_editable__state_group\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.edit_mode.set(\"off\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is modified\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is set\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\tstate: (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_set__state_group__type__property\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\tnew_binding_context: client_state.properties.state.ref,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"invalid rules\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"no state selected\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\treset: function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cstate_group__type__property);\n\t\t\t\tiStategroup(client_state).discard();\n\t\t\t},\n\t\t},\n\t},\n\tstate: {\n\t\tbindings: {\n\t\t\tnode: function (implementation_context: ImplementationVisitorContext): ImplementationVisitorContext {\n\t\t\t\tconst client_state = ensure(\n\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\tcsr.Cstates__state_group__type__property\n\t\t\t\t);\n\t\t\t\tconst new_client_state = client_state.properties.node;\n\t\t\t\treturn implementation_context.changeState({ new_binding_context: new_client_state });\n\t\t\t},\n\t\t\tstyle: (implementation_context) => {\n\t\t\t\tconst client_state = ensure(\n\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\tcsr.Cstates__state_group__type__property\n\t\t\t\t);\n\t\t\t\tconst style = initializedStyle(client_state.properties.style);\n\t\t\t\tconst ui = client_state.key.ref.properties.ui;\n\t\t\t\tswitch (ui.properties.has_style.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst $ = ui.properties.has_style.state.node;\n\t\t\t\t\t\tevaluateStyle(style, $.properties.style_expression, client_state.properties.node);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(ui.properties.has_style.state);\n\t\t\t\t}\n\n\t\t\t\treturn implementation_context.changeState({ new_binding_context: style });\n\t\t\t},\n\t\t},\n\t\tproperties: {\n\t\t\t\"create permitted\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"set state\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__create_permitted\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tiState(client_state.parent).select(\"user\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is selected\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"all rules are valid\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"violated rule\": {},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\trule: {\n\t\tproperties: {\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\tstatus: {\n\t\t\t\tonContext: (implmentation_context, destructor) => {\n\t\t\t\t\tconst rule = ensure(implmentation_context.current_binding_context, csr.Crules);\n\t\t\t\t\tonScalarValue(\n\t\t\t\t\t\tRule.node(rule),\n\t\t\t\t\t\t() => undefined,\n\t\t\t\t\t\t(scalar, subscription) => destructor.onDestroy(() => scalar.unsubscribe(subscription))\n\t\t\t\t\t);\n\t\t\t\t\treturn implmentation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: rule.properties.resolve_status,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tstates: {\n\t\t\t\t\t\"is busy resolving\": { binding: { properties: {} } },\n\t\t\t\t\tresolved: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\tnode: (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cresolved__status);\n\t\t\t\t\t\t\t\t\tconst node = getReferencedNode(client_state);\n\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\tnew_binding_context: node.input.entity().output.node(),\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"open entity\": (implementation_context, view) => {\n\t\t\t\t\t\t\t\t\tconst binding_context = ensure(implementation_context.current_binding_context, csr.Cresolved__status);\n\t\t\t\t\t\t\t\t\topen.state_rule(\n\t\t\t\t\t\t\t\t\t\tbinding_context.parent.input.resolvable().cast(\"rule\"),\n\t\t\t\t\t\t\t\t\t\tview.parent.properties.view.ref,\n\t\t\t\t\t\t\t\t\t\tview.properties.window.ref\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t\"failed to resolve\": { binding: { properties: {} } },\n\t\t\t\t\tunresolved: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t\"query text column\": {\n\t\tproperties: {\n\t\t\t\"has filter\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t\t\t\t\"filter set\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"has default filter\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t// \"value\": {}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"reset filter\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__has_default_filter__yes__has_filter__text\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tqueryFilter.resetTextFilter(state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"remove filter\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__text);\n\t\t\t\t\t\t\t\t\tqueryFilter.removeTextFilter(state);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"set text contains\": function (implementation_context: ImplementationVisitorContext, event) {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__text);\n\t\t\t\t\t\t\t\t\tqueryFilter.textColumn(state, event, \"contains\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"set text equals\": function (implementation_context: ImplementationVisitorContext, event) {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__text);\n\t\t\t\t\t\t\t\t\tqueryFilter.textColumn(state, event, \"equals\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"set text starts with\": function (implementation_context: ImplementationVisitorContext, event) {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__text);\n\t\t\t\t\t\t\t\t\tqueryFilter.textColumn(state, event, \"starts with\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"set text ends with\": function (implementation_context: ImplementationVisitorContext, event) {\n\t\t\t\t\t\t\t\t\tconst state = ensure(implementation_context.current_binding_context, csr.Cyes__has_filter__text);\n\t\t\t\t\t\t\t\t\tqueryFilter.textColumn(state, event, \"ends with\");\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\ttext: {\n\t\tproperties: {\n\t\t\t\"backend known\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"mail password\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__backend_known__text\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tmailPasswordToken(client_state.parent);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"copy password to clipboard\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__backend_known__text\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tcopyPasswordTokenToClipboard(client_state.parent);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\trevert: function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__backend_known__text\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tiText(client_state.parent).discard();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is editable\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tmodified: {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"edit mode\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\toff: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch on\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Coff__edit_mode__yes__is_editable__text\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.edit_mode.set(\"on\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\ton: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"switch off\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Con__edit_mode__yes__is_editable__text\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_state.parent.properties.edit_mode.set(\"off\", {});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"reset password\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\tcsr.Cyes__is_editable__text\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tresetPassword(client_state.parent);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"invalid rules\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"key is not unique\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"reference not resolved\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"referenced node not valid\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"text does not match pattern\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tpattern: {},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\tnavigable: {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tstatus: {\n\t\t\t\t\t\t\t\t\tonContext: (implementation_context, destructor) => {\n\t\t\t\t\t\t\t\t\t\tconst reference = ensure(implementation_context.current_binding_context, csr.Cyes__navigable);\n\t\t\t\t\t\t\t\t\t\tconst status = iReference(reference).status;\n\t\t\t\t\t\t\t\t\t\tconst subscription = status.subscribe({ update: () => undefined });\n\t\t\t\t\t\t\t\t\t\tdestructor.onDestroy(() => status.unsubscribe(subscription));\n\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\tnew_binding_context: reference.properties.resolve_status,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\"is busy resolving\": { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tresolved: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"open reference\": (implementation_context, view) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst binding_context = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cresolved__status\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topen.reference(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbinding_context.parent.input.resolvable().cast(\"reference\"),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tview.parent.properties.view.ref,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tview.properties.window.ref\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\tbindings: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tnode: (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cresolved__status\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst node = getReferencedNode(client_state);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew_binding_context: node.input.entity().output.node(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\"failed to resolve\": { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tunresolved: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is set\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\ttext: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is key\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"key unique\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"validation result\": {\n\t\t\t\tstates: {\n\t\t\t\t\tfailure: { binding: { properties: {} } },\n\t\t\t\t\tsuccess: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\treset: (implementation_context) => {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Ctext__type__property);\n\t\t\t\tif (isPasswordProperty(client_state.inferences.text_type())) {\n\t\t\t\t\tconst entry = client_state.parent.parent.parent.input.entity().cast(\"entry\");\n\t\t\t\t\tentry.properties.key.ref.properties.is_editable.switch({\n\t\t\t\t\t\tno: () => iText(client_state).discard(),\n\t\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t\t$.properties.modified.switch({\n\t\t\t\t\t\t\t\tno: () => iText(client_state).discard(),\n\t\t\t\t\t\t\t\tyes: () => {\n\t\t\t\t\t\t\t\t\tmessages.addMessage(\"warning\", \"Cannot reset password.\", { body: \"The username changed.\" });\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tiText(client_state).discard();\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"update text\": function (implementation_context: ImplementationVisitorContext, event) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Ctext__type__property);\n\t\t\t\tif (isPasswordProperty(client_state.inferences.text_type())) {\n\t\t\t\t\tupdate.password(client_state.properties.navigable.cast(\"no\"), event);\n\t\t\t\t} else {\n\t\t\t\t\tiText(client_state).update(event, \"user\");\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\tview: {\n\t\tbindings: {\n\t\t\tentity: function (implementation_context: ImplementationVisitorContext): ImplementationVisitorContext {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Copen_views);\n\t\t\t\tconst new_client_state = client_state.properties.view_context.output.result_node();\n\t\t\t\treturn implementation_context.changeState({ new_binding_context: new_client_state });\n\t\t\t},\n\t\t\tnode: function (implementation_context: ImplementationVisitorContext): ImplementationVisitorContext {\n\t\t\t\tconst client_state = implementation_context.current_binding_context;\n\t\t\t\tif (client_state instanceof csr.Copen_views) {\n\t\t\t\t\tconst new_client_state = client_state.properties.view_context.output.result_node();\n\t\t\t\t\treturn implementation_context.changeState({ new_binding_context: new_client_state });\n\t\t\t\t} else if (client_state instanceof csr.Cnode) {\n\t\t\t\t\t//for inline views\n\t\t\t\t\treturn implementation_context;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"Expected current binding context to be of type Copen_views or Cnode.\");\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tproperties: {\n\t\t\t\"is active view\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"action active\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\"can finish step\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"finish current step\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst client_state = ensure(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsr.Cyes__can_finish_step\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfinishAction(client_state.parent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"last step\": {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\t\t\"cancel action\": (implementation_context) => {\n\t\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cyes__action_active);\n\t\t\t\t\t\t\t\t\tcancelAction(client_state);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\t\"close view\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Copen_views);\n\t\t\t\tWindow.getWindowInstance(client_state.parent.key.entry).close_view(client_state);\n\t\t\t},\n\t\t\t\"copy link to clipboard\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Copen_views);\n\t\t\t\tdeeplink.copy_link_to_clipboard(client_state);\n\t\t\t},\n\t\t\t\"open in new window\": function (implementation_context: ImplementationVisitorContext) {\n\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Copen_views);\n\t\t\t\tdeeplink.view_in_new_window(client_state);\n\t\t\t},\n\t\t},\n\t},\n\treport: {\n\t\tproperties: {\n\t\t\t\"is valid\": {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: reports.initializedReport(\n\t\t\t\t\t\t\tensure(implementation_context.current_binding_context, csr.Creport_types__node)\n\t\t\t\t\t\t).properties.parameters,\n\t\t\t\t\t}),\n\t\t\t\tstates: {\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\ttemplates: {\n\t\t\t\tonContext: (implementation_context) =>\n\t\t\t\t\timplementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: reports.initializedReport(\n\t\t\t\t\t\t\tensure(implementation_context.current_binding_context, csr.Creport_types__node)\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\tentry: {\n\t\t\t\t\tbinding: {\n\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\tinstruction_handlers: {\n\t\t\t\t\t\t\tdownload: (implementation_context) => {\n\t\t\t\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Ctemplates);\n\t\t\t\t\t\t\t\treports.download_report(client_state.parent, client_state.key);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t\"report number parameter\": {\n\t\tproperties: {\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is set\": {\n\t\t\t\tstates: {\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\tunit: {\n\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnumber__type__parameters);\n\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t\t);\n\t\t\t\t\t//TODO: evaluateNumericalType(numerical_type_properties, client_state.inferences.number_type().inferences.number_type(), client_state.parent.parent.parent);\n\t\t\t\t\treturn implementation_context.changeState({ new_binding_context: numerical_type_properties });\n\t\t\t\t},\n\t\t\t},\n\t\t\tdecimals: {\n\t\t\t\tonContext: (implementation_context) => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnumber__type__parameters);\n\t\t\t\t\tconst numerical_type_properties = initializedNumericalTypeProperties(\n\t\t\t\t\t\tclient_state.properties.numerical_type_properties\n\t\t\t\t\t);\n\t\t\t\t\t//TODO: evaluateNumericalType(numerical_type_properties, client_state.inferences.number_type(), client_state.parent.parent.parent);\n\t\t\t\t\treturn implementation_context.changeState({ new_binding_context: numerical_type_properties });\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\t\"set number\": (implementation_context, value) => {\n\t\t\t\tupdate.reportNumberParameter(\n\t\t\t\t\tensure(implementation_context.current_binding_context, csr.Cnumber__type__parameters),\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t},\n\t\"report text parameter\": {\n\t\tproperties: {\n\t\t\t\"is valid\": {\n\t\t\t\tstates: {\n\t\t\t\t\tyes: { binding: { properties: {} } },\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"is set\": {\n\t\t\t\tstates: {\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinstruction_handlers: {\n\t\t\t\"update text\": (implementation_context, value) => {\n\t\t\t\tupdate.reportTextParameter(\n\t\t\t\t\tensure(implementation_context.current_binding_context, csr.Ctext__type__parameters),\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t},\n\tstyle: {\n\t\tproperties: {\n\t\t\t\"has style\": {\n\t\t\t\tstates: {\n\t\t\t\t\tno: { binding: { properties: {} } },\n\t\t\t\t\tyes: {\n\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\ttype: {\n\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tfixed: {\n\t\t\t\t\t\t\t\t\t\t\tbinding: {\n\t\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstates: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tforeground: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbackground: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbrand: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlink: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccent: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsuccess: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twarning: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\terror: { binding: { properties: {} } },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\n\nconst max_serializable_julian_date = 102440587;\nconst min_serializable_julian_date = -97559413;\nconst max_serializable_julian_time = 8850866716800;\nconst min_serializable_julian_time = -8429133283200;\n\nfunction julianDateInRange(value: number) {\n\treturn value <= max_serializable_julian_date && value >= min_serializable_julian_date;\n}\n\nfunction julianTimeInRange(value: number) {\n\treturn value <= max_serializable_julian_time && value >= min_serializable_julian_time;\n}\n\nexport const formatters: Formatters = {\n\tdate: function (value: number) {\n\t\tif (julianDateInRange(value)) {\n\t\t\treturn julian_date_2_js_date(value).toLocaleDateString();\n\t\t}\n\t\treturn \"out of range\";\n\t},\n\t\"date and time\": function (value: number) {\n\t\tif (julianTimeInRange(value)) {\n\t\t\treturn julian_datetime_2_js_date(value).toLocaleString();\n\t\t}\n\t\treturn \"out of range\";\n\t},\n\t\"HTML date and time\": function (value: number) {\n\t\tif (julianTimeInRange(value)) {\n\t\t\treturn julian_datetime_2_gregorian_datetime(value).htmlformat();\n\t\t}\n\t\treturn \"out of range\";\n\t},\n\t\"duration in hours\": function (value: number) {\n\t\treturn serializeHours(value);\n\t},\n\t\"duration in minutes\": function (value: number) {\n\t\treturn serializeMinutes(value);\n\t},\n\t\"duration in seconds\": function (value: number) {\n\t\treturn serializeSeconds(value);\n\t},\n\t\"to color\": function (value: string) {\n\t\treturn to_color(value);\n\t},\n\t\"url encode\": (value) => encodeURIComponent(value),\n};\n\nexport const transformers: Transformers = {\n\t\"julian date to JS date\": function (value: number) {\n\t\tif (julianDateInRange(value)) {\n\t\t\treturn julian_date_2_js_date(value).getTime();\n\t\t}\n\t\treturn NaN;\n\t},\n\t\"julian date time to JS date\": function (value: number) {\n\t\tif (julianTimeInRange(value)) {\n\t\t\treturn julian_datetime_2_js_date(value).getTime();\n\t\t}\n\t\treturn NaN;\n\t},\n\t\"JS date to julian date\": function (value: number) {\n\t\treturn jsdate_2_julian_date(new Date(value));\n\t},\n\t\"JS date to julian date and time\": function (value: number) {\n\t\treturn jsdate_2_julian_datetime(new Date(value));\n\t},\n\t\"HTML date to julian date\": function (value: string) {\n\t\treturn jsdate_2_julian_date(new Date(value));\n\t},\n\t\"HTML date time to julian date time\": function (value: string) {\n\t\tconst parsed_date = parseHtmlDate(value);\n\t\tif (parsed_date) {\n\t\t\treturn jsdate_2_julian_datetime(parsed_date);\n\t\t} else {\n\t\t\treturn NaN;\n\t\t}\n\t},\n\t\"duration in seconds\": function (value: string) {\n\t\treturn parserNumber.parseSeconds(value);\n\t},\n\t\"duration in minutes\": function (value: string) {\n\t\treturn parserNumber.parseMinutes(value);\n\t},\n\t\"duration in hours\": function (value: string) {\n\t\treturn parserNumber.parseHours(value);\n\t},\n};\n","import { api_configuration } from \"../../common\";\nimport DestructorTree from \"../DestructorTree\";\nimport { forReference } from \"../state/addQueryIfNotExistsAndGet\";\nimport * as sort from \"../state/sorting\";\nimport { ensure, isDefined } from \"../validation\";\nimport ImplementationVisitorContext from \"./ImplementationVisitorContext\";\nimport { initializedReport } from \"./instructions/reports\";\nimport api_widget = api_configuration.libraries.gui_definition_lib.types.widget.alan_api;\nimport csr = api_configuration.types.client_state.alan_api;\nimport client_state_binder = require(\"./client_state_binder\");\nimport ClientState = require(\"../state/ClientState\");\nimport * as addClientState from \"../state/addClientState\";\nimport {\n\tregisterModelBindingPropertyPath,\n\tregisterCommand,\n\tregisterAction,\n\tregisterFile,\n\tregisterGroup,\n\tregisterNumber,\n\tregisterStategroup,\n\tregisterText,\n\tregisterJoin,\n} from \"../state/registerClientState\";\nimport { initializeQueryWithModelBinding } from \"./bindQuery\";\n\nexport function walk_context_ancestor_path(\n\tpath: api_widget.Ccontext_ancestor_path,\n\timplementation_context: ImplementationVisitorContext\n): ImplementationVisitorContext {\n\tswitch (path.properties.has_step.state.name) {\n\t\tcase \"no\": {\n\t\t\tconst no_has_steps = path.properties.has_step.state.node;\n\t\t\tswitch (no_has_steps.properties.context.state.name) {\n\t\t\t\tcase \"anonymous\": {\n\t\t\t\t\treturn implementation_context.explicit_context;\n\t\t\t\t}\n\t\t\t\tcase \"implicit\": {\n\t\t\t\t\treturn implementation_context;\n\t\t\t\t}\n\t\t\t\tcase \"named\": {\n\t\t\t\t\treturn implementation_context.explicit_context;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(no_has_steps.properties.context.state);\n\t\t\t}\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst yes_has_steps = path.properties.has_step.state.node;\n\t\t\tconst parent_implementation_context =\n\t\t\t\timplementation_context.explicit_context.parent_widget_implementation_context;\n\t\t\treturn walk_context_ancestor_path(yes_has_steps.properties.tail, parent_implementation_context);\n\t\t}\n\t\tcase \"root\":\n\t\t\treturn implementation_context.root_widget_implementation_context;\n\t\tdefault:\n\t\t\treturn unexpectedState(path.properties.has_step.state);\n\t}\n}\n\nfunction switchModelBinding(\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n): ImplementationVisitorContext {\n\tswitch (implementation_context.model_binding.properties.type.state.name) {\n\t\tcase \"collection\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst node = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\tconst client_state = registerModelBindingPropertyPath($.properties.property_path, node, destructor);\n\t\t\tconst collection_state = addClientState.addCollectionAttribute(\n\t\t\t\t$.properties.collection.ref.inferences.collection(),\n\t\t\t\tclient_state\n\t\t\t);\n\t\t\tsort.patchCollection(collection_state);\n\t\t\tlet new_binding_context: any = collection_state;\n\t\t\tswitch ($.properties.join.state.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tnew_binding_context = registerJoin(collection_state, destructor);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($.properties.join.state);\n\t\t\t}\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_binding_context,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"ordered graph\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cyes__has_ordered_graphs);\n\t\t\tconst new_client_state = client_state.properties.ordered_graphs.get($.properties.ordered_graph.entry)!;\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"sort property\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\treturn implementation_context.changeState({ new_widget_configuration: $.properties.configuration });\n\t\t}\n\t\tcase \"command\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst node = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\tconst client_state = registerModelBindingPropertyPath($.properties.property_path, node, destructor);\n\t\t\tconst operation_attribute = registerCommand(\n\t\t\t\t$.properties.command.ref.inferences.global_type(),\n\t\t\t\tclient_state,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: operation_attribute,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"action\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst node = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\tconst client_state = registerModelBindingPropertyPath($.properties.property_path, node, destructor);\n\t\t\tconst action_attribute = registerAction(\n\t\t\t\t$.properties.action.ref.inferences.action_type(),\n\t\t\t\tclient_state,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: action_attribute,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"current node\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst client_state = implementation_context.current_binding_context;\n\t\t\tlet node: csr.Cnode;\n\t\t\tif (client_state instanceof csr.Cnode) {\n\t\t\t\tnode = client_state;\n\t\t\t} else if (client_state instanceof csr.Copen_views) {\n\t\t\t\tnode = client_state.properties.view_context.output.result_node();\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Expected current binding context to be of type Cnode.\");\n\t\t\t}\n\t\t\tnode = registerModelBindingPropertyPath($.properties.property_path, node, destructor);\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: node,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"user\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst user_found = ensure(implementation_context.current_binding_context, csr.Cyes__user_found);\n\t\t\tconst user_node = (user_found as any).node;\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: user_node,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"entity\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\treturn implementation_context.switchGuiWidgetConfiguration($.properties.configuration);\n\t\t}\n\t\tcase \"file\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst node = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\tconst client_state = registerModelBindingPropertyPath($.properties.property_path, node, destructor);\n\t\t\tconst new_client_state = registerFile($.properties.property.ref.inferences.file(), client_state, destructor);\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"window\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: ClientState.client_state.properties.windows.get($.properties.window.entry)!,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"group\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\tconst new_client_state = registerGroup($.properties.group.ref.inferences.group(), client_state, destructor);\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"number\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst node = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\tconst client_state = registerModelBindingPropertyPath($.properties.property_path, node, destructor);\n\t\t\tconst new_client_state = registerNumber($.properties.property.ref.inferences.number(), client_state, destructor);\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t\t// new_number_converter: makeNumberConverter(new_client_state.properties.numerical_type_properties)\n\t\t\t});\n\t\t}\n\t\tcase \"query\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tlet new_client_state: api_configuration.types.client_state.alan_api.Cquery__client_state;\n\t\t\tconst query_context_binding = $.properties.query_context;\n\t\t\tconst query_definition = $.properties.query_context.state.node.output.query();\n\t\t\tswitch (query_context_binding.state.name) {\n\t\t\t\tcase \"node\": {\n\t\t\t\t\tlet client_state = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\t\t\tconst node_context = query_context_binding.state.node;\n\t\t\t\t\tswitch (node_context.properties.switch_.state.name) {\n\t\t\t\t\t\tcase \"root\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"current node\":\n\t\t\t\t\t\t\tclient_state = registerModelBindingPropertyPath(\n\t\t\t\t\t\t\t\tnode_context.properties.switch_.state.node.properties.property_path,\n\t\t\t\t\t\t\t\tclient_state,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(node_context.properties.switch_.state);\n\t\t\t\t\t}\n\t\t\t\t\tnew_client_state = initializeQueryWithModelBinding(client_state, node_context, destructor);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"candidates\": {\n\t\t\t\t\tconst navigable_text_property = ensure(implementation_context.current_binding_context, csr.Cyes__navigable);\n\t\t\t\t\t(query_context_binding as any).__configuration = $.properties.configuration; //TODO us an explicit interface or function so that it is clear why this is done.\n\t\t\t\t\tnew_client_state = forReference(navigable_text_property, query_definition, undefined);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(query_context_binding.state);\n\t\t\t}\n\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"query file\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__yes__has_result);\n\t\t\tconst new_client_state = client_state.properties.cells.get($.properties.file.entry)!.properties.type.cast(\"file\");\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"query number\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst column_name = $.properties.number.entry;\n\t\t\tconst number_binding = $.inferences.query_number();\n\n\t\t\tswitch (number_binding.properties.type.state.name) {\n\t\t\t\tcase \"column\": {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\t\tconst new_client_state = client_state.properties.columns.get(column_name)!.properties.type.cast(\"number\");\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tcase \"entry\": {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__yes__has_result);\n\t\t\t\t\tconst new_client_state = client_state.properties.cells.get(column_name)!.properties.type.cast(\"number\");\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(number_binding.properties.type.state);\n\t\t\t}\n\t\t}\n\t\tcase \"query text\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst column_name = $.properties.text.entry;\n\t\t\treturn $.inferences.query_text().properties.type.switch({\n\t\t\t\tcolumn: () => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\t\tconst new_client_state = client_state.properties.columns.get(column_name)!.properties.type.cast(\"text\");\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tentry: () => {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__yes__has_result);\n\t\t\t\t\tconst new_client_state = client_state.properties.cells.get(column_name)!.properties.type.cast(\"text\");\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tcase \"query stategroup\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst column_name = $.properties.stategroup.entry;\n\t\t\tconst stategroup_binding = $.inferences.query_stategroup();\n\t\t\tswitch (stategroup_binding.properties.type.state.name) {\n\t\t\t\tcase \"column\": {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cquery__client_state);\n\t\t\t\t\tconst new_client_state = client_state.properties.columns\n\t\t\t\t\t\t.get(column_name)!\n\t\t\t\t\t\t.properties.type.cast(\"state group\");\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tcase \"entry\": {\n\t\t\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centries__yes__has_result);\n\t\t\t\t\tconst new_client_state = client_state.properties.cells.get(column_name)!.properties.type.cast(\"state group\");\n\t\t\t\t\treturn implementation_context.changeState({\n\t\t\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state group\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst node = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\tconst client_state = registerModelBindingPropertyPath($.properties.property_path, node, destructor);\n\t\t\tconst new_client_state = registerStategroup(\n\t\t\t\t$.properties.state_group.ref.inferences.state_group(),\n\t\t\t\tclient_state,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cstate_group__type__property);\n\t\t\tconst new_client_state = client_state.properties.states.get(\n\t\t\t\t$.properties.state_group_context.switch({\n\t\t\t\t\t\"states list\": ($) => $.inferences.state_context().key.ref.key.ref.key,\n\t\t\t\t\t\"state group binding\": ($) => $.properties.state.ref.key.ref.key,\n\t\t\t\t})\n\t\t\t)!;\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"state rule\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst client_state = ensure(\n\t\t\t\timplementation_context.current_binding_context,\n\t\t\t\tcsr.Cstates__state_group__type__property\n\t\t\t);\n\t\t\tconst new_client_state = client_state.properties.rules.properties.rules.get($.properties.rule.entry)!;\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"text\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst node = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\tconst client_state = registerModelBindingPropertyPath($.properties.property_path, node, destructor);\n\t\t\tconst new_client_state = registerText($.properties.property.ref.inferences.text(), client_state, destructor);\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"report\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Cnode);\n\t\t\tconst report_type = $.properties.report.entry;\n\t\t\tconst new_client_state = client_state.properties.report_types.switchOnEntryExists(\n\t\t\t\treport_type,\n\t\t\t\t($) => $,\n\t\t\t\t() =>\n\t\t\t\t\tclient_state.properties.report_types.create(report_type, {\n\t\t\t\t\t\tinitialized: \"no\",\n\t\t\t\t\t})\n\t\t\t);\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: new_client_state,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"report text parameter\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst client_state = initializedReport(\n\t\t\t\tensure(implementation_context.current_binding_context, csr.Creport_types__node)\n\t\t\t).properties.parameters;\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: client_state.properties.parameters\n\t\t\t\t\t.get($.properties.text.entry)!\n\t\t\t\t\t.properties.type.cast(\"text\"),\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tcase \"report number parameter\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst client_state = initializedReport(\n\t\t\t\tensure(implementation_context.current_binding_context, csr.Creport_types__node)\n\t\t\t).properties.parameters;\n\t\t\tconst report_number = client_state.properties.parameters\n\t\t\t\t.get($.properties.number.entry)!\n\t\t\t\t.properties.type.cast(\"number\");\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: report_number,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t\t// new_number_converter: makeNumberConverter(report_number.properties.numerical_type_properties)\n\t\t\t});\n\t\t}\n\t\tcase \"joined entry\": {\n\t\t\tconst $ = implementation_context.model_binding.properties.type.state.node;\n\t\t\tconst client_state = ensure(implementation_context.current_binding_context, csr.Centry__referenced_entry);\n\t\t\treturn implementation_context.changeState({\n\t\t\t\tnew_binding_context: client_state.properties.entry.ref,\n\t\t\t\tnew_widget_configuration: $.properties.configuration,\n\t\t\t});\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(implementation_context.model_binding.properties.type.state);\n\t}\n}\n\nexport function context_selection_path(\n\tpath: api_widget.Ccontext_selection_path,\n\timplementationVisitorContext: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n): ImplementationVisitorContext {\n\tswitch (path.properties.has_steps.state.name) {\n\t\tcase \"no\": {\n\t\t\treturn implementationVisitorContext;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = path.properties.has_steps.state.node;\n\t\t\tconst new_implementation_context = context_selection_path_step_type(\n\t\t\t\t$.properties.type,\n\t\t\t\timplementationVisitorContext,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\treturn context_selection_path($.properties.tail, new_implementation_context, destructor);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(path.properties.has_steps.state);\n\t}\n}\n\nfunction context_selection_path_step_type(\n\tstep_type: api_widget.Cyes__has_steps__context_selection_path[\"properties\"][\"type\"],\n\timplementationVisitorContext: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n): ImplementationVisitorContext {\n\tswitch (step_type.state.name) {\n\t\tcase \"client binding\": {\n\t\t\tconst $ = step_type.state.node;\n\t\t\tconst binding_name = $.properties.binding.entry;\n\t\t\tconst binding_type_name = $.properties.binding.ref.properties.binding.entry;\n\t\t\treturn isDefined(implementationVisitorContext.client_state_binder_AsPropertiesBinding.bindings)\n\t\t\t\t[binding_name](implementationVisitorContext, destructor)\n\t\t\t\t.switchClientStateBinder((client_state_binder as any).binding[binding_type_name]);\n\t\t}\n\t\tcase \"constrained configuration attribute\": {\n\t\t\tconst $ = step_type.state.node;\n\t\t\tconst binding_type_name = $.properties.configuration_attribute.inferences\n\t\t\t\t.binding()\n\t\t\t\t.properties.constrained_on_containing_binding.state.node.output.client_binding().key;\n\t\t\tconst configuration_attribute_name = $.properties.configuration_attribute.entry;\n\t\t\tconst new_model_binding = implementationVisitorContext.gui_widget_configuration.properties.configuration\n\t\t\t\t.get(configuration_attribute_name)!\n\t\t\t\t.properties.attribute.properties.type.cast(\"model binding\");\n\t\t\treturn switchModelBinding(\n\t\t\t\timplementationVisitorContext\n\t\t\t\t\t.switchGuiModelBinding(new_model_binding)\n\t\t\t\t\t.switchClientStateBinder((client_state_binder as any).binding[binding_type_name]),\n\t\t\t\tdestructor\n\t\t\t);\n\t\t}\n\t\tcase \"unconstrained configuration attribute\": {\n\t\t\tconst $ = step_type.state.node;\n\t\t\tconst binding_name = $.properties.configuration_attribute.inferences\n\t\t\t\t.binding()\n\t\t\t\t.properties.constrained_on_containing_binding.state.node.output.client_binding().key;\n\t\t\tconst configuration_attribute_name = $.properties.configuration_attribute.entry;\n\t\t\tconst new_gui_model_binding = implementationVisitorContext.gui_widget_configuration.properties.configuration\n\t\t\t\t.get(configuration_attribute_name)!\n\t\t\t\t.properties.attribute.properties.type.cast(\"model binding\");\n\t\t\treturn switchModelBinding(\n\t\t\t\timplementationVisitorContext\n\t\t\t\t\t.switchGuiModelBinding(new_gui_model_binding)\n\t\t\t\t\t.switchClientStateBinder((client_state_binder as any).binding[binding_name]),\n\t\t\t\tdestructor\n\t\t\t);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(step_type.state);\n\t}\n}\n\nexport function context_selection(\n\tcontext_selection: api_widget.Ccontext_selection,\n\timplementationVisitorContext: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n): ImplementationVisitorContext {\n\tswitch (context_selection.properties.change_context_to.state.name) {\n\t\tcase \"other context\": {\n\t\t\tconst $ = context_selection.properties.change_context_to.state.node;\n\t\t\tconst parent_implementation_context = walk_context_ancestor_path(\n\t\t\t\t$.properties.ancestor_path,\n\t\t\t\timplementationVisitorContext\n\t\t\t);\n\t\t\tlet new_implementation_context = implementationVisitorContext\n\t\t\t\t.changeState({\n\t\t\t\t\tnew_widget_configuration: parent_implementation_context.widget_configuration,\n\t\t\t\t\tnew_model_binding: parent_implementation_context.raw_model_binding,\n\t\t\t\t\tentry_key: parent_implementation_context.entry_keys,\n\t\t\t\t\tid_generator: parent_implementation_context.id_generator,\n\t\t\t\t\tnew_last_gui_widget_configuration: parent_implementation_context.last_gui_widget_configuration,\n\t\t\t\t})\n\t\t\t\t.changeState({\n\t\t\t\t\tnew_binding_context: parent_implementation_context.current_binding_context,\n\t\t\t\t});\n\t\t\tif (parent_implementation_context.client_state_binder !== null) {\n\t\t\t\tnew_implementation_context = new_implementation_context.changeState({\n\t\t\t\t\tnew_client_state_binder: parent_implementation_context.client_state_binder,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn context_selection_path($.properties.path, new_implementation_context, destructor);\n\t\t}\n\t\tcase \"engine state\": {\n\t\t\tconst $ = context_selection.properties.change_context_to.state.node;\n\t\t\treturn implementationVisitorContext\n\t\t\t\t.switchBindingContext(ClientState.client_state)\n\t\t\t\t.switchClientStateBinder((client_state_binder as any).binding[$.properties.engine_state_binding.entry]);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(context_selection.properties.change_context_to.state);\n\t}\n}\n","import { api_configuration } from \"../../../common\";\nimport gui_definition_types = api_configuration.libraries.gui_definition_lib.types;\nimport { client_state } from \"../../state/ClientState\";\nimport csr = api_configuration.types.client_state.alan_api;\nimport DestructorTree from \"../../DestructorTree\";\nimport renderView = require(\"../renderView\");\nimport { createIdPathFromNode, createIdPathBuilderFromNode } from \"../../navigation/createIdPathFromNode\";\nimport { IdPathBuilder } from \"../../navigation/IdPathBuilder\";\nimport uuid = require(\"../../state/uuid\");\nimport createClientIdPathFromNode from \"../../navigation/createClientIdPathFromNode\";\nimport hash = require(\"./hash\");\nimport { isDefined, isNonNull } from \"../../validation\";\nimport { subscribeOnSave, unSubscribeOnSave } from \"../instructions/save\";\nimport { ControlsAreSynchronized } from \"../ControlLibrary\";\nimport { linkIdPath } from \"../../state/ClientIdPath\";\n\nfunction pushHistoryState(deeplink_hash: string, title: string) {\n\tif (window.location.hash !== \"#\" + deeplink_hash) {\n\t\twindow.history.pushState(undefined, title, window.location.origin + window.location.pathname + \"#\" + deeplink_hash);\n\t}\n}\n\nfunction generateNodeEntryKeyPartOfViewName(\n\tnode: csr.Cnode,\n\ton_update: (new_value: string, on_removed: () => void) => void\n): void {\n\tnode.input.entity().switch({\n\t\troot: function () {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\t\t\ton_update(\"\", () => {});\n\t\t},\n\t\tentry: function ($) {\n\t\t\tconst mutable_text = $.properties.key.ref;\n\t\t\tmutable_text.properties.is_set.subscribe({\n\t\t\t\ton_update: function (_, subscription) {\n\t\t\t\t\tconst new_value = $.properties.key.ref.properties.is_set.switch({\n\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\tyes: ($) => $.properties.text,\n\t\t\t\t\t});\n\t\t\t\t\ton_update(new_value, () => {\n\t\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n}\n\nfunction isEntryView(node: csr.Cnode): boolean {\n\tconst entity = node.input.entity();\n\tswitch (entity.variant.name) {\n\t\tcase \"root\":\n\t\t\treturn false;\n\t\tcase \"entry\":\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn unexpectedState(entity.variant);\n\t}\n}\n\nfunction translate(phrase: string): string {\n\treturn client_state.properties.selected_language.ref.key.ref.properties.translations.switchOnEntryExists(\n\t\tphrase,\n\t\t(translation) => translation.properties.translation,\n\t\t() => phrase\n\t);\n}\n\nfunction generateNodePathPartOfViewName(node: csr.Cnode): string {\n\treturn node.input.position().switch({\n\t\tentity: ($) =>\n\t\t\t$.switch({\n\t\t\t\troot: () => \"\",\n\t\t\t\tentry: function ($) {\n\t\t\t\t\tconst collection_name = translate($.parent.parent.parent.key.ref.key);\n\t\t\t\t\treturn generateNodePathPartOfViewName($.parent.parent.parent.parent) + \" › \" + collection_name;\n\t\t\t\t},\n\t\t\t}),\n\t\tgroup: function ($) {\n\t\t\tconst group_name = translate($.parent.parent.key.ref.key);\n\t\t\treturn generateNodePathPartOfViewName($.parent.parent.parent) + \" › \" + group_name;\n\t\t},\n\t\tstate: function ($) {\n\t\t\tconst state_name = translate($.key.ref.key);\n\t\t\tconst state_group_name = translate($.parent.parent.parent.key.ref.key);\n\t\t\treturn (\n\t\t\t\tgenerateNodePathPartOfViewName($.parent.parent.parent.parent) + \" › \" + state_group_name + \" › \" + state_name\n\t\t\t);\n\t\t},\n\t\troot: ($) =>\n\t\t\t$.switch({\n\t\t\t\troot: () => \"\",\n\t\t\t\toperation: ($) => {\n\t\t\t\t\tconst operation_name = translate($.parent.parent.key.ref.key);\n\t\t\t\t\treturn generateNodePathPartOfViewName($.parent.parent.parent) + \" › \" + operation_name;\n\t\t\t\t},\n\t\t\t}),\n\t});\n}\n\ntype HasOpenView = \"no\" | csr.Copen_views;\n\nconst windows = new Map();\n\nclass View {\n\tview_containing_element: () => HTMLElement;\n\tdestructor: DestructorTree;\n\tdefinition: csr.Copen_views;\n\tactive_element: Element | null;\n\tprivate in_front = false;\n\tprivate created_element: HTMLElement;\n\n\tconstructor(window_containing_element: () => HTMLElement, destructor: DestructorTree, definition: csr.Copen_views) {\n\t\tthis.view_containing_element = () => {\n\t\t\tif (this.created_element === undefined) {\n\t\t\t\tthis.created_element = isNonNull(window_containing_element().ownerDocument).createElementNS(\n\t\t\t\t\t\"http://www.w3.org/1999/xhtml\",\n\t\t\t\t\t\"div\"\n\t\t\t\t);\n\t\t\t\tif (this.in_front) {\n\t\t\t\t\tthis.created_element?.classList.add(\"in-front\");\n\t\t\t\t}\n\t\t\t\tthis.created_element.classList.add(\"engine-window\");\n\t\t\t\twindow_containing_element().appendChild(this.created_element);\n\t\t\t\tthis.destructor.onDestroy(() => {\n\t\t\t\t\tthis.created_element.remove();\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn this.created_element;\n\t\t};\n\t\tthis.destructor = destructor;\n\t\tthis.definition = definition;\n\n\t\trenderView.render(\n\t\t\tthis.view_containing_element,\n\t\t\tthis.definition.properties.view_definition.ref,\n\t\t\tthis.definition.properties.view_context.output.result_node(),\n\t\t\tthis.destructor,\n\t\t\tthis.view_containing_element,\n\t\t\tthis.definition\n\t\t);\n\t}\n\n\tmoveToFront() {\n\t\tthis.created_element?.classList.add(\"in-front\");\n\t\tthis.in_front = true;\n\t\tsetTimeout(() => {\n\t\t\tif (this.active_element instanceof HTMLElement) {\n\t\t\t\tthis.active_element.focus();\n\t\t\t}\n\t\t}, 10);\n\t}\n\n\tmoveToBack() {\n\t\tthis.created_element?.classList.remove(\"in-front\");\n\t\tthis.in_front = false;\n\t}\n\n\tclose() {\n\t\tthis.destructor.destroy();\n\t}\n}\n\nfunction bindEntryKey(view: csr.Copen_views, node: csr.Cnode, view_destructor: DestructorTree) {\n\tconst gui_view = view.properties.view_definition.ref;\n\tconst mutable_added_view = view;\n\n\tif (isEntryView(view.properties.view_context.output.result_node()) === true) {\n\t\tlet unsubscribe_from_entry_key: (() => void) | undefined;\n\n\t\tmutable_added_view.properties.is_entry_view.set(\"yes\", {\n\t\t\t\"entry key\": \"\",\n\t\t\t\"entry path\": \"\",\n\t\t});\n\t\tconst mutable_is_entry_view = mutable_added_view.properties.is_entry_view.cast(\"yes\");\n\n\t\tgenerateNodeEntryKeyPartOfViewName(\n\t\t\tview.properties.view_context.output.result_node(),\n\t\t\tfunction (new_entry_key, unsubscribe) {\n\t\t\t\tif (view.destroyed) {\n\t\t\t\t\tunsubscribe();\n\t\t\t\t} else {\n\t\t\t\t\tunsubscribe_from_entry_key = unsubscribe;\n\t\t\t\t\tmutable_is_entry_view.set_entry_key(new_entry_key);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tview_destructor.onDestroy(() => {\n\t\t\tunsubscribe_from_entry_key?.();\n\t\t});\n\t} else {\n\t\tmutable_added_view.properties.is_entry_view.set(\"no\", {\n\t\t\ttitle: \"\",\n\t\t});\n\t}\n\n\tconst make_title = gui_view.properties.translate_title.switch({\n\t\tno: () => () => generateNodePathPartOfViewName(node),\n\t\tyes: ($) => {\n\t\t\tconst gui_view_title = $.properties.title.entry;\n\t\t\treturn () => {\n\t\t\t\tif (gui_view_title.trim() === \"\") {\n\t\t\t\t\treturn generateNodePathPartOfViewName(node);\n\t\t\t\t} else {\n\t\t\t\t\treturn translate(gui_view_title);\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t});\n\n\tconst language_observer = client_state.subscribe_selected_language({\n\t\ton_update: function () {\n\t\t\tconst title = make_title();\n\t\t\tview.properties.is_entry_view.switch({\n\t\t\t\tno: ($) => {\n\t\t\t\t\t$.set_title(title);\n\t\t\t\t},\n\t\t\t\tyes: ($) => {\n\t\t\t\t\t$.set_entry_path(title);\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n\tview_destructor.onDestroy(() => {\n\t\tlanguage_observer.unsubscribe();\n\t});\n}\n\nconst OPEN_VIEWS_THRESHOLD = 10;\n\nexport class Window {\n\twindow_containing_element: () => HTMLElement;\n\topen_views: { [key: string]: View } = {};\n\topen_views_history: View[] = [];\n\tdefinition: csr.Cwindows;\n\tdestructor: DestructorTree;\n\tdeeplink_target = false;\n\n\tconstructor(window_containing_element: () => HTMLElement, destructor: DestructorTree, definition: csr.Cwindows) {\n\t\tthis.window_containing_element = window_containing_element;\n\t\tthis.definition = definition;\n\t\tthis.destructor = destructor;\n\t\tthis.destructor.onDestroy(() => {\n\t\t\tif (this.definition.destroyed) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (const [, open_view] of this.definition.properties.open_views) {\n\t\t\t\tthis.close_view(open_view);\n\t\t\t}\n\t\t});\n\t\tthis.deeplink_target = definition.key.ref.parent.properties.allow_deeplink.switch({\n\t\t\tyes: function ($) {\n\t\t\t\tconst is_target = $.properties.target_window.ref === definition.key.ref;\n\t\t\t\tif (is_target) {\n\t\t\t\t\tconst on_saved = subscribeOnSave((saved_node) => {\n\t\t\t\t\t\tdefinition.properties.has_active_view.switch({\n\t\t\t\t\t\t\tno: undefined,\n\t\t\t\t\t\t\tyes: function ($) {\n\t\t\t\t\t\t\t\tconst active_view = $.properties.view.ref;\n\t\t\t\t\t\t\t\tconst node_of_view = active_view.properties.view_context.output.result_node();\n\t\t\t\t\t\t\t\tif (saved_node === node_of_view) {\n\t\t\t\t\t\t\t\t\tpushHistoryState(\n\t\t\t\t\t\t\t\t\t\thash.deepLinkTo(\n\t\t\t\t\t\t\t\t\t\t\tactive_view.properties.view_definition_context.entry,\n\t\t\t\t\t\t\t\t\t\t\tactive_view.properties.view_definition.entry,\n\t\t\t\t\t\t\t\t\t\t\tcreateIdPathBuilderFromNode(node_of_view)\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\tactive_view.properties.view_definition.entry\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\tunSubscribeOnSave(on_saved);\n\t\t\t\t\t\thash.clearDeepLink();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn is_target;\n\t\t\t},\n\t\t\tno: false,\n\t\t});\n\t}\n\n\taddView(node: csr.Cnode, gui_view: gui_definition_types.views.alan_api.Cviews__, subscribe = true): csr.Copen_views {\n\t\tif (node.output.node_type() === gui_view.properties.node_type.output.result_gui_node().input.application_node()) {\n\t\t\t// Check if the view is a view of the current node\n\t\t\tconst open_view = this.is_view_open(node, gui_view);\n\t\t\tlet view: View;\n\t\t\tif (open_view !== \"no\") {\n\t\t\t\tview = this.open_views[open_view.key];\n\t\t\t} else {\n\t\t\t\tconst view_id = uuid.generate();\n\t\t\t\tconst added_view = this.definition.properties.open_views.create(view_id, {\n\t\t\t\t\t\"is active view\": [\"no\", {}],\n\t\t\t\t\t\"is entry view\": [\n\t\t\t\t\t\t\"no\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t\"action active\": [\"no\", {}],\n\t\t\t\t\t\"view context\": createClientIdPathFromNode(node),\n\t\t\t\t\t\"view definition context\": isDefined(gui_view.parent.key),\n\t\t\t\t\t\"view definition\": gui_view.key,\n\t\t\t\t\tsubscribe: subscribe ? \"yes\" : \"no\",\n\t\t\t\t});\n\t\t\t\tlinkIdPath(added_view.properties.view_context);\n\t\t\t\tconst view_destructor = this.destructor.addChild();\n\t\t\t\tbindEntryKey(added_view, node, view_destructor);\n\t\t\t\tthis.open_views[view_id] = new View(this.window_containing_element, view_destructor, added_view);\n\t\t\t\tview = this.open_views[view_id];\n\t\t\t}\n\t\t\treturn view.definition;\n\t\t} else {\n\t\t\tthrow new Error(\"invalid view\");\n\t\t}\n\t}\n\n\topen_view(\n\t\tnode: csr.Cnode,\n\t\tgui_view: gui_definition_types.views.alan_api.Cviews__,\n\t\ton_activated?: (view: csr.Copen_views) => void,\n\t\tin_front = true\n\t): csr.Copen_views {\n\t\tconst view = this.addView(node, gui_view);\n\t\tsetTimeout(() => {\n\t\t\tthis.activate_view(view, in_front);\n\t\t\ton_activated?.(view);\n\t\t\tthis.closeInactiveViews();\n\t\t}, 50); // delay the rendering to give the backend state some time to initialize.\n\t\treturn view;\n\t}\n\n\tis_view_open(\n\t\tcontext: IdPathBuilder | csr.Cnode,\n\t\tgui_view: gui_definition_types.views.alan_api.Cviews__\n\t): HasOpenView {\n\t\tlet view_open: HasOpenView = \"no\";\n\t\tif (context instanceof csr.Cnode) {\n\t\t\tfor (const open_view of this.definition.properties.open_views.values())\n\t\t\t\tif (open_view.properties.view_definition.ref.is(gui_view))\n\t\t\t\t\tif (context.is(open_view.properties.view_context.output.result_node())) view_open = open_view;\n\t\t} else {\n\t\t\tfor (const open_view of this.definition.properties.open_views.values())\n\t\t\t\tif (open_view.properties.view_definition.ref.is(gui_view))\n\t\t\t\t\tif (\n\t\t\t\t\t\tJSON.stringify(createIdPathFromNode(open_view.properties.view_context.output.result_node())) ===\n\t\t\t\t\t\tJSON.stringify(context.build())\n\t\t\t\t\t)\n\t\t\t\t\t\tview_open = open_view;\n\t\t}\n\t\treturn view_open;\n\t}\n\n\tactivate_view(view: csr.Copen_views, in_front = true): void {\n\t\tif (view.destroyed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.definition.properties.has_active_view.switch({\n\t\t\tno: () => {\n\t\t\t\tin_front = true;\n\t\t\t},\n\t\t\tyes: async ($) => {\n\t\t\t\tif (in_front) {\n\t\t\t\t\tconst active_view = $.properties.view.ref;\n\t\t\t\t\tthis.definition.properties.has_active_view.set(\"no\", {});\n\t\t\t\t\tactive_view.properties.is_active_view.set(\"no\", {});\n\t\t\t\t\tconst open_view = this.open_views[active_view.key];\n\t\t\t\t\topen_view.moveToBack();\n\t\t\t\t\tconst active_element = document.activeElement;\n\t\t\t\t\tawait ControlsAreSynchronized();\n\t\t\t\t\tif (open_view.view_containing_element().contains(active_element)) {\n\t\t\t\t\t\topen_view.active_element = active_element;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tconst open_view = this.open_views[view.key];\n\t\tthis.open_views_history = this.open_views_history.filter(\n\t\t\t(a_view_from_history) => a_view_from_history !== open_view\n\t\t);\n\t\tif (in_front) {\n\t\t\tview.properties.is_active_view.set(\"yes\", {});\n\t\t\tthis.definition.properties.has_active_view.set(\"yes\", {\n\t\t\t\tview: view.key,\n\t\t\t});\n\t\t\topen_view.moveToFront();\n\t\t\tif (this.deeplink_target) {\n\t\t\t\tconst node = open_view.definition.properties.view_context.output.result_node();\n\t\t\t\tnode.properties.location.switch({\n\t\t\t\t\tlocal: undefined,\n\t\t\t\t\tremote: function () {\n\t\t\t\t\t\tpushHistoryState(\n\t\t\t\t\t\t\thash.deepLinkTo(\n\t\t\t\t\t\t\t\tisDefined(view.properties.view_definition.ref.parent.key),\n\t\t\t\t\t\t\t\tview.properties.view_definition.ref.key,\n\t\t\t\t\t\t\t\tcreateIdPathBuilderFromNode(node)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tview.properties.view_definition.ref.key\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t\t//insert at last place\n\t\t\tthis.open_views_history.splice(this.open_views_history.length, 0, open_view);\n\t\t} else {\n\t\t\t//insert at second to last place\n\t\t\tthis.open_views_history.splice(this.open_views_history.length - 1, 0, open_view);\n\t\t}\n\t}\n\n\tclose_view(view: csr.Copen_views): void {\n\t\tconst open_view = this.open_views[view.key];\n\t\tif (!open_view) {\n\t\t\treturn;\n\t\t}\n\t\tconst mutable_window = this.definition;\n\n\t\tthis.open_views_history = this.open_views_history.filter(function (a_view_from_history) {\n\t\t\treturn a_view_from_history !== open_view;\n\t\t});\n\t\tthis.definition.properties.has_active_view.switch({\n\t\t\tno: undefined,\n\t\t\tyes: ($) => {\n\t\t\t\tif ($.properties.view.ref.key === view.key) {\n\t\t\t\t\tif (this.open_views_history.length > 0) {\n\t\t\t\t\t\tthis.activate_view(this.open_views_history[this.open_views_history.length - 1].definition);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (this.deeplink_target) {\n\t\t\t\t\t\t\tpushHistoryState(hash.clearDeepLink(), \"\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmutable_window.properties.has_active_view.set(\"no\", {});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\topen_view.close();\n\t\tmutable_window.properties.open_views.delete(view.key);\n\t\tdelete this.open_views[view.key];\n\t}\n\n\tprivate closeInactiveViews() {\n\t\tconst number_of_open_views = this.open_views_history.length;\n\t\tif (number_of_open_views <= OPEN_VIEWS_THRESHOLD) {\n\t\t\treturn;\n\t\t}\n\t\tlet closed_views = 0;\n\t\tconst views_to_close = number_of_open_views - OPEN_VIEWS_THRESHOLD;\n\t\tconst history_copy = this.open_views_history.slice(); //use a copy because the original is going to change in the loop\n\t\tfor (let i = 0; i < number_of_open_views && closed_views < views_to_close; i += 1) {\n\t\t\tconst view_definition = history_copy[i].definition;\n\t\t\tif (!view_definition.destroyed) {\n\t\t\t\tview_definition.properties.is_active_view.switch({\n\t\t\t\t\tno: () => {\n\t\t\t\t\t\tconst context_node = view_definition.properties.view_context.output.result_node();\n\t\t\t\t\t\tif (context_node === undefined) {\n\t\t\t\t\t\t\tclosed_views += 1;\n\t\t\t\t\t\t\tthis.close_view(view_definition);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcontext_node.properties.modified.switch({\n\t\t\t\t\t\t\t\tno: () => {\n\t\t\t\t\t\t\t\t\tclosed_views += 1;\n\t\t\t\t\t\t\t\t\tthis.close_view(view_definition);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tyes: undefined,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tyes: undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getWindowInstance(name: string): Window {\n\tconst window = windows.get(name);\n\tif (window !== undefined) {\n\t\treturn window;\n\t} else {\n\t\tthrow new Error(`Window '${name}' is not initialized`);\n\t}\n}\n\nexport function initialize(\n\twindow_name: string,\n\twindow_containing_element: () => HTMLElement,\n\tdestructor: DestructorTree,\n\tdefinition: csr.Cwindows\n): void {\n\twindows.set(window_name, new Window(window_containing_element, destructor, definition));\n\tdestructor.onDestroy(() => {\n\t\tdefinition.parent.properties.windows.delete(window_name);\n\t\twindows.delete(window_name);\n\t});\n}\n","import { IdPathBuilder, Raw_Id_Path_Head } from \"../../navigation/IdPathBuilder\";\n\nexport function deepLinkTo(views: string, view: string, context: IdPathBuilder): string {\n\tconst properties = parseHash();\n\tproperties.set(\"vs\", views);\n\tproperties.set(\"v\", view);\n\tproperties.set(\"c\", keysOfIdPath(context));\n\treturn serializeHash(properties);\n}\n\nconst context_separator = \">\";\nconst context_escape = \"*\";\nconst separator_regex = new RegExp(context_separator, \"g\");\nconst escape_regex = new RegExp(`\\\\${context_escape}`, \"g\");\n\nfunction keysOfIdPath(id: IdPathBuilder): string {\n\tconst result: string[] = [];\n\tconst walk = (step: Raw_Id_Path_Head) => {\n\t\tswitch (step[\"has steps\"][0]) {\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tcase \"yes\": {\n\t\t\t\tconst yes = step[\"has steps\"][1];\n\t\t\t\tswitch (yes.type[0]) {\n\t\t\t\t\tcase \"collection entry\": {\n\t\t\t\t\t\tconst entry = yes.type[1];\n\t\t\t\t\t\tresult.push(\n\t\t\t\t\t\t\tentry.id\n\t\t\t\t\t\t\t\t.replace(escape_regex, context_escape + context_escape)\n\t\t\t\t\t\t\t\t.replace(separator_regex, context_escape + context_separator)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"state\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(yes.type[0]);\n\t\t\t\t}\n\t\t\t\twalk(yes.tail);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(step[\"has steps\"][0]);\n\t\t}\n\t};\n\twalk(id.build());\n\treturn result.join(context_separator);\n}\n\nexport function parseKeys(s: string): string[] {\n\tconst result: string[] = [];\n\tlet part = \"\";\n\tfor (let i = 0; i < s.length; i += 1) {\n\t\tconst c = s[i];\n\t\tif (c === context_escape) {\n\t\t\tconst next_c = s[i + 1];\n\t\t\tif (next_c === undefined) {\n\t\t\t\tpart += c;\n\t\t\t} else if (next_c === context_escape) {\n\t\t\t\tpart += next_c;\n\t\t\t\ti += 1;\n\t\t\t} else if (next_c === context_separator) {\n\t\t\t\tpart += next_c;\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t} else if (c === context_separator) {\n\t\t\tresult.push(part);\n\t\t\tpart = \"\";\n\t\t} else {\n\t\t\tpart += c;\n\t\t}\n\t}\n\tif (part.length > 0) {\n\t\tresult.push(part);\n\t}\n\treturn result;\n}\n\nexport function clearDeepLink(): string {\n\tconst properties = parseHash();\n\tproperties.delete(\"vs\");\n\tproperties.delete(\"v\");\n\tproperties.delete(\"c\");\n\trewriteHash(properties);\n\treturn serializeHash(properties);\n}\n\nexport function setUpdated(): void {\n\tconst properties = parseHash();\n\tproperties.set(\"updated\", \"updated\");\n\trewriteHash(properties);\n}\n\nexport function clearUpdated(): void {\n\tconst properties = parseHash();\n\tproperties.delete(\"updated\");\n\trewriteHash(properties);\n}\n\nexport function getUpdated(): string | null {\n\treturn parseHash().get(\"updated\");\n}\n\nexport function getDeepLink(): { views: string; view: string; context: string } | undefined {\n\tconst properties = parseHash();\n\tconst views = properties.get(\"vs\");\n\tconst view = properties.get(\"v\");\n\tconst context = properties.get(\"c\");\n\tif (views !== null && view !== null && context !== null) {\n\t\treturn {\n\t\t\tviews: views,\n\t\t\tview: view,\n\t\t\tcontext: context,\n\t\t};\n\t} else {\n\t\treturn undefined;\n\t}\n}\n\nexport function getLanguage(): string | null {\n\treturn parseHash().get(\"lang\");\n}\n\nexport function clearLanguage(): void {\n\tconst properties = parseHash();\n\tproperties.delete(\"lang\");\n\trewriteHash(properties);\n}\n\nexport function getUserName(): string | null {\n\treturn parseHash().get(\"u\");\n}\n\nexport function getToken(): string | null {\n\treturn parseHash().get(\"t\");\n}\n\nexport function getDebug(): boolean {\n\treturn parseHash().get(\"debug\") !== null;\n}\n\nexport function clearToken(): void {\n\tconst properties = parseHash();\n\tproperties.delete(\"t\");\n\trewriteHash(properties);\n}\n\nexport function clearUsername(): void {\n\tconst properties = parseHash();\n\tproperties.delete(\"u\");\n\trewriteHash(properties);\n}\n\nexport function getDevserverPort(): string | null {\n\treturn parseHash().get(\"dev-server-port\");\n}\n\nexport function clearDevserverPort(): void {\n\tconst properties = parseHash();\n\tproperties.delete(\"dev-server-port\");\n\trewriteHash(properties);\n}\n\nfunction parseHash() {\n\treturn new URLSearchParams(window.location.hash.slice(1));\n}\n\nfunction serializeHash(properties: Record | URLSearchParams) {\n\treturn new URLSearchParams(properties).toString();\n}\n\nfunction rewriteHash(properties: URLSearchParams) {\n\twindow.location.hash = serializeHash(properties);\n}\n","const identifier_cache: { [key: string]: string } = {};\n\nexport default function (identifier: string): string {\n\tlet escaped_identifier = identifier_cache[identifier];\n\tif (escaped_identifier === void 0) {\n\t\tescaped_identifier = identifier.replace(/[^a-zA-Z0-9_]/g, \"_\").replace(/^[0-9]+$/, \"_\" + identifier);\n\t\tif (reserved_keywords.has(escaped_identifier)) {\n\t\t\tescaped_identifier = escaped_identifier + \"_\";\n\t\t}\n\t\tidentifier_cache[identifier] = escaped_identifier;\n\t}\n\treturn escaped_identifier;\n}\n\nconst reserved_keywords = new Set([\n\t\"break\",\n\t\"case\",\n\t\"catch\",\n\t\"class\",\n\t\"const\",\n\t\"continue\",\n\t\"debugger\",\n\t\"default\",\n\t\"delete\",\n\t\"do\",\n\t\"else\",\n\t\"enum\",\n\t\"export\",\n\t\"extends\",\n\t\"false\",\n\t\"finally\",\n\t\"for\",\n\t\"function\",\n\t\"if\",\n\t\"import\",\n\t\"in\",\n\t\"instanceof\",\n\t\"new\",\n\t\"null\",\n\t\"return\",\n\t\"super\",\n\t\"switch\",\n\t\"this\",\n\t\"throw\",\n\t\"true\",\n\t\"try\",\n\t\"typeof\",\n\t\"var\",\n\t\"void\",\n\t\"while\",\n\t\"with\",\n\t\"as\",\n\t\"implements\",\n\t\"interface\",\n\t\"let\",\n\t\"package\",\n\t\"private\",\n\t\"protected\",\n\t\"public\",\n\t\"static\",\n\t\"yield\",\n]);\n","import { api_configuration } from \"../../common\";\nimport DestructorTree from \"../DestructorTree\";\nimport {\n\tsetState,\n\tsetWidgetState,\n\tstoreNumber,\n\tstoreState,\n\tstoreText,\n\tstoreWidgetNumber,\n\tstoreWidgetText,\n} from \"../state/modifications\";\nimport { isDefined } from \"../validation\";\nimport ImplementationVisitorContext from \"./ImplementationVisitorContext\";\nimport { visitExpression } from \"./visit_widget_implementation_expression\";\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_widget = api_configuration.libraries.gui_definition_lib.types.widget.alan_api;\nimport api_modification = api_configuration.types.modifications.alan_api;\nimport context_selection = require(\"./context_selection\");\nimport { EventValue } from \"./ExpressionTypes\";\nimport { decorateInstructionError, isNonDecoratedError } from \"./stackTraceMessage\";\nimport { logInstruction } from \"../state/ClientState\";\nimport { InstructionError } from \"./instructions/InstructionError\";\n\ntype Writeable = { -readonly [P in keyof T]: T[P] };\n\nasync function executeInstruction(\n\tevent_name: string,\n\timplementation_context: ImplementationVisitorContext,\n\targument_context: ImplementationVisitorContext,\n\tevent_selection: api_widget.Cbinding__configuration_attribute_type,\n\tdestructor: DestructorTree,\n\tevent_value: EventValue\n): Promise {\n\tlet typed_events = [];\n\n\tswitch (event_selection.properties.has_arguments.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst mapArgument = async (argument: api_widget.Cinstruction_argument): Promise => {\n\t\t\t\tswitch (argument.properties.type.state.name) {\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\treturn event_value;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst number_type = argument.properties.type.state.node;\n\t\t\t\t\t\treturn await visitExpression(number_type.properties.argument.properties.expression).execute(\n\t\t\t\t\t\t\targument_context,\n\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst text_type = argument.properties.type.state.node;\n\t\t\t\t\t\treturn await visitExpression(text_type.properties.argument.properties.expression).execute(\n\t\t\t\t\t\t\targument_context,\n\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcase \"view\": {\n\t\t\t\t\t\tconst $ = argument.properties.type.state.node;\n\t\t\t\t\t\tconst view_configuration_key = $.properties.view_configuration.entry;\n\t\t\t\t\t\tconst view_argument_context = context_selection.context_selection(\n\t\t\t\t\t\t\t$.properties.context,\n\t\t\t\t\t\t\targument_context,\n\t\t\t\t\t\t\tnew DestructorTree()\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tconst widget_configuration_view = view_argument_context.gui_widget_configuration.properties.configuration\n\t\t\t\t\t\t\t.get(view_configuration_key)!\n\t\t\t\t\t\t\t.properties.attribute.properties.type.cast(\"view\")\n\t\t\t\t\t\t\t.properties.render.cast(\"in window\");\n\t\t\t\t\t\treturn widget_configuration_view;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(argument.properties.type.state);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst mapArguments = async (argument: api_widget.Cinstruction_argument): Promise => {\n\t\t\t\tconst typed_argument = await mapArgument(argument);\n\t\t\t\tswitch (argument.properties.next_argument.state.name) {\n\t\t\t\t\tcase \"exists\": {\n\t\t\t\t\t\tconst $ = argument.properties.next_argument.state.node;\n\t\t\t\t\t\treturn [typed_argument].concat(await mapArguments($.properties.argument));\n\t\t\t\t\t}\n\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\treturn [typed_argument];\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(argument.properties.next_argument.state);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst has_argument = event_selection.properties.has_arguments.state.node;\n\t\t\ttyped_events = await mapArguments(has_argument.properties.first_argument);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(event_selection.properties.has_arguments.state);\n\t}\n\n\tif (implementation_context.current_binding_context.destroyed) {\n\t\tconsole.warn(\n\t\t\t\"trying to execute an instruction on a destroyed binding context:\" +\n\t\t\t\timplementation_context.current_binding_context.path\n\t\t);\n\t\treturn;\n\t}\n\n\tlogInstruction(implementation_context.current_binding_context, event_name);\n\n\treturn (\n\t\tisDefined(implementation_context.client_state_binder_AsPropertiesBinding.instruction_handlers)[event_name](\n\t\t\timplementation_context,\n\t\t\t...typed_events\n\t\t) || Promise.resolve()\n\t);\n}\n\nasync function execute_configuration_intruction_handler(\n\timplementation_context: ImplementationVisitorContext,\n\targument_context: ImplementationVisitorContext,\n\tconfiguration_instruction: api_widget.Cconfiguration__configuration_attribute_type,\n\tdestructor: DestructorTree,\n\tvalue?: EventValue\n): Promise {\n\tconst node_context = implementation_context.view_context_node;\n\tswitch (configuration_instruction.properties.instruction.state.name) {\n\t\tcase \"set number\": {\n\t\t\tconst set_number = configuration_instruction.properties.instruction.state.node;\n\t\t\tconst new_value = (await visitExpression(set_number.properties.argument.properties.expression).execute(\n\t\t\t\targument_context,\n\t\t\t\tdestructor,\n\t\t\t\tvalue\n\t\t\t)) as number;\n\n\t\t\tconst widget_configuration = implementation_context.widget_configuration;\n\t\t\tif (widget_configuration instanceof api_views.Cgui_widget_configuration_node) {\n\t\t\t\tconst number_configuration_property = widget_configuration.properties.configuration\n\t\t\t\t\t.get(set_number.properties.number.entry)\n\t\t\t\t\t?.properties.attribute.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"number\");\n\t\t\t\tif (number_configuration_property === undefined) {\n\t\t\t\t\tstoreWidgetNumber(\n\t\t\t\t\t\tnode_context,\n\t\t\t\t\t\timplementation_context.last_gui_widget_configuration,\n\t\t\t\t\t\tset_number.properties.number.ref,\n\t\t\t\t\t\tnew_value,\n\t\t\t\t\t\timplementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tstoreNumber(node_context, number_configuration_property, new_value, implementation_context.entry_keys);\n\t\t\t\t}\n\t\t\t} else if (widget_configuration instanceof api_modification.Cconfiguration_node) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst number_property = widget_configuration.properties.attributes\n\t\t\t\t\t.get(set_number.properties.number.entry)!\n\t\t\t\t\t.properties.type.cast(\"number\");\n\t\t\t\tnumber_property.set_value(new_value);\n\t\t\t\tstoreState(widget_configuration.root);\n\t\t\t} else if (widget_configuration instanceof api_widget.Cwidget_configuration_node) {\n\t\t\t\tstoreWidgetNumber(\n\t\t\t\t\tnode_context,\n\t\t\t\t\timplementation_context.last_gui_widget_configuration,\n\t\t\t\t\tset_number.properties.number.ref,\n\t\t\t\t\tnew_value,\n\t\t\t\t\timplementation_context.entry_keys\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tunexpectedState(widget_configuration);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"set state\": {\n\t\t\tconst set_state = configuration_instruction.properties.instruction.state.node;\n\t\t\tconst widget_configuration = implementation_context.widget_configuration;\n\t\t\tif (widget_configuration instanceof api_views.Cgui_widget_configuration_node) {\n\t\t\t\tconst state_configuration_property = widget_configuration.properties.configuration\n\t\t\t\t\t.get(set_state.properties.state_group.entry)\n\t\t\t\t\t?.properties.attribute.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"state group\");\n\t\t\t\tif (state_configuration_property === undefined) {\n\t\t\t\t\tsetWidgetState(\n\t\t\t\t\t\tnode_context,\n\t\t\t\t\t\timplementation_context.last_gui_widget_configuration,\n\t\t\t\t\t\tset_state.properties.state_group.ref,\n\t\t\t\t\t\tset_state.properties.state.entry,\n\t\t\t\t\t\tawait mapInstructionArgumentToModification(\n\t\t\t\t\t\t\tset_state.properties.node,\n\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\timplementation_context\n\t\t\t\t\t\t),\n\t\t\t\t\t\timplementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tsetState(\n\t\t\t\t\t\tnode_context,\n\t\t\t\t\t\tstate_configuration_property,\n\t\t\t\t\t\tset_state.properties.state.entry,\n\t\t\t\t\t\tawait mapInstructionArgumentToModification(\n\t\t\t\t\t\t\tset_state.properties.node,\n\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\timplementation_context\n\t\t\t\t\t\t),\n\t\t\t\t\t\timplementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (widget_configuration instanceof api_modification.Cconfiguration_node) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst state_configuration_property = widget_configuration.properties.attributes\n\t\t\t\t\t.get(set_state.properties.state_group.entry)!\n\t\t\t\t\t.properties.type.cast(\"state group\");\n\t\t\t\tstate_configuration_property.root.transact(async () => {\n\t\t\t\t\tstate_configuration_property.set_selected_state(set_state.properties.state.entry);\n\t\t\t\t\t(state_configuration_property.properties as Writeable).node =\n\t\t\t\t\t\tnew api_modification.Cconfiguration_node(\n\t\t\t\t\t\t\tawait mapInstructionArgumentToModification(\n\t\t\t\t\t\t\t\tset_state.properties.node,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\timplementation_context\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tstate_configuration_property,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\twidget_node: () => set_state.properties.state.ref.properties.node,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"node\"\n\t\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t\tstoreState(widget_configuration.root);\n\t\t\t} else if (widget_configuration instanceof api_widget.Cwidget_configuration_node) {\n\t\t\t\tsetWidgetState(\n\t\t\t\t\tnode_context,\n\t\t\t\t\timplementation_context.last_gui_widget_configuration,\n\t\t\t\t\tset_state.properties.state_group.ref,\n\t\t\t\t\tset_state.properties.state.entry,\n\t\t\t\t\tawait mapInstructionArgumentToModification(\n\t\t\t\t\t\tset_state.properties.node,\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\timplementation_context\n\t\t\t\t\t),\n\t\t\t\t\timplementation_context.entry_keys\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tunexpectedState(widget_configuration);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"set text\": {\n\t\t\tconst set_text = configuration_instruction.properties.instruction.state.node;\n\t\t\tconst new_text_value = (await visitExpression(set_text.properties.argument.properties.expression).execute(\n\t\t\t\targument_context,\n\t\t\t\tdestructor,\n\t\t\t\tvalue\n\t\t\t)) as string;\n\t\t\tconst widget_configuration = implementation_context.widget_configuration;\n\t\t\tif (widget_configuration instanceof api_views.Cgui_widget_configuration_node) {\n\t\t\t\tconst text_configuration_property = widget_configuration.properties.configuration\n\t\t\t\t\t.get(set_text.properties.text.entry)\n\t\t\t\t\t?.properties.attribute.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"text\");\n\t\t\t\tif (text_configuration_property === undefined) {\n\t\t\t\t\tstoreWidgetText(\n\t\t\t\t\t\tnode_context,\n\t\t\t\t\t\timplementation_context.last_gui_widget_configuration,\n\t\t\t\t\t\tset_text.properties.text.ref,\n\t\t\t\t\t\tnew_text_value,\n\t\t\t\t\t\timplementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tstoreText(node_context, text_configuration_property, new_text_value, implementation_context.entry_keys);\n\t\t\t\t}\n\t\t\t} else if (widget_configuration instanceof api_modification.Cconfiguration_node) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst text_property = widget_configuration.properties.attributes\n\t\t\t\t\t.get(set_text.properties.text.entry)!\n\t\t\t\t\t.properties.type.cast(\"text\");\n\t\t\t\ttext_property.set_value(new_text_value);\n\t\t\t} else if (widget_configuration instanceof api_widget.Cwidget_configuration_node) {\n\t\t\t\tstoreWidgetText(\n\t\t\t\t\tnode_context,\n\t\t\t\t\timplementation_context.last_gui_widget_configuration,\n\t\t\t\t\tset_text.properties.text.ref,\n\t\t\t\t\tnew_text_value,\n\t\t\t\t\timplementation_context.entry_keys\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tunexpectedState(widget_configuration);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(configuration_instruction.properties.instruction.state);\n\t}\n}\n\nasync function mapInstructionArgumentToModification(\n\tnode: api_widget.Cinstruction_argument_configuration_node,\n\tdestructor: DestructorTree,\n\tvalue: EventValue,\n\timplementation_context: ImplementationVisitorContext\n): Promise {\n\tconst new_node: api_modification.Tconfiguration_node = {\n\t\tattributes: {},\n\t};\n\tfor (const [key, attribute] of node.properties.attributes) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"configuration\": {\n\t\t\t\tconst config = attribute.properties.type.state.node;\n\t\t\t\tswitch (config.properties.type.state.name) {\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst $ = config.properties.type.state.node;\n\t\t\t\t\t\tnew_node.attributes[key] = {\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: (await visitExpression($.properties.argument.properties.expression).execute(\n\t\t\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t\t)) as number,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst $ = config.properties.type.state.node;\n\t\t\t\t\t\tnew_node.attributes[key] = {\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"state group\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"selected state\": $.properties.state.entry,\n\t\t\t\t\t\t\t\t\tnode: await mapInstructionArgumentToModification(\n\t\t\t\t\t\t\t\t\t\t$.properties.node,\n\t\t\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t\timplementation_context\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst $ = config.properties.type.state.node;\n\t\t\t\t\t\tnew_node.attributes[key] = {\n\t\t\t\t\t\t\ttype: [\n\t\t\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: (await visitExpression($.properties.argument.properties.expression).execute(\n\t\t\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t\t)) as string,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(config.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state.name);\n\t\t}\n\t}\n\treturn new_node;\n}\n\nexport async function instruction_selection(\n\tinstruction: api_widget.Cinstruction_selection,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree,\n\tvalue: string | number | undefined | File\n): Promise {\n\ttry {\n\t\tconst instruction_implementation_context = context_selection.context_selection(\n\t\t\tinstruction.properties.context,\n\t\t\timplementation_context,\n\t\t\tdestructor\n\t\t);\n\t\tswitch (instruction.properties.configuration_attribute_type.state.name) {\n\t\t\tcase \"binding\": {\n\t\t\t\tconst binding_event = instruction.properties.configuration_attribute_type.state.node;\n\t\t\t\tawait executeInstruction(\n\t\t\t\t\tbinding_event.properties.instruction.entry,\n\t\t\t\t\tinstruction_implementation_context,\n\t\t\t\t\timplementation_context,\n\t\t\t\t\tbinding_event,\n\t\t\t\t\tdestructor,\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"configuration\": {\n\t\t\t\tconst configuration_type = instruction.properties.configuration_attribute_type.state.node;\n\t\t\t\tawait execute_configuration_intruction_handler(\n\t\t\t\t\tinstruction_implementation_context,\n\t\t\t\t\timplementation_context,\n\t\t\t\t\tconfiguration_type,\n\t\t\t\t\tdestructor,\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn unexpectedState(instruction.properties.configuration_attribute_type.state);\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof Error && error.message.startsWith(\"Trying to access destroyed property!\")) {\n\t\t\t//FIXME make destroyed property Errors typed e.g. DestroyedError\n\t\t\tconsole.warn(\"Aborting instruction because of destroyed property \", error);\n\t\t\tthrow new InstructionError(\"Trying to access destroyed property!\");\n\t\t}\n\t\tif (isNonDecoratedError(error)) {\n\t\t\tthrow decorateInstructionError(error, instruction, implementation_context);\n\t\t}\n\t\tthrow error;\n\t}\n}\n","export class InstructionError extends Error {}\n","import { api_configuration } from \"../../../common\";\nimport gui_definition_types = api_configuration.libraries.gui_definition_lib.types;\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport DestructorTree from \"../../DestructorTree\";\nimport { addMessage } from \"../../front/messages\";\nimport { createIdPathBuilderFromNode } from \"../../navigation/createIdPathFromNode\";\nimport { hasCollectionCreationPermission } from \"../../state 2 interface/permissions\";\nimport * as requery from \"../../state 2 interface/reQuery\";\nimport { subscribeOnSave, unSubscribeOnSave } from \"./save\";\nimport { iReference } from \"../../state/Reference\";\nimport openViewOnNode from \"../../front/openViewOnNode\";\nimport * as Status from \"../../Status\";\nimport { registerGroup, registerStategroup } from \"../../state/registerClientState\";\nimport { iCollection } from \"../../state/Collection\";\nimport { iState } from \"../../state/Stategroup\";\nimport { iText } from \"../../state/Text\";\n\nfunction onViewClose(open_view: api_cs.Copen_views, onClose: () => void) {\n\tconst onRemove = open_view.parent.properties.open_views.subscribe({\n\t\ton_remove: (view_key) => {\n\t\t\tif (view_key === open_view.key) {\n\t\t\t\tonRemove.unsubscribe();\n\t\t\t\t/* a timeout so that the save action can execute. When it takes longer than\n\t\t\t\t * 150 ms. the user can always update the candidates manually. */\n\t\t\t\tsetTimeout(onClose, 150);\n\t\t\t}\n\t\t},\n\t});\n}\n\nexport function query_entry(\n\tquery: api_cs.Cyes__can_create_entry__yes,\n\tview: gui_definition_types.views.alan_api.Cviews__,\n\twindow: gui_definition_types.settings.alan_api.Cwindows,\n\tkey?: string\n): void {\n\tquery.properties.in_.switch({\n\t\tquery: function (in_query) {\n\t\t\tconst parent_node = in_query.inferences.query().inferences.node();\n\t\t\tconst new_node = addCollectionEntry(in_query.properties.collection.ref, key).properties.node;\n\t\t\tconst open_view = openViewOnNode(new_node, view, window);\n\t\t\tparent_node.properties.location.switch({\n\t\t\t\tlocal: function () {\n\t\t\t\t\tonViewClose(open_view, () => {\n\t\t\t\t\t\trequery.execute(query.parent.parent);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tremote: undefined,\n\t\t\t});\n\t\t},\n\t\tcandidates: function ($) {\n\t\t\tentryInCandidateSelection($.inferences.candidates_query(), view, window);\n\t\t},\n\t});\n}\n\nexport enum DefaultsAction {\n\tDoNotApply,\n\tApplyDefaults,\n}\n\nexport function entry(\n\tcollection: api_cs.Ccollection,\n\tview: gui_definition_types.views.alan_api.Cviews__,\n\twindow: gui_definition_types.settings.alan_api.Cwindows\n): api_cs.Cnode {\n\tconst new_node = addCollectionEntry(collection).properties.node;\n\topenViewOnNode(new_node, view, window);\n\treturn new_node;\n}\n\ntype CsObject = api_cs.Cnode | api_cs.Cstate_group__type__property;\nfunction selectStateOfReferenceTail(tail: api_app.Cobject_path_tail, object: CsObject, destructor: DestructorTree) {\n\ttail.properties.has_steps.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\tconst next_tail = $.properties.tail;\n\t\t\t$.properties.type.switch({\n\t\t\t\tparent: undefined,\n\t\t\t\tdependency: undefined,\n\t\t\t\t\"reference set\": undefined,\n\t\t\t\t\"property value\": ($) => {\n\t\t\t\t\tconst $type = $.properties.property.properties.property.ref.properties.type.state;\n\t\t\t\t\tswitch ($type.name) {\n\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\tthrow new Error(\"unexpected state\");\n\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\tthrow new Error(\"unexpected state\");\n\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\tthrow new Error(\"unexpected state\");\n\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\tselectStateOfReferenceTail(\n\t\t\t\t\t\t\t\tnext_tail,\n\t\t\t\t\t\t\t\tregisterGroup($type.node, object as api_cs.Cnode, destructor).properties.node,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\t\tselectStateOfReferenceTail(\n\t\t\t\t\t\t\t\tnext_tail,\n\t\t\t\t\t\t\t\tregisterStategroup($type.node, object as api_cs.Cnode, destructor),\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"collection\":\n\t\t\t\t\t\t\tthrow new Error(\"unexpected state\");\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState($type);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tstate: ($) => {\n\t\t\t\t\tconst state_group = object as api_cs.Cstate_group__type__property;\n\t\t\t\t\tconst state = state_group.properties.states.get($.properties.state.entry)!;\n\t\t\t\t\tiState(state).select(\"user\");\n\t\t\t\t\tselectStateOfReferenceTail(next_tail, state.properties.node, destructor);\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n}\n\nasync function entryInCandidateSelection(\n\tcandidate_selection: api_cs.Ccandidates__use_for__query,\n\tview: gui_definition_types.views.alan_api.Cviews__,\n\twindow: gui_definition_types.settings.alan_api.Cwindows\n) {\n\tconst destructor = new DestructorTree();\n\tconst collection = iReference(candidate_selection.inferences.reference_property().parent).collectionContext.value;\n\tif (!Status.isResolved(collection)) {\n\t\taddMessage(\"warning\", \"Cannot add entry\", { body: \"The reference is not resolved. Try again later\" });\n\t\treturn;\n\t}\n\n\tconst collection_entry = iCollection(collection).addEntry(\"user\");\n\tconst new_node = collection_entry.properties.node;\n\t// set reference text value as key of new node\n\tconst reference = candidate_selection.inferences.reference_property().parent.parent;\n\tconst key_of_new_node = collection_entry.properties.key.ref;\n\n\t// set reference value as key of new node, but only if the reference is not resolved so the entry does not already exist\n\tif (\n\t\treference.properties.backend_known.switch({\n\t\t\tno: true,\n\t\t\tyes: reference.properties.navigable.switch({\n\t\t\t\tno: false,\n\t\t\t\tyes: ($) =>\n\t\t\t\t\t$.properties.resolve_status.properties.status.switch({\n\t\t\t\t\t\tunresolved: true,\n\t\t\t\t\t\t\"failed to resolve\": true,\n\t\t\t\t\t\t\"is busy resolving\": false,\n\t\t\t\t\t\tresolved: false,\n\t\t\t\t\t}),\n\t\t\t}),\n\t\t})\n\t) {\n\t\treference.properties.is_set.switch({\n\t\t\tno: undefined,\n\t\t\tyes: ($) => {\n\t\t\t\tiText(key_of_new_node).update($.properties.text, \"user\");\n\t\t\t},\n\t\t});\n\t}\n\tselectStateOfReferenceTail(\n\t\tcandidate_selection.inferences.reference_property().parent.inferences.is_navigable().properties.expression\n\t\t\t.properties.tail.properties.path,\n\t\tnew_node,\n\t\tdestructor\n\t);\n\tconst on_save = subscribeOnSave(($) => {\n\t\tif (reference.destroyed) return;\n\t\tif ($ === new_node) {\n\t\t\tkey_of_new_node.properties.is_set.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: ($) => {\n\t\t\t\t\t// set key of new node as reference text\n\t\t\t\t\tiText(reference).update($.properties.text, \"user\");\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t});\n\tconst open_view = openViewOnNode(new_node, view, window);\n\tonViewClose(open_view, () => {\n\t\tunSubscribeOnSave(on_save);\n\t\tdestructor?.destroy();\n\t});\n}\n\nexport function entryFromEntity(\n\tnode: api_cs.Cnode,\n\tview: gui_definition_types.views.alan_api.Cviews__,\n\twindow: gui_definition_types.settings.alan_api.Cwindows\n): void {\n\tnode.input.entity().switch({\n\t\troot: () => {\n\t\t\taddMessage(\"warning\", \"Add entry not allowed\", { body: \"Can not duplicate the root.\" });\n\t\t},\n\t\tentry: (collection_entry) => {\n\t\t\tconst collection = collection_entry.parent;\n\t\t\tconst collection_name = collection.parent.parent.key.entry;\n\t\t\tconst id_path = createIdPathBuilderFromNode(collection.parent.parent.parent);\n\t\t\thasCollectionCreationPermission(id_path, collection_name, (has_create_permission) => {\n\t\t\t\tif (collection.destroyed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (has_create_permission) {\n\t\t\t\t\tentry(collection, view, window);\n\t\t\t\t} else {\n\t\t\t\t\taddMessage(\"warning\", \"Add entry not allowed\", {\n\t\t\t\t\t\tbody: \"You do not have the sufficient rights to perform this operation.\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t});\n}\n\nexport function addCollectionEntry(collection: api_cs.Ccollection, key?: string): api_cs.Centries__collection {\n\tconst new_entry = iCollection(collection).addEntry(\"user\", key);\n\tcollection.properties.last_created_entry.set(\"entry\", {\n\t\tentry: new_entry.key_value,\n\t});\n\treturn new_entry;\n}\n","import { api_configuration } from \"../../../common\";\nimport messages = require(\"../../front/messages\");\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { removeFilesFromUploadQueue } from \"./fileUpload\";\nimport * as discard from \"./discard\";\nimport { deleteCollectionEntry } from \"./delete\";\n\nexport function entry(node: api_cs.Cnode): void {\n\tremoveFilesFromUploadQueue(node);\n\tconst entity = node.input.entity().variant;\n\tswitch (entity.name) {\n\t\tcase \"root\":\n\t\t\tdiscard.entity(entity.definition.properties.root);\n\t\t\tbreak;\n\t\tcase \"entry\":\n\t\t\tswitch (entity.definition.properties.location.state.name) {\n\t\t\t\tcase \"remote\":\n\t\t\t\t\tdiscard.entity(entity.definition.properties.node);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"local\":\n\t\t\t\t\tdeleteCollectionEntry(entity.definition);\n\t\t\t}\n\t}\n\tmessages.removeAllMessages();\n}\n","import { api_configuration } from \"../../../common\";\nimport { translate } from \"../../front/translate\";\nimport * as reQuery from \"../../state 2 interface/reQuery\";\nimport * as ClientState from \"../../state/ClientState\";\nimport { importCsv, ImportError } from \"../../state/csv-importer\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport messages = require(\"../../front/messages\");\n\nconst CSV_IMPORT_FAILED_KEY = \"csv-import-failed\";\nconst CSV_IMPORT_SUCCESS_KEY = \"csv-import-success\";\nexport async function forQuery(query: api_cs.Cquery__use_for__query, file: File): Promise {\n\tconst context_node = query.inferences.node();\n\tconst gui_node = query.inferences.node_context().properties.path.output.result_node().output.gui_entity();\n\tswitch (context_node.properties.modified.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\":\n\t\t\tif (\n\t\t\t\t//FIXME move this to the controls\n\t\t\t\t!confirm(translate(\"There are unsaved changes which might be overwritten. Are you sure you want to continue?\"))\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(context_node.properties.modified.state);\n\t}\n\t// Set status to importing\n\tquery.parent.properties.entries_are_editable.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\t$.properties.is_importing.set(\"yes\", {});\n\t\t},\n\t});\n\n\tmessages.removeMessage(CSV_IMPORT_FAILED_KEY);\n\tmessages.removeMessage(CSV_IMPORT_SUCCESS_KEY);\n\tconst transaction = ClientState.transact();\n\ttry {\n\t\tawait importCsv(context_node, gui_node, file);\n\t\tmessages.addMessage(\"success\", \"Sucessfully imported CSV file\", {\n\t\t\tkey: CSV_IMPORT_SUCCESS_KEY,\n\t\t\tbody: \"Changes have been saved\",\n\t\t});\n\t\treQuery.execute(query.parent);\n\t} catch (error) {\n\t\tif (error instanceof ImportError) {\n\t\t\tmessages.addMessage(\"error\", \"Failed to import file\", {\n\t\t\t\tbody: error.message,\n\t\t\t\tkey: CSV_IMPORT_FAILED_KEY,\n\t\t\t});\n\t\t\t//FIXME set state and let the user decide\n\t\t\treQuery.execute(query.parent);\n\t\t} else {\n\t\t\tthrow error;\n\t\t}\n\t} finally {\n\t\ttransaction.unsubscribe();\n\t\tquery.parent.properties.entries_are_editable.switch({\n\t\t\tno: undefined,\n\t\t\tyes: ($) => {\n\t\t\t\t$.properties.is_importing.set(\"no\", {});\n\t\t\t},\n\t\t});\n\t}\n}\n","import { api_configuration } from \"../../../common\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport { addMessage } from \"../../front/messages\";\nimport { createIdPathBuilderFromNode } from \"../../navigation/createIdPathFromNode\";\nimport hash = require(\"../dom/hash\");\nimport { isDefined } from \"../../validation\";\n\nlet copyToClipboard: (value: string) => void;\n\nfunction openDeeplink(deeplink_hash: string) {\n\twindow.open(window.location.origin + window.location.pathname + \"#\" + deeplink_hash);\n}\n\nfunction copyLinkToClipboard(deeplink_hash: string) {\n\tif (!copyToClipboard) {\n\t\tconst text_input = document.createElement(\"input\");\n\t\ttext_input.setAttribute(\"style\", \"left:-1000vw\");\n\t\tdocument.body.appendChild(text_input);\n\n\t\tcopyToClipboard = function (value: string) {\n\t\t\ttext_input.value = value;\n\t\t\ttext_input.select();\n\t\t\ttext_input.setSelectionRange(0, text_input.value.length);\n\t\t\tdocument.execCommand(\"copy\");\n\t\t};\n\t}\n\tcopyToClipboard(window.location.origin + window.location.pathname + \"#\" + deeplink_hash);\n}\n\nexport function view_in_new_window(view: api_client_state.Copen_views): void {\n\tconst node = view.properties.view_context.output.result_node();\n\tnode.properties.location.switch({\n\t\tlocal: function () {\n\t\t\taddMessage(\"warning\", \"Cannot open new window\", { body: \"Save the entry, then try again.\" });\n\t\t},\n\t\tremote: function () {\n\t\t\topenDeeplink(\n\t\t\t\thash.deepLinkTo(\n\t\t\t\t\tisDefined(view.properties.view_definition.ref.parent.key),\n\t\t\t\t\tview.properties.view_definition.ref.key,\n\t\t\t\t\tcreateIdPathBuilderFromNode(node)\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t});\n}\n\nexport function copy_link_to_clipboard(view: api_client_state.Copen_views): void {\n\tconst node = view.properties.view_context.output.result_node();\n\tnode.properties.location.switch({\n\t\tlocal: function () {\n\t\t\taddMessage(\"warning\", \"Cannot copy link\", { body: \"Save the entry first, then try again\" });\n\t\t},\n\t\tremote: function () {\n\t\t\tcopyLinkToClipboard(\n\t\t\t\thash.deepLinkTo(\n\t\t\t\t\tisDefined(view.properties.view_definition.ref.parent.key),\n\t\t\t\t\tview.properties.view_definition.ref.key,\n\t\t\t\t\tcreateIdPathBuilderFromNode(node)\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t});\n}\n","import { api_configuration } from \"../../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { addChild } from \"../../../../../../destructables\";\nimport DestructorTree from \"../../DestructorTree\";\nimport { registerQueryEntry } from \"../../state/registerClientState\";\nimport clientWorkIsDone from \"../../state/tasks\";\nimport { iCollection } from \"../../state/Collection\";\n\nexport function deleteCollectionEntry(entry: api_cs.Centries__collection): void {\n\tiCollection(entry.parent).deleteEntry(entry);\n}\n\nexport async function deleteQueryEntry(qes: api_cs.Cquery_entry_status) {\n\tconst initialized = qes.properties.initialized.state;\n\tswitch (initialized.name) {\n\t\tcase \"yes\":\n\t\t\tdeleteCollectionEntry(\n\t\t\t\tinitialized.node.properties.referenced_node.output.result_node().input.entity().cast(\"entry\")\n\t\t\t);\n\t\t\tbreak;\n\t\tcase \"no\": {\n\t\t\tconst destructor = new DestructorTree();\n\t\t\taddChild(qes, destructor);\n\t\t\tconst entry = registerQueryEntry(qes, destructor).input.entity().cast(\"entry\");\n\t\t\tawait clientWorkIsDone();\n\t\t\tdeleteCollectionEntry(entry);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"unknown\":\n\t}\n}\n","import { api_configuration } from \"../../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { iNode } from \"../../state/Node\";\n\nexport function entity(client_state: api_cs.Cnode): void {\n\tif (client_state.destroyed) return;\n\tclient_state.properties.modified.switch({\n\t\tyes: function () {\n\t\t\tclient_state.properties.is_busy_discarding.set(\"yes\", {});\n\t\t\tiNode(client_state).discard();\n\t\t\tclient_state.properties.is_busy_discarding.set(\"no\", {});\n\t\t},\n\t\tno: undefined,\n\t});\n}\n\nexport function isBusyDiscarding(node: api_cs.Cnode): boolean {\n\tswitch (node.properties.is_busy_discarding.state.name) {\n\t\tcase \"yes\":\n\t\t\treturn true;\n\t\tcase \"no\": {\n\t\t\tconst entity = node.input.entity().variant;\n\t\t\tswitch (entity.name) {\n\t\t\t\tcase \"root\":\n\t\t\t\t\treturn false;\n\t\t\t\tcase \"entry\":\n\t\t\t\t\treturn isBusyDiscarding(entity.definition.component_root);\n\t\t\t}\n\t\t}\n\t}\n}\n","import { api_configuration } from \"../../../common\";\nimport csr = api_configuration.types.client_state.alan_api;\nimport gui_definition_types = api_configuration.libraries.gui_definition_lib.types;\nimport messages = require(\"../../front/messages\");\nimport add = require(\"./add\");\nimport { createIdPathBuilderFromNode } from \"../../navigation/createIdPathFromNode\";\nimport createSubscriptionFromDuplicationMapping from \"../../state 2 interface/createSubscriptionFromDuplicationMapping\";\nimport initializeNewNodeFromSubscriptionResult from \"../../state 2 interface/initializeNewNodeFromSubscriptionResult\";\nimport { DatastoreProxy } from \"../../interface/DatastoreProxy\";\nimport { getGuiCollection } from \"../../guiModel\";\nimport { ignoreCollectionDefaults } from \"../../state/ClientState\";\n\nexport function entity(\n\tnode: csr.Cnode,\n\tview: gui_definition_types.views.alan_api.Cviews__,\n\twindow: gui_definition_types.settings.alan_api.Cwindows\n): void {\n\tnode.input.entity().switch({\n\t\troot: () => {\n\t\t\tmessages.addMessage(\"warning\", \"Duplication not allowed\", { body: \"Can not duplicate the root.\" });\n\t\t},\n\t\tentry: (collection_entry) => {\n\t\t\tcollection_entry.parent.properties.is_editable.switch({\n\t\t\t\tno: () => {\n\t\t\t\t\tmessages.addMessage(\"warning\", \"Duplication not allowed\", {\n\t\t\t\t\t\tbody: \"You do not have the sufficient rights to perform this operation.\",\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tyes: () => {\n\t\t\t\t\tgetGuiCollection(collection_entry.parent.inferences.collection_type())?.properties.duplication_mapping.switch(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"from current context\": function ($) {\n\t\t\t\t\t\t\t\tconst mapping = $.properties.mapping;\n\t\t\t\t\t\t\t\tconst collection = collection_entry.parent;\n\t\t\t\t\t\t\t\tignoreCollectionDefaults.set(true);\n\t\t\t\t\t\t\t\tconst new_node = add.entry(collection, view, window);\n\t\t\t\t\t\t\t\tconst subscription = createSubscriptionFromDuplicationMapping(\n\t\t\t\t\t\t\t\t\tmapping,\n\t\t\t\t\t\t\t\t\tcreateIdPathBuilderFromNode(node).build()\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tDatastoreProxy.instance.subscribeOnce(subscription, function (subscription_result) {\n\t\t\t\t\t\t\t\t\tif (new_node.destroyed) {\n\t\t\t\t\t\t\t\t\t\tignoreCollectionDefaults.set(false);\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsubscription_result.properties.context.switch({\n\t\t\t\t\t\t\t\t\t\texists: function ($) {\n\t\t\t\t\t\t\t\t\t\t\tinitializeNewNodeFromSubscriptionResult(new_node, mapping, $.properties.subscription_result_data);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\"does not exist\": undefined,\n\t\t\t\t\t\t\t\t\t\t\"permission denied\": () => {\n\t\t\t\t\t\t\t\t\t\t\tmessages.addMessage(\n\t\t\t\t\t\t\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"You do not have the sufficient rights to perform this operation.\"\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tignoreCollectionDefaults.set(false);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnone: function () {\n\t\t\t\t\t\t\t\tmessages.addMessage(\"warning\", \"Cannot duplicate this item.\");\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n}\n","import clientWorkIsDone from \"../../state/tasks\";\nimport { api_configuration } from \"../../../common\";\nimport { updatePermissions } from \"../../state 2 interface/permissions\";\nimport { executeAction } from \"../../state/actions\";\nimport { executeCommand } from \"../../state/commands\";\nimport { uploadFilesInQueue } from \"./fileUpload\";\nimport { InstructionError } from \"./InstructionError\";\nimport client_read_api = api_configuration.types.client_state.alan_api;\nimport api_application = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport views_api = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport messages = require(\"../../front/messages\");\n\nexport async function command(command: client_read_api.Cyes__started): Promise {\n\tmessages.removeAllMessages();\n\tawait clientWorkIsDone();\n\tswitch (command.properties.is_valid.state.name) {\n\t\tcase \"no\": {\n\t\t\tmessages.addMessage(\"warning\", \"Invalid parameters\", { body: \"Check all fields and try again.\" });\n\t\t\tthrow new InstructionError();\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tawait uploadFilesInQueue(command.properties.node);\n\t\t\tawait executeCommand(command);\n\t\t\tconst entity_node = command.parent.parent.parent.input.entity().output.node();\n\t\t\tupdatePermissions(entity_node);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(command.properties.is_valid.state);\n\t}\n}\n\nexport async function action(\n\taction: client_read_api.Cyes__started,\n\tview_bindings: Record,\n\tcan_use_containing_view: boolean,\n\tview_node_type: api_application.Cnode__application\n): Promise {\n\tawait clientWorkIsDone();\n\tswitch (action.properties.is_valid.state.name) {\n\t\tcase \"yes\":\n\t\t\tawait uploadFilesInQueue(action.properties.node);\n\t\t\treturn executeAction(action, view_bindings, can_use_containing_view, view_node_type);\n\t\tcase \"no\":\n\t\t\tmessages.addMessage(\"warning\", \"Invalid parameters\", { body: \"Check all fields and try again.\" });\n\t\t\tthrow new InstructionError();\n\t\tdefault:\n\t\t\tunexpectedState(action.properties.is_valid.state);\n\t}\n}\n","import { api_configuration } from \"../../../common\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport api_app = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.application.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport evaluateFileNameExpression from \"../../state/evaluateFileNameExpression\";\nimport { download_from_files_resource, uploadToFilesResource } from \"../../interface/FilesResourceProxy\";\nimport * as mapToIdPathBuilder from \"../../state/mapToIdPathBuilder\";\nimport { saveAs } from \"./saveAs\";\nimport { DatastoreProxy } from \"../../interface/DatastoreProxy\";\nimport { mapNodePath } from \"../../state 2 interface/createPropertiesDictionaryFromColumns\";\nimport * as JSZip from \"jszip\";\nimport { report_name_from_path } from \"./reports\";\nimport walkNodePath from \"../../navigation/walkNodePath\";\nimport { getGuiFile } from \"../../guiModel\";\nimport { IdPathBuilder } from \"../../navigation/IdPathBuilder\";\nimport { createIdPathBuilderFromNode } from \"../../navigation/createIdPathFromNode\";\nimport { setModified } from \"../../state/SaveModifiedStatus\";\nconst fileUploadQueue = new Map();\ntype FileDownloadResult = [string, any] | undefined;\n\nfunction containsFile(node: api_client_state.Cnode, file: api_client_state.Cfile__type__property): boolean {\n\tlet file_parent = file.parent.parent.parent;\n\twhile (file_parent !== node) {\n\t\tconst parent = file_parent.output.position().output.parent();\n\t\tswitch (parent.variant.name) {\n\t\t\tcase \"none\": {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tcase \"node\": {\n\t\t\t\tfile_parent = parent.variant.definition;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\nexport async function uploadFilesInQueue(node: api_client_state.Cnode): Promise {\n\tconst file_upload_queue = [...fileUploadQueue].filter(([file]) => {\n\t\treturn containsFile(node, file.parent);\n\t});\n\tawait Promise.all(\n\t\tfile_upload_queue.map(async ([property, file]) => {\n\t\t\tawait uploadFile(property, file);\n\t\t})\n\t);\n}\n\nexport function removeFilesFromUploadQueue(node: api_client_state.Cnode): void {\n\tfor (const [file] of fileUploadQueue) {\n\t\tif (containsFile(node, file.parent)) {\n\t\t\tfileUploadQueue.delete(file);\n\t\t}\n\t}\n}\n\nexport function addFileUploadToQueue(file_property: api_client_state.Cyes__is_editable__file, file: File): void {\n\tconst extension = file.name.substring(file.name.lastIndexOf(\".\") + 1);\n\tconst is_modified = file_property.properties.modified.set(\"yes\", {\n\t\textension: extension,\n\t\t\"upload status\": [\"not uploaded\", {}],\n\t});\n\tsetModified(is_modified);\n\tfileUploadQueue.set(file_property, file);\n\tfile_property.onDestroy(() => {\n\t\tfileUploadQueue.delete(file_property);\n\t});\n}\n\nasync function uploadFile(file_property: api_client_state.Cyes__is_editable__file, file: File) {\n\tswitch (file_property.properties.modified.state.name) {\n\t\tcase \"yes\": {\n\t\t\tconst modified = file_property.properties.modified.state.node;\n\t\t\tmodified.properties.upload_status.set(\"uploading\", {});\n\t\t\tconst token = await uploadToFilesResource(file);\n\t\t\tfileUploadQueue.delete(file_property);\n\t\t\tif (!file_property.destroyed) {\n\t\t\t\tmodified.properties.upload_status.set(\"done\", {\n\t\t\t\t\ttoken: token,\n\t\t\t\t});\n\t\t\t\tfile_property.parent.properties.is_set.set(\"yes\", {\n\t\t\t\t\textension: modified.properties.extension,\n\t\t\t\t\ttoken: token,\n\t\t\t\t});\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tbreak;\n\t}\n}\n\nexport function downloadFile(file_property: api_client_state.Cfile__type__property): void {\n\tdownloadNodeFile(file_property).then((file_download) => {\n\t\tif (file_download !== undefined) {\n\t\t\tsaveAs(file_download[1], file_download[0]);\n\t\t}\n\t});\n}\n\nasync function downloadNodeFile(file_property: api_client_state.Cfile__type__property): Promise {\n\tswitch (file_property.properties.is_set.state.name) {\n\t\tcase \"no\":\n\t\t\treturn undefined;\n\t\tcase \"yes\": {\n\t\t\tconst set_file = file_property.properties.is_set.state.node;\n\t\t\tconst gui_file = getGuiFile(file_property.inferences.file_type());\n\t\t\tif (gui_file) {\n\t\t\t\tconst file_name = await evaluateFileNameExpression(\n\t\t\t\t\tgui_file,\n\t\t\t\t\tfile_property.parent.parent.parent,\n\t\t\t\t\tset_file.properties.extension\n\t\t\t\t);\n\t\t\t\tconst data = await download_from_files_resource(set_file.properties.token);\n\t\t\t\treturn [file_name, data];\n\t\t\t} else {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function downloadFiles(collection: api_client_state.Ccollection): void {\n\tPromise.all(\n\t\tArray.from(collection.properties.entries).map((entry) => Promise.all(downloadNodeFiles(entry[1].properties.node)))\n\t).then((entries) => {\n\t\tconst zip = new JSZip();\n\t\tfor (const entry of entries) {\n\t\t\tfor (const file_download of entry) {\n\t\t\t\tif (file_download !== undefined) {\n\t\t\t\t\tzip.file(sanitizeFileName(file_download[0]), file_download[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tzip.generateAsync({ type: \"blob\" }).then((blob) => {\n\t\t\tsaveAs(blob, collection.parent.parent.key.entry + \".zip\");\n\t\t});\n\t});\n}\n\nfunction downloadNodeFiles(node: api_client_state.Cnode): Promise[] {\n\tconst promises: Promise[] = [];\n\tfor (const attribute of node.properties.attributes.values()) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"operation\":\n\t\t\t\tbreak;\n\t\t\tcase \"property\": {\n\t\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\tconst collection = property.properties.type.state.node;\n\t\t\t\t\t\tconst application_collection = collection.inferences.collection_type();\n\t\t\t\t\t\tswitch (application_collection.properties.ui.properties.size.state.name) {\n\t\t\t\t\t\t\tcase \"large\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"small\":\n\t\t\t\t\t\t\t\tfor (const entry of collection.properties.entries) {\n\t\t\t\t\t\t\t\t\tconst entry_promises = downloadNodeFiles(entry[1].properties.node);\n\t\t\t\t\t\t\t\t\tfor (const entry_promise of entry_promises) {\n\t\t\t\t\t\t\t\t\t\tpromises.push(entry_promise);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\tconst file = property.properties.type.state.node;\n\t\t\t\t\t\tpromises.push(downloadNodeFile(file));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"group\": {\n\t\t\t\t\t\tconst group = property.properties.type.state.node;\n\t\t\t\t\t\tconst group_promises = downloadNodeFiles(group.properties.node);\n\t\t\t\t\t\tfor (const group_promise of group_promises) {\n\t\t\t\t\t\t\tpromises.push(group_promise);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst state_group = property.properties.type.state.node;\n\t\t\t\t\t\tswitch (state_group.properties.is_set.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst is_set = state_group.properties.is_set.state.node;\n\t\t\t\t\t\t\t\tconst state_promises = downloadNodeFiles(is_set.properties.state.ref.properties.node);\n\t\t\t\t\t\t\t\tfor (const state_promise of state_promises) {\n\t\t\t\t\t\t\t\t\tpromises.push(state_promise);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn promises;\n}\n\nexport function downloadFileFromQuery(state: api_client_state.Cyes__is_set__file__type__cells): void {\n\tdownloadQueryFile(state).then((data) => {\n\t\tif (data !== undefined) {\n\t\t\tsaveAs(data[1], data[0]);\n\t\t}\n\t});\n}\n\nasync function queryAbsoluteContext(\n\tcontext: IdPathBuilder,\n\tproperty_path: api_views.Cnode_path\n): Promise {\n\tconst result = await DatastoreProxy.instance.collectionQuery({\n\t\t\"context node path\": context.build(),\n\t\t\"collection path\": { \"has steps\": \"no\" },\n\t\tfilters: {\n\t\t\t\"todo filter\": \"no\",\n\t\t\t\"value filters\": {},\n\t\t},\n\t\t\"select entries\": [\n\t\t\t\"yes\",\n\t\t\t{\n\t\t\t\tproperties: {\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\"property context\": {\n\t\t\t\t\t\t\tpath: mapNodePath(property_path).build(),\n\t\t\t\t\t\t\ttype: \"id path\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"limit number of entries\": 1,\n\t\t\t},\n\t\t],\n\t\taggregates: {},\n\t});\n\n\tswitch (result.properties.context.state.name) {\n\t\tcase \"does not exist\":\n\t\t\treturn undefined;\n\t\tcase \"exists\": {\n\t\t\tconst $ = result.properties.context.state.node;\n\t\t\tconst result_property = $.properties.entries\n\t\t\t\t.cast(\"yes\")\n\t\t\t\t.properties.entries.properties.has_steps.cast(\"no\")\n\t\t\t\t.properties.properties.properties.properties.get(\"property context\")!;\n\t\t\tswitch (result_property.properties.result.state.name) {\n\t\t\t\tcase \"does not exist\":\n\t\t\t\t\treturn undefined;\n\t\t\t\tcase \"exists\": {\n\t\t\t\t\tconst exists = result_property.properties.result.state.node;\n\t\t\t\t\treturn mapToIdPathBuilder.fromClientReply(exists.properties.type.cast(\"id path\").properties.id_path);\n\t\t\t\t}\n\t\t\t\tcase \"permission denied\":\n\t\t\t\t\treturn undefined;\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(result_property.properties.result.state);\n\t\t\t}\n\t\t}\n\t\tcase \"permission denied\":\n\t\t\treturn undefined;\n\t\tdefault:\n\t\t\treturn unexpectedState(result.properties.context.state);\n\t}\n}\n\nasync function downloadQueryFileFromDatastore(\n\tcontext: IdPathBuilder,\n\tfile: api_client_state.Cyes__is_set__file__type__cells\n): Promise {\n\tconst file_context = await queryAbsoluteContext(context, file.parent.parent.key.ref.key.ref.properties.path);\n\tif (file_context === undefined) {\n\t\treturn undefined;\n\t}\n\tconst file_name = await evaluateFileNameExpression(\n\t\tfile.parent.inferences.column_type().inferences.file_type().properties.file.ref,\n\t\tfile_context,\n\t\tfile.properties.extension\n\t);\n\tconst file_content = await download_from_files_resource(file.properties.token);\n\treturn [file_name, file_content];\n}\n\nasync function downloadQueryFile(file: api_client_state.Cyes__is_set__file__type__cells): Promise {\n\tconst entry = file.parent.parent.parent;\n\tswitch (entry.properties.entry_status.properties.initialized.state.name) {\n\t\tcase \"no\": {\n\t\t\tconst no = entry.properties.entry_status.properties.initialized.state.node;\n\t\t\tconst entry_id_path = mapToIdPathBuilder.fromClientState(no.properties.referenced_node);\n\t\t\treturn downloadQueryFileFromDatastore(entry_id_path, file);\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst yes = entry.properties.entry_status.properties.initialized.state.node;\n\t\t\tconst referenced_node = yes.properties.referenced_node.output.result_node();\n\t\t\tconst reference_entry = referenced_node.input.entity().cast(\"entry\");\n\t\t\tswitch (reference_entry.properties.location.state.name) {\n\t\t\t\tcase \"remote\": {\n\t\t\t\t\tconst file_def = file.parent.inferences.column_type().inferences.file_type();\n\t\t\t\t\tconst context_node = walkNodePath(file_def.parent.properties.path, referenced_node);\n\t\t\t\t\tif (context_node && context_node.properties.attributes.has(file_def.properties.file.entry)) {\n\t\t\t\t\t\tconst node_file = context_node.properties.attributes\n\t\t\t\t\t\t\t.get(file_def.properties.file.entry)!\n\t\t\t\t\t\t\t.properties.type.cast(\"property\")\n\t\t\t\t\t\t\t.properties.type.cast(\"file\");\n\t\t\t\t\t\tswitch (node_file.properties.backend_known.state.name) {\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\tconst entry_id_path = createIdPathBuilderFromNode(referenced_node);\n\t\t\t\t\t\t\t\treturn downloadQueryFileFromDatastore(entry_id_path, file);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst backend_known = node_file.properties.backend_known.state.node;\n\t\t\t\t\t\t\t\tswitch (backend_known.properties.is_readable.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\t\tconst entry_id_path = createIdPathBuilderFromNode(referenced_node);\n\t\t\t\t\t\t\t\t\t\treturn downloadQueryFileFromDatastore(entry_id_path, file);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\t\treturn downloadNodeFile(node_file);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\treturn unexpectedState(backend_known.properties.is_readable.state);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn unexpectedState(node_file.properties.backend_known.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst entry_id_path = createIdPathBuilderFromNode(referenced_node);\n\t\t\t\t\t\treturn downloadQueryFileFromDatastore(entry_id_path, file);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"local\":\n\t\t\t\t\treturn undefined;\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(reference_entry.properties.location.state);\n\t\t\t}\n\t\t}\n\t\tcase \"unknown\":\n\t\t\treturn undefined;\n\t\tdefault:\n\t\t\tunexpectedState(entry.properties.entry_status.properties.initialized.state);\n\t}\n}\n\nexport function downloadFilesFromQuery(query: api_client_state.Cquery__client_state): void {\n\tquery.properties.has_result.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\tPromise.all(\n\t\t\t\tArray.from($.properties.entries).map((entry) =>\n\t\t\t\t\tPromise.all(\n\t\t\t\t\t\tArray.from(entry[1].properties.cells).map((cell) =>\n\t\t\t\t\t\t\tcell[1].properties.type.switch>({\n\t\t\t\t\t\t\t\t\"state group\": () => Promise.resolve(undefined),\n\t\t\t\t\t\t\t\tfile: ($) =>\n\t\t\t\t\t\t\t\t\t$.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\t\tno: () => Promise.resolve(undefined),\n\t\t\t\t\t\t\t\t\t\tyes: ($) => downloadQueryFile($),\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\tnumber: () => Promise.resolve(undefined),\n\t\t\t\t\t\t\t\ttext: () => Promise.resolve(undefined),\n\t\t\t\t\t\t\t\twidget: () => Promise.resolve(undefined),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t).then((entries) => {\n\t\t\t\tconst zip = new JSZip();\n\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\tfor (const file_download of entry) {\n\t\t\t\t\t\tif (file_download !== undefined) {\n\t\t\t\t\t\t\tzip.file(sanitizeFileName(file_download[0]), file_download[1]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tzip.generateAsync({ type: \"blob\" }).then((blob) => {\n\t\t\t\t\tconst file_name = query.properties.definition.ref.properties.context.switch({\n\t\t\t\t\t\tcandidates: \"download\",\n\t\t\t\t\t\tnode: ($) => report_name_from_path($.properties.path),\n\t\t\t\t\t});\n\t\t\t\t\tsaveAs(blob, file_name + \".zip\");\n\t\t\t\t});\n\t\t\t});\n\t\t},\n\t});\n}\n\nexport function canDownloadFiles(collection: api_app.Ccollection__type__property): boolean {\n\tconst can_download = collection as unknown as { can_download_files: boolean | undefined };\n\tif (can_download.can_download_files === undefined) {\n\t\tcan_download.can_download_files = canDownloadFilesNode(collection.properties.node);\n\t}\n\treturn can_download.can_download_files;\n}\n\nexport function canDownloadFilesQuery(query: api_views.Cqueries): boolean {\n\tconst can_download = query as unknown as { can_download_files: boolean | undefined };\n\tif (can_download.can_download_files === undefined) {\n\t\tlet can_download_files = false;\n\t\tfor (const column of query.properties.columns.values()) {\n\t\t\tswitch (column.properties.type.state.name) {\n\t\t\t\tcase \"file\":\n\t\t\t\t\tcan_download_files = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"number\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"state group\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"text\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"widget\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcan_download.can_download_files = can_download_files;\n\t}\n\treturn can_download.can_download_files;\n}\n\nconst nodeHasFileChildren = new Map();\n\nfunction canDownloadFilesNode(node: api_app.Cnode__application): boolean {\n\tif (!nodeHasFileChildren.has(node)) {\n\t\tlet has_files = false;\n\t\tfor (const attribute of node.properties.attributes.values()) {\n\t\t\tconst $type = attribute.properties.type.state;\n\t\t\tswitch ($type.name) {\n\t\t\t\tcase \"action\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"command\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"reference set\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"property\":\n\t\t\t\t\tswitch ($type.node.properties.type.state.name) {\n\t\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"number\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"file\":\n\t\t\t\t\t\t\thas_files = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"group\":\n\t\t\t\t\t\t\tif (!has_files) {\n\t\t\t\t\t\t\t\thas_files = canDownloadFilesNode($type.node.properties.type.state.node.properties.node);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"state group\":\n\t\t\t\t\t\t\tif (!has_files) {\n\t\t\t\t\t\t\t\tfor (const state of $type.node.properties.type.state.node.properties.states.values()) {\n\t\t\t\t\t\t\t\t\tif (!has_files) {\n\t\t\t\t\t\t\t\t\t\thas_files = canDownloadFilesNode(state.properties.node);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\tconst collection = $type.node.properties.type.state.node;\n\t\t\t\t\t\t\tif (!has_files) {\n\t\t\t\t\t\t\t\tconst size = collection.properties.ui.properties.size;\n\t\t\t\t\t\t\t\tswitch (size.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"large\":\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase \"small\":\n\t\t\t\t\t\t\t\t\t\thas_files = canDownloadFilesNode(collection.properties.node);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tnodeHasFileChildren.set(node, has_files);\n\t}\n\treturn nodeHasFileChildren.get(node)!;\n}\n\nexport function removeFileFromQueue(file: api_client_state.Cfile__type__property): void {\n\tswitch (file.properties.is_editable.state.name) {\n\t\tcase \"yes\": {\n\t\t\tfileUploadQueue.delete(file.properties.is_editable.state.node);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"no\":\n\t\t\tbreak;\n\t}\n}\n\n// eslint-disable-next-line no-useless-escape\nconst illegalRe = /[\\/\\?<>\\\\:\\*\\|\"]/g;\n// eslint-disable-next-line no-control-regex\nconst controlRe = /[\\x00-\\x1f\\x80-\\x9f]/g;\nconst reservedRe = /^\\.+$/;\nconst windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\\..*)?$/i;\nconst windowsTrailingRe = /[. ]+$/;\nconst linuxPathSeparator = /\\//g;\n\n//from: https://github.com/parshap/node-sanitize-filename/blob/master/index.js\nfunction sanitizeFileName(name: string, replacement = \"_\"): string {\n\treturn name\n\t\t.replace(illegalRe, replacement)\n\t\t.replace(controlRe, replacement)\n\t\t.replace(reservedRe, replacement)\n\t\t.replace(windowsReservedRe, replacement)\n\t\t.replace(windowsTrailingRe, replacement)\n\t\t.replace(linuxPathSeparator, replacement);\n}\n","import clientWorkIsDone from \"../../state/tasks\";\nimport { ControlsAreSynchronized } from \"../../widgets/ControlLibrary\";\n\nexport default async function onSynchronized(): Promise {\n\tawait ControlsAreSynchronized();\n\tawait clientWorkIsDone();\n}\n","import { api_configuration } from \"../../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_settings = api_configuration.libraries.gui_definition_lib.types.settings.alan_api;\nimport openViewOnNode from \"../../front/openViewOnNode\";\nimport { addMessage } from \"../../front/messages\";\nimport * as mapToIdPathBuilder from \"../../state/mapToIdPathBuilder\";\nimport DestructorTree from \"../../DestructorTree\";\nimport { registerQueryEntry } from \"../../state/registerClientState\";\nimport { iReference } from \"../../state/Reference\";\nimport * as Rule from \"../../state/Rule\";\nimport { Result, isResolved } from \"../../Status\";\nimport createIdPathBuilderFromClientIdPath from \"../../navigation/createIdPathBuilderFromClientIdPath\";\nimport { scalarValue } from \"../../../../../../stream\";\n\nexport function reference(\n\treference: api_cs.Cyes__navigable,\n\tview: api_views.Cviews__,\n\twindow: api_settings.Cwindows\n): void {\n\toptional_node(iReference(reference).referencedNode.value, view, window);\n}\n\nexport function state_rule(rule: api_cs.Crules, view: api_views.Cviews__, window: api_settings.Cwindows): void {\n\toptional_node(scalarValue(Rule.node(rule)), view, window);\n}\n\nfunction optional_node(\n\toptional_node: Result,\n\tview: api_views.Cviews__,\n\twindow: api_settings.Cwindows\n): void {\n\tif (!(optional_node instanceof api_cs.Cnode)) {\n\t\taddMessage(\"warning\", \"Cannot open item\", { body: \"The item cannot be found.\" });\n\t\treturn;\n\t}\n\topenViewOnNode(optional_node.input.entity().output.node(), view, window);\n}\n\nexport function node(node: api_cs.Cnode, view: api_views.Cviews__, window: api_settings.Cwindows): void {\n\topenViewOnNode(node, view, window);\n}\n\nexport function entity(node_of_entity: api_cs.Cnode, view: api_views.Cviews__, window: api_settings.Cwindows): void {\n\topenViewOnNode(node_of_entity.input.entity().input.node(), view, window);\n}\n\nexport function entry(\n\tentry: api_cs.Centries__yes__has_result,\n\tview: api_views.Cviews__,\n\twindow: api_settings.Cwindows\n): void {\n\tentry.parent.parent.properties.use_for.switch({\n\t\tquery: async () => {\n\t\t\tentry.properties.entry_status.properties.initialized.switch({\n\t\t\t\tno: ($) => {\n\t\t\t\t\tconst destructor = new DestructorTree();\n\t\t\t\t\tregisterQueryEntry(entry.properties.entry_status, destructor);\n\t\t\t\t\tconst open_view = openViewOnNode(\n\t\t\t\t\t\tmapToIdPathBuilder.fromClientState($.properties.referenced_node),\n\t\t\t\t\t\tview,\n\t\t\t\t\t\twindow\n\t\t\t\t\t);\n\t\t\t\t\topen_view.onDestroy(() => destructor.destroy());\n\t\t\t\t},\n\t\t\t\tyes: ($) => {\n\t\t\t\t\topenViewOnNode($.properties.referenced_node.output.result_node(), view, window);\n\t\t\t\t},\n\t\t\t\tunknown: undefined,\n\t\t\t});\n\t\t},\n\t\tcandidates: async ($) => {\n\t\t\tconst key = entry.key;\n\t\t\tconst destructor = new DestructorTree();\n\t\t\tentry.onDestroy(() => destructor.destroy());\n\t\t\tconst collection = iReference($.inferences.reference_property().parent).collectionContext.value;\n\t\t\tif (!isResolved(collection)) {\n\t\t\t\taddMessage(\"warning\", \"Cannot open item\", { body: \"The item cannot be found.\" });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst node = collection.parent.parent.parent;\n\t\t\tnode.properties.location.switch({\n\t\t\t\tlocal: () =>\n\t\t\t\t\tcollection.properties.entries.switchOnEntryExists(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\t(entry) => openViewOnNode(entry.properties.node, view, window),\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\taddMessage(\"warning\", \"Unable to find entry\");\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\tremote: () => {\n\t\t\t\t\tswitch (entry.properties.entry_status.properties.initialized.state.name) {\n\t\t\t\t\t\tcase \"unknown\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\tconst not_initialize = entry.properties.entry_status.properties.initialized.state.node;\n\t\t\t\t\t\t\tconst id_path_builder = createIdPathBuilderFromClientIdPath(not_initialize.properties.referenced_node);\n\t\t\t\t\t\t\topenViewOnNode(id_path_builder, view, window);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst initialized = entry.properties.entry_status.properties.initialized.state.node;\n\t\t\t\t\t\t\topenViewOnNode(initialized.properties.referenced_node.output.result_node(), view, window);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n}\n","import { api_configuration } from \"../../../common\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport csd = api_configuration.types.client_state.alan_api;\nimport * as reQuery from \"../../state 2 interface/reQuery\";\nimport { addMessage } from \"../../front/messages\";\nimport clock from \"../../state/clock\";\n\ntype State = [string, any];\n\nexport function numberColumnOperator(\n\tstate: api_client_state.Cyes__has_filter__number,\n\toperator: Extract[0]\n): void {\n\tstate.properties.operator_selected.set(\"yes\", {\n\t\toperator: [operator, {}],\n\t});\n\tstate.properties.criteria_is_valid.switch({\n\t\tyes: function () {\n\t\t\treQuery.execute(state.parent.parent.parent);\n\t\t},\n\t\tno: undefined,\n\t});\n\tswitch (operator) {\n\t\tcase \"equal to\": {\n\t\t\tstate.properties.filter_range.ensure(\"not available\", {});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"smaller than or equal to\":\n\t\tcase \"smaller than\": {\n\t\t\tswitch (state.properties.filter_range.state.name) {\n\t\t\t\tcase \"no\": {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst range_filter = state.properties.filter_range.state.node;\n\t\t\t\t\tswitch (range_filter.properties.operator.state.name) {\n\t\t\t\t\t\tcase \"smaller than\": {\n\t\t\t\t\t\t\tconst smaller_than = range_filter.properties.operator.state.node;\n\t\t\t\t\t\t\trange_filter.properties.operator.ensure(\"greater than\", {\n\t\t\t\t\t\t\t\t\"or equal to\": smaller_than.properties.or_equal_to.switch({\n\t\t\t\t\t\t\t\t\tno: \"no\",\n\t\t\t\t\t\t\t\t\tyes: \"yes\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"greater than\": {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"not available\": {\n\t\t\t\t\tstate.properties.filter_range.ensure(\"no\", {});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"greater than or equal to\":\n\t\tcase \"greater than\": {\n\t\t\tswitch (state.properties.filter_range.state.name) {\n\t\t\t\tcase \"no\": {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst range_filter = state.properties.filter_range.state.node;\n\t\t\t\t\tswitch (range_filter.properties.operator.state.name) {\n\t\t\t\t\t\tcase \"greater than\": {\n\t\t\t\t\t\t\tconst greater_than = range_filter.properties.operator.state.node;\n\t\t\t\t\t\t\trange_filter.properties.operator.ensure(\"smaller than\", {\n\t\t\t\t\t\t\t\t\"or equal to\": greater_than.properties.or_equal_to.switch({\n\t\t\t\t\t\t\t\t\tno: \"no\",\n\t\t\t\t\t\t\t\t\tyes: \"yes\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"smaller than\": {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"not available\": {\n\t\t\t\t\tstate.properties.filter_range.ensure(\"no\", {});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nexport function numberColumn(state: api_client_state.Cyes__has_filter__number, filter_value: number): void {\n\treQuery.stopDelayingQuery(state.parent.parent.parent);\n\tconst mutable_state = state;\n\tif (!isNaN(filter_value) && filter_value === Math.floor(filter_value)) {\n\t\tmutable_state.properties.filter_set.set(\"yes\", {});\n\t\tmutable_state.properties.criteria_is_valid.set(\"yes\", {\n\t\t\tcriteria: filter_value,\n\t\t});\n\t} else {\n\t\tmutable_state.properties.filter_set.set(\"no\", {});\n\t\tmutable_state.properties.criteria_is_valid.set(\"no\", {});\n\t}\n\treQuery.execute(state.parent.parent.parent);\n}\nexport function numberColumnRange(state: api_client_state.Cyes__filter_range, filter_value: number): void {\n\treQuery.stopDelayingQuery(state.parent.parent.parent.parent);\n\tif (!isNaN(filter_value) && filter_value === Math.floor(filter_value)) {\n\t\tstate.properties.criteria_is_valid.set(\"yes\", {\n\t\t\tcriteria: filter_value,\n\t\t});\n\t} else {\n\t\tstate.properties.criteria_is_valid.set(\"no\", {});\n\t}\n\treQuery.execute(state.parent.parent.parent.parent);\n}\nconst maximum_text_filter_length = 1000;\nexport function textColumn(\n\tstate: api_client_state.Cyes__has_filter__text,\n\tcriteria: string,\n\toperation: Extract\n): void {\n\tif (criteria.length > maximum_text_filter_length) {\n\t\t// truncate the criteria, because it will otherwise conflicts with the expression\n\t\t// that is build using the collation table. This will prevent a maximum call stack\n\t\t// exceeded error.\n\t\tcriteria = criteria.substring(0, maximum_text_filter_length);\n\t\taddMessage(\"warning\", \"Text filter limit exceeded.\");\n\t}\n\treQuery.stopDelayingQuery(state.parent.parent.parent);\n\tstate.set_value(criteria);\n\tstate.properties.operation.set(operation, {});\n\tstate.properties.filter_set.ensure(\"yes\", {});\n\treQuery.execute(state.parent.parent.parent);\n}\n\nexport function enableStateGroupColumn(state: api_client_state.Cno__filter_enabled): void {\n\treQuery.stopDelayingQuery(state.parent.parent.parent.parent);\n\tconst mutable_state = state.parent;\n\tmutable_state.properties.filter_enabled.set(\"yes\", {});\n\tstate.parent.properties.states.forEach(function ($) {\n\t\t$.properties.is_selected.set(\"no\", {});\n\t});\n\treQuery.execute(state.parent.parent.parent.parent);\n}\nexport function disableStateGroupColumn(state: api_client_state.Cyes__filter_enabled): void {\n\tconst mutable_state = state.parent;\n\tmutable_state.properties.filter_enabled.set(\"no\", {});\n\tstate.parent.properties.states.forEach(function ($) {\n\t\t$.properties.is_selected.set(\"yes\", {});\n\t});\n\treQuery.execute(state.parent.parent.parent.parent);\n}\nexport function setStateFilter(state: api_client_state.Cno__is_selected__states__yes): void {\n\tstate.parent.properties.is_selected.set(\"yes\", {});\n\treQuery.execute(state.parent.parent.parent.parent.parent);\n}\n\nexport function unsetStateFilter(state: api_client_state.Cyes__is_selected__states__yes): void {\n\tstate.parent.properties.is_selected.set(\"no\", {});\n\treQuery.execute(state.parent.parent.parent.parent.parent);\n}\n\nexport function resetFilters(query: api_client_state.Cquery__client_state): void {\n\tfor (const [, $] of query.properties.columns) {\n\t\tswitch ($.properties.type.state.name) {\n\t\t\tcase \"file\":\n\t\t\t\tbreak;\n\t\t\tcase \"number\": {\n\t\t\t\tconst number = $.properties.type.state.node;\n\t\t\t\tswitch (number.properties.has_filter.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst $ = number.properties.has_filter.state.node;\n\t\t\t\t\t\tresetNumberFilter($);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(number.properties.has_filter.state);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state group\": {\n\t\t\t\tconst state_group = $.properties.type.state.node;\n\t\t\t\tswitch (state_group.properties.has_filter.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst $ = state_group.properties.has_filter.state.node;\n\t\t\t\t\t\tresetStateGroupFilter($);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(state_group.properties.has_filter.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"text\": {\n\t\t\t\tconst text = $.properties.type.state.node;\n\t\t\t\tswitch (text.properties.has_filter.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst yes = text.properties.has_filter.state.node;\n\t\t\t\t\t\tresetTextFilter(yes);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(text.properties.has_filter.state);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"widget\":\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState($.properties.type.state);\n\t\t}\n\t}\n}\n\nexport function resetNumberFilter(state: api_client_state.Cyes__has_filter__number): void {\n\tstate.parent.inferences.number_type().properties.has_filter.switch({\n\t\tyes: ($) => {\n\t\t\t$.properties.operator_selected.switch({\n\t\t\t\tyes: ($) => {\n\t\t\t\t\tstate.properties.operator_selected.set(\"yes\", {\n\t\t\t\t\t\toperator: $.properties.operator.switch({\n\t\t\t\t\t\t\t\"equal to\": [\"equal to\", {}],\n\t\t\t\t\t\t\t\"greater than\": [\"greater than\", {}],\n\t\t\t\t\t\t\t\"greater than or equal to\": [\"greater than or equal to\", {}],\n\t\t\t\t\t\t\t\"smaller than\": [\"smaller than\", {}],\n\t\t\t\t\t\t\t\"smaller than or equal to\": [\"smaller than or equal to\", {}],\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tno: () => state.properties.operator_selected.set(\"no\", {}),\n\t\t\t});\n\t\t\t$.properties.initial_criteria.switch({\n\t\t\t\tnone: () => state.properties.filter_set.set(\"no\", {}),\n\t\t\t\tyes: () => state.properties.filter_set.set(\"yes\", {}),\n\t\t\t});\n\t\t\t$.properties.initial_criteria.switch({\n\t\t\t\tnone: () => state.properties.criteria_is_valid.set(\"no\", {}),\n\t\t\t\tyes: (yes__initial_criteria) => {\n\t\t\t\t\tstate.properties.criteria_is_valid.set(\"yes\", {\n\t\t\t\t\t\tcriteria: yes__initial_criteria.properties.source.switch({\n\t\t\t\t\t\t\tnow: (now__source) =>\n\t\t\t\t\t\t\t\tclock.getNow() +\n\t\t\t\t\t\t\t\tnow__source.properties.has_offset.switch({\n\t\t\t\t\t\t\t\t\tnone: 0,\n\t\t\t\t\t\t\t\t\tyes: (yes__has_offset) => yes__has_offset.properties.offset.value,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tstatic: (static__source) => static__source.properties.number.value,\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t\tdisableRange(state);\n\t\t},\n\t\tno: undefined,\n\t});\n\treQuery.execute(state.parent.parent.parent);\n}\n\nexport function resetTextFilter(state: api_client_state.Cyes__has_filter__text): void {\n\tstate.parent.inferences.text_type().properties.filter.switch({\n\t\tsimple: ($) => {\n\t\t\tconst criteria = $.properties.criteria;\n\t\t\tif (criteria.length > 0) {\n\t\t\t\tstate.properties.filter_set.set(\"yes\", {});\n\t\t\t} else {\n\t\t\t\tstate.properties.filter_set.set(\"no\", {});\n\t\t\t}\n\t\t\tstate.set_value(criteria);\n\t\t\tstate.properties.operation.set(\"equals\", {});\n\t\t},\n\t\t\"current id path\": undefined,\n\t\tnone: undefined,\n\t});\n\treQuery.execute(state.parent.parent.parent);\n}\n\nexport function resetStateGroupFilter(state: api_client_state.Cyes__has_filter__state_group): void {\n\tstate.parent.inferences.state_group_type().properties.has_filter.switch({\n\t\tyes: ($) => {\n\t\t\t$.properties.filter_enabled.switch({\n\t\t\t\tyes: () => state.properties.filter_enabled.set(\"yes\", {}),\n\t\t\t\tno: () => state.properties.filter_enabled.set(\"no\", {}),\n\t\t\t});\n\t\t\t$.properties.states.map(($) => {\n\t\t\t\t$.properties.is_selected.switch({\n\t\t\t\t\tyes: () => state.properties.states.get($.key.ref.key.ref.key)!.properties.is_selected.set(\"yes\", {}),\n\t\t\t\t\tno: () => state.properties.states.get($.key.ref.key.ref.key)!.properties.is_selected.set(\"no\", {}),\n\t\t\t\t});\n\t\t\t});\n\t\t},\n\t\tno: undefined,\n\t});\n\treQuery.execute(state.parent.parent.parent);\n}\n\nexport function removeFilters(query: api_client_state.Cquery__client_state): void {\n\tfor (const [, $] of query.properties.columns) {\n\t\tswitch ($.properties.type.state.name) {\n\t\t\tcase \"file\":\n\t\t\t\tbreak;\n\t\t\tcase \"number\": {\n\t\t\t\tconst number = $.properties.type.state.node;\n\t\t\t\tswitch (number.properties.has_filter.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst $ = number.properties.has_filter.state.node;\n\t\t\t\t\t\tremoveNumberFilter($);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(number.properties.has_filter.state);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state group\": {\n\t\t\t\tconst state_group = $.properties.type.state.node;\n\t\t\t\tswitch (state_group.properties.has_filter.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst $ = state_group.properties.has_filter.state.node;\n\t\t\t\t\t\tremoveStateGroupFilter($);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(state_group.properties.has_filter.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"text\": {\n\t\t\t\tconst text = $.properties.type.state.node;\n\t\t\t\tswitch (text.properties.has_filter.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst yes = text.properties.has_filter.state.node;\n\t\t\t\t\t\tremoveTextFilter(yes);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(text.properties.has_filter.state);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"widget\":\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState($.properties.type.state);\n\t\t}\n\t}\n}\n\nexport function removeNumberFilter(state: api_client_state.Cyes__has_filter__number): void {\n\tstate.properties.operator_selected.set(\"no\", {});\n\tstate.properties.filter_set.set(\"no\", {});\n\tstate.properties.criteria_is_valid.set(\"no\", {});\n\tdisableRange(state);\n\treQuery.execute(state.parent.parent.parent);\n}\n\nexport function removeTextFilter(state: api_client_state.Cyes__has_filter__text): void {\n\tstate.properties.filter_set.set(\"no\", {});\n\tstate.properties.operation.ensure(\"equals\", {});\n\tstate.set_value(\"\");\n\treQuery.execute(state.parent.parent.parent);\n}\n\nexport function removeStateGroupFilter(state: api_client_state.Cyes__has_filter__state_group): void {\n\tconst mutable_state = state;\n\tmutable_state.properties.filter_enabled.set(\"no\", {});\n\tstate.properties.states.map(function ($) {\n\t\t$.properties.is_selected.set(\"no\", {});\n\t});\n\treQuery.execute(state.parent.parent.parent);\n}\n\nexport function enableRange(state: api_client_state.Cyes__has_filter__number): void {\n\tstate.properties.filter_range.ensure(\"yes\", {\n\t\t\"criteria is valid\": state.properties.criteria_is_valid.switch<\n\t\t\tapi_client_state.Tyes__filter_range[\"criteria is valid\"]\n\t\t>({\n\t\t\tno: \"no\",\n\t\t\tyes: ($) => [\n\t\t\t\t\"yes\",\n\t\t\t\t{\n\t\t\t\t\tcriteria: $.properties.criteria.value,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t\toperator: state.properties.operator_selected.switch({\n\t\t\tno: [\n\t\t\t\t\"smaller than\",\n\t\t\t\t{\n\t\t\t\t\t\"or equal to\": \"no\",\n\t\t\t\t},\n\t\t\t],\n\t\t\tyes: ($) =>\n\t\t\t\t$.properties.operator.switch({\n\t\t\t\t\t\"equal to\": [\n\t\t\t\t\t\t\"smaller than\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"or equal to\": \"no\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t\"smaller than\": [\n\t\t\t\t\t\t\"greater than\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"or equal to\": \"no\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t\"smaller than or equal to\": [\n\t\t\t\t\t\t\"greater than\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"or equal to\": \"no\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t\"greater than\": [\n\t\t\t\t\t\t\"smaller than\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"or equal to\": \"no\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t\"greater than or equal to\": [\n\t\t\t\t\t\t\"smaller than\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"or equal to\": \"no\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t}),\n\t});\n\treQuery.execute(state.parent.parent.parent);\n}\n\nexport function disableRange(state: api_client_state.Cyes__has_filter__number): void {\n\tstate.properties.filter_range.ensure(\"no\", {});\n\treQuery.execute(state.parent.parent.parent);\n}\n\nexport function rangeGreaterThan(state: api_client_state.Cgreater_than__operator__yes__filter_range): void {\n\tstate.properties.or_equal_to.ensure(\"no\", {});\n\treQuery.execute(state.parent.parent.parent.parent.parent);\n}\n\nexport function rangeGreaterThanOrEqualTo(state: api_client_state.Cgreater_than__operator__yes__filter_range): void {\n\tstate.properties.or_equal_to.ensure(\"yes\", {});\n\treQuery.execute(state.parent.parent.parent.parent.parent);\n}\n\nexport function rangeSmallerThan(state: api_client_state.Csmaller_than__operator__yes__filter_range): void {\n\tstate.properties.or_equal_to.ensure(\"no\", {});\n\treQuery.execute(state.parent.parent.parent.parent.parent);\n}\n\nexport function rangeSmallerThanOrEqualTo(state: api_client_state.Csmaller_than__operator__yes__filter_range): void {\n\tstate.properties.or_equal_to.ensure(\"yes\", {});\n\treQuery.execute(state.parent.parent.parent.parent.parent);\n}\n","import { api_configuration } from \"common\";\nimport api_report = api_configuration.report_protocol_types;\nimport api_report_arguments = api_configuration.report_protocol_types.arguments_;\nimport api_excel_transformation = api_configuration.report_protocol_types.collection_query_to_table.alan_api;\nimport api_client_reply = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_reply.alan_api;\nimport api_client_request = api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_request.alan_api;\nimport { client_state } from \"../../state/ClientState\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport messages = require(\"../../front/messages\");\nimport { saveAs } from \"./saveAs\";\nimport createReportGenerationRequest = require(\"../../state 2 interface/createReportGenerationRequest\");\nimport { addMessage } from \"../../front/messages\";\nimport { download_from_report_resource, post_to_report_resource } from \"../../interface/ReportResourceProxy\";\nimport serializeNumber = require(\"../../state 2 interface/serializeNumber\");\nimport * as papa from \"papaparse\";\nimport { translate } from \"../../front/translate\";\nimport { isNonNull } from \"../../validation\";\nimport { DatastoreProxy } from \"../../interface/DatastoreProxy\";\nimport { evaluateReportValidity } from \"./update\";\nimport { createCSVBlob } from \"../../utils\";\nimport { TranslationKey, FormatString } from \"../../front/translate\";\n\nconst padTwo = function (number: number): string {\n\tconst result = \"\" + number;\n\tif (result.length === 1) {\n\t\treturn \"0\" + number;\n\t}\n\treturn result;\n};\n\nexport function initializedReport(\n\treport: api_client_state.Creport_types__node\n): api_client_state.Cyes__initialized__report_types {\n\treturn report.properties.initialized.switch({\n\t\tyes: ($) => $,\n\t\tno: () => {\n\t\t\treport.properties.initialized.set(\"yes\", {\n\t\t\t\tparameters: {\n\t\t\t\t\t\"is valid\": \"no\",\n\t\t\t\t\tparameters: report.key.ref.properties.parameters.map((parameter) => ({\n\t\t\t\t\t\ttype: parameter.properties.type.switch({\n\t\t\t\t\t\t\tnumber: [\n\t\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"is set\": \"no\",\n\t\t\t\t\t\t\t\t\t\"is valid\": \"no\",\n\t\t\t\t\t\t\t\t\t\"numerical type properties\": { initialized: \"no\" },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttext: [\n\t\t\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"is set\": \"no\",\n\t\t\t\t\t\t\t\t\t\"is valid\": \"no\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t}),\n\t\t\t\t\t})),\n\t\t\t\t},\n\t\t\t\ttemplates: {},\n\t\t\t});\n\t\t\tconst initialized_report = report.properties.initialized.cast(\"yes\");\n\t\t\tevaluateReportValidity(initialized_report.properties.parameters);\n\t\t\tinitializeTemplates(initialized_report);\n\t\t\treturn initialized_report;\n\t\t},\n\t});\n}\n\nfunction initializeTemplates(report: api_client_state.Cyes__initialized__report_types): void {\n\t//FIXME cache the downloaded templates.\n\tconst report_request = api_report.report_protocol_request.alan_api.Creport_protocol_request.create({\n\t\ttype: [\"listing\", {}],\n\t\t\"access type\": createReportGenerationRequest.determineAccessType(),\n\t});\n\n\tpost_to_report_resource(report_request, function (reply) {\n\t\tconst listing = reply.properties.type\n\t\t\t.cast(\"listing\")\n\t\t\t.properties.reports.toArray()\n\t\t\t.filter((template) => template[1].properties.type === report.parent.key.entry);\n\t\treport.properties.templates.forEach((template) => {\n\t\t\treport.properties.templates.delete(template.key);\n\t\t});\n\t\tlisting.forEach((template) => {\n\t\t\treport.properties.templates.create(template[0], {});\n\t\t});\n\t});\n}\n\nexport function download_report(report: api_client_state.Cyes__initialized__report_types, template: string): void {\n\treport.properties.parameters.properties.is_valid.switch({\n\t\tyes: () => {\n\t\t\tconst download_request =\n\t\t\t\tapi_report.report_protocol_download_request.alan_api.Creport_protocol_download_request.create({\n\t\t\t\t\t\"access type\": createReportGenerationRequest.determineAccessType(),\n\t\t\t\t\ttype: [\n\t\t\t\t\t\t\"predefined\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treport: template,\n\t\t\t\t\t\t\targuments: JSON.stringify(\n\t\t\t\t\t\t\t\tapi_report_arguments.serializer_json.serialize(\n\t\t\t\t\t\t\t\t\tapi_report_arguments.alan_api.Carguments.create(\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\targuments: report.properties.parameters.properties.parameters.map((parameter) => ({\n\t\t\t\t\t\t\t\t\t\t\t\ttype: parameter.properties.type.switch({\n\t\t\t\t\t\t\t\t\t\t\t\t\tnumber: ($) => [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"number\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: $.properties.is_set.cast(\"yes\").properties.value.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext: ($) => [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: $.properties.is_set.cast(\"yes\").properties.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t\t\t\t\t\"context node\": reportContextNode(report.parent.parent, { \"has step\": \"no\" }),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tparameters: report.parent.key.ref,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\tdownload_from_report_resource(download_request, function (report) {\n\t\t\t\tconst today = new Date();\n\t\t\t\tconst timestamp =\n\t\t\t\t\ttoday.getFullYear() +\n\t\t\t\t\tpadTwo(today.getMonth() + 1) +\n\t\t\t\t\tpadTwo(today.getDate()) +\n\t\t\t\t\t\"-\" +\n\t\t\t\t\tpadTwo(today.getHours()) +\n\t\t\t\t\tpadTwo(today.getMinutes()) +\n\t\t\t\t\tpadTwo(today.getSeconds()) +\n\t\t\t\t\t\"-\";\n\n\t\t\t\tsaveAs(report, timestamp + template);\n\t\t\t});\n\t\t},\n\t\tno: () => {\n\t\t\tmessages.addMessage(\"warning\", \"Can't download report because the parameters are invalid\");\n\t\t},\n\t});\n}\n\nfunction reportContextNode(\n\tnode: api_client_state.Cnode,\n\ttail: api_report_arguments.alan_api.Tplural_type_arguments\n): api_report_arguments.alan_api.Tplural_type_arguments {\n\tconst parent_node = node.output.position().output.parent();\n\treturn node.input.position().switch({\n\t\tentity: ($) =>\n\t\t\t$.switch({\n\t\t\t\troot: () => tail,\n\t\t\t\tentry: ($) =>\n\t\t\t\t\treportContextNode(parent_node.cast(\"node\"), {\n\t\t\t\t\t\t\"has step\": [\n\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tkey: $.properties.key.ref.properties.is_set.switch({\n\t\t\t\t\t\t\t\t\tyes: ($) => $.properties.text,\n\t\t\t\t\t\t\t\t\tno: \"\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\ttail: tail,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t}),\n\t\tgroup: () => reportContextNode(parent_node.cast(\"node\"), tail),\n\t\tstate: () => reportContextNode(parent_node.cast(\"node\"), tail),\n\t\troot: () => tail,\n\t});\n}\n\nexport function download_ad_hoc_report(query: api_client_state.Cquery__use_for__query): void {\n\tconst report_generation_request = createReportGenerationRequest.fromQuery(query);\n\tdownload_from_report_resource(report_generation_request, function (report) {\n\t\tconst today = new Date();\n\t\tconst timestamp =\n\t\t\ttoday.getFullYear() +\n\t\t\tpadTwo(today.getMonth() + 1) +\n\t\t\tpadTwo(today.getDate()) +\n\t\t\t\"-\" +\n\t\t\tpadTwo(today.getHours()) +\n\t\t\tpadTwo(today.getMinutes()) +\n\t\t\tpadTwo(today.getSeconds()) +\n\t\t\t\"-\";\n\n\t\tsaveAs(report, timestamp + report_name_from_path(query.inferences.node_context().properties.path) + \".xlsx\");\n\t});\n}\n\nfunction mapQueryResultsToCsv(\n\tcollection_query_reply: api_client_reply.Cexists__context__collection_query,\n\ttransformation: api_excel_transformation.Ccollection_query_to_table\n) {\n\tconst result: { [key: string]: PropertyType }[] = [];\n\ttype PropertyType = string | null;\n\tfunction walkEntries(\n\t\tentry_result: api_client_reply.Ccollection_query_entries,\n\t\tcollection_block: api_excel_transformation.Ccollection_block,\n\t\theaders: [string, string][] = []\n\t) {\n\t\tentry_result.properties.has_steps.switch({\n\t\t\tyes: function (has_steps) {\n\t\t\t\thas_steps.properties.entries.forEach(function ($) {\n\t\t\t\t\tconst collection_name = has_steps.inferences.step().properties.collection.entry;\n\t\t\t\t\twalkEntries($.properties.tail, collection_block, headers.concat([[collection_name, $.key]]));\n\t\t\t\t});\n\t\t\t},\n\t\t\tno: function ($) {\n\t\t\t\tconst row: Record = {};\n\t\t\t\tconst parent_headers: string[] = [];\n\t\t\t\tfor (let hi = 0; hi < headers.length - 1; hi += 1) {\n\t\t\t\t\tconst header_name = headers[hi][0];\n\t\t\t\t\tparent_headers.push(header_name);\n\t\t\t\t\trow[parent_headers.join(\".\")] = headers[hi][1];\n\t\t\t\t}\n\t\t\t\tmapCollectionBlocks(collection_block, function (column) {\n\t\t\t\t\tconst node_query = $.properties.properties;\n\t\t\t\t\tconst property_selection = column.properties.property;\n\t\t\t\t\tconst value = getPropertyValue(node_query, property_selection);\n\t\t\t\t\tconst csv_header = column.properties.header;\n\t\t\t\t\trow[csv_header] = value;\n\t\t\t\t});\n\t\t\t\tresult.push(row);\n\t\t\t},\n\t\t});\n\t}\n\n\tfunction getPropertyValue(\n\t\tnode_query: api_client_reply.Cnode_query_result,\n\t\tproperty_selection: api_excel_transformation.Cproperty_selection\n\t) {\n\t\tconst property = node_query.properties.properties.get(property_selection.properties.property.ref.key)!;\n\t\tconst value = property.properties.result.switch({\n\t\t\texists: function ($) {\n\t\t\t\treturn $.properties.type.switch({\n\t\t\t\t\t\"id path\": null,\n\t\t\t\t\tfile: null,\n\t\t\t\t\tnumber: function ($) {\n\t\t\t\t\t\treturn $.inferences.number().properties.expression.properties.type.switch({\n\t\t\t\t\t\t\t\"number property\": function (number_property) {\n\t\t\t\t\t\t\t\tconst nummerical_type =\n\t\t\t\t\t\t\t\t\tnumber_property.properties.signed_number_property.properties.property_name.ref.properties\n\t\t\t\t\t\t\t\t\t\t.numerical_type.ref;\n\t\t\t\t\t\t\t\treturn serializeNumber.serializeNumber(\n\t\t\t\t\t\t\t\t\t$.properties.value.value,\n\t\t\t\t\t\t\t\t\tserializeNumber.getStaticDecimalsFromNumericalType(nummerical_type),\n\t\t\t\t\t\t\t\t\tnummerical_type,\n\t\t\t\t\t\t\t\t\t\"english\"\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcount: () => String($.properties.value.value),\n\t\t\t\t\t\t\tdivision: () => String($.properties.value.value),\n\t\t\t\t\t\t\tmaximum: () => String($.properties.value.value),\n\t\t\t\t\t\t\tminimum: () => String($.properties.value.value),\n\t\t\t\t\t\t\tproduct: () => String($.properties.value.value),\n\t\t\t\t\t\t\tremainder: () => String($.properties.value.value),\n\t\t\t\t\t\t\t\"state based\": () => String($.properties.value.value),\n\t\t\t\t\t\t\tsum: () => String($.properties.value.value),\n\t\t\t\t\t\t\t\"sum list\": () => String($.properties.value.value),\n\t\t\t\t\t\t\tvalue: () => String($.properties.value.value),\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\t\"state group\": function ($) {\n\t\t\t\t\t\treturn $.properties.state.ref.key;\n\t\t\t\t\t},\n\t\t\t\t\ttext: function ($) {\n\t\t\t\t\t\treturn $.properties.value;\n\t\t\t\t\t},\n\t\t\t\t\tcollection: ($) => {\n\t\t\t\t\t\tconst value: string[] = [];\n\t\t\t\t\t\tconst join_selection = property_selection.properties.type.cast(\"join\");\n\t\t\t\t\t\tfor (const entry of $.properties.entries) {\n\t\t\t\t\t\t\tconst entry_value = getPropertyValue(entry[1].properties.properties, join_selection.properties.value);\n\t\t\t\t\t\t\tif (entry_value !== null) {\n\t\t\t\t\t\t\t\tvalue.push(entry_value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value.join(join_selection.properties.separator);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"does not exist\": null,\n\t\t\t\"permission denied\": null,\n\t\t});\n\t\treturn value;\n\t}\n\n\tfunction mapCollectionBlocks(\n\t\tcollection_block: api_excel_transformation.Ccollection_block,\n\t\tcallback: (column: api_excel_transformation.Cyes__has_columns__collection_block) => void\n\t) {\n\t\tcollection_block.properties.has_columns.switch({\n\t\t\tno: undefined,\n\t\t\tyes: function ($) {\n\t\t\t\tcallback($);\n\t\t\t\tmapCollectionBlocks($.properties.next, callback);\n\t\t\t},\n\t\t});\n\t}\n\n\tfunction createHeaderFields(collection_path: api_client_request.Ccollection_query_path): string[] {\n\t\treturn collection_path.properties.has_steps.switch({\n\t\t\tno: [],\n\t\t\tyes: ($) => [$.properties.collection.entry].concat(createHeaderFields($.properties.tail)),\n\t\t});\n\t}\n\tfunction createFields(column: api_excel_transformation.Ccollection_block): string[] {\n\t\treturn column.properties.has_columns.switch({\n\t\t\tno: [],\n\t\t\tyes: ($) => [$.properties.header].concat(createFields($.properties.next)),\n\t\t});\n\t}\n\tlet fields = createHeaderFields(collection_query_reply.parent.inferences.source().properties.collection_path).map(\n\t\t(_, index, headers) => headers.slice(0, index + 1).join(\".\")\n\t);\n\ttransformation.properties.type.switch({\n\t\t\"collection query\": function ($) {\n\t\t\tfields = fields\n\t\t\t\t.concat(createFields($.properties.columns))\n\t\t\t\t.filter((value, index, self) => self.indexOf(value) === index); // only unique fields\n\t\t\tcollection_query_reply.properties.entries.switch({\n\t\t\t\tno: undefined,\n\t\t\t\tyes: (has_entries) => {\n\t\t\t\t\twalkEntries(has_entries.properties.entries, $.properties.columns);\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\t\"acyclic graph list query\": undefined, // FIXME: implement graph queries\n\t});\n\treturn papa.unparse({ data: result, fields: fields });\n}\n\nexport function download_ad_hoc_import_template(query: api_client_state.Cquery__use_for__query): void {\n\tconst import_template = createReportGenerationRequest.forImportTemplate(query);\n\tconst client_request = import_template.query;\n\tconst transformation = import_template.transformation;\n\tconst report_name = report_name_from_path(query.inferences.node_context().properties.path);\n\tDatastoreProxy.instance.collectionQuery(client_request, {\n\t\thandleSuccess: function (\n\t\t\tresult: api_configuration.libraries.gui_definition_lib.libraries.model_lib.types.client_reply.alan_api.Ccollection_query\n\t\t) {\n\t\t\tresult.properties.context.switch({\n\t\t\t\texists: function ($) {\n\t\t\t\t\tsaveAs(createCSVBlob(mapQueryResultsToCsv($, transformation)), report_name + \".csv\");\n\t\t\t\t},\n\t\t\t\t\"does not exist\": function () {\n\t\t\t\t\tmessages.addMessage(\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\t{ phrase: \"Could not download report {0}\", vars: [report_name] },\n\t\t\t\t\t\t{ body: \"Reopen the view and try again.\" }\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t\"permission denied\": function () {\n\t\t\t\t\tmessages.addMessage(\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\t{ phrase: \"Could not download report {0}\", vars: [report_name] },\n\t\t\t\t\t\t{ body: \"Permission denied.\" }\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\thandleFailure: function () {\n\t\t\tmessages.addMessage(\"warning\", { phrase: \"Could not download report {0}\", vars: [report_name] });\n\t\t},\n\t});\n}\n\nexport function report_name_from_path(\n\tpath: api_configuration.libraries.gui_definition_lib.types.views.alan_api.Cquery_path,\n\tseparator = \"\"\n): string {\n\treturn path.properties.has_steps.switch({\n\t\tno: \"\",\n\t\tyes: ($) => separator + $.properties.collection.entry + report_name_from_path($.properties.tail, \".\"),\n\t});\n}\n\nexport function upload_template(\n\treport_type: api_client_state.Creport_types__client_state,\n\tfile_event: File,\n\troot_node: api_client_state.Cnode\n): void {\n\tconst report_name = file_event.name;\n\tfunction reinitializeRootReportTemplates() {\n\t\tif (root_node.properties.report_types.has(report_type.key.entry)) {\n\t\t\tconst report = root_node.properties.report_types.get(report_type.key.entry)!;\n\t\t\tswitch (report.properties.initialized.state.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst $ = report.properties.initialized.state.node;\n\t\t\t\t\tinitializeTemplates($);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(report.properties.initialized.state);\n\t\t\t}\n\t\t}\n\t}\n\tfunction doUpload() {\n\t\tconst reader = new FileReader();\n\t\treader.readAsDataURL(file_event);\n\t\treader.onload = function () {\n\t\t\tconst report_request = api_report.report_protocol_request.alan_api.Creport_protocol_request.create({\n\t\t\t\ttype: [\n\t\t\t\t\t\"upload\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: report_type.key.entry,\n\t\t\t\t\t\tname: report_name,\n\t\t\t\t\t\ttemplate: isNonNull(reader.result as string).split(\"base64,\")[1],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t\"access type\": createReportGenerationRequest.determineAccessType(),\n\t\t\t});\n\t\t\tpost_to_report_resource(report_request, function (response) {\n\t\t\t\tresponse.properties.type.cast(\"upload\").properties.status.switch({\n\t\t\t\t\tfailure: function ($) {\n\t\t\t\t\t\tconst message_body = $.properties.cause.switch({\n\t\t\t\t\t\t\t\"duplicate name\": { phrase: \"The file '{0}' already exists.\", vars: [file_event.name] },\n\t\t\t\t\t\t\t\"invalid name\": { phrase: \"The file name '{0}' is invalid.\", vars: [file_event.name] },\n\t\t\t\t\t\t\t\"server error\": \"Something went wrong. Please try again.\",\n\t\t\t\t\t\t\t\"unknown type\": (): TranslationKey => {\n\t\t\t\t\t\t\t\tlist_reports();\n\t\t\t\t\t\t\t\treturn \"Something went wrong. Please try again.\";\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t\taddMessage(\"warning\", \"Cannot upload template\", { body: message_body });\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function () {\n\t\t\t\t\t\tlist_reports();\n\t\t\t\t\t\treinitializeRootReportTemplates();\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t\treader.onerror = function () {\n\t\t\tmessages.addMessage(\"error\", \"Cannot read template\", { body: \"Upload the file again.\" });\n\t\t};\n\t}\n\treport_type.parent.properties.reports.switchOnEntryExists(\n\t\treport_name,\n\t\tfunction ($) {\n\t\t\tif (confirm(translate({ phrase: 'Replace \"{0}\"?', vars: [report_name] }))) {\n\t\t\t\tdelete_template($, root_node, function () {\n\t\t\t\t\tdoUpload();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlist_reports();\n\t\t\t}\n\t\t},\n\t\tfunction () {\n\t\t\tdoUpload();\n\t\t}\n\t);\n}\n\nexport function delete_template(\n\ttemplate: api_client_state.Creports,\n\troot_node: api_client_state.Cnode,\n\tcallback?: () => void\n): void {\n\tconst report_request = api_report.report_protocol_request.alan_api.Creport_protocol_request.create({\n\t\ttype: [\n\t\t\t\"delete\",\n\t\t\t{\n\t\t\t\treport: template.key,\n\t\t\t},\n\t\t],\n\t\t\"access type\": createReportGenerationRequest.determineAccessType(),\n\t});\n\tpost_to_report_resource(report_request, function () {\n\t\tcallback?.();\n\t\tlist_reports();\n\t\ttemplate.properties.definition.switch({\n\t\t\tknown: ($) => {\n\t\t\t\tconst report_type = root_node.properties.report_types.get($.properties.of_type.entry);\n\t\t\t\treport_type?.properties.initialized.switch({\n\t\t\t\t\tno: undefined,\n\t\t\t\t\tyes: ($) => {\n\t\t\t\t\t\t$.properties.templates.delete(template.key);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t\tunknown: undefined,\n\t\t});\n\t});\n}\n\nexport function list_reports(): void {\n\tconst report_request = api_report.report_protocol_request.alan_api.Creport_protocol_request.create({\n\t\ttype: [\"listing\", {}],\n\t\t\"access type\": createReportGenerationRequest.determineAccessType(),\n\t});\n\n\tpost_to_report_resource(report_request, function (reply) {\n\t\tconst listing = reply.properties.type.cast(\"listing\");\n\t\tclient_state.properties.reports.forEach(function (report) {\n\t\t\tclient_state.properties.reports.delete(report.key);\n\t\t});\n\t\tlisting.properties.reports.forEach(function ($) {\n\t\t\tclient_state.properties.reports.create($.key, {\n\t\t\t\tdefinition: client_state.properties.report_types.switchOnEntryExists(\n\t\t\t\t\t$.properties.type,\n\t\t\t\t\t(report_type) => [\n\t\t\t\t\t\t\"known\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"of type\": report_type.key.entry,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t() => \"unknown\"\n\t\t\t\t),\n\t\t\t\tpermissions: $.properties.permissions.switch({\n\t\t\t\t\t\"read only\": [\"read only\", {}],\n\t\t\t\t\twritable: [\"writable\", {}],\n\t\t\t\t}),\n\t\t\t});\n\t\t});\n\t});\n}\n","import { api_configuration } from \"../../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport { client_state } from \"../../state/ClientState\";\nimport * as createMutation from \"../../state 2 interface/createMutation\";\nimport messages = require(\"../../front/messages\");\nimport { uploadFilesInQueue } from \"./fileUpload\";\nimport { InstructionError } from \"./InstructionError\";\nimport { DatastoreProxy } from \"../../interface/DatastoreProxy\";\nimport * as reQuery from \"../../state 2 interface/reQuery\";\nimport * as Entry from \"../../state/Entry\";\nimport clientWorkIsDone from \"../../state/tasks\";\nimport { iCollection } from \"../../state/Collection\";\nimport resetModifiedState from \"../../state/resetModifiedState\";\n\nasync function uploadFilesAndVerifyValidAgain(state: api_cs.Cnode): Promise {\n\tawait uploadFilesInQueue(state);\n\tassertIsValid(state);\n}\n\nconst save_handlers: ((node: api_cs.Cnode) => void)[] = [];\nexport function subscribeOnSave(callback: (node: api_cs.Cnode) => void): (node: api_cs.Cnode) => void {\n\tsave_handlers.push(callback);\n\treturn callback;\n}\n\nexport function unSubscribeOnSave(callback: (node: api_cs.Cnode) => void): void {\n\tconst index = save_handlers.indexOf(callback);\n\tsave_handlers.splice(index, 1);\n}\n\nexport async function saveAll(node: api_cs.Cnode) {\n\treturn entity(node, true);\n}\n\nexport async function entity(state: api_cs.Cnode, save_all = false): Promise {\n\tif (state.destroyed) return;\n\tmessages.removeAllMessages();\n\tawait clientWorkIsDone();\n\tif (state.destroyed) throw new InstructionError(\"Node has been destroyed\");\n\ttry {\n\t\tstate.properties.is_busy_saving.ensure(\"yes\", {});\n\t\tconst location = state.input.position();\n\t\tswitch (location.variant.name) {\n\t\t\tcase \"entity\": {\n\t\t\t\tconst entity = location.variant.definition;\n\t\t\t\tswitch (entity.variant.name) {\n\t\t\t\t\tcase \"root\":\n\t\t\t\t\t\tawait saveNodeToBackend(state, save_all);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"entry\": {\n\t\t\t\t\t\tconst entry = entity.variant.definition;\n\t\t\t\t\t\tconst parent_node = entry.parent.parent.parent.parent;\n\t\t\t\t\t\tswitch (parent_node.properties.location.state.name) {\n\t\t\t\t\t\t\tcase \"remote\": {\n\t\t\t\t\t\t\t\tswitch (entry.properties.location.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"remote\": {\n\t\t\t\t\t\t\t\t\t\tconst remote_entry = entry.properties.location.state.node;\n\t\t\t\t\t\t\t\t\t\tswitch (remote_entry.properties.marked_for_deletion.state.name) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\t\t\tawait assertEntryValid(entry);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t\t\t\tawait assertEntryValid(entry);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (entry.destroyed === true) return;\n\t\t\t\t\t\t\t\tif (iCollection(entry.parent).graphNodeIsModified(entry)) {\n\t\t\t\t\t\t\t\t\tconst collection = entry.parent;\n\t\t\t\t\t\t\t\t\tassertCollectionIsValid(collection);\n\t\t\t\t\t\t\t\t\tconst mutation = createMutation.forCollection(collection, save_all);\n\t\t\t\t\t\t\t\t\tawait sendMutation(entry.component_root, mutation);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst mutation = createMutation.forEntry(entry, save_all);\n\t\t\t\t\t\t\t\t\tawait sendMutation(entry.component_root, mutation);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (!entry.destroyed) {\n\t\t\t\t\t\t\t\t\trequerySubCollections(entry.properties.node);\n\t\t\t\t\t\t\t\t\treQuery.queriesForCollection(entry);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"local\":\n\t\t\t\t\t\t\t// Do nothing\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"group\":\n\t\t\t\tawait saveNodeToBackend(state, save_all);\n\t\t\t\tbreak;\n\t\t\tcase \"root\": {\n\t\t\t\tconst root = location.variant.definition;\n\t\t\t\tswitch (root.variant.name) {\n\t\t\t\t\tcase \"operation\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"root\":\n\t\t\t\t\t\tawait saveNodeToBackend(state, save_all);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"state\":\n\t\t\t\tawait saveNodeToBackend(state, save_all);\n\t\t}\n\t\tif (!state.destroyed) {\n\t\t\tresetModifiedState(state, true);\n\t\t\tsave_handlers.forEach((handler) => handler(state));\n\t\t}\n\t} finally {\n\t\tif (!state.destroyed) {\n\t\t\tstate.properties.is_busy_saving.ensure(\"no\", {});\n\t\t}\n\t}\n}\n\nfunction assertIsValid(node: api_cs.Cnode) {\n\tswitch (node.properties.is_valid.state.name) {\n\t\tcase \"no\":\n\t\t\tmessages.addMessage(\"warning\", \"Changes not saved\", {\n\t\t\t\tbody: \"There are invalid fields remaining. Check all fields and try again.\",\n\t\t\t});\n\t\t\tthrow new InstructionError(\"State is not valid\");\n\t\tcase \"yes\":\n\t}\n}\n\nfunction assertCollectionIsValid(collection: api_cs.Ccollection) {\n\tswitch (collection.properties.is_valid.state.name) {\n\t\tcase \"no\":\n\t\t\tmessages.addMessage(\"warning\", \"Changes not saved\", {\n\t\t\t\tbody: \"There are invalid fields remaining. Check all fields and try again.\",\n\t\t\t});\n\t\t\tthrow new InstructionError(\"State is not valid\");\n\t\tcase \"yes\":\n\t}\n}\n\nasync function assertEntryValid(entry: api_cs.Centries__collection) {\n\tawait Entry.keyInitialized(entry);\n\tconst key = entry.properties.key.inferences.key();\n\tswitch (key.properties.key_unique.state.name) {\n\t\tcase \"no\":\n\t\t\tmessages.addMessage(\"warning\", \"Changes not saved\", {\n\t\t\t\tbody: \"Name is not valid or already in use.\",\n\t\t\t});\n\t\t\tthrow new InstructionError(\"Name is not valid or already in use.\");\n\t\tcase \"yes\":\n\t}\n\tassertIsValid(entry.properties.node);\n\tawait uploadFilesAndVerifyValidAgain(entry.properties.node);\n}\n\nasync function saveNodeToBackend(state: api_cs.Cnode, save_all: boolean) {\n\tassertIsValid(state);\n\tawait uploadFilesAndVerifyValidAgain(state);\n\tif (state.destroyed === true) return;\n\tawait sendMutation(state, createMutation.forNode(state, save_all));\n}\n\nexport async function sendMutation(node: api_cs.Cnode, mutation_object: createMutation.MutationObject): Promise {\n\tconst mutation_reply = await DatastoreProxy.instance.update(mutation_object.mutation);\n\tif (node.destroyed) {\n\t\tthrow new InstructionError(\"Node removed\");\n\t}\n\tmutation_reply.properties.context.switch({\n\t\t\"does not exist\": function () {\n\t\t\tmessages.addMessage(\"warning\", \"Item not saved\", { body: \"Parent item removed.\" });\n\t\t\tmutation_object.onFailed(false);\n\t\t\tthrow new InstructionError();\n\t\t},\n\t\t\"permission denied\": () => {\n\t\t\tmessages.addMessage(\"warning\", \"Item not saved\", {\n\t\t\t\tbody: \"Permission denied. Permissions may have changed while you were editing. Try saving again.\",\n\t\t\t});\n\t\t\tmutation_object.onFailed(true);\n\t\t\tthrow new InstructionError();\n\t\t},\n\t\texists: function (yes__context_exists) {\n\t\t\tyes__context_exists.properties.result.switch({\n\t\t\t\tsuccess: () => {\n\t\t\t\t\tmutation_object.onSucces();\n\t\t\t\t},\n\t\t\t\tfailure: () => {\n\t\t\t\t\tmessages.addMessage(\"error\", \"Item not saved\", {\n\t\t\t\t\t\tbody: \"Item cannot be saved, the datastore did not accept your changes.\",\n\t\t\t\t\t});\n\t\t\t\t\tmutation_object.onFailed(false);\n\t\t\t\t\tthrow new InstructionError();\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n}\n\nfunction requerySubCollections(node: api_cs.Cnode) {\n\tnode.properties.queries.forEach((query) => {\n\t\tquery.properties.query.properties.delay_query.switch({\n\t\t\tno: () => {\n\t\t\t\treQuery.query(query.properties.query);\n\t\t\t},\n\t\t\tyes: undefined,\n\t\t});\n\t});\n\tnode.properties.attributes.forEach(function ($) {\n\t\t$.properties.type.switch({\n\t\t\toperation: undefined,\n\t\t\tproperty: function ($) {\n\t\t\t\t$.properties.type.switch({\n\t\t\t\t\tcollection: undefined,\n\t\t\t\t\tfile: undefined,\n\t\t\t\t\tgroup: function ($) {\n\t\t\t\t\t\trequerySubCollections($.properties.node);\n\t\t\t\t\t},\n\t\t\t\t\tnumber: undefined,\n\t\t\t\t\t\"state group\": function ($) {\n\t\t\t\t\t\t$.properties.states.forEach(function ($) {\n\t\t\t\t\t\t\trequerySubCollections($.properties.node);\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\ttext: undefined,\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t});\n}\n","let save: (save_blob: Blob, save_file_name: string) => void;\n\nexport function saveAs(blob: Blob, file_name: string): void {\n\tif (!save) {\n\t\tsave = (function () {\n\t\t\tconst a = document.createElement(\"a\");\n\t\t\ta.setAttribute(\"style\", \"display:none\");\n\t\t\tdocument.body.appendChild(a);\n\n\t\t\treturn function (save_blob: Blob, save_file_name: string) {\n\t\t\t\tconst url = window.URL.createObjectURL(save_blob);\n\t\t\t\ta.href = url;\n\t\t\t\t(a).download = save_file_name;\n\t\t\t\ta.click();\n\t\t\t\twindow.URL.revokeObjectURL(url);\n\t\t\t};\n\t\t})();\n\t}\n\tsave(blob, file_name);\n};\n","import { api_configuration } from \"../../../common\";\nimport cs = api_configuration.types.client_state.alan_api;\nimport messages = require(\"../../front/messages\");\nimport { getQueryEntryKey } from \"../../state/Query\";\nimport { iText } from \"../../state/Text\";\n\nexport default function (candidate: cs.Ccandidates__use_for__entries): void {\n\tconst cs_text = candidate.inferences.use().inferences.reference_property().parent;\n\tconst value = getQueryEntryKey(candidate.parent.properties.entry_status);\n\tif (value !== undefined) {\n\t\tiText(cs_text.parent).update(value, \"user\");\n\t} else {\n\t\tmessages.addMessage(\"warning\", \"Cannot select reference\", { body: \"The key is unknown.\" });\n\t}\n}\n","import { api_configuration } from \"../../../common\";\nimport { sha256 } from \"../../front 2 state/hashCode\";\nimport { notify_node_update } from \"../../state/events\";\nimport { setStickyNumberValue, setStickyTextValue } from \"../../state/mapCommandParameters\";\nimport { validateText } from \"../../state/textValidation\";\nimport { removeFileFromQueue } from \"./fileUpload\";\nimport client_read_api = api_configuration.types.client_state.alan_api;\nimport client_decorator = api_configuration.types.client_state.alan_api;\nimport { getGuiText } from \"../../guiModel\";\nimport { raw_state_name } from \"../../utils\";\nimport { FileToken } from \"../../state/expressions\";\nimport { setModified } from \"../../state/SaveModifiedStatus\";\n\ntype UpdatableObject = {\n\tupdating: boolean;\n};\n\nexport function is_updating(property: client_read_api.Cproperty): boolean {\n\tconst updatable_object = property as any as UpdatableObject;\n\tif (updatable_object.updating) {\n\t\treturn true;\n\t} else {\n\t\tupdatable_object.updating = true;\n\t\treturn false;\n\t}\n}\n\nexport function stop_updating(property: client_read_api.Cproperty) {\n\tconst updatable_object = property as any as UpdatableObject;\n\tupdatable_object.updating = false;\n}\n\nfunction lookupUserName(node: client_read_api.Cnode) {\n\tconst entry = node.input.entity().cast(\"entry\");\n\treturn entry.properties.key.ref.properties.is_set.switch({\n\t\tno: \"\",\n\t\tyes: ($) => $.properties.text,\n\t});\n}\n\ntype TextPropertySetBy = client_decorator.Tyes__is_set__text__type__property[\"by\"];\nfunction set_text_value(\n\ttext_property: client_read_api.Ctext__type__property,\n\tvalue: string,\n\tmodified: boolean,\n\tby: TextPropertySetBy\n) {\n\ttext_property.root.transact(() => {\n\t\ttext_property.properties.is_editable.switch({\n\t\t\tno: undefined,\n\t\t\tyes: ($) => {\n\t\t\t\tif (modified) {\n\t\t\t\t\tconst is_modified = $.properties.modified.ensure(\"yes\", {\n\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\tsaving: [\"no\", {}],\n\t\t\t\t\t});\n\t\t\t\t\tsetModified(is_modified);\n\t\t\t\t\tif (is_modified.properties.value !== value) {\n\t\t\t\t\t\tis_modified.set_value(value);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$.properties.modified.ensure(\"no\", {});\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tconst is_set = text_property.properties.is_set.ensure(\"yes\", {\n\t\t\ttext: value,\n\t\t\tby: by,\n\t\t});\n\t\tif (is_set.properties.text !== value) {\n\t\t\tis_set.set_text(value);\n\t\t}\n\t\tis_set.properties.by.ensure(raw_state_name(by), {});\n\t\tswitch (is_set.properties.by.state.name) {\n\t\t\tcase \"engine\":\n\t\t\t\tbreak;\n\t\t\tcase \"user\":\n\t\t\t\tsetStickyTextValue(text_property.inferences.text_type(), value);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunexpectedState(is_set.properties.by.state);\n\t\t}\n\t});\n}\n\nexport function password(text_property: client_read_api.Cno__navigable, value: string): void {\n\tconst mutable_text = text_property.parent;\n\tmutable_text.properties.is_valid.set(\"yes\", {});\n\tconst user_name = lookupUserName(text_property.parent.parent.parent.parent);\n\tsha256(user_name + value).then((hash) => {\n\t\tset_text_value(text_property.parent, hash, true, \"user\");\n\t\tgetGuiText(text_property.parent.inferences.text_type())?.properties.validation.switch({\n\t\t\tnone: undefined,\n\t\t\tcustom: (custom) => {\n\t\t\t\tif (validateText(value, custom.properties.rules)) {\n\t\t\t\t\tmutable_text.properties.is_valid.set(\"yes\", {});\n\t\t\t\t} else {\n\t\t\t\t\tmutable_text.properties.is_valid.set(\"no\", {\n\t\t\t\t\t\t\"invalid rules\": \"no\",\n\t\t\t\t\t\t\"key is not unique\": \"no\",\n\t\t\t\t\t\t\"reference not resolved\": \"no\",\n\t\t\t\t\t\t\"referenced node not valid\": \"no\",\n\t\t\t\t\t\t\"text does not match pattern\": [\n\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpattern: custom.properties.rules.properties.regular_expression,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\tmodel: (model) => {\n\t\t\t\tconst rules = model.inferences.text_with_validation().properties.rules;\n\t\t\t\tif (validateText(value, rules)) {\n\t\t\t\t\tmutable_text.properties.is_valid.set(\"yes\", {});\n\t\t\t\t} else {\n\t\t\t\t\tmutable_text.properties.is_valid.set(\"no\", {\n\t\t\t\t\t\t\"invalid rules\": \"no\",\n\t\t\t\t\t\t\"key is not unique\": \"no\",\n\t\t\t\t\t\t\"reference not resolved\": \"no\",\n\t\t\t\t\t\t\"referenced node not valid\": \"no\",\n\t\t\t\t\t\t\"text does not match pattern\": [\n\t\t\t\t\t\t\t\"yes\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpattern: rules.properties.regular_expression,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t});\n}\n\ntype NumberPropertySetBy = client_decorator.Tyes__is_set__number__type__property[\"by\"];\nexport function number(\n\tnumber_property: client_read_api.Cnumber__type__property,\n\tvalue: number,\n\tby: NumberPropertySetBy\n): void {\n\tif (\n\t\tnumber_property.properties.backend_known.switch({\n\t\t\tno: false,\n\t\t\tyes: ($) =>\n\t\t\t\t$.properties.is_readable.switch({\n\t\t\t\t\tno: false,\n\t\t\t\t\tyes: ($) => $.properties.number.value === value,\n\t\t\t\t}),\n\t\t})\n\t) {\n\t\tnumber_toBackendValue(number_property);\n\t} else {\n\t\tif (is_updating(number_property.parent)) {\n\t\t\treturn;\n\t\t}\n\t\tconst value_is_a_number = !isNaN(value) && value === Math.round(value);\n\t\tif (value_is_a_number) {\n\t\t\tswitch (number_property.properties.is_editable.state.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst yes_is_editable = number_property.properties.is_editable.state.node;\n\t\t\t\t\tconst is_modified = yes_is_editable.properties.modified.set(\"yes\", {\n\t\t\t\t\t\tnumber: value,\n\t\t\t\t\t});\n\t\t\t\t\tsetModified(is_modified);\n\t\t\t\t\tnumber_property.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\tnumber: value,\n\t\t\t\t\t\tby: by,\n\t\t\t\t\t});\n\t\t\t\t\tconst is_set = number_property.properties.is_set.cast(\"yes\");\n\t\t\t\t\tswitch (is_set.properties.by.state.name) {\n\t\t\t\t\t\tcase \"engine\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"user\": {\n\t\t\t\t\t\t\tsetStickyNumberValue(number_property.inferences.number_type(), value);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(is_set.properties.by.state);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(number_property.properties.is_editable.state);\n\t\t\t}\n\t\t} else {\n\t\t\tnumber_property.properties.is_set.set(\"no\", {});\n\t\t}\n\t\tnotifyEntityUpdate(number_property.parent);\n\t\tstop_updating(number_property.parent);\n\t}\n}\n\nexport function number_toBackendValue(number_property: client_read_api.Cnumber__type__property): void {\n\tnumber_property.properties.backend_known.switch({\n\t\tno: undefined,\n\t\tyes: function (backend_known) {\n\t\t\tbackend_known.properties.is_readable.switch({\n\t\t\t\tno: function () {\n\t\t\t\t\tnumber_property.properties.is_set.set(\"no\", {});\n\t\t\t\t},\n\t\t\t\tyes: function ($) {\n\t\t\t\t\tnumber_property.properties.is_set.set(\"yes\", {\n\t\t\t\t\t\tnumber: $.properties.number.value,\n\t\t\t\t\t\tby: [\"engine\", {}],\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n\tnumber_property.properties.is_editable.switch({\n\t\tno: undefined,\n\t\tyes: function ($) {\n\t\t\t$.properties.modified.set(\"no\", {});\n\t\t},\n\t});\n\tnotifyEntityUpdate(number_property.parent);\n}\n\nexport function unset_number(number_property: client_read_api.Cnumber__type__property): void {\n\tconst unset = () => {\n\t\tnumber_property.properties.is_editable.switch({\n\t\t\tyes: ($) => {\n\t\t\t\t$.properties.modified.ensure(\"no\", {});\n\t\t\t},\n\t\t\tno: undefined,\n\t\t});\n\t\tnumber_property.properties.is_set.ensure(\"no\", {});\n\t};\n\tnumber_property.properties.backend_known.switch({\n\t\tyes: ($) =>\n\t\t\t$.properties.is_readable.switch({\n\t\t\t\tno: () => {\n\t\t\t\t\tunset();\n\t\t\t\t},\n\t\t\t\tyes: () => {\n\t\t\t\t\tnumber_toBackendValue(number_property);\n\t\t\t\t},\n\t\t\t}),\n\t\tno: () => {\n\t\t\tunset();\n\t\t},\n\t});\n}\n\nexport function file_toBackendValue(\n\tfile_backend_value: client_read_api.Cyes__is_readable__yes__backend_known__file\n): void {\n\tconst mutable_file = file_backend_value.parent.parent;\n\tmutable_file.properties.is_set.set(\"yes\", {\n\t\ttoken: file_backend_value.properties.token,\n\t\textension: file_backend_value.properties.extension,\n\t});\n\tmutable_file.properties.is_editable.switch({\n\t\tno: undefined,\n\t\tyes: function ($) {\n\t\t\t$.properties.modified.ensure(\"no\", {});\n\t\t},\n\t});\n\tremoveFileFromQueue(file_backend_value.parent.parent);\n}\n\nexport function fileToken(file_property: client_read_api.Cfile__type__property, file_token: FileToken): void {\n\tswitch (file_property.properties.is_editable.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst yes_is_editable = file_property.properties.is_editable.state.node;\n\t\t\tyes_is_editable.properties.modified.set(\"yes\", {\n\t\t\t\textension: file_token.extension,\n\t\t\t\t\"upload status\": [\n\t\t\t\t\t\"done\",\n\t\t\t\t\t{\n\t\t\t\t\t\ttoken: file_token.token,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t});\n\t\t\tfile_property.properties.is_set.set(\"yes\", {\n\t\t\t\ttoken: file_token.token,\n\t\t\t\textension: file_token.extension,\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nexport function reportNumberParameter(number: client_read_api.Cnumber__type__parameters, value: number): void {\n\tnumber.properties.is_set.set(\"yes\", {\n\t\tvalue: value,\n\t});\n\tnumber.properties.is_valid.set(\"yes\", {});\n\tevaluateReportValidity(number.parent.parent);\n}\n\nexport function reportTextParameter(text: client_read_api.Ctext__type__parameters, value: string): void {\n\ttext.properties.is_set.set(\"yes\", {\n\t\tvalue: value,\n\t});\n\ttext.properties.is_valid.set(\"yes\", {});\n\tevaluateReportValidity(text.parent.parent);\n}\n\nexport function evaluateReportValidity(parameters: client_read_api.Creport_parameters): void {\n\tlet valid = true;\n\tparameters.properties.parameters.forEach((parameter) => {\n\t\tvalid =\n\t\t\tvalid &&\n\t\t\tparameter.properties.type.switch({\n\t\t\t\tnumber: ($) =>\n\t\t\t\t\t$.properties.is_valid.switch({\n\t\t\t\t\t\tno: false,\n\t\t\t\t\t\tyes: true,\n\t\t\t\t\t}),\n\t\t\t\ttext: ($) =>\n\t\t\t\t\t$.properties.is_valid.switch({\n\t\t\t\t\t\tno: false,\n\t\t\t\t\t\tyes: true,\n\t\t\t\t\t}),\n\t\t\t});\n\t});\n\tif (valid) {\n\t\tparameters.properties.is_valid.set(\"yes\", {});\n\t} else {\n\t\tparameters.properties.is_valid.set(\"no\", {});\n\t}\n}\n\nexport function notifyEntityUpdate(property: client_read_api.Cproperty) {\n\tnotify_node_update(property.parent.parent.input.entity().input.node());\n}\n","import DestructorTree from \"lib/DestructorTree\";\nimport { api_configuration } from \"../../common\";\nimport api_client_state = api_configuration.types.client_state.alan_api;\nexport type NumberConverter = {\n\tto: (destructor: DestructorTree) => (value: number, callback: (result: number) => void) => void;\n\tonceTo: (value: number) => number;\n\tfrom: (value: number) => number;\n};\n\nexport const noConversion: NumberConverter = {\n\tto: () => (value, callback) => callback(value),\n\tonceTo: (value) => value,\n\tfrom: (value) => value,\n};\n\nexport function makeNumberConverter(\n\tnumerical_type_properties: api_client_state.Cyes__initialized__numerical_type_properties\n): NumberConverter {\n\tlet decimals = Math.min(numerical_type_properties.properties.decimals.value, 20);\n\treturn {\n\t\tto: (destructor) => {\n\t\t\tlet local_callback: ((result: number) => void) | undefined = undefined;\n\t\t\tlet local_value: number | undefined = undefined;\n\t\t\tdestructor.subscribeToNumber(numerical_type_properties, \"subscribe_decimals\", (new_decimals) => {\n\t\t\t\tdecimals = Math.min(new_decimals, 20);\n\t\t\t\tif (local_value !== undefined) {\n\t\t\t\t\tlocal_callback?.(applyToConversion(local_value, decimals));\n\t\t\t\t}\n\t\t\t});\n\t\t\tdestructor.onDestroy(() => {\n\t\t\t\tlocal_callback = undefined;\n\t\t\t});\n\n\t\t\treturn (value, callback) => {\n\t\t\t\tlocal_value = value;\n\t\t\t\tlocal_callback = callback;\n\t\t\t\tcallback(applyToConversion(local_value, decimals));\n\t\t\t};\n\t\t},\n\t\tonceTo: (value) => applyToConversion(value, decimals),\n\t\tfrom: (value) => {\n\t\t\tif (!value) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\treturn Math.round(value * Math.pow(10, decimals));\n\t\t},\n\t};\n}\n\nexport function applyToConversion(value: number, decimals: number): number {\n\tif (decimals === 0) {\n\t\treturn value;\n\t} else {\n\t\treturn Number((value / Math.pow(10, decimals)).toFixed(decimals));\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport gui_definition_types = api_configuration.libraries.gui_definition_lib.types;\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport DestructorTree from \"../DestructorTree\";\nimport { visit_widget_expression } from \"./visit_widget_expression\";\n\nexport function render(\n\tparent_dom_element: () => HTMLElement,\n\tview: gui_definition_types.views.alan_api.Cviews__,\n\tclient_state_context: api_client_state.Cnode,\n\tdestructor: DestructorTree,\n\tview_root_dom_element: () => HTMLElement,\n\tclient_view: api_client_state.Copen_views\n): void {\n\tvisit_widget_expression(view.properties.instance, client_state_context, destructor, {\n\t\tclient_view: client_view,\n\t\tparent_dom_element: parent_dom_element,\n\t\tview_root_dom_element: view_root_dom_element,\n\t\tmodel_binding: undefined,\n\t\tentry_keys: [],\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport ImplementationVisitorContext from \"./ImplementationVisitorContext\";\nimport api_widget = api_configuration.libraries.gui_definition_lib.types.widget.alan_api;\n\nexport function decorateInstructionError(\n\terror: Error,\n\tinstruction: api_widget.Cinstruction_selection,\n\timplementation_context: ImplementationVisitorContext\n): Error {\n\tmarkErrorAsDecorated(error);\n\tconst old_message = error.message;\n\terror.message = `Exception at instruction:${instruction.root.key} ${instruction.path}${tryGetApplicationContext(\n\t\timplementation_context\n\t)}\nat gui config:${implementation_context.widget_configuration.path}\n${tryGetInstructionDetails(instruction)}\n${old_message}`;\n\treturn error;\n}\n\nexport function decorateControlError(\n\terror: Error,\n\tcontrol_binding: api_widget.Ccontrol_binding,\n\timplementation_context: ImplementationVisitorContext\n): Error {\n\tmarkErrorAsDecorated(error);\n\tconst old_message = error.message;\n\terror.message = `Exception at widget:${control_binding.root.key} ${control_binding.path}${tryGetApplicationContext(\n\t\timplementation_context\n\t)}\nat gui config:${implementation_context.widget_configuration.path}\n${old_message}`;\n\treturn error;\n}\n\nfunction tryGetApplicationContext(implementation_context: ImplementationVisitorContext): string {\n\tif (global.logClientStateOnError) {\n\t\ttry {\n\t\t\treturn \"\\nat context:\" + implementation_context.current_binding_context.path;\n\t\t} catch (e) {\n\t\t\treturn \"\";\n\t\t}\n\t}\n\treturn \"\";\n}\n\nfunction tryGetInstructionDetails(instruction: api_widget.Cinstruction_selection): string {\n\ttry {\n\t\treturn instruction.properties.configuration_attribute_type.switch({\n\t\t\tbinding: ($) => \"instruction: \" + $.properties.instruction.entry,\n\t\t\tconfiguration: ($) => {\n\t\t\t\treturn $.properties.instruction.switch({\n\t\t\t\t\t\"set number\": ($) => \"set number: \" + $.properties.number.entry,\n\t\t\t\t\t\"set state\": ($) => \"set state: \" + $.properties.state_group.entry + \" : \" + $.properties.state.entry,\n\t\t\t\t\t\"set text\": ($) => \"set text: \" + $.properties.text.entry,\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t} catch (e) {\n\t\treturn \"\";\n\t}\n}\n\nfunction markErrorAsDecorated(e: Error) {\n\t(e as any)._alan_decorated = true;\n}\n\nexport function isNonDecoratedError(e: any) {\n\treturn e instanceof Error && (e as any)._alan_decorated !== true;\n}\n","import md5 = require(\"blueimp-md5\");\n\nexport default function (value: string): string {\n\tconst hash = md5(value);\n\tconst rgb = \"#\" + hash.substring(0, 6);\n\treturn rgb;\n}\n","import { api_configuration } from \"../../common\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport { entityBuilderOf } from \"../navigation/IdPathBuilder\";\nimport { createIdPathBuilderFromNode } from \"../navigation/createIdPathFromNode\";\nimport ImplementationVisitorContext from \"./ImplementationVisitorContext\";\nimport * as mapToIdPathBuilder from \"../state/mapToIdPathBuilder\";\nimport { ensure } from \"../validation\";\nimport openViewOnNode from \"../front/openViewOnNode\";\nimport { iReference } from \"../state/Reference\";\nimport * as Rule from \"../state/Rule\";\nimport { getWindowInstance } from \"../widgets/dom/Window\";\nimport * as step from \"../state/step\";\nimport { createExpressionBuilder } from \"../../../../../stream\";\n\nexport function openViewContext(\n\tview: api_views.Cview__type__gui_widget_configuration_attribute,\n\timplementation_context: ImplementationVisitorContext\n): void {\n\tconst view_context = view.properties.view_context;\n\n\tconst view_def = view.properties.view.ref;\n\tconst window = view.properties.render.switch({\n\t\t\"in window\": ($) => $.properties.window.ref,\n\t});\n\n\tswitch (view_context.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\topenViewOnNode(implementation_context.clientStateAsNode, view_def, window);\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst $ = view_context.properties.has_steps.state.node;\n\t\t\tswitch ($.properties.type.state.name) {\n\t\t\t\tcase \"query entry\": {\n\t\t\t\t\t//TODO do not use instanceof\n\t\t\t\t\tif (implementation_context.current_binding_context instanceof api_cs.Cnode) {\n\t\t\t\t\t\topenViewOnNode(implementation_context.current_binding_context, view_def, window);\n\t\t\t\t\t} else if (implementation_context.current_binding_context instanceof api_cs.Centries__yes__has_result) {\n\t\t\t\t\t\tconst binding_context = implementation_context.current_binding_context;\n\t\t\t\t\t\tswitch (binding_context.properties.entry_status.properties.initialized.state.name) {\n\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\tconst id_path = entityBuilderOf(\n\t\t\t\t\t\t\t\t\tmapToIdPathBuilder.fromClientState(\n\t\t\t\t\t\t\t\t\t\tbinding_context.properties.entry_status.properties.initialized.state.node.properties.referenced_node\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\topenViewOnNode(id_path, view_def, window);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\tconst initialized = binding_context.properties.entry_status.properties.initialized.state.node;\n\t\t\t\t\t\t\t\tconst node = initialized.properties.referenced_node.output.result_node();\n\t\t\t\t\t\t\t\topenViewOnNode(node, view_def, window);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"unknown\":\n\t\t\t\t\t\t\t\tthrow new Error(\"\");\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(binding_context.properties.entry_status.properties.initialized.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(\"\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"entity\": {\n\t\t\t\t\tconst binding_context = ensure(implementation_context.current_binding_context, api_cs.Cnode);\n\t\t\t\t\tconst id_path = createIdPathBuilderFromNode(binding_context.input.entity().input.node());\n\t\t\t\t\topenViewOnNode(id_path, view_def, window);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"parent\": {\n\t\t\t\t\tconst parent__type = $.properties.type.state.node;\n\t\t\t\t\tconst local_parent_node = walk_view_context_parent_path_over_node(\n\t\t\t\t\t\tparent__type.properties.path,\n\t\t\t\t\t\timplementation_context.clientStateAsNode\n\t\t\t\t\t);\n\t\t\t\t\topenViewOnNode(local_parent_node, view_def, window);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"reference\": {\n\t\t\t\t\tconst binding_context = ensure(implementation_context.current_binding_context, api_cs.Ctext__type__property);\n\t\t\t\t\tconst reference = binding_context.properties.navigable.cast(\"yes\");\n\t\t\t\t\tconst stream = createExpressionBuilder(iReference(reference).referencedNode).pipe(\n\t\t\t\t\t\tstep.sync((node, destructor) => {\n\t\t\t\t\t\t\tconst open_view = openViewOnNode(node.input.entity().input.node(), view_def, window);\n\t\t\t\t\t\t\tdestructor.onDestroy(() => getWindowInstance(window.key).close_view(open_view));\n\t\t\t\t\t\t\topen_view.onDestroy(() => stream.unsubscribe(subscription));\n\t\t\t\t\t\t})\n\t\t\t\t\t)();\n\t\t\t\t\tconst subscription = stream.subscribe({ update: () => undefined });\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state rule\": {\n\t\t\t\t\tconst rule = ensure(implementation_context.current_binding_context, api_cs.Crules);\n\t\t\t\t\tconst stream = createExpressionBuilder(Rule.node(rule)).pipe(\n\t\t\t\t\t\tstep.sync((node, destructor) => {\n\t\t\t\t\t\t\tconst open_view = openViewOnNode(node.input.entity().input.node(), view_def, window);\n\t\t\t\t\t\t\tdestructor.onDestroy(() => getWindowInstance(window.key).close_view(open_view));\n\t\t\t\t\t\t\topen_view.onDestroy(() => stream.unsubscribe(subscription));\n\t\t\t\t\t\t})\n\t\t\t\t\t)();\n\t\t\t\t\tconst subscription = stream.subscribe({ update: () => undefined });\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState($.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(view_context.properties.has_steps.state);\n\t}\n}\n\nfunction walk_view_context_parent_path_over_node(\n\tpath: api_views.Cview_context_parent_path,\n\tnode: api_cs.Cnode\n): api_cs.Cnode {\n\tconst intermediate_result = path.properties.type.switch({\n\t\t\"collection parent\": function () {\n\t\t\treturn node.input.position().cast(\"entity\").cast(\"entry\").parent.parent.parent.parent;\n\t\t},\n\t\t\"group parent\": function () {\n\t\t\treturn node.input.position().cast(\"group\").parent.parent.parent;\n\t\t},\n\t\t\"state parent\": function () {\n\t\t\treturn node.input.position().cast(\"state\").parent.parent.parent.parent;\n\t\t},\n\t});\n\n\treturn path.properties.has_tail.switch({\n\t\tno: intermediate_result,\n\t\tyes: function ($) {\n\t\t\treturn walk_view_context_parent_path_over_node($.properties.tail, intermediate_result);\n\t\t},\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport DestructorTree from \"../DestructorTree\";\nimport { settings } from \"../state/ClientState\";\nimport { registerQueryEntry, registerStategroup, registerGroup, registerText } from \"../state/registerClientState\";\nimport { ensure, isNonNull } from \"../validation\";\nimport { walk_context_ancestor_path } from \"./context_selection\";\nimport { ControlProperties, getControl } from \"./ControlLibrary\";\nimport ImplementationVisitorContext from \"./ImplementationVisitorContext\";\nimport { visit_widget_expression } from \"./visit_widget_expression\";\nimport { visitExpression, visitVariable } from \"./visit_widget_implementation_expression\";\nimport { visit_widget_implementation_node } from \"./visit_widget_implementation_node\";\nimport { wrapNode } from \"./wrapNode\";\nimport api_cs = api_configuration.types.client_state.alan_api;\nimport api_widget = api_configuration.libraries.gui_definition_lib.types.widget.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport ClientState = require(\"../state/ClientState\");\nimport Window = require(\"./dom/Window\");\nimport context_selection = require(\"./context_selection\");\nimport * as SubscriptionManager from \"../state 2 interface/SubscriptionManager\";\nimport { decorateControlError, isNonDecoratedError } from \"./stackTraceMessage\";\nimport * as renderQueue from \"../renderQueue\";\nimport { iReference } from \"../state/Reference\";\nimport * as step from \"../state/step\";\nimport * as deeplinkHandler from \"../front/deeplinkHandler\";\nimport { createExpressionBuilder } from \"../../../../../stream\";\n\nfunction createDomElementThatDestructsOnDestructorTreeDestroy(\n\tdom_element_constructor: () => HTMLElement,\n\tdestructor: DestructorTree\n): () => HTMLElement {\n\treturn () => {\n\t\t//FIXME: Do not do this for every control initializer.\n\t\t//FIXME: rewrite using Proxy?\n\t\tconst dom_element = dom_element_constructor();\n\t\tconst patchedElement = Object.create(dom_element) as HTMLElement;\n\t\tpatchedElement.appendChild = function (node: T) {\n\t\t\tdestructor.onDestroy(function () {\n\t\t\t\tif (node) {\n\t\t\t\t\t(node).remove();\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn dom_element.appendChild(node);\n\t\t};\n\t\tif (dom_element.insertBefore) {\n\t\t\tpatchedElement.insertBefore = function (node: T, child: Node | null) {\n\t\t\t\tdestructor.onDestroy(function () {\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\t(node).remove();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn dom_element.insertBefore(node, child);\n\t\t\t};\n\t\t}\n\t\treturn patchedElement;\n\t};\n}\n\nfunction swich_binding_type(\n\tcontrol_binding: api_widget.Ccontrol_binding,\n\timplementation_context: ImplementationVisitorContext,\n\tcontrol_parent_dom_element: () => HTMLElement,\n\tdestructor: DestructorTree,\n\twrap_in_dynamic_area: boolean\n) {\n\tswitch (control_binding.properties.binding_type.state.name) {\n\t\tcase \"let declaration\": {\n\t\t\tconst let_declaration__binding_type = control_binding.properties.binding_type.cast(\"let declaration\");\n\n\t\t\tconst new_let_declaration_context = walk_context_ancestor_path(\n\t\t\t\tlet_declaration__binding_type.properties.path,\n\t\t\t\timplementation_context\n\t\t\t);\n\t\t\tvisitExpression(let_declaration__binding_type.properties.declaration.ref.properties.expression).subscribe(\n\t\t\t\tnew_let_declaration_context,\n\t\t\t\t{\n\t\t\t\t\tadd: (value: api_widget.Ccontrol_binding, sub_implementation_context, sub_destructor, wrap) => {\n\t\t\t\t\t\tvisit_control_binding(\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\tcontrol_parent_dom_element,\n\t\t\t\t\t\t\tsub_implementation_context,\n\t\t\t\t\t\t\tsub_destructor,\n\t\t\t\t\t\t\twrap || wrap_in_dynamic_area\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdestructor,\n\t\t\t\tundefined\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"static\": {\n\t\t\tconst static__binding_type = control_binding.properties.binding_type.cast(\"static\");\n\t\t\tconst wrapped_dom_element = wrap_in_dynamic_area\n\t\t\t\t? wrapNode(control_parent_dom_element, destructor)\n\t\t\t\t: control_parent_dom_element;\n\t\t\tconst control_properties = getControl(\n\t\t\t\tstatic__binding_type.properties.control.ref.key!,\n\t\t\t\twrapped_dom_element,\n\t\t\t\tcreateDomElementThatDestructsOnDestructorTreeDestroy(implementation_context.get_view_root(), destructor),\n\t\t\t\tmakeControlDestructor(destructor)\n\t\t\t);\n\t\t\tvisit_widget_implementation_node(\n\t\t\t\tstatic__binding_type.properties.node_binding,\n\t\t\t\tcontrol_properties as ControlProperties,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"window\": {\n\t\t\tconst window__binding_type = control_binding.properties.binding_type.cast(\"window\");\n\t\t\tconst window_widget_name = window__binding_type.properties.window.entry;\n\t\t\tconst window_definition = implementation_context.gui_widget_configuration.properties.configuration\n\t\t\t\t.get(window_widget_name)!\n\t\t\t\t.properties.attribute.properties.type.cast(\"window\");\n\t\t\tconst window_name = window_definition.properties.window.ref.key;\n\t\t\tconst cs_window = ClientState.client_state.properties.windows.create(window_name, {\n\t\t\t\t\"has active view\": [\"no\", {}],\n\t\t\t\t\"open views\": {},\n\t\t\t});\n\n\t\t\tlet window_div: HTMLElement;\n\t\t\tconst window_div_constructor = () => {\n\t\t\t\tif (window_div === undefined) {\n\t\t\t\t\twindow_div = isNonNull(control_parent_dom_element().ownerDocument).createElementNS(\n\t\t\t\t\t\t\"http://www.w3.org/1999/xhtml\",\n\t\t\t\t\t\t\"div\"\n\t\t\t\t\t);\n\t\t\t\t\twindow_div.classList.add(\"engine-window-list\");\n\t\t\t\t\tconst wrapped_dom_element = wrap_in_dynamic_area\n\t\t\t\t\t\t? wrapNode(control_parent_dom_element, destructor)\n\t\t\t\t\t\t: control_parent_dom_element;\n\t\t\t\t\twrapped_dom_element().appendChild(window_div);\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\twindow_div.remove();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn window_div;\n\t\t\t};\n\n\t\t\tWindow.initialize(window_name, window_div_constructor, destructor, cs_window);\n\t\t\tsettings.properties.allow_deeplink.switch({\n\t\t\t\tyes: function ($) {\n\t\t\t\t\tconst target_window = $.properties.target_window.ref;\n\t\t\t\t\tif (window_name === target_window.key) {\n\t\t\t\t\t\tdeeplinkHandler.startListening(target_window);\n\t\t\t\t\t\tdestructor.onDestroy(deeplinkHandler.stopListening);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tno: undefined,\n\t\t\t});\n\n\t\t\tconst gui_widget_config__window = implementation_context.gui_widget_configuration.properties.configuration\n\t\t\t\t.get(window__binding_type.properties.window.entry)!\n\t\t\t\t.properties.attribute.properties.type.cast(\"window\");\n\t\t\tconst variable_context = visitVariable(\n\t\t\t\twindow__binding_type.properties.variable,\n\t\t\t\timplementation_context.switchGuiWidgetConfiguration(gui_widget_config__window.properties.configuration),\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tvisit_control_binding(\n\t\t\t\twindow__binding_type.properties.control_binding,\n\t\t\t\twindow_div_constructor,\n\t\t\t\tvariable_context,\n\t\t\t\tdestructor,\n\t\t\t\twrap_in_dynamic_area\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"widget\": {\n\t\t\tconst widget__binding_type = control_binding.properties.binding_type.cast(\"widget\");\n\t\t\tconst selected_implementation_context = context_selection.context_selection(\n\t\t\t\twidget__binding_type.properties.context,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst gui_widget_config = selected_implementation_context.gui_widget_configuration.properties.configuration\n\t\t\t\t.get(widget__binding_type.properties.widget.entry)!\n\t\t\t\t.properties.attribute.properties.type.cast(\"widget\");\n\t\t\tconst wrapped_dom_element = wrap_in_dynamic_area\n\t\t\t\t? wrapNode(control_parent_dom_element, destructor)\n\t\t\t\t: control_parent_dom_element;\n\t\t\tvisit_widget_expression(\n\t\t\t\tgui_widget_config.properties.instance,\n\t\t\t\tselected_implementation_context.current_binding_context,\n\t\t\t\tdestructor,\n\t\t\t\t{\n\t\t\t\t\tmodel_binding: selected_implementation_context.raw_model_binding,\n\t\t\t\t\tparent_dom_element: wrapped_dom_element,\n\t\t\t\t\tclient_view: selected_implementation_context.get_client_view(),\n\t\t\t\t\tview_root_dom_element: selected_implementation_context.get_view_root(),\n\t\t\t\t\tentry_keys: selected_implementation_context.entry_keys,\n\t\t\t\t},\n\t\t\t\twrap_in_dynamic_area\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"client binding widget\": {\n\t\t\tconst client_binding_widget_type = control_binding.properties.binding_type.state.node;\n\t\t\tconst selected_implementation_context = context_selection.context_selection(\n\t\t\t\tclient_binding_widget_type.properties.context,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst widget_cell = ensure(selected_implementation_context.current_binding_context, api_cs.Cwidget__type__cells);\n\t\t\tconst entry = widget_cell.parent.parent;\n\t\t\tconst node = registerQueryEntry(entry.properties.entry_status, destructor);\n\n\t\t\tswitch (node.properties.location.state.name) {\n\t\t\t\tcase \"remote\":\n\t\t\t\t\tSubscriptionManager.finishedAndInitialized().then(() =>\n\t\t\t\t\t\tstageRenderCell(widget_cell, node, control_parent_dom_element, selected_implementation_context, destructor)\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"local\":\n\t\t\t\t\tstageRenderCell(widget_cell, node, control_parent_dom_element, selected_implementation_context, destructor);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(node.properties.location.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(control_binding.properties.binding_type.state);\n\t}\n}\nexport function visit_control_binding(\n\tcontrol_binding: api_widget.Ccontrol_binding,\n\tparent_dom_element: () => HTMLElement,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree,\n\twrap_in_dynamic_area: boolean\n): void {\n\tconst control_destructor = destructor.addChild();\n\ttry {\n\t\tswich_binding_type(\n\t\t\tcontrol_binding,\n\t\t\timplementation_context,\n\t\t\tparent_dom_element,\n\t\t\tcontrol_destructor,\n\t\t\twrap_in_dynamic_area\n\t\t);\n\t} catch (e) {\n\t\tif (isNonDecoratedError(e)) {\n\t\t\tthrow decorateControlError(e, control_binding, implementation_context);\n\t\t}\n\t\tthrow e;\n\t}\n}\n\nfunction subscribeToNodePath(\n\tpath: api_views.Cnode_path,\n\tnode: api_cs.Cnode,\n\tdestructor: DestructorTree,\n\tcallback: (node: api_cs.Cnode | undefined, destructor: DestructorTree) => void\n): void {\n\tswitch (path.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\tcallback(node, destructor);\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst has_steps = path.properties.has_steps.state.node;\n\t\t\tswitch (has_steps.properties.type.state.name) {\n\t\t\t\tcase \"parent\":\n\t\t\t\t\tsubscribeToNodePath(\n\t\t\t\t\t\thas_steps.properties.tail,\n\t\t\t\t\t\tnode.output.position().output.parent().cast(\"node\"),\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tcallback\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"state rule\":\n\t\t\t\t\tcallback(undefined, destructor);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"reference rule\":\n\t\t\t\t\tcallback(undefined, destructor);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"reference\": {\n\t\t\t\t\tconst reference_step = has_steps.properties.type.state.node;\n\t\t\t\t\tconst reference = registerText(\n\t\t\t\t\t\treference_step.properties.text.ref.inferences.text(),\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t).properties.navigable.cast(\"yes\");\n\t\t\t\t\tconst reference_expression = createExpressionBuilder(iReference(reference).referencedNode).pipe(\n\t\t\t\t\t\tstep.sync((node, destructor) => subscribeToNodePath(has_steps.properties.tail, node, destructor, callback))\n\t\t\t\t\t)();\n\t\t\t\t\tconst subscription = reference_expression.subscribe({ update: () => undefined });\n\t\t\t\t\tdestructor.onDestroy(() => reference_expression.unsubscribe(subscription));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"group\": {\n\t\t\t\t\tconst group_step = has_steps.properties.type.state.node;\n\t\t\t\t\tconst type_node = registerGroup(group_step.properties.group.ref.inferences.group(), node, destructor)\n\t\t\t\t\t\t.properties.node;\n\t\t\t\t\tsubscribeToNodePath(has_steps.properties.tail, type_node, destructor, callback);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state\": {\n\t\t\t\t\tconst state_type = has_steps.properties.type.state.node;\n\t\t\t\t\tconst state_group = registerStategroup(\n\t\t\t\t\t\tstate_type.properties.state_group.ref.inferences.state_group(),\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tconst state = state_group.properties.states.get(state_type.properties.state.entry)!;\n\t\t\t\t\tdestructor.subscribeToStategroup(state.properties.is_selected, (destructor) => {\n\t\t\t\t\t\tswitch (state.properties.is_selected.state.name) {\n\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\tcallback(undefined, destructor);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\tsubscribeToNodePath(has_steps.properties.tail, state.properties.node, destructor, callback);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"collection entry\":\n\t\t\t\t\tcallback(undefined, destructor);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nfunction makeControlDestructor(destructor: DestructorTree) {\n\treturn (callback: () => void) => {\n\t\tdestructor.onDestroy(() => {\n\t\t\tcallback();\n\t\t});\n\t};\n}\n\nfunction stageRenderCell(\n\twidget_cell: api_cs.Cwidget__type__cells,\n\tnode: api_cs.Cnode,\n\tcontrol_parent_dom_element: () => HTMLElement,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n) {\n\tconst task = renderQueue.add(() => {\n\t\tconst property_path = widget_cell.inferences.column_type().inferences.widget_type().parent.properties.path;\n\t\tconst widget_instance = widget_cell.inferences.column_type().inferences.widget_type().properties.instance;\n\t\tsubscribeToNodePath(property_path, node, destructor, (selected_node, destructor) => {\n\t\t\tif (selected_node !== undefined) {\n\t\t\t\tvisit_widget_expression(\n\t\t\t\t\twidget_instance,\n\t\t\t\t\tselected_node,\n\t\t\t\t\tdestructor,\n\t\t\t\t\t{\n\t\t\t\t\t\tclient_view: implementation_context.get_client_view(),\n\t\t\t\t\t\tentry_keys: implementation_context.entry_keys,\n\t\t\t\t\t\tmodel_binding: implementation_context.raw_model_binding,\n\t\t\t\t\t\tparent_dom_element: wrapNode(control_parent_dom_element, destructor),\n\t\t\t\t\t\tview_root_dom_element: implementation_context.get_view_root(),\n\t\t\t\t\t},\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t});\n\tdestructor.onDestroy(() => {\n\t\trenderQueue.remove(task);\n\t});\n}\n","import { api_configuration } from \"../../common\";\nimport DestructorTree from \"../DestructorTree\";\nimport clock from \"../state/clock\";\nimport { getNumber, getText, getWidgetNumber, getWidgetText } from \"../state/modifications\";\nimport escapeIdentifier from \"./escapeIdentifier\";\nimport { ExpressionHandler, ScalarValue } from \"./ExpressionTypes\";\nimport ImplementationVisitorContext from \"./ImplementationVisitorContext\";\nimport { noConversion } from \"./number_converter\";\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_modifications = api_configuration.types.modifications.alan_api;\nimport api_widget = api_configuration.libraries.gui_definition_lib.types.widget.alan_api;\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport client_state_binder = require(\"./client_state_binder\");\nimport context_selection = require(\"./context_selection\");\nimport { Transformers } from \"./ClientBindings\";\nimport { visitOneOrMoreExpression } from \"./visit_widget_implementation_expression\";\nimport { expressionIdGenerator } from \"./visit_widget_implementation_node\";\nimport { getTranslation, subscribeToTranslation } from \"../state/phrases\";\n\nexport function visitScalar(scalar: api_widget.Cscalar__widget): ExpressionHandler {\n\tlet binding_handler: ExpressionHandler | undefined = undefined;\n\tswitch (scalar.properties.binding_type.state.name) {\n\t\tcase \"binding\": {\n\t\t\tconst binding = scalar.properties.binding_type.state.node;\n\t\t\tbinding_handler = bindingHanlder(binding);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"configuration\": {\n\t\t\tconst configuration = scalar.properties.binding_type.state.node;\n\t\t\tswitch (configuration.properties.type.state.name) {\n\t\t\t\tcase \"number\": {\n\t\t\t\t\tconst number__configuration = configuration.properties.type.state.node;\n\t\t\t\t\tbinding_handler = numberConfigurationHandler(number__configuration);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"text\": {\n\t\t\t\t\tconst text__configuration = configuration.properties.type.state.node;\n\t\t\t\t\tbinding_handler = textConfigurationHandler(text__configuration);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(configuration.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"current time\": {\n\t\t\tconst current_time = scalar.properties.binding_type.state.node;\n\t\t\tbinding_handler = currentTimeHandler(current_time);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"event\": {\n\t\t\tconst event = scalar.properties.binding_type.state.node;\n\t\t\tswitch (event.properties.type.state.name) {\n\t\t\t\tcase \"number\": {\n\t\t\t\t\tbinding_handler = {\n\t\t\t\t\t\texecute: async (_, _d, e: number) => e,\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor, _generate_key, e: number) => {\n\t\t\t\t\t\t\tcallback.add(e, implementation_context, destructor, false);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"text\": {\n\t\t\t\t\tbinding_handler = {\n\t\t\t\t\t\texecute: async (_, _d, e: string) => e,\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor, _generate_key, e: string) => {\n\t\t\t\t\t\t\tcallback.add(e, implementation_context, destructor, false);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(event.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"list index\": {\n\t\t\tconst list_index = scalar.properties.binding_type.state.node;\n\t\t\tbinding_handler = listIndexHandler(list_index);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"phrase\": {\n\t\t\tconst phrase = scalar.properties.binding_type.state.node;\n\t\t\tbinding_handler = phraseHandler(phrase);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"static number\": {\n\t\t\tconst static_number = scalar.properties.binding_type.state.node;\n\t\t\tbinding_handler = staticValueHandler(static_number.properties.value.value);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"static text\": {\n\t\t\tconst static_text = scalar.properties.binding_type.state.node;\n\t\t\tbinding_handler = staticValueHandler(static_text.properties.text);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"unary expression\": {\n\t\t\tconst unary_expression = scalar.properties.binding_type.state.node;\n\t\t\tbinding_handler = unaryExpressionHandler(unary_expression);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"list expression\": {\n\t\t\tconst list_expression = scalar.properties.binding_type.state.node;\n\t\t\tbinding_handler = listExpressionHandler(list_expression);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\treturn unexpectedState(scalar.properties.binding_type.state);\n\t}\n\tswitch (scalar.properties.transform.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst $ = scalar.properties.transform.state.node;\n\t\t\tbinding_handler = transformationHandler($, binding_handler);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(scalar.properties.transform.state);\n\t}\n\tswitch (scalar.properties.format.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst $ = scalar.properties.format.state.node;\n\t\t\tbinding_handler = formattingHandler($, binding_handler);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(scalar.properties.format.state);\n\t}\n\treturn binding_handler;\n}\n\nfunction transformationHandler(\n\tconvert: api_widget.Cyes__transform,\n\twrapped_handler: ExpressionHandler\n): ExpressionHandler {\n\tconst transformer: (value: string | number) => number =\n\t\tclient_state_binder.transformers[convert.properties.transformer.entry as keyof Transformers];\n\treturn {\n\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\tconst value = (await wrapped_handler.execute(implementation_context, destructor, event_value)) as string | number;\n\t\t\treturn transformer(value);\n\t\t},\n\t\tsubscribe: (implementation_context, callback, destructor, event_value) => {\n\t\t\twrapped_handler.subscribe(\n\t\t\t\timplementation_context,\n\t\t\t\t{\n\t\t\t\t\tadd: (value: string | number, ic, d, wrap) => {\n\t\t\t\t\t\tcallback.add(transformer(value), ic, d, wrap);\n\t\t\t\t\t},\n\t\t\t\t\tupdate: callback.update,\n\t\t\t\t},\n\t\t\t\tdestructor,\n\t\t\t\tevent_value\n\t\t\t);\n\t\t},\n\t};\n}\n\nfunction formattingHandler(\n\tformat_type: api_widget.Cyes__format,\n\twrapped_handler: ExpressionHandler\n): ExpressionHandler {\n\tconst formatter = (client_state_binder.formatters as any)[format_type.properties.formatter.entry];\n\treturn {\n\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\treturn formatter(wrapped_handler.execute(implementation_context, destructor, event_value));\n\t\t},\n\t\tsubscribe: (implementation_context, callback, destructor, event_value) => {\n\t\t\twrapped_handler.subscribe(\n\t\t\t\timplementation_context,\n\t\t\t\t{\n\t\t\t\t\tadd: (value, ic, d, wrap) => {\n\t\t\t\t\t\tcallback.add(formatter(value), ic, d, wrap);\n\t\t\t\t\t},\n\t\t\t\t\tupdate: callback.update,\n\t\t\t\t},\n\t\t\t\tdestructor,\n\t\t\t\tevent_value\n\t\t\t);\n\t\t},\n\t};\n}\n\nfunction staticValueHandler(value: T): ExpressionHandler {\n\treturn {\n\t\texecute: async () => value,\n\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\tcallback.add(value, implementation_context, destructor, false);\n\t\t},\n\t};\n}\n\nfunction listIndexHandler(list_index: api_widget.Clist_index): ExpressionHandler {\n\treturn {\n\t\texecute: async (implementation_context) => getListIndex(list_index, implementation_context),\n\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\tcallback.add(getListIndex(list_index, implementation_context), implementation_context, destructor, false);\n\t\t},\n\t};\n}\n\nfunction getListIndex(\n\tlist_index: api_widget.Clist_index,\n\timplementation_context: ImplementationVisitorContext\n): number {\n\tconst destructor = DestructorTree.create();\n\tconst list_context = context_selection.context_selection(\n\t\tlist_index.properties.context,\n\t\timplementation_context,\n\t\tdestructor\n\t);\n\tdestructor.destroy();\n\tconst list_counter = ( //FIXME: do the location cast in the schema\n\t\tlist_context.gui_widget_configuration.location as api_views.Cyes__has_steps__gui_widget_configuration_list\n\t).definitions.list_counter;\n\treturn numberindex(list_counter);\n}\n\nfunction numberindex(list_counter: api_views.Clist_counter): number {\n\treturn list_counter.switch({\n\t\tstart: 0,\n\t\tentry: ($) => numberindex($.parent.input.previous_entry()) + 1,\n\t});\n}\n\nfunction currentTimeHandler(current_time: api_widget.Ccurrent_time): ExpressionHandler {\n\tlet current_time_throttle: ((callback: (value: number) => void) => (value: number) => void) | undefined = undefined;\n\tswitch (current_time.properties.throttle.state.name) {\n\t\tcase \"no\": {\n\t\t\tcurrent_time_throttle = (callback) => callback;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = current_time.properties.throttle.state.node;\n\t\t\tcurrent_time_throttle = (callback) => throttle(callback, $.properties.interval.value);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(current_time.properties.throttle.state);\n\t}\n\treturn {\n\t\texecute: async () => clock.getNow(),\n\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\tconst clock_callback = current_time_throttle!((time: number) => {\n\t\t\t\tcallback.add(time, implementation_context, destructor, false);\n\t\t\t});\n\t\t\tclock.on(\"tick\", clock_callback);\n\t\t\tdestructor.onDestroy(() => {\n\t\t\t\tclock.off(\"tick\", clock_callback);\n\t\t\t});\n\t\t},\n\t};\n}\n\ntype NumberCallback = (value: number) => void;\nfunction throttle(callback: NumberCallback, interval: number): NumberCallback {\n\tlet executing = false;\n\tlet reexecute = false;\n\tlet last_value: number;\n\n\treturn function execute(value: number) {\n\t\tif (executing) {\n\t\t\treexecute = true;\n\t\t\tlast_value = value;\n\t\t\treturn;\n\t\t}\n\t\texecuting = true;\n\t\tcallback(value);\n\t\tsetTimeout(function () {\n\t\t\texecuting = false;\n\t\t\tif (reexecute) {\n\t\t\t\treexecute = false;\n\t\t\t\texecute(last_value);\n\t\t\t}\n\t\t}, interval * 1000);\n\t};\n}\n\nfunction bindingHanlder(expression: api_widget.Cbinding__binding_type): ExpressionHandler {\n\tswitch (expression.properties.type.state.name) {\n\t\tcase \"key\": {\n\t\t\treturn {\n\t\t\t\texecute: async (implementation_context) => {\n\t\t\t\t\tconst destructor = DestructorTree.create();\n\t\t\t\t\tconst binding_context = context_selection.context_selection(\n\t\t\t\t\t\texpression.properties.context,\n\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tdestructor.destroy();\n\t\t\t\t\treturn (binding_context.current_binding_context as unknown as api_client_state.AlanDictionaryEntry).key_value;\n\t\t\t\t},\n\t\t\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\t\t\tconst binding_context = context_selection.context_selection(\n\t\t\t\t\t\texpression.properties.context,\n\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\tDestructorTree.create()\n\t\t\t\t\t);\n\t\t\t\t\tconst key_value = (binding_context.current_binding_context as unknown as api_client_state.AlanDictionaryEntry)\n\t\t\t\t\t\t.key_value;\n\t\t\t\t\tcallback.add(key_value, binding_context, destructor, false);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase \"property\": {\n\t\t\tconst property = expression.properties.type.state.node;\n\t\t\tconst property_name = property.properties.property.entry;\n\t\t\tconst escaped_property_name = escapeIdentifier(property_name);\n\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\tcase \"number\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\texecute: async (implementation_context) => {\n\t\t\t\t\t\t\tconst destructor = DestructorTree.create();\n\t\t\t\t\t\t\tconst binding_context = context_selection.context_selection(\n\t\t\t\t\t\t\t\texpression.properties.context,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tdestructor.destroy();\n\t\t\t\t\t\t\tconst property_context = binding_context.switchClientStateBinderToProperty(property_name, destructor);\n\t\t\t\t\t\t\tconst converter = property_context.number_converter ?? noConversion;\n\t\t\t\t\t\t\treturn converter.onceTo(\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\tproperty_context.current_binding_context.properties[\n\t\t\t\t\t\t\t\t\t\tescaped_property_name\n\t\t\t\t\t\t\t\t\t] as api_client_state.AlanInteger\n\t\t\t\t\t\t\t\t).value\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\t\t\t\t\tconst binding_context = context_selection.context_selection(\n\t\t\t\t\t\t\t\texpression.properties.context,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst property_context = binding_context.switchClientStateBinderToProperty(property_name, destructor);\n\t\t\t\t\t\t\tconst converter = (property_context.number_converter ?? noConversion).to(destructor);\n\t\t\t\t\t\t\tdestructor.subscribeToNumber(\n\t\t\t\t\t\t\t\tproperty_context.current_binding_context as any,\n\t\t\t\t\t\t\t\t(\"subscribe_\" + escaped_property_name) as any,\n\t\t\t\t\t\t\t\t(value, property_destructor) => {\n\t\t\t\t\t\t\t\t\tconverter(value, (result) => {\n\t\t\t\t\t\t\t\t\t\tcallback.add(result, property_context, property_destructor, false);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase \"reference\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\texecute: async (implementation_context) => {\n\t\t\t\t\t\t\tconst destructor = DestructorTree.create();\n\t\t\t\t\t\t\tconst binding_context = context_selection.context_selection(\n\t\t\t\t\t\t\t\texpression.properties.context,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst property_context = binding_context.switchClientStateBinderToProperty(property_name, destructor);\n\t\t\t\t\t\t\tdestructor.destroy();\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\tproperty_context.current_binding_context.properties[\n\t\t\t\t\t\t\t\t\tescaped_property_name\n\t\t\t\t\t\t\t\t] as api_client_state.Reference\n\t\t\t\t\t\t\t).entry;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\t\t\t\t\tconst binding_context = context_selection.context_selection(\n\t\t\t\t\t\t\t\texpression.properties.context,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst property_context = binding_context.switchClientStateBinderToProperty(property_name, destructor);\n\t\t\t\t\t\t\tdestructor.subscribeToText(\n\t\t\t\t\t\t\t\tproperty_context.current_binding_context as any,\n\t\t\t\t\t\t\t\t(\"subscribe_\" + escaped_property_name) as any,\n\t\t\t\t\t\t\t\t(value, property_destructor) => {\n\t\t\t\t\t\t\t\t\tcallback.add(value, binding_context, property_destructor, false);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase \"text\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\texecute: async (implementation_context) => {\n\t\t\t\t\t\t\tconst destructor = DestructorTree.create();\n\t\t\t\t\t\t\tconst binding_context = context_selection.context_selection(\n\t\t\t\t\t\t\t\texpression.properties.context,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst property_context = binding_context.switchClientStateBinderToProperty(property_name, destructor);\n\t\t\t\t\t\t\tdestructor.destroy();\n\t\t\t\t\t\t\treturn property_context.current_binding_context.properties[escaped_property_name] as string;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\t\t\t\t\tconst binding_context = context_selection.context_selection(\n\t\t\t\t\t\t\t\texpression.properties.context,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst property_context = binding_context.switchClientStateBinderToProperty(property_name, destructor);\n\t\t\t\t\t\t\tdestructor.subscribeToText(\n\t\t\t\t\t\t\t\tproperty_context.current_binding_context as any,\n\t\t\t\t\t\t\t\t(\"subscribe_\" + escaped_property_name) as any,\n\t\t\t\t\t\t\t\t(value, property_destructor) => {\n\t\t\t\t\t\t\t\t\tcallback.add(value, property_context, property_destructor, false);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(property.properties.type.state);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(expression.properties.type.state);\n\t}\n}\n\nfunction numberConfigurationHandler(\n\tnumber__type: api_widget.Cnumber__type__configuration__binding_type\n): ExpressionHandler {\n\treturn {\n\t\texecute: async (implementation_context) => {\n\t\t\tconst destructor = DestructorTree.create();\n\t\t\tconst number_implementation_context = context_selection.context_selection(\n\t\t\t\tnumber__type.parent.properties.context,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tdestructor.destroy();\n\t\t\tconst widget_configuration = number_implementation_context.widget_configuration;\n\t\t\tconst node_context = number_implementation_context.view_context_node;\n\t\t\tif (widget_configuration instanceof api_views.Cgui_widget_configuration_node) {\n\t\t\t\tconst number__type__configuration = widget_configuration.properties.configuration\n\t\t\t\t\t.get(number__type.parent.properties.attribute.entry)\n\t\t\t\t\t?.properties.attribute.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"number\");\n\t\t\t\tif (number__type__configuration === undefined) {\n\t\t\t\t\tconst widget_number = number__type.inferences.number_type().properties.has_default.cast(\"yes\");\n\t\t\t\t\tconst number_value = getWidgetNumber(\n\t\t\t\t\t\tnode_context,\n\t\t\t\t\t\tnumber_implementation_context.last_gui_widget_configuration,\n\t\t\t\t\t\twidget_number.parent,\n\t\t\t\t\t\tnumber_implementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t\tif (number_value.value !== undefined) {\n\t\t\t\t\t\treturn number_value.value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn widget_number.properties.value.value;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst number_value = getNumber(\n\t\t\t\t\t\tnode_context,\n\t\t\t\t\t\tnumber__type__configuration,\n\t\t\t\t\t\tnumber_implementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t\tconst current_value =\n\t\t\t\t\t\tnumber_value.value ??\n\t\t\t\t\t\tnumber__type__configuration.properties.source.switch({\n\t\t\t\t\t\t\tnow: ($) =>\n\t\t\t\t\t\t\t\tclock.getNow() +\n\t\t\t\t\t\t\t\t$.properties.has_offset.switch({\n\t\t\t\t\t\t\t\t\tnone: 0,\n\t\t\t\t\t\t\t\t\tyes: ($) => $.properties.offset.value,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tstatic: ($) => $.properties.number.value,\n\t\t\t\t\t\t});\n\t\t\t\t\treturn current_value;\n\t\t\t\t}\n\t\t\t} else if (widget_configuration instanceof api_modifications.Cconfiguration_node) {\n\t\t\t\tconst number__type__configuration = widget_configuration.properties.attributes\n\t\t\t\t\t.get(number__type.parent.properties.attribute.entry)!\n\t\t\t\t\t.properties.type.cast(\"number\");\n\t\t\t\treturn number__type__configuration.properties.value.value;\n\t\t\t} else if (widget_configuration instanceof api_widget.Cwidget_configuration_node) {\n\t\t\t\tconst widget_number = number__type.inferences.number_type().properties.has_default.cast(\"yes\");\n\t\t\t\tconst number_value = getWidgetNumber(\n\t\t\t\t\tnode_context,\n\t\t\t\t\tnumber_implementation_context.last_gui_widget_configuration,\n\t\t\t\t\twidget_number.parent,\n\t\t\t\t\tnumber_implementation_context.entry_keys\n\t\t\t\t);\n\t\t\t\tif (number_value.value !== undefined) {\n\t\t\t\t\treturn number_value.value;\n\t\t\t\t} else {\n\t\t\t\t\treturn widget_number.properties.value.value;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tunexpectedState(widget_configuration);\n\t\t\t}\n\t\t},\n\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\tconst number_implementation_context = context_selection.context_selection(\n\t\t\t\tnumber__type.parent.properties.context,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst onNumberValue = (value: number) => {\n\t\t\t\tcallback.add(value, number_implementation_context, destructor, false);\n\t\t\t};\n\t\t\tconst widget_configuration = number_implementation_context.widget_configuration;\n\t\t\tconst node_context = number_implementation_context.view_context_node;\n\t\t\tif (widget_configuration instanceof api_views.Cgui_widget_configuration_node) {\n\t\t\t\tconst number__type__configuration = widget_configuration.properties.configuration\n\t\t\t\t\t.get(number__type.parent.properties.attribute.entry)\n\t\t\t\t\t?.properties.attribute.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"number\");\n\t\t\t\tif (number__type__configuration === undefined) {\n\t\t\t\t\tconst widget_number = number__type.inferences.number_type().properties.has_default.cast(\"yes\");\n\t\t\t\t\tconst number_value = getWidgetNumber(\n\t\t\t\t\t\tnode_context,\n\t\t\t\t\t\tnumber_implementation_context.last_gui_widget_configuration,\n\t\t\t\t\t\twidget_number.parent,\n\t\t\t\t\t\tnumber_implementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t\tif (number_value.value !== undefined) {\n\t\t\t\t\t\tonNumberValue(number_value.value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tonNumberValue(widget_number.properties.value.value);\n\t\t\t\t\t}\n\t\t\t\t\tconst subscription = number_value.subscribe((new_value) => {\n\t\t\t\t\t\tonNumberValue(new_value);\n\t\t\t\t\t});\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst number_value = getNumber(\n\t\t\t\t\t\tnode_context,\n\t\t\t\t\t\tnumber__type__configuration,\n\t\t\t\t\t\tnumber_implementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t\tconst current_value =\n\t\t\t\t\t\tnumber_value.value ??\n\t\t\t\t\t\tnumber__type__configuration.properties.source.switch({\n\t\t\t\t\t\t\tnow: ($) =>\n\t\t\t\t\t\t\t\tclock.getNow() +\n\t\t\t\t\t\t\t\t$.properties.has_offset.switch({\n\t\t\t\t\t\t\t\t\tnone: 0,\n\t\t\t\t\t\t\t\t\tyes: ($) => $.properties.offset.value,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tstatic: ($) => $.properties.number.value,\n\t\t\t\t\t\t});\n\t\t\t\t\tonNumberValue(current_value);\n\t\t\t\t\tconst subscription = number_value.subscribe((new_value) => {\n\t\t\t\t\t\tonNumberValue(new_value);\n\t\t\t\t\t});\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (widget_configuration instanceof api_modifications.Cconfiguration_node) {\n\t\t\t\tconst number__type__configuration = widget_configuration.properties.attributes\n\t\t\t\t\t.get(number__type.parent.properties.attribute.entry)!\n\t\t\t\t\t.properties.type.cast(\"number\");\n\t\t\t\tonNumberValue(number__type__configuration.properties.value.value);\n\t\t\t\tdestructor.subscribeToNumber(\n\t\t\t\t\tnumber__type__configuration as any,\n\t\t\t\t\t\"subscribe_value\" as any,\n\t\t\t\t\t(value) => {\n\t\t\t\t\t\tonNumberValue(value);\n\t\t\t\t\t},\n\t\t\t\t\ttrue\n\t\t\t\t);\n\t\t\t} else if (widget_configuration instanceof api_widget.Cwidget_configuration_node) {\n\t\t\t\tconst widget_number = number__type.inferences.number_type().properties.has_default.cast(\"yes\");\n\t\t\t\tconst number_value = getWidgetNumber(\n\t\t\t\t\tnode_context,\n\t\t\t\t\tnumber_implementation_context.last_gui_widget_configuration,\n\t\t\t\t\twidget_number.parent,\n\t\t\t\t\tnumber_implementation_context.entry_keys\n\t\t\t\t);\n\t\t\t\tif (number_value.value !== undefined) {\n\t\t\t\t\tonNumberValue(number_value.value);\n\t\t\t\t} else {\n\t\t\t\t\tonNumberValue(widget_number.properties.value.value);\n\t\t\t\t}\n\t\t\t\tconst subscription = number_value.subscribe((new_value) => {\n\t\t\t\t\tonNumberValue(new_value);\n\t\t\t\t});\n\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tunexpectedState(widget_configuration);\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction textConfigurationHandler(\n\ttext__type: api_widget.Ctext__type__configuration__binding_type\n): ExpressionHandler {\n\treturn {\n\t\texecute: async (implementation_context) => {\n\t\t\tconst destructor = DestructorTree.create();\n\t\t\tconst text_implementation_context = context_selection.context_selection(\n\t\t\t\ttext__type.parent.properties.context,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tdestructor.destroy();\n\n\t\t\tconst bound_text_key = text__type.parent.properties.attribute.entry;\n\t\t\tconst widget_configuration = text_implementation_context.widget_configuration;\n\t\t\tconst node_context = text_implementation_context.view_context_node;\n\n\t\t\tif (widget_configuration instanceof api_views.Cgui_widget_configuration_node) {\n\t\t\t\tconst configuration_text = widget_configuration.properties.configuration\n\t\t\t\t\t.get(bound_text_key)\n\t\t\t\t\t?.properties.attribute.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"text\");\n\t\t\t\tif (configuration_text === undefined) {\n\t\t\t\t\tconst widget_text = widget_configuration.input\n\t\t\t\t\t\t.widget_configuration_node()\n\t\t\t\t\t\t.properties.attributes.get(bound_text_key)!\n\t\t\t\t\t\t.properties.type.cast(\"configuration\")\n\t\t\t\t\t\t.properties.type.cast(\"text\")\n\t\t\t\t\t\t.properties.has_default.cast(\"yes\");\n\n\t\t\t\t\tconst text_value = getWidgetText(\n\t\t\t\t\t\tnode_context,\n\t\t\t\t\t\twidget_configuration,\n\t\t\t\t\t\twidget_text.parent,\n\t\t\t\t\t\ttext_implementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t\tif (text_value.value !== undefined) {\n\t\t\t\t\t\treturn text_value.value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tswitch (widget_text.properties.type.state.name) {\n\t\t\t\t\t\t\tcase \"static\": {\n\t\t\t\t\t\t\t\tconst $ = widget_text.properties.type.state.node;\n\t\t\t\t\t\t\t\treturn $.properties.value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"unique id\": {\n\t\t\t\t\t\t\t\tconst $ = widget_text.properties.type.state.node;\n\t\t\t\t\t\t\t\treturn text_implementation_context.uniqueId($);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tunexpectedState(widget_text.properties.type.state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst text_value = getText(node_context, configuration_text, text_implementation_context.entry_keys);\n\t\t\t\t\tif (text_value.value !== undefined) {\n\t\t\t\t\t\treturn text_value.value;\n\t\t\t\t\t}\n\t\t\t\t\tswitch (configuration_text.properties.type.state.name) {\n\t\t\t\t\t\tcase \"static\":\n\t\t\t\t\t\t\treturn configuration_text.properties.type.state.node.properties.value;\n\t\t\t\t\t\tcase \"phrase\": {\n\t\t\t\t\t\t\tconst gui_definition_configuration_text_value =\n\t\t\t\t\t\t\t\tconfiguration_text.properties.type.state.node.properties.value.ref;\n\t\t\t\t\t\t\tconst phrase = gui_definition_configuration_text_value.key;\n\t\t\t\t\t\t\treturn getTranslation(phrase);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"key\": {\n\t\t\t\t\t\t\tconst key_type = configuration_text.properties.type.state.node;\n\t\t\t\t\t\t\tconst key = switchKeyContext(key_type);\n\t\t\t\t\t\t\tswitch (key_type.properties.translate.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\treturn key;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\treturn getTranslation(key);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn unexpectedState(key_type.properties.translate.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(configuration_text.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (widget_configuration instanceof api_modifications.Cconfiguration_node) {\n\t\t\t\tconst configuration_text = widget_configuration.properties.attributes\n\t\t\t\t\t.get(bound_text_key)!\n\t\t\t\t\t.properties.type.cast(\"text\");\n\t\t\t\treturn configuration_text.properties.value;\n\t\t\t} else if (widget_configuration instanceof api_widget.Cwidget_configuration_node) {\n\t\t\t\tconst widget_text = widget_configuration.properties.attributes\n\t\t\t\t\t.get(bound_text_key)!\n\t\t\t\t\t.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"text\")\n\t\t\t\t\t.properties.has_default.cast(\"yes\");\n\t\t\t\tconst text_value = getWidgetText(\n\t\t\t\t\tnode_context,\n\t\t\t\t\ttext_implementation_context.last_gui_widget_configuration,\n\t\t\t\t\twidget_text.parent,\n\t\t\t\t\ttext_implementation_context.entry_keys\n\t\t\t\t);\n\t\t\t\tif (text_value.value !== undefined) {\n\t\t\t\t\treturn text_value.value;\n\t\t\t\t} else {\n\t\t\t\t\tswitch (widget_text.properties.type.state.name) {\n\t\t\t\t\t\tcase \"static\": {\n\t\t\t\t\t\t\tconst $ = widget_text.properties.type.state.node;\n\t\t\t\t\t\t\treturn $.properties.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"unique id\": {\n\t\t\t\t\t\t\tconst $ = widget_text.properties.type.state.node;\n\t\t\t\t\t\t\treturn text_implementation_context.uniqueId($);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(widget_text.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tunexpectedState(widget_configuration);\n\t\t\t}\n\t\t},\n\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\tconst text_implementation_context = context_selection.context_selection(\n\t\t\t\ttext__type.parent.properties.context,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst onTextValue = (value: string) => {\n\t\t\t\tcallback.add(value, text_implementation_context, destructor, false);\n\t\t\t};\n\n\t\t\tconst bound_text_key = text__type.parent.properties.attribute.entry;\n\t\t\tconst widget_configuration = text_implementation_context.widget_configuration;\n\t\t\tconst node_context = text_implementation_context.view_context_node;\n\n\t\t\tconst subscribeWidgetText = (\n\t\t\t\tnode: api_widget.Cwidget_configuration_node,\n\t\t\t\tgui_node: api_views.Cgui_widget_configuration_node\n\t\t\t) => {\n\t\t\t\tconst widget_text = node.properties.attributes\n\t\t\t\t\t.get(bound_text_key)!\n\t\t\t\t\t.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"text\")\n\t\t\t\t\t.properties.has_default.cast(\"yes\");\n\n\t\t\t\tconst text_value = getWidgetText(\n\t\t\t\t\tnode_context,\n\t\t\t\t\tgui_node,\n\t\t\t\t\twidget_text.parent,\n\t\t\t\t\ttext_implementation_context.entry_keys\n\t\t\t\t);\n\t\t\t\tif (text_value.value !== undefined) {\n\t\t\t\t\tonTextValue(text_value.value);\n\t\t\t\t} else {\n\t\t\t\t\tswitch (widget_text.properties.type.state.name) {\n\t\t\t\t\t\tcase \"static\": {\n\t\t\t\t\t\t\tconst $ = widget_text.properties.type.state.node;\n\t\t\t\t\t\t\tonTextValue($.properties.value);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"unique id\": {\n\t\t\t\t\t\t\tconst $ = widget_text.properties.type.state.node;\n\t\t\t\t\t\t\tonTextValue(text_implementation_context.uniqueId($));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(widget_text.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tunsubscribeOnDestroy(text_value.subscribe(onTextValue), destructor);\n\t\t\t};\n\n\t\t\tif (widget_configuration instanceof api_views.Cgui_widget_configuration_node) {\n\t\t\t\tconst configuration_text = widget_configuration.properties.configuration\n\t\t\t\t\t.get(bound_text_key)\n\t\t\t\t\t?.properties.attribute.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"text\");\n\t\t\t\tif (configuration_text === undefined) {\n\t\t\t\t\tsubscribeWidgetText(widget_configuration.input.widget_configuration_node(), widget_configuration);\n\t\t\t\t} else {\n\t\t\t\t\tlet text_modified = false;\n\t\t\t\t\tconst text_value = getText(node_context, configuration_text, text_implementation_context.entry_keys);\n\t\t\t\t\tif (text_value.value !== undefined) {\n\t\t\t\t\t\ttext_modified = true;\n\t\t\t\t\t\tonTextValue(text_value.value);\n\t\t\t\t\t}\n\t\t\t\t\tunsubscribeOnDestroy(\n\t\t\t\t\t\ttext_value.subscribe((value) => {\n\t\t\t\t\t\t\tonTextValue(value);\n\t\t\t\t\t\t\ttext_modified = true;\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\n\t\t\t\t\tswitch (configuration_text.properties.type.state.name) {\n\t\t\t\t\t\tcase \"static\":\n\t\t\t\t\t\t\tif (!text_modified) {\n\t\t\t\t\t\t\t\tonTextValue(configuration_text.properties.type.state.node.properties.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"phrase\": {\n\t\t\t\t\t\t\tconst gui_definition_configuration_text_value =\n\t\t\t\t\t\t\t\tconfiguration_text.properties.type.state.node.properties.value.ref;\n\t\t\t\t\t\t\tconst phrase = gui_definition_configuration_text_value.key;\n\t\t\t\t\t\t\tsubscribeToTranslation(phrase, destructor, (translation) => {\n\t\t\t\t\t\t\t\tif (!text_modified) {\n\t\t\t\t\t\t\t\t\tonTextValue(translation);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"key\": {\n\t\t\t\t\t\t\tconst key_type = configuration_text.properties.type.state.node;\n\t\t\t\t\t\t\tconst key = switchKeyContext(key_type);\n\t\t\t\t\t\t\tswitch (key_type.properties.translate.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\": {\n\t\t\t\t\t\t\t\t\tonTextValue(key);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\t\t\tsubscribeToTranslation(key, destructor, (translation) => {\n\t\t\t\t\t\t\t\t\t\tif (!text_modified) {\n\t\t\t\t\t\t\t\t\t\t\tonTextValue(translation);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tunexpectedState(key_type.properties.translate.state);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(configuration_text.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (widget_configuration instanceof api_modifications.Cconfiguration_node) {\n\t\t\t\tconst configuration_text = widget_configuration.properties.attributes\n\t\t\t\t\t.get(bound_text_key)!\n\t\t\t\t\t.properties.type.cast(\"text\");\n\t\t\t\tdestructor.subscribeToText(\n\t\t\t\t\tconfiguration_text,\n\t\t\t\t\t\"subscribe_value\",\n\t\t\t\t\t(value) => {\n\t\t\t\t\t\tonTextValue(value);\n\t\t\t\t\t},\n\t\t\t\t\ttrue\n\t\t\t\t);\n\t\t\t} else if (widget_configuration instanceof api_widget.Cwidget_configuration_node) {\n\t\t\t\tsubscribeWidgetText(widget_configuration, text_implementation_context.last_gui_widget_configuration);\n\t\t\t} else {\n\t\t\t\tunexpectedState(widget_configuration);\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction switchKeyContext(key_type: api_views.Ckey) {\n\tlet key = \"\";\n\tconst key_is_set = key_type.inferences.is_set();\n\tswitch (key_is_set.variant.name) {\n\t\tcase \"graph\": {\n\t\t\tkey = key_is_set.variant.definition.inferences.ordered_graph().parent.key_value;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"rule\": {\n\t\t\tkey = key_is_set.variant.definition.key_value;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state\": {\n\t\t\tkey = key_is_set.variant.definition.key_value;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"attribute\": {\n\t\t\tkey = key_is_set.variant.definition.key_value;\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(key_is_set.variant);\n\t}\n\treturn key;\n}\n\nfunction unsubscribeOnDestroy(subscription: { unsubscribe: () => void }, destructor: DestructorTree): void {\n\tdestructor.onDestroy(() => {\n\t\tsubscription.unsubscribe();\n\t});\n}\n\nfunction phraseHandler(phrase_type: api_widget.Cphrase): ExpressionHandler {\n\tconst phrase = phrase_type.properties.phrase.entry;\n\treturn {\n\t\texecute: async () => {\n\t\t\treturn getTranslation(phrase);\n\t\t},\n\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\tsubscribeToTranslation(phrase, destructor, (translation) => {\n\t\t\t\tcallback.add(translation, implementation_context, destructor, false);\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction unaryExpressionHandler(unary_expression: api_widget.Cunary_expression): ExpressionHandler {\n\tconst process_value = unary_expression.properties.type.switch<(value: number) => number>({\n\t\t\"absolute value\": () => {\n\t\t\treturn (value: number) => Math.abs(value);\n\t\t},\n\t\t\"sign inversion\": () => {\n\t\t\treturn (value: number) => -value;\n\t\t},\n\t});\n\tconst scalar_expression = visitScalar(unary_expression.properties.value);\n\n\treturn {\n\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\tconst expression_value = await scalar_expression.execute(implementation_context, destructor, event_value);\n\t\t\treturn process_value(expression_value as number);\n\t\t},\n\t\tsubscribe: (implementation_context, callback, destructor, generate_key, event_value) => {\n\t\t\tscalar_expression.subscribe(\n\t\t\t\timplementation_context,\n\t\t\t\t{\n\t\t\t\t\tadd: (value, ic, d, w, key) => {\n\t\t\t\t\t\tcallback.add(process_value(value as number), ic, d, w, key);\n\t\t\t\t\t},\n\t\t\t\t\tupdate: (sorting) => {\n\t\t\t\t\t\tcallback.update?.(sorting);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdestructor,\n\t\t\t\tgenerate_key,\n\t\t\t\tevent_value\n\t\t\t);\n\t\t},\n\t};\n}\n\nfunction listExpressionHandler(list_expression: api_widget.Clist_expression): ExpressionHandler {\n\tconst process_values = list_expression.properties.operation.switch<(values: number[]) => number>({\n\t\tmaximum: () => (values: number[]) => {\n\t\t\treturn Math.max(...values);\n\t\t},\n\t\tminimum: () => (values: number[]) => {\n\t\t\treturn Math.min(...values);\n\t\t},\n\t\tproduct: () => (values: number[]) => {\n\t\t\tif (values.length === 0) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn values.reduce((p, c) => p * c);\n\t\t},\n\t\tsum: () => (values: number[]) => {\n\t\t\treturn values.reduce((p, c) => p + c, 0);\n\t\t},\n\t});\n\tconst expression = visitOneOrMoreExpression(list_expression.properties.value);\n\n\treturn {\n\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\tconst expression_result = await expression.execute(implementation_context, destructor, event_value);\n\t\t\tconst result = expression_result instanceof Array ? expression_result : [expression_result];\n\t\t\treturn process_values(\n\t\t\t\tresult.filter((v) => {\n\t\t\t\t\treturn v !== undefined;\n\t\t\t\t}) as number[]\n\t\t\t);\n\t\t},\n\t\tsubscribe: (implementation_context, callback, destructor, generate_key, event_value) => {\n\t\t\tconst values = new Map();\n\t\t\tconst list_expression_key = generate_key?.();\n\t\t\tlet first = true;\n\t\t\tconst update = () => {\n\t\t\t\tif (destructor.destroyed) return;\n\t\t\t\tfirst = false;\n\t\t\t\tcallback.add(\n\t\t\t\t\tprocess_values([...values.values()]),\n\t\t\t\t\timplementation_context,\n\t\t\t\t\tdestructor,\n\t\t\t\t\tfalse,\n\t\t\t\t\tlist_expression_key\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texpression.subscribe(\n\t\t\t\timplementation_context,\n\t\t\t\t{\n\t\t\t\t\tadd: (value: number, ic, d, w, key) => {\n\t\t\t\t\t\tif (value === undefined) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalues.set(key, value);\n\t\t\t\t\t\td.onDestroy(() => {\n\t\t\t\t\t\t\tvalues.delete(key);\n\t\t\t\t\t\t\tupdate();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tupdate();\n\t\t\t\t\t},\n\t\t\t\t\tupdate: () => {\n\t\t\t\t\t\t// do nothing\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdestructor,\n\t\t\t\texpressionIdGenerator(),\n\t\t\t\tevent_value\n\t\t\t);\n\t\t\tif (first) {\n\t\t\t\tupdate();\n\t\t\t}\n\t\t},\n\t};\n}\n","import { api_configuration } from \"../../common\";\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport DestructorTree from \"../DestructorTree\";\nimport { visit_widget_implementation } from \"./visit_widget_implementation\";\nimport { wrapNode } from \"./wrapNode\";\nimport { iReference } from \"../state/Reference\";\nimport * as Rule from \"../state/Rule\";\nimport {\n\tregisterGuiWidgetConfigurationNode,\n\tregisterGroup,\n\tregisterStategroup,\n\tregisterText,\n\tregisterNodeContext,\n} from \"../state/registerClientState\";\nimport { Result, isResolved } from \"../Status\";\nimport { Scalar, onScalarValue } from \"../../../../../stream\";\n\nexport function visit_widget_expression(\n\texpression: api_views.Cwidget_expression,\n\tcurrent_context: api_client_state.AlanObject,\n\tdestructor: DestructorTree,\n\timplementation_arguments: ImplementationArguments,\n\twrap_in_dynamic_area = false\n): void {\n\tswitch (expression.properties.type.state.name) {\n\t\tcase \"group\": {\n\t\t\tconst group_type = expression.properties.type.state.node;\n\t\t\tconst node = current_context as unknown as api_client_state.Cnode;\n\t\t\tconst group_property = registerGroup(group_type.properties.group.ref.inferences.group(), node, destructor);\n\t\t\tvisit_widget_expression(\n\t\t\t\tgroup_type.properties.next,\n\t\t\t\tgroup_property.properties.node,\n\t\t\t\tdestructor,\n\t\t\t\timplementation_arguments,\n\t\t\t\twrap_in_dynamic_area\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state\": {\n\t\t\tconst state_type = expression.properties.type.state.node;\n\t\t\tconst node = current_context as unknown as api_client_state.Cnode;\n\t\t\tconst state = registerStategroup(\n\t\t\t\tstate_type.properties.state_group.ref.inferences.state_group(),\n\t\t\t\tnode,\n\t\t\t\tdestructor\n\t\t\t).properties.states.get(state_type.properties.state.entry)!;\n\t\t\tbindToState(state, state_type.properties.next, destructor, implementation_arguments);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"switch\": {\n\t\t\tconst switch_type = expression.properties.type.state.node;\n\t\t\tconst node = current_context as unknown as api_client_state.Cnode;\n\t\t\tconst state_group_property = registerStategroup(\n\t\t\t\tswitch_type.properties.state_group.ref.inferences.state_group(),\n\t\t\t\tnode,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tfor (const state of switch_type.properties.states.values()) {\n\t\t\t\tconst client_state = state_group_property.properties.states.get(state.key.entry)!;\n\t\t\t\tbindToState(client_state, state.properties.next, destructor, implementation_arguments);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"parent\": {\n\t\t\tconst parent_type = expression.properties.type.state.node;\n\t\t\tconst node = current_context as unknown as api_client_state.Cnode;\n\t\t\tconst parent = node.input\n\t\t\t\t.position()\n\t\t\t\t.input.parent()\n\t\t\t\t.switch({\n\t\t\t\t\tnode: ($) => $,\n\t\t\t\t\tnone: node.input\n\t\t\t\t\t\t.position()\n\t\t\t\t\t\t.input.root()\n\t\t\t\t\t\t.switch({\n\t\t\t\t\t\t\troot: ($) => $.properties.root,\n\t\t\t\t\t\t\toperation: ($) => $.parent.parent.parent,\n\t\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\tvisit_widget_expression(\n\t\t\t\tparent_type.properties.next,\n\t\t\t\tparent,\n\t\t\t\tdestructor,\n\t\t\t\timplementation_arguments,\n\t\t\t\twrap_in_dynamic_area\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"widget\": {\n\t\t\tconst widget_type = expression.properties.type.state.node;\n\t\t\tif (current_context instanceof api_client_state.Cnode) {\n\t\t\t\tregisterGuiWidgetConfigurationNode(\n\t\t\t\t\twidget_type.properties.widget.properties.configuration,\n\t\t\t\t\tcurrent_context,\n\t\t\t\t\tdestructor\n\t\t\t\t);\n\t\t\t}\n\t\t\tvisit_widget_implementation(\n\t\t\t\twrap_in_dynamic_area\n\t\t\t\t\t? wrapNode(implementation_arguments.parent_dom_element, destructor)\n\t\t\t\t\t: implementation_arguments.parent_dom_element,\n\t\t\t\twidget_type.properties.widget.properties.widget.ref,\n\t\t\t\twidget_type.properties.widget.properties.configuration,\n\t\t\t\tcurrent_context,\n\t\t\t\tdestructor,\n\t\t\t\timplementation_arguments.view_root_dom_element,\n\t\t\t\timplementation_arguments.client_view,\n\t\t\t\timplementation_arguments.model_binding,\n\t\t\t\timplementation_arguments.entry_keys\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"view\": {\n\t\t\tconst view_type = expression.properties.type.state.node;\n\t\t\tvisit_widget_expression(\n\t\t\t\tview_type.properties.view.ref.properties.instance,\n\t\t\t\tcurrent_context,\n\t\t\t\tdestructor,\n\t\t\t\timplementation_arguments,\n\t\t\t\twrap_in_dynamic_area\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"reference\": {\n\t\t\tconst reference_type = expression.properties.type.state.node;\n\t\t\tconst node = current_context as unknown as api_client_state.Cnode;\n\t\t\tconst text = registerText(reference_type.properties.text.ref.inferences.text(), node, destructor);\n\t\t\tconst reference = text.properties.navigable.cast(\"yes\");\n\t\t\tbindToNodeStream(\n\t\t\t\tiReference(reference).referencedNode,\n\t\t\t\treference_type.properties.next,\n\t\t\t\tdestructor,\n\t\t\t\timplementation_arguments\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"reference rule\": {\n\t\t\tconst reference_rule_type = expression.properties.type.state.node;\n\t\t\tconst node = current_context as unknown as api_client_state.Cnode;\n\t\t\tconst text = registerText(reference_rule_type.properties.text.ref.inferences.text(), node, destructor);\n\t\t\tconst rule_type = reference_rule_type.properties.rule.ref.key.ref;\n\t\t\tconst rule = text.properties.navigable.cast(\"yes\").properties.rules.properties.rules.get(rule_type.key)!;\n\t\t\tbindToNodeStream(Rule.node(rule), reference_rule_type.properties.next, destructor, implementation_arguments);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"state context rule\": {\n\t\t\tconst state_context_rule_type = expression.properties.type.state.node;\n\t\t\tconst rule_type = state_context_rule_type.properties.rule.ref.key.ref;\n\t\t\tconst node = current_context as unknown as api_client_state.Cnode;\n\t\t\tconst state = node.input.position().cast(\"state\");\n\t\t\tconst rule = state.properties.rules.properties.rules.get(rule_type.key)!;\n\t\t\tbindToNodeStream(Rule.node(rule), state_context_rule_type.properties.next, destructor, implementation_arguments);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(expression.properties.type.state);\n\t}\n}\n\nfunction bindToState(\n\tstate: api_client_state.Cstates__state_group__type__property,\n\texpression: api_views.Cwidget_expression,\n\tdestructor: DestructorTree,\n\timplementation_arguments: ImplementationArguments\n) {\n\tdestructor.subscribeToStategroup(state.properties.is_selected, (state_destructor) => {\n\t\tswitch (state.properties.is_selected.state.name) {\n\t\t\tcase \"no\":\n\t\t\t\tbreak;\n\t\t\tcase \"yes\": {\n\t\t\t\tvisit_widget_expression(expression, state.properties.node, state_destructor, implementation_arguments, true);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(state.properties.is_selected.state);\n\t\t}\n\t});\n}\n\nfunction bindToNodeStream(\n\tstream: Scalar>,\n\texpression: api_views.Cwidget_expression,\n\tdestructor: DestructorTree,\n\timplementation_arguments: ImplementationArguments\n) {\n\tlet sub_destructor: DestructorTree | undefined;\n\tonScalarValue(\n\t\tstream,\n\t\t(node) => {\n\t\t\tsub_destructor?.destroy();\n\t\t\tif (isResolved(node)) {\n\t\t\t\tsub_destructor = destructor.addChild();\n\t\t\t\tregisterNodeContext(node, sub_destructor);\n\t\t\t\tvisit_widget_expression(expression, node, sub_destructor, implementation_arguments, true);\n\t\t\t}\n\t\t},\n\t\t(scalar, subscription) => destructor.onDestroy(() => scalar.unsubscribe(subscription))\n\t);\n}\n\ntype ImplementationArguments = {\n\tparent_dom_element: () => HTMLElement;\n\tview_root_dom_element: () => HTMLElement;\n\tclient_view: api_client_state.Copen_views;\n\tmodel_binding: api_views.Cmodel_binding | undefined;\n\tentry_keys: string[];\n};\n","import { api_configuration } from \"../../common\";\nimport DestructorTree from \"../DestructorTree\";\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport client_state_api = api_configuration.types.client_state.alan_api;\nimport api_widget = api_configuration.libraries.gui_definition_lib.types.widget.alan_api;\nimport client_state_binder = require(\"./client_state_binder\");\nimport ImplementationVisitorContext from \"./ImplementationVisitorContext\";\nimport { isDefined, ensure } from \"../validation\";\nimport { wrapNode } from \"./wrapNode\";\nimport * as modifications from \"../state/modifications\";\nimport { registerModelBindingPropertyPath } from \"../state/registerClientState\";\nimport { initializeQueryWithModelBinding } from \"./bindQuery\";\nimport { visitExpression, visitOptionalContextDefinition } from \"./visit_widget_implementation_expression\";\nimport { visit_control_binding } from \"./visit_control_binding\";\n\nexport function visit_widget_implementation(\n\tparent_dom_element: () => HTMLElement,\n\twidget: api_widget.Cwidget,\n\twidget_configuration: api_views.Cgui_widget_configuration_node,\n\tclient_state_context: client_state_api.AlanObject,\n\tdestructor: DestructorTree,\n\tview_root_dom_element: () => HTMLElement,\n\tclient_view: client_state_api.Copen_views,\n\tmodel_binding: api_views.Cmodel_binding | undefined,\n\tentry_keys: string[]\n): void {\n\tif (global.alan_debug) {\n\t\tparent_dom_element = pathDomElementWithContext(parent_dom_element, client_state_context);\n\t}\n\n\tparent_dom_element = patchDomElementWithWidgetName(parent_dom_element, widget.key!);\n\twalkConfigurationNode(widget_configuration, client_state_context, destructor);\n\twalkWidget(widget.properties.widget, destructor, {\n\t\tnode: client_view.properties.view_context.output.result_node(),\n\t\tgui_config: widget_configuration,\n\t\tentry_keys: entry_keys,\n\t});\n\tlet implementation_context = widget.properties.binding_context\n\t\t.switch({\n\t\t\tnone: function () {\n\t\t\t\treturn ImplementationVisitorContext.create(\n\t\t\t\t\tclient_state_context,\n\t\t\t\t\twidget_configuration,\n\t\t\t\t\tmodel_binding,\n\t\t\t\t\tnull,\n\t\t\t\t\tview_root_dom_element,\n\t\t\t\t\tclient_view,\n\t\t\t\t\tentry_keys\n\t\t\t\t);\n\t\t\t},\n\t\t\tselect: function ($) {\n\t\t\t\tconst intermediate_visitor_context = ImplementationVisitorContext.create(\n\t\t\t\t\tclient_state_context,\n\t\t\t\t\twidget_configuration,\n\t\t\t\t\tmodel_binding,\n\t\t\t\t\t(client_state_binder.binding as any)[$.properties.binding.ref.key],\n\t\t\t\t\tview_root_dom_element,\n\t\t\t\t\tclient_view,\n\t\t\t\t\tentry_keys\n\t\t\t\t);\n\t\t\t\treturn $.properties.switch_client_binding_context.switch({\n\t\t\t\t\tyes: function ($) {\n\t\t\t\t\t\tconst binding_name = $.properties.constrained_on_containing_binding.state.node.output.client_binding().key;\n\t\t\t\t\t\treturn isDefined(intermediate_visitor_context.client_state_binder_AsPropertiesBinding.bindings)[\n\t\t\t\t\t\t\tbinding_name\n\t\t\t\t\t\t](intermediate_visitor_context, destructor);\n\t\t\t\t\t},\n\t\t\t\t\tno: intermediate_visitor_context,\n\t\t\t\t});\n\t\t\t},\n\t\t})\n\t\t.push_widget_implementation_frame();\n\n\timplementation_context = visitOptionalContextDefinition(\n\t\twidget.properties.optional_context_definition,\n\t\timplementation_context,\n\t\tdestructor\n\t);\n\n\tvisitExpression(widget.properties.expression).subscribe(\n\t\timplementation_context,\n\t\t{\n\t\t\tadd: (control_binding: api_widget.Ccontrol_binding, sub_implementation_context, sub_destructor, wrap) => {\n\t\t\t\tconst wrapped_parent_dom_element = wrap ? wrapNode(parent_dom_element, sub_destructor) : parent_dom_element;\n\t\t\t\tvisit_control_binding(\n\t\t\t\t\tcontrol_binding,\n\t\t\t\t\twrapped_parent_dom_element,\n\t\t\t\t\tsub_implementation_context,\n\t\t\t\t\tsub_destructor,\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\tdestructor,\n\t\tundefined\n\t);\n}\n\nfunction walkConfigurationAttribute(\n\tattribute: api_views.Cgui_widget_configuration_attribute,\n\tclient_state_context: client_state_api.AlanObject,\n\tdestructor: DestructorTree\n) {\n\tswitch (attribute.properties.type.state.name) {\n\t\tcase \"configuration\": {\n\t\t\tconst configuration_attribute = attribute.properties.type.state.node;\n\t\t\tswitch (configuration_attribute.properties.type.state.name) {\n\t\t\t\tcase \"state group\": {\n\t\t\t\t\tconst state_group_node = configuration_attribute.properties.type.state.node;\n\t\t\t\t\twalkConfigurationNode(state_group_node.properties.configuration, client_state_context, destructor);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"list\":\n\t\t\t\t\twalk_gui_widget_configuration_list(\n\t\t\t\t\t\tconfiguration_attribute.properties.type.state.node.properties.list,\n\t\t\t\t\t\t(configuration) => {\n\t\t\t\t\t\t\twalkConfigurationNode(configuration, client_state_context, destructor);\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"number\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"text\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"states list\":\n\t\t\t\t\tfor (const $ of configuration_attribute.properties.type.state.node.properties.states.values()) {\n\t\t\t\t\t\twalkConfigurationNode($.properties.configuration, client_state_context, destructor);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(configuration_attribute.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"model binding\": {\n\t\t\tconst model_binding_attribute = attribute.properties.type.state.node;\n\t\t\tswitch (model_binding_attribute.properties.type.state.name) {\n\t\t\t\tcase \"entity\":\n\t\t\t\t\twalkConfigurationNode(\n\t\t\t\t\t\tmodel_binding_attribute.properties.type.state.node.properties.configuration,\n\t\t\t\t\t\tclient_state_context,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"current node\":\n\t\t\t\t\twalkConfigurationNode(\n\t\t\t\t\t\tmodel_binding_attribute.properties.type.state.node.properties.configuration,\n\t\t\t\t\t\tclient_state_context,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"collection\":\n\t\t\t\t\twalkConfigurationNode(\n\t\t\t\t\t\tmodel_binding_attribute.properties.type.state.node.properties.configuration,\n\t\t\t\t\t\tclient_state_context,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ordered graph\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"sort property\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"query\": {\n\t\t\t\t\tconst query_type = model_binding_attribute.properties.type.state.node;\n\t\t\t\t\tbindToQuery(client_state_context, query_type, destructor);\n\t\t\t\t\t// create optional subscription for query (that can be used in the client state binder)\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"group\":\n\t\t\t\t\twalkConfigurationNode(\n\t\t\t\t\t\tmodel_binding_attribute.properties.type.state.node.properties.configuration,\n\t\t\t\t\t\tclient_state_context,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"state group\":\n\t\t\t\t\twalkConfigurationNode(\n\t\t\t\t\t\tmodel_binding_attribute.properties.type.state.node.properties.configuration,\n\t\t\t\t\t\tclient_state_context,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"state\":\n\t\t\t\t\twalkConfigurationNode(\n\t\t\t\t\t\tmodel_binding_attribute.properties.type.state.node.properties.configuration,\n\t\t\t\t\t\tclient_state_context,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"state rule\":\n\t\t\t\t\twalkConfigurationNode(\n\t\t\t\t\t\tmodel_binding_attribute.properties.type.state.node.properties.configuration,\n\t\t\t\t\t\tclient_state_context,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"command\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"action\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"file\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"number\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"query file\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"query stategroup\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"query number\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"query text\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"text\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"window\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"report\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"report text parameter\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"report number parameter\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"joined entry\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"user\":\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(model_binding_attribute.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"view\":\n\t\t\tbreak;\n\t\tcase \"widget\":\n\t\t\tbreak;\n\t\tcase \"window\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tunexpectedState(attribute.properties.type.state);\n\t}\n}\n\nfunction walkConfigurationNode(\n\tconfig_node: api_views.Cgui_widget_configuration_node,\n\tclient_state_context: client_state_api.AlanObject,\n\tdestructor: DestructorTree\n) {\n\tfor (const attribute of config_node.properties.configuration.values()) {\n\t\twalkConfigurationAttribute(attribute.properties.attribute, client_state_context, destructor);\n\t}\n}\n\nfunction walkWidget(\n\tconfig: api_widget.Cwidget_configuration_node,\n\tdestructor: DestructorTree,\n\tcontext: {\n\t\tnode: client_state_api.Cnode;\n\t\tgui_config: api_views.Cgui_widget_configuration_node;\n\t\tentry_keys: string[];\n\t}\n) {\n\tfor (const attribute of config.properties.attributes.values()) {\n\t\tswitch (attribute.properties.type.state.name) {\n\t\t\tcase \"binding\": {\n\t\t\t\tconst $ = attribute.properties.type.state.node;\n\t\t\t\twalkWidget($.properties.node, destructor, context);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"configuration\": {\n\t\t\t\tconst $ = attribute.properties.type.state.node;\n\t\t\t\tswitch ($.properties.type.state.name) {\n\t\t\t\t\tcase \"list\": {\n\t\t\t\t\t\tconst list_property = $.properties.type.state.node;\n\t\t\t\t\t\twalkWidget(list_property.properties.node, destructor, context);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\tconst number_property = $.properties.type.state.node;\n\t\t\t\t\t\tmodifications.registerNumberDestructor(\n\t\t\t\t\t\t\tcontext.node,\n\t\t\t\t\t\t\tcontext.gui_config,\n\t\t\t\t\t\t\tnumber_property,\n\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\tcontext.entry_keys\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\tconst state_group_property = $.properties.type.state.node;\n\t\t\t\t\t\tmodifications.registerStateDestructor(\n\t\t\t\t\t\t\tcontext.node,\n\t\t\t\t\t\t\tcontext.gui_config,\n\t\t\t\t\t\t\tstate_group_property,\n\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\tcontext.entry_keys\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\tconst text_property = $.properties.type.state.node;\n\t\t\t\t\t\tmodifications.registerTextDestructor(\n\t\t\t\t\t\t\tcontext.node,\n\t\t\t\t\t\t\tcontext.gui_config,\n\t\t\t\t\t\t\ttext_property,\n\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\tcontext.entry_keys\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState($.properties.type.state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"view\": {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"widget\": {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"window\": {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunexpectedState(attribute.properties.type.state);\n\t\t}\n\t}\n}\n\nfunction walk_gui_widget_configuration_list(\n\twidget_list: api_views.Cgui_widget_configuration_list,\n\ton_item: (widget: api_views.Cgui_widget_configuration_node) => void\n) {\n\tswitch (widget_list.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst yes_has_steps = widget_list.properties.has_steps.state.node;\n\t\t\ton_item(yes_has_steps.properties.configuration);\n\t\t\twalk_gui_widget_configuration_list(yes_has_steps.properties.tail, on_item);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(widget_list.properties.has_steps.state);\n\t}\n}\n\nfunction bindToQuery(\n\tclient_state_context: client_state_api.AlanObject,\n\tquery_type: api_views.Cquery,\n\tdestructor: DestructorTree\n) {\n\tswitch (query_type.properties.query_context.state.name) {\n\t\tcase \"node\": {\n\t\t\tconst node_type = query_type.properties.query_context.state.node;\n\t\t\tconst context_node = ensure(client_state_context, client_state_api.Cnode);\n\t\t\tswitch (node_type.properties.switch_.state.name) {\n\t\t\t\tcase \"root\":\n\t\t\t\t\tinitializeQueryWithModelBinding(context_node, node_type, destructor);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"current node\": {\n\t\t\t\t\tconst current_node_switch = node_type.properties.switch_.state.node;\n\t\t\t\t\tconst expected_node_type = current_node_switch.properties.query.inferences\n\t\t\t\t\t\t.query()\n\t\t\t\t\t\t.properties.query_context.output.result_node()\n\t\t\t\t\t\t.input.application_node();\n\t\t\t\t\tconst actual_type = context_node.input.node_type();\n\t\t\t\t\tif (expected_node_type !== actual_type) return;\n\t\t\t\t\tconst new_node = registerModelBindingPropertyPath(\n\t\t\t\t\t\tnode_type.properties.switch_.state.node.properties.property_path,\n\t\t\t\t\t\tcontext_node,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tinitializeQueryWithModelBinding(new_node, node_type, destructor);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(node_type.properties.switch_.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"candidates\":\n\t\t\t// Candidate queries can not be added here because references nested\n\t\t\t// under matrix entries must be initialized seperatly.\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn unexpectedState(query_type.properties.query_context.state);\n\t}\n\treturn;\n}\n\nfunction pathDomElementWithContext(\n\tparent_dom_element_constructor: () => HTMLElement,\n\tclient_state_context: client_state_api.AlanObject\n): () => HTMLElement {\n\tlet created_element: HTMLElement;\n\treturn () => {\n\t\tif (created_element !== undefined) {\n\t\t\treturn created_element;\n\t\t}\n\t\tcreated_element = parent_dom_element_constructor();\n\n\t\t(created_element as any).alan_node = client_state_context;\n\t\tif (created_element.nodeName !== \"#comment\") {\n\t\t\tcreated_element.setAttribute(\"data-alan-context\", client_state_context.path);\n\t\t}\n\t\treturn created_element;\n\t};\n}\n\nfunction patchDomElementWithWidgetName(parent_dom_element: () => HTMLElement, key: string): () => HTMLElement {\n\tlet created_element: HTMLElement;\n\treturn () => {\n\t\tif (created_element === undefined) {\n\t\t\tcreated_element = parent_dom_element();\n\t\t\tif (created_element.nodeName !== \"#comment\") {\n\t\t\t\tcreated_element.setAttribute(\"data-widget\", key);\n\t\t\t}\n\t\t}\n\t\treturn created_element;\n\t};\n}\n","import { getState, getWidgetState } from \"../state/modifications\";\nimport { api_configuration } from \"../../common\";\nimport DestructorTree from \"../DestructorTree\";\nimport { ensure } from \"../validation\";\nimport escapeIdentifier from \"./escapeIdentifier\";\nimport { instruction_selection } from \"./execute_instruction\";\nimport { EventValue, ExpressionHandler, ExpressionValue, SortedKeys, TargetCallback } from \"./ExpressionTypes\";\nimport ImplementationVisitorContext, { WidgetConfigurationNode } from \"./ImplementationVisitorContext\";\nimport { visitScalar } from \"./visit_scalar\";\nimport api_modification = api_configuration.types.modifications.alan_api;\nimport api_views = api_configuration.libraries.gui_definition_lib.types.views.alan_api;\nimport api_widget = api_configuration.libraries.gui_definition_lib.types.widget.alan_api;\nimport api_client_state = api_configuration.types.client_state.alan_api;\nimport context_selection = require(\"./context_selection\");\nimport sort = require(\"../state/sorting\");\nimport * as microtaskQueue from \"../microtaskQueue\";\nimport { iGraph } from \"../state/Graph\";\n\nconst expressionCache = new Map();\nexport function visitExpression(expression: api_widget.Cexpression): ExpressionHandler {\n\tlet cached_expression = expressionCache.get(expression);\n\tif (cached_expression === undefined) {\n\t\tcached_expression = internalVisitExpression(expression);\n\t\texpressionCache.set(expression, cached_expression);\n\t}\n\treturn cached_expression;\n}\n\nfunction internalVisitExpression(expression: api_widget.Cexpression): ExpressionHandler {\n\tswitch (expression.properties.type.state.name) {\n\t\tcase \"control\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\treturn {\n\t\t\t\texecute: async () => $.properties.control_binding,\n\t\t\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\t\t\tcallback.add($.properties.control_binding, implementation_context, destructor, false);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase \"create entry\": {\n\t\t\tconst $ = expression.properties.type.state.node;\n\t\t\tswitch ($.properties.for_.state.name) {\n\t\t\t\tcase \"control node\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\texecute: async () => $.properties.node,\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\t\t\t\t\tcallback.add($.properties.node, implementation_context, destructor, false);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase \"state\": {\n\t\t\t\t\tconst select_state = $.properties.for_.state.node;\n\t\t\t\t\treturn {\n\t\t\t\t\t\texecute: async () => select_state,\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\t\t\t\t\tcallback.add(select_state, implementation_context, destructor, false);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState($.properties.for_.state);\n\t\t\t}\n\t\t}\n\t\tcase \"instruction\": {\n\t\t\tconst instruction = expression.properties.type.state.node;\n\t\t\treturn {\n\t\t\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\t\t\tawait instruction_selection(\n\t\t\t\t\t\tinstruction.properties.instruction,\n\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tevent_value\n\t\t\t\t\t);\n\t\t\t\t\treturn undefined;\n\t\t\t\t},\n\t\t\t\tsubscribe: () => {\n\t\t\t\t\t//no need to execute instructions.\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase \"match\": {\n\t\t\tconst match_type = expression.properties.type.state.node;\n\t\t\tconst true_expression = visitOneOrMoreExpression(match_type.properties.cases.properties.true_);\n\t\t\tconst false_expression = visitOneOrMoreExpression(match_type.properties.cases.properties.false_);\n\t\t\tswitch (match_type.properties.type.state.name) {\n\t\t\t\tcase \"number\": {\n\t\t\t\t\tconst number_match = match_type.properties.type.state.node;\n\t\t\t\t\tconst left_expression = visitScalar(number_match.properties.left_expression);\n\t\t\t\t\tconst right_expression = visitScalar(number_match.properties.right_expression);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\t\t\t\t\tconst left_value = await left_expression.execute(implementation_context, destructor, event_value);\n\t\t\t\t\t\t\tconst right_value = await right_expression.execute(implementation_context, destructor, event_value);\n\t\t\t\t\t\t\tconst values_equal = left_value !== undefined && left_value === right_value;\n\t\t\t\t\t\t\tif (values_equal) {\n\t\t\t\t\t\t\t\treturn await true_expression.execute(implementation_context, destructor, event_value);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn await false_expression.execute(implementation_context, destructor, event_value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor, event_value) => {\n\t\t\t\t\t\t\tlet left_value: number | undefined = undefined;\n\t\t\t\t\t\t\tlet right_value: number | undefined = undefined;\n\t\t\t\t\t\t\tlet previous_result: boolean | undefined = undefined;\n\t\t\t\t\t\t\tlet match_destructor: DestructorTree | undefined = undefined;\n\n\t\t\t\t\t\t\tconst evaluate = () => {\n\t\t\t\t\t\t\t\tconst values_equal = left_value !== undefined && left_value === right_value;\n\t\t\t\t\t\t\t\tif (previous_result === values_equal) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tprevious_result = values_equal;\n\t\t\t\t\t\t\t\tmatch_destructor?.destroy();\n\t\t\t\t\t\t\t\tmatch_destructor = destructor.addChild();\n\t\t\t\t\t\t\t\tif (values_equal) {\n\t\t\t\t\t\t\t\t\ttrue_expression.subscribe(\n\t\t\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\t\t\twrapWithDynamicArea(callback),\n\t\t\t\t\t\t\t\t\t\tmatch_destructor,\n\t\t\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tfalse_expression.subscribe(\n\t\t\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\t\t\twrapWithDynamicArea(callback),\n\t\t\t\t\t\t\t\t\t\tmatch_destructor,\n\t\t\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\tleft_expression.subscribe(\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tadd: async (value: number) => {\n\t\t\t\t\t\t\t\t\t\tleft_value = value;\n\t\t\t\t\t\t\t\t\t\tevaluate();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tright_expression.subscribe(\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tadd: async (value: number) => {\n\t\t\t\t\t\t\t\t\t\tright_value = value;\n\t\t\t\t\t\t\t\t\t\tevaluate();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase \"text\": {\n\t\t\t\t\tconst text_match = match_type.properties.type.state.node;\n\t\t\t\t\tconst left_expression = visitScalar(text_match.properties.left_expression);\n\t\t\t\t\tconst right_expression = visitScalar(text_match.properties.right_expression);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\t\t\t\t\tconst left_value = await left_expression.execute(implementation_context, destructor, event_value);\n\t\t\t\t\t\t\tconst right_value = await right_expression.execute(implementation_context, destructor, event_value);\n\t\t\t\t\t\t\tconst values_equal = left_value !== undefined && left_value === right_value;\n\t\t\t\t\t\t\tif (values_equal) {\n\t\t\t\t\t\t\t\treturn await true_expression.execute(implementation_context, destructor, event_value);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn await false_expression.execute(implementation_context, destructor, event_value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor, event_value) => {\n\t\t\t\t\t\t\tlet left_value: string | undefined = undefined;\n\t\t\t\t\t\t\tlet right_value: string | undefined = undefined;\n\t\t\t\t\t\t\tlet previous_result: boolean | undefined = undefined;\n\t\t\t\t\t\t\tlet match_destructor: DestructorTree | undefined = undefined;\n\n\t\t\t\t\t\t\tconst evaluate = () => {\n\t\t\t\t\t\t\t\tconst values_equal = left_value !== undefined && left_value === right_value;\n\t\t\t\t\t\t\t\tif (previous_result === values_equal) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tprevious_result = values_equal;\n\t\t\t\t\t\t\t\tmatch_destructor?.destroy();\n\t\t\t\t\t\t\t\tmatch_destructor = destructor.addChild();\n\t\t\t\t\t\t\t\tif (values_equal) {\n\t\t\t\t\t\t\t\t\ttrue_expression.subscribe(implementation_context, callback, match_destructor, event_value);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tfalse_expression.subscribe(implementation_context, callback, match_destructor, event_value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\tleft_expression.subscribe(\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tadd: async (value: string) => {\n\t\t\t\t\t\t\t\t\t\tleft_value = value;\n\t\t\t\t\t\t\t\t\t\tevaluate();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tright_expression.subscribe(\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tadd: async (value: string) => {\n\t\t\t\t\t\t\t\t\t\tright_value = value;\n\t\t\t\t\t\t\t\t\t\tevaluate();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(match_type.properties.type.state);\n\t\t\t}\n\t\t}\n\t\tcase \"node switch\": {\n\t\t\tconst node_switch = expression.properties.type.state.node;\n\t\t\tconst node_expression = visitOneOrMoreExpression(node_switch.properties.cases.properties.node);\n\t\t\tconst none_expression = visitOneOrMoreExpression(node_switch.properties.cases.properties.none);\n\t\t\tswitch (node_switch.properties.from.state.name) {\n\t\t\t\tcase \"collection\": {\n\t\t\t\t\tconst from_collection = node_switch.properties.from.state.node;\n\t\t\t\t\tconst escaped_collection_name = escapeIdentifier(from_collection.properties.collection.entry);\n\t\t\t\t\treturn {\n\t\t\t\t\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\t\t\t\t\tconst collection_context = context_selection.context_selection(\n\t\t\t\t\t\t\t\tnode_switch.properties.context,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst collection = collection_context.current_binding_context.properties[\n\t\t\t\t\t\t\t\tescaped_collection_name\n\t\t\t\t\t\t\t] as api_client_state.AlanDictionary;\n\n\t\t\t\t\t\t\tconst key = (await visitScalar(from_collection.properties.key).execute(\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t)) as string;\n\t\t\t\t\t\t\tconst collection_entry = collection.get(key);\n\n\t\t\t\t\t\t\tif (collection_entry !== undefined) {\n\t\t\t\t\t\t\t\tconst entry_context = createEntryContext(\n\t\t\t\t\t\t\t\t\tcollection_entry,\n\t\t\t\t\t\t\t\t\tcollection_context,\n\t\t\t\t\t\t\t\t\tfrom_collection.properties.collection.entry,\n\t\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst variable_context = visitVariableAssignment(\n\t\t\t\t\t\t\t\t\tnode_switch.properties.cases.properties.variable_assignment,\n\t\t\t\t\t\t\t\t\tentry_context,\n\t\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn await node_expression.execute(variable_context, destructor, event_value);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn await none_expression.execute(implementation_context, destructor, event_value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor, event_value) => {\n\t\t\t\t\t\t\tconst collection_context = context_selection.context_selection(\n\t\t\t\t\t\t\t\tnode_switch.properties.context,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst collection = collection_context.current_binding_context.properties[\n\t\t\t\t\t\t\t\tescaped_collection_name\n\t\t\t\t\t\t\t] as api_client_state.AlanDictionary;\n\t\t\t\t\t\t\tlet key: string | undefined = undefined;\n\t\t\t\t\t\t\tlet entry_destructor: DestructorTree | undefined = undefined;\n\t\t\t\t\t\t\tconst evaluate = () => {\n\t\t\t\t\t\t\t\tentry_destructor?.destroy();\n\t\t\t\t\t\t\t\tentry_destructor = destructor.addChild();\n\t\t\t\t\t\t\t\tconst collection_entry = key === undefined ? undefined : collection.get(key);\n\t\t\t\t\t\t\t\tif (collection_entry !== undefined) {\n\t\t\t\t\t\t\t\t\tconst entry_context = createEntryContext(\n\t\t\t\t\t\t\t\t\t\tcollection_entry,\n\t\t\t\t\t\t\t\t\t\tcollection_context,\n\t\t\t\t\t\t\t\t\t\tfrom_collection.properties.collection.entry,\n\t\t\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tconst variable_context = visitVariableAssignment(\n\t\t\t\t\t\t\t\t\t\tnode_switch.properties.cases.properties.variable_assignment,\n\t\t\t\t\t\t\t\t\t\tentry_context,\n\t\t\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tnode_expression.subscribe(\n\t\t\t\t\t\t\t\t\t\tvariable_context,\n\t\t\t\t\t\t\t\t\t\twrapWithDynamicArea(callback),\n\t\t\t\t\t\t\t\t\t\tentry_destructor,\n\t\t\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tnone_expression.subscribe(\n\t\t\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\t\t\twrapWithDynamicArea(callback),\n\t\t\t\t\t\t\t\t\t\tentry_destructor,\n\t\t\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tvisitScalar(from_collection.properties.key).subscribe(\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tadd: async (value: string) => {\n\t\t\t\t\t\t\t\t\t\tkey = value;\n\t\t\t\t\t\t\t\t\t\tevaluate();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tdestructor.subscribeToCollection(\n\t\t\t\t\t\t\t\tcollection,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ton_change: () => {\n\t\t\t\t\t\t\t\t\t\tevaluate();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase \"list\": {\n\t\t\t\t\tconst from_list = node_switch.properties.from.state.node;\n\t\t\t\t\treturn {\n\t\t\t\t\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\t\t\t\t\tconst result = await nodeSwitchListHandler(\n\t\t\t\t\t\t\t\tfrom_list,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tnode_expression,\n\t\t\t\t\t\t\t\tnone_expression,\n\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t).execute();\n\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor, generate_key, event_value) => {\n\t\t\t\t\t\t\tnodeSwitchListHandler(\n\t\t\t\t\t\t\t\tfrom_list,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tnode_expression,\n\t\t\t\t\t\t\t\tnone_expression,\n\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t).subscribe(callback, generate_key!);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(node_switch.properties.from.state);\n\t\t\t}\n\t\t}\n\t\tcase \"none\": {\n\t\t\treturn {\n\t\t\t\texecute: async () => undefined,\n\t\t\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\t\t\tcallback.add(undefined, implementation_context, destructor, false);\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase \"scalar\": {\n\t\t\tconst scalar = expression.properties.type.state.node;\n\t\t\treturn visitScalar(scalar.properties.value);\n\t\t}\n\t\tcase \"sort collection\": {\n\t\t\tconst sort_collection = expression.properties.type.state.node;\n\t\t\treturn {\n\t\t\t\texecute: async (implementation_context, destructor) => {\n\t\t\t\t\tconst sort_context = context_selection.context_selection(\n\t\t\t\t\t\tsort_collection.properties.context,\n\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tswitch (sort_context.model_binding.properties.type.state.name) {\n\t\t\t\t\t\tcase \"ordered graph\": {\n\t\t\t\t\t\t\tconst ordered_graph = ensure(sort_context.current_binding_context, api_client_state.Cordered_graphs);\n\t\t\t\t\t\t\tconst sorting = iGraph(ordered_graph).sort();\n\t\t\t\t\t\t\tswitch (sort_collection.properties.direction.state.name) {\n\t\t\t\t\t\t\t\tcase \"ascending\":\n\t\t\t\t\t\t\t\t\treturn sorting;\n\t\t\t\t\t\t\t\tcase \"descending\":\n\t\t\t\t\t\t\t\t\treturn sorting.reverse();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"sort property\":\n\t\t\t\t\t\t\tthrow new Error(\"Not yet supported\");\n\t\t\t\t\t\tcase \"query\":\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tsort_context.current_binding_context instanceof api_client_state.Ctext__type__columns ||\n\t\t\t\t\t\t\t\tsort_context.current_binding_context instanceof api_client_state.Cnumber__type__columns ||\n\t\t\t\t\t\t\t\tsort_context.current_binding_context instanceof api_client_state.Cstate_group__type__columns\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tconst query = sort_context.current_binding_context.parent.parent;\n\t\t\t\t\t\t\t\tswitch (query.properties.has_result.state.name) {\n\t\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\t\tthrow new Error(\"Not yet supported\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthrow new Error(\"Unexpected binding context for query sorting\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"query number\": {\n\t\t\t\t\t\t\tconst number_column = ensure(\n\t\t\t\t\t\t\t\tsort_context.current_binding_context,\n\t\t\t\t\t\t\t\tapi_client_state.Cnumber__type__columns\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst query = number_column.parent.parent;\n\t\t\t\t\t\t\tswitch (query.properties.has_result.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\tthrow new Error(\"Not yet supported\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"query text\": {\n\t\t\t\t\t\t\tconst text_column = ensure(sort_context.current_binding_context, api_client_state.Ctext__type__columns);\n\t\t\t\t\t\t\tconst query = text_column.parent.parent;\n\t\t\t\t\t\t\tswitch (query.properties.has_result.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\tthrow new Error(\"Not yet supported\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"query stategroup\": {\n\t\t\t\t\t\t\tconst stategroup_column = ensure(\n\t\t\t\t\t\t\t\tsort_context.current_binding_context,\n\t\t\t\t\t\t\t\tapi_client_state.Cstate_group__type__columns\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst query = stategroup_column.parent.parent;\n\t\t\t\t\t\t\tswitch (query.properties.has_result.state.name) {\n\t\t\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t\t\t\tthrow new Error(\"Not yet supported\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow new Error(\"Unexpected model binding context for sorting\");\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tsubscribe: (implementation_context, callback, destructor) => {\n\t\t\t\t\tconst sort_context = context_selection.context_selection(\n\t\t\t\t\t\tsort_collection.properties.context,\n\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tswitch (sort_context.model_binding.properties.type.state.name) {\n\t\t\t\t\t\tcase \"ordered graph\": {\n\t\t\t\t\t\t\tconst ordered_graph = ensure(sort_context.current_binding_context, api_client_state.Cordered_graphs);\n\t\t\t\t\t\t\tconst sorting = iGraph(ordered_graph).sorted;\n\t\t\t\t\t\t\tconst subscription = sorting.subscribe({\n\t\t\t\t\t\t\t\tupdate: (new_sorting) => {\n\t\t\t\t\t\t\t\t\tconst sort_copy = new_sorting.slice(0);\n\t\t\t\t\t\t\t\t\tswitch (sort_collection.properties.direction.state.name) {\n\t\t\t\t\t\t\t\t\t\tcase \"ascending\":\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase \"descending\":\n\t\t\t\t\t\t\t\t\t\t\tsort_copy.reverse();\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcallback.add(sort_copy, sort_context, destructor, false);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tdestructor.onDestroy(() => sorting.unsubscribe(subscription));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"sort property\": {\n\t\t\t\t\t\t\tconst collection = ensure(sort_context.current_binding_context, api_client_state.Ccollection);\n\t\t\t\t\t\t\tconst sort_property = sort_context.model_binding.properties.type.state.node;\n\t\t\t\t\t\t\tsort.subscribeToSortCriteriaForProperty(\n\t\t\t\t\t\t\t\tcollection,\n\t\t\t\t\t\t\t\tsort_property,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tsort_collection.properties.direction.state.name,\n\t\t\t\t\t\t\t\t(new_sorting) => {\n\t\t\t\t\t\t\t\t\tcallback.add(new_sorting, sort_context, destructor, false);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"query\": {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tsort_context.current_binding_context instanceof api_client_state.Ctext__type__columns ||\n\t\t\t\t\t\t\t\tsort_context.current_binding_context instanceof api_client_state.Cnumber__type__columns ||\n\t\t\t\t\t\t\t\tsort_context.current_binding_context instanceof api_client_state.Cstate_group__type__columns\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tsort.subscribToSortCriteriaForQueryProperty(\n\t\t\t\t\t\t\t\t\tsort_context.current_binding_context,\n\t\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\t\tsort_collection.properties.direction.state.name,\n\t\t\t\t\t\t\t\t\t(new_sorting) => {\n\t\t\t\t\t\t\t\t\t\tcallback.add(new_sorting, sort_context, destructor, false);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthrow new Error(\"Unexpected binding context for query sorting\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"query number\": {\n\t\t\t\t\t\t\tconst number_column = ensure(\n\t\t\t\t\t\t\t\tsort_context.current_binding_context,\n\t\t\t\t\t\t\t\tapi_client_state.Cnumber__type__columns\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsort.subscribToSortCriteriaForQueryProperty(\n\t\t\t\t\t\t\t\tnumber_column,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tsort_collection.properties.direction.state.name,\n\t\t\t\t\t\t\t\t(new_sorting) => {\n\t\t\t\t\t\t\t\t\tcallback.add(new_sorting, sort_context, destructor, false);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"query text\": {\n\t\t\t\t\t\t\tconst text_column = ensure(sort_context.current_binding_context, api_client_state.Ctext__type__columns);\n\t\t\t\t\t\t\tsort.subscribToSortCriteriaForQueryProperty(\n\t\t\t\t\t\t\t\ttext_column,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tsort_collection.properties.direction.state.name,\n\t\t\t\t\t\t\t\t(new_sorting) => {\n\t\t\t\t\t\t\t\t\tcallback.add(new_sorting, sort_context, destructor, false);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"query stategroup\": {\n\t\t\t\t\t\t\tconst stategroup_column = ensure(\n\t\t\t\t\t\t\t\tsort_context.current_binding_context,\n\t\t\t\t\t\t\t\tapi_client_state.Cstate_group__type__columns\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsort.subscribToSortCriteriaForQueryProperty(\n\t\t\t\t\t\t\t\tstategroup_column,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tsort_collection.properties.direction.state.name,\n\t\t\t\t\t\t\t\t(new_sorting) => {\n\t\t\t\t\t\t\t\t\tcallback.add(new_sorting, sort_context, destructor, false);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow new Error(\"Unexpected model binding context for sorting\");\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase \"switch\": {\n\t\t\tconst state_switch = expression.properties.type.state.node;\n\t\t\tswitch (state_switch.properties.type.state.name) {\n\t\t\t\tcase \"binding\": {\n\t\t\t\t\tconst binding_switch = state_switch.properties.type.state.node;\n\t\t\t\t\treturn bindingSwitchHandler(binding_switch);\n\t\t\t\t}\n\t\t\t\tcase \"configuration\": {\n\t\t\t\t\tconst configuration_switch = state_switch.properties.type.state.node;\n\t\t\t\t\treturn configurationSwitchHandler(configuration_switch);\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(state_switch.properties.type.state);\n\t\t\t}\n\t\t}\n\t\tcase \"walk\": {\n\t\t\tconst walk = expression.properties.type.state.node;\n\t\t\tswitch (walk.properties.type.state.name) {\n\t\t\t\tcase \"configuration\": {\n\t\t\t\t\tconst configuration_walk = walk.properties.type.state.node;\n\t\t\t\t\treturn {\n\t\t\t\t\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\t\t\t\t\tconst result = await walkConfigurationListHandler(\n\t\t\t\t\t\t\t\tconfiguration_walk,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t).execute();\n\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsubscribe: (implementation_context, callback, destructor, generate_key, event_value) => {\n\t\t\t\t\t\t\twalkConfigurationListHandler(\n\t\t\t\t\t\t\t\tconfiguration_walk,\n\t\t\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t\t).subscribe(callback, generate_key!);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase \"widget binding\": {\n\t\t\t\t\tconst binding_walk = walk.properties.type.state.node;\n\t\t\t\t\treturn walkCollectionBindingHandler(binding_walk);\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(walk.properties.type.state);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn unexpectedState(expression.properties.type.state);\n\t}\n}\n\nfunction visitExpressionList(expression: api_widget.Cexpression_list): ExpressionHandler {\n\tlet tail_expression: ExpressionHandler | undefined;\n\tswitch (expression.properties.has_next.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst $ = expression.properties.has_next.state.node;\n\t\t\ttail_expression = visitExpressionList($.properties.next);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(expression.properties.has_next.state);\n\t}\n\tconst expression_handler = visitExpression(expression.properties.expression);\n\treturn {\n\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\tlet result: ExpressionValue[] = [];\n\t\t\tconst variable_context = visitOptionalContextDefinition(\n\t\t\t\texpression.properties.optional_context_definition,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst expression_result = await expression_handler.execute(variable_context, destructor, event_value);\n\t\t\tresult = result.concat(expression_result);\n\t\t\tif (tail_expression !== undefined) {\n\t\t\t\tconst tail_result = await tail_expression.execute(implementation_context, destructor, event_value);\n\t\t\t\tresult = result.concat(tail_result);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t},\n\t\tsubscribe: (implementation_context, c, destructor, generate_key, e) => {\n\t\t\tconst entries: SortedKeys = [];\n\t\t\tentries[0] = [];\n\t\t\tconst variable_context = visitOptionalContextDefinition(\n\t\t\t\texpression.properties.optional_context_definition,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\texpression_handler.subscribe(\n\t\t\t\tvariable_context,\n\t\t\t\twrapWithKeyGenerator(c, 0, entries, generate_key!),\n\t\t\t\tdestructor,\n\t\t\t\tgenerate_key,\n\t\t\t\te\n\t\t\t);\n\t\t\tif (tail_expression !== undefined) {\n\t\t\t\tentries[1] = [];\n\t\t\t\ttail_expression?.subscribe(\n\t\t\t\t\timplementation_context,\n\t\t\t\t\twrapWithKeyGenerator(c, 1, entries, generate_key!),\n\t\t\t\t\tdestructor,\n\t\t\t\t\tgenerate_key,\n\t\t\t\t\te\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction wrapWithKeyGenerator(\n\tcallback: TargetCallback,\n\tindex: number,\n\tsorted_entries: SortedKeys,\n\tgenerate_key: () => string\n): TargetCallback {\n\tlet generated_key: string | undefined = undefined;\n\n\treturn {\n\t\tadd: (value, implementation_context, destructor, wrap, key) => {\n\t\t\tlet new_key = key || generated_key;\n\t\t\tif (new_key === undefined) {\n\t\t\t\tnew_key = generated_key = generate_key();\n\t\t\t\tsorted_entries[index] = generated_key;\n\t\t\t\tcallback.update?.(sorted_entries);\n\t\t\t}\n\t\t\tcallback.add(value, implementation_context, destructor, wrap, new_key);\n\t\t},\n\t\tupdate: (sorting) => {\n\t\t\tsorted_entries[index] = sorting;\n\t\t\tcallback.update?.(sorted_entries);\n\t\t},\n\t};\n}\n\nfunction wrapWithDynamicArea(callback: TargetCallback): TargetCallback {\n\treturn {\n\t\tadd: (value, i, d, _w, key) => {\n\t\t\tcallback.add(value, i, d, true, key);\n\t\t},\n\t\tupdate: callback.update,\n\t};\n}\n\nexport function visitOneOrMoreExpression(expression: api_widget.Cone_or_more_expression): ExpressionHandler {\n\tswitch (expression.properties.multiplicity.state.name) {\n\t\tcase \"plural\": {\n\t\t\tconst $ = expression.properties.multiplicity.state.node;\n\t\t\treturn visitExpressionList($.properties.expression);\n\t\t}\n\t\tcase \"singular\": {\n\t\t\tconst $ = expression.properties.multiplicity.state.node;\n\t\t\treturn visitExpression($.properties.expression);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(expression.properties.multiplicity.state);\n\t}\n}\n\nexport function visitOptionalContextDefinition(\n\tdefinition: api_widget.Coptional_context_definition,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n): ImplementationVisitorContext {\n\tswitch (definition.properties.define_context.state.name) {\n\t\tcase \"no\":\n\t\t\treturn implementation_context;\n\t\tcase \"yes\": {\n\t\t\tconst $ = definition.properties.define_context.state.node;\n\t\t\treturn visitVariable($.properties.variable, implementation_context, destructor);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(definition.properties.define_context.state);\n\t}\n}\n\nexport function visitVariableAssignment(\n\tvariable_assignment: api_widget.Cvariable_assignment,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n): ImplementationVisitorContext {\n\tswitch (variable_assignment.properties.assign.state.name) {\n\t\tcase \"no\": {\n\t\t\treturn implementation_context;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = variable_assignment.properties.assign.state.node;\n\t\t\tconst variable_context = visitVariable($.properties.variable, implementation_context, destructor);\n\t\t\treturn variable_context.changeState({\n\t\t\t\tnew_explicit_context: variable_context,\n\t\t\t});\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(variable_assignment.properties.assign.state);\n\t}\n}\n\nexport function visitVariable(\n\tvariable: api_widget.Cvariable,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n): ImplementationVisitorContext {\n\tconst selected_context = context_selection.context_selection(\n\t\tvariable.properties.context,\n\t\timplementation_context,\n\t\tdestructor\n\t);\n\tconst variable_context = selected_context.push_widget_implementation_frame();\n\tswitch (variable.properties.more_variables.state.name) {\n\t\tcase \"no\": {\n\t\t\treturn variable_context;\n\t\t}\n\t\tcase \"yes\": {\n\t\t\tconst $ = variable.properties.more_variables.state.node;\n\t\t\treturn visitVariable($.properties.variable, variable_context, destructor);\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(variable.properties.more_variables.state);\n\t}\n}\n\nfunction walkConfigurationListHandler(\n\twalk_configuration_list: api_widget.Cconfiguration__type__walk,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree,\n\tevent_value?: EventValue\n) {\n\tconst walk_implementation_context = context_selection.context_selection(\n\t\twalk_configuration_list.parent.properties.context,\n\t\timplementation_context,\n\t\tdestructor\n\t);\n\n\tconst gui_configuration = walk_implementation_context.gui_widget_configuration.properties.configuration\n\t\t.get(walk_configuration_list.properties.list.entry)!\n\t\t.properties.attribute.properties.type.cast(\"configuration\");\n\n\tconst widgets: api_views.Cgui_widget_configuration_node[] = [];\n\n\tswitch (gui_configuration.properties.type.state.name) {\n\t\tcase \"list\": {\n\t\t\tconst bound_list = gui_configuration.properties.type.state.node;\n\t\t\tlet widget_list = bound_list.properties.list;\n\t\t\twhile (widget_list.properties.has_steps.state.name === \"yes\") {\n\t\t\t\tconst $ = widget_list.properties.has_steps.state.node;\n\t\t\t\twidgets.push($.properties.configuration);\n\t\t\t\twidget_list = $.properties.tail;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"states list\": {\n\t\t\tconst states_list = gui_configuration.properties.type.state.node;\n\t\t\tconst walkStates = (state: api_views.Cstates__states_list) => {\n\t\t\t\twidgets.push(state.properties.configuration);\n\t\t\t\tswitch (state.properties.has_successor.state.name) {\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\tconst $ = state.properties.has_successor.state.node;\n\t\t\t\t\t\twalkStates($.properties.successor.ref);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunexpectedState(state.properties.has_successor.state);\n\t\t\t\t}\n\t\t\t};\n\t\t\tswitch (states_list.properties.has_states.state.name) {\n\t\t\t\tcase \"no\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"yes\": {\n\t\t\t\t\tconst $ = states_list.properties.has_states.state.node;\n\t\t\t\t\twalkStates($.properties.first.ref);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn unexpectedState(states_list.properties.has_states.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"number\":\n\t\t\tthrow new Error(\"number can not be bound to a configuration list entry\");\n\t\tcase \"state group\":\n\t\t\tthrow new Error(\"state group can not be bound to a configuration list entry\");\n\t\tcase \"text\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn unexpectedState(gui_configuration.properties.type.state);\n\t}\n\tconst entry_expression = visitOneOrMoreExpression(walk_configuration_list.parent.properties.entry_expression);\n\treturn {\n\t\texecute: async () => {\n\t\t\tlet results: ExpressionValue[] = [];\n\t\t\tfor (const widget_entry of widgets) {\n\t\t\t\tconst variable_context = visitVariable(\n\t\t\t\t\twalk_configuration_list.parent.properties.variable,\n\t\t\t\t\twalk_implementation_context.switchGuiWidgetConfiguration(widget_entry),\n\t\t\t\t\tdestructor\n\t\t\t\t);\n\t\t\t\tconst result = await entry_expression.execute(variable_context, destructor, event_value);\n\t\t\t\tresults = results.concat(result);\n\t\t\t}\n\t\t\treturn results;\n\t\t},\n\t\tsubscribe: (callback: TargetCallback, generate_key: () => string) => {\n\t\t\tlet index = 0;\n\t\t\tconst entries: SortedKeys = [];\n\t\t\tfor (const widget_entry of widgets) {\n\t\t\t\tentries[index] = [];\n\t\t\t\tconst variable_context = visitVariable(\n\t\t\t\t\twalk_configuration_list.parent.properties.variable,\n\t\t\t\t\twalk_implementation_context.switchGuiWidgetConfiguration(widget_entry),\n\t\t\t\t\tdestructor\n\t\t\t\t);\n\t\t\t\tentry_expression.subscribe(\n\t\t\t\t\tvariable_context,\n\t\t\t\t\twrapWithKeyGenerator(callback, index, entries, generate_key!),\n\t\t\t\t\tdestructor,\n\t\t\t\t\tgenerate_key,\n\t\t\t\t\tevent_value\n\t\t\t\t);\n\t\t\t\tindex = index + 1;\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction nodeSwitchListHandler(\n\tfrom_list: api_widget.Clist__from,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree,\n\tnode_expression: ExpressionHandler,\n\tnone_expression: ExpressionHandler,\n\tevent_value?: EventValue\n) {\n\tconst list_context = context_selection.context_selection(\n\t\tfrom_list.parent.properties.context,\n\t\timplementation_context,\n\t\tdestructor\n\t);\n\tconst list = list_context.gui_widget_configuration.properties.configuration\n\t\t.get(from_list.properties.list.entry)!\n\t\t.properties.attribute.properties.type.cast(\"configuration\")\n\t\t.properties.type.cast(\"list\");\n\n\treturn {\n\t\texecute: async () => {\n\t\t\tconst list_index = (await visitScalar(from_list.properties.index).execute(\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor,\n\t\t\t\tevent_value\n\t\t\t)) as number | undefined;\n\n\t\t\tconst list_entry = list_index === undefined ? undefined : getNodeAtIndex(list.properties.list, list_index);\n\n\t\t\tif (list_entry !== undefined) {\n\t\t\t\tconst variable_context = visitVariableAssignment(\n\t\t\t\t\tfrom_list.parent.properties.cases.properties.variable_assignment,\n\t\t\t\t\tlist_context.switchGuiWidgetConfiguration(list_entry),\n\t\t\t\t\tdestructor\n\t\t\t\t);\n\t\t\t\treturn await node_expression.execute(variable_context, destructor, event_value);\n\t\t\t} else {\n\t\t\t\treturn await none_expression.execute(implementation_context, destructor, event_value);\n\t\t\t}\n\t\t},\n\t\tsubscribe: (callback: TargetCallback, generate_key: () => string) => {\n\t\t\tlet list_index: number | undefined;\n\t\t\tlet list_destructor: DestructorTree | undefined;\n\n\t\t\tconst evaluate = () => {\n\t\t\t\tlist_destructor?.destroy();\n\t\t\t\tlist_destructor = destructor.addChild();\n\t\t\t\tconst list_entry = list_index === undefined ? undefined : getNodeAtIndex(list.properties.list, list_index);\n\n\t\t\t\tif (list_entry !== undefined) {\n\t\t\t\t\tconst variable_context = visitVariableAssignment(\n\t\t\t\t\t\tfrom_list.parent.properties.cases.properties.variable_assignment,\n\t\t\t\t\t\tlist_context.switchGuiWidgetConfiguration(list_entry),\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tnode_expression.subscribe(\n\t\t\t\t\t\tvariable_context,\n\t\t\t\t\t\twrapWithDynamicArea(callback),\n\t\t\t\t\t\tlist_destructor,\n\t\t\t\t\t\tgenerate_key,\n\t\t\t\t\t\tevent_value\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tnone_expression.subscribe(\n\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\twrapWithDynamicArea(callback),\n\t\t\t\t\t\tlist_destructor,\n\t\t\t\t\t\tgenerate_key,\n\t\t\t\t\t\tevent_value\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t};\n\t\t\tvisitScalar(from_list.properties.index).subscribe(\n\t\t\t\timplementation_context,\n\t\t\t\t{\n\t\t\t\t\tadd: async (value: number) => {\n\t\t\t\t\t\tif (list_index === undefined) {\n\t\t\t\t\t\t\tlist_index = value;\n\t\t\t\t\t\t\tevaluate();\n\t\t\t\t\t\t} else if (list_index !== value) {\n\t\t\t\t\t\t\tlist_index = value;\n\t\t\t\t\t\t\tevaluate();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdestructor,\n\t\t\t\tgenerate_key,\n\t\t\t\tevent_value\n\t\t\t);\n\t\t},\n\t};\n}\n\nfunction configurationSwitchHandler(configuration_switch: api_widget.Cconfiguration__type__switch): ExpressionHandler {\n\tconst state_group_property = configuration_switch.properties.state_group.entry;\n\tconst state_expressions: Record = {};\n\tfor (const state of configuration_switch.properties.states.values()) {\n\t\tstate_expressions[state.key.entry] = visitOneOrMoreExpression(state.properties.next);\n\t}\n\treturn {\n\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\tconst switch_implementation_context = context_selection.context_selection(\n\t\t\t\tconfiguration_switch.parent.properties.context,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\n\t\t\tconst context_node = switch_implementation_context.view_context_node;\n\t\t\tconst widget_configuration = switch_implementation_context.widget_configuration;\n\n\t\t\tconst updateConfigurationState = async (state: string, configuration: WidgetConfigurationNode) => {\n\t\t\t\tconst new_implementation_context = switch_implementation_context.changeState({\n\t\t\t\t\tnew_widget_configuration: configuration,\n\t\t\t\t});\n\t\t\t\tconst variable_context = visitVariableAssignment(\n\t\t\t\t\tconfiguration_switch.properties.states.get(state)!.properties.variable_assignment,\n\t\t\t\t\tnew_implementation_context,\n\t\t\t\t\tdestructor\n\t\t\t\t);\n\t\t\t\tconst expression = state_expressions[state];\n\t\t\t\treturn await expression.execute!(variable_context, destructor, event_value);\n\t\t\t};\n\n\t\t\tif (widget_configuration instanceof api_views.Cgui_widget_configuration_node) {\n\t\t\t\tconst binding_context = widget_configuration.properties.configuration\n\t\t\t\t\t.get(state_group_property)\n\t\t\t\t\t?.properties.attribute.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"state group\");\n\t\t\t\tif (binding_context === undefined) {\n\t\t\t\t\tconst widget_default_state =\n\t\t\t\t\t\tconfiguration_switch.properties.state_group.ref.properties.has_default.cast(\"yes\");\n\n\t\t\t\t\tconst state_value = getWidgetState(\n\t\t\t\t\t\tcontext_node,\n\t\t\t\t\t\twidget_configuration,\n\t\t\t\t\t\twidget_default_state.parent,\n\t\t\t\t\t\tswitch_implementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t\tif (state_value.value === undefined) {\n\t\t\t\t\t\treturn await updateConfigurationState(\n\t\t\t\t\t\t\twidget_default_state.properties.state.entry,\n\t\t\t\t\t\t\twidget_default_state.properties.state.ref.properties.node\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn await updateConfigurationState(\n\t\t\t\t\t\t\tstate_value.value.properties.selected_state.entry,\n\t\t\t\t\t\t\tstate_value.value.properties.configuration\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst state_value = getState(context_node, binding_context, switch_implementation_context.entry_keys);\n\t\t\t\t\tif (state_value.value !== undefined) {\n\t\t\t\t\t\treturn await updateConfigurationState(\n\t\t\t\t\t\t\tstate_value.value.properties.selected_state.entry,\n\t\t\t\t\t\t\tstate_value.value.properties.configuration\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn await updateConfigurationState(\n\t\t\t\t\t\t\tbinding_context.properties.state.entry,\n\t\t\t\t\t\t\tbinding_context.properties.configuration\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (widget_configuration instanceof api_modification.Cconfiguration_node) {\n\t\t\t\tconst selected_state = widget_configuration.properties.attributes\n\t\t\t\t\t.get(state_group_property)!\n\t\t\t\t\t.properties.type.cast(\"state group\");\n\n\t\t\t\tconst binding_context = selected_state;\n\t\t\t\treturn await updateConfigurationState(\n\t\t\t\t\tbinding_context.properties.selected_state.entry,\n\t\t\t\t\tbinding_context.properties.node\n\t\t\t\t);\n\t\t\t} else if (widget_configuration instanceof api_widget.Cwidget_configuration_node) {\n\t\t\t\tconst widget_default_state = configuration_switch.properties.state_group.ref.properties.has_default.cast(\"yes\");\n\t\t\t\tconst state_value = getWidgetState(\n\t\t\t\t\tcontext_node,\n\t\t\t\t\tswitch_implementation_context.last_gui_widget_configuration,\n\t\t\t\t\twidget_default_state.parent,\n\t\t\t\t\tswitch_implementation_context.entry_keys\n\t\t\t\t);\n\t\t\t\tif (state_value.value === undefined) {\n\t\t\t\t\treturn await updateConfigurationState(\n\t\t\t\t\t\twidget_default_state.properties.state.entry,\n\t\t\t\t\t\twidget_default_state.properties.state.ref.properties.node\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn await updateConfigurationState(\n\t\t\t\t\t\tstate_value.value.properties.selected_state.entry,\n\t\t\t\t\t\tstate_value.value.properties.configuration\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tunexpectedState(widget_configuration);\n\t\t\t}\n\t\t},\n\t\tsubscribe: (implementation_context, callback, destructor, generate_key, event_value) => {\n\t\t\tconst switch_implementation_context = context_selection.context_selection(\n\t\t\t\tconfiguration_switch.parent.properties.context,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst context_node = switch_implementation_context.view_context_node;\n\n\t\t\tlet stategroup_destructor: DestructorTree | undefined;\n\t\t\tconst widget_configuration = switch_implementation_context.widget_configuration;\n\n\t\t\tconst updateConfigurationState = (state: string, configuration: WidgetConfigurationNode) => {\n\t\t\t\tstategroup_destructor?.destroy();\n\t\t\t\tstategroup_destructor = destructor.addChild();\n\t\t\t\tconst new_implementation_context = switch_implementation_context.changeState({\n\t\t\t\t\tnew_widget_configuration: configuration,\n\t\t\t\t});\n\t\t\t\tconst variable_context = visitVariableAssignment(\n\t\t\t\t\tconfiguration_switch.properties.states.get(state)!.properties.variable_assignment,\n\t\t\t\t\tnew_implementation_context,\n\t\t\t\t\tdestructor\n\t\t\t\t);\n\n\t\t\t\tconst expression = state_expressions[state];\n\t\t\t\texpression.subscribe?.(\n\t\t\t\t\tvariable_context,\n\t\t\t\t\twrapWithDynamicArea(callback),\n\t\t\t\t\tstategroup_destructor,\n\t\t\t\t\tgenerate_key,\n\t\t\t\t\tevent_value\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tif (widget_configuration instanceof api_views.Cgui_widget_configuration_node) {\n\t\t\t\tconst binding_context = widget_configuration.properties.configuration\n\t\t\t\t\t.get(state_group_property)\n\t\t\t\t\t?.properties.attribute.properties.type.cast(\"configuration\")\n\t\t\t\t\t.properties.type.cast(\"state group\");\n\t\t\t\tif (binding_context === undefined) {\n\t\t\t\t\tconst widget_default_state =\n\t\t\t\t\t\tconfiguration_switch.properties.state_group.ref.properties.has_default.cast(\"yes\");\n\n\t\t\t\t\tconst state_value = getWidgetState(\n\t\t\t\t\t\tcontext_node,\n\t\t\t\t\t\twidget_configuration,\n\t\t\t\t\t\twidget_default_state.parent,\n\t\t\t\t\t\tswitch_implementation_context.entry_keys\n\t\t\t\t\t);\n\t\t\t\t\tif (state_value.value === undefined) {\n\t\t\t\t\t\tupdateConfigurationState(\n\t\t\t\t\t\t\twidget_default_state.properties.state.entry,\n\t\t\t\t\t\t\twidget_default_state.properties.state.ref.properties.node\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tupdateConfigurationState(\n\t\t\t\t\t\t\tstate_value.value.properties.selected_state.entry,\n\t\t\t\t\t\t\tstate_value.value.properties.configuration\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst subscription = state_value.subscribe((new_value) => {\n\t\t\t\t\t\tstategroup_destructor?.destroy();\n\t\t\t\t\t\tupdateConfigurationState(new_value.properties.selected_state.entry, new_value.properties.configuration);\n\t\t\t\t\t});\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst state_value = getState(context_node, binding_context, switch_implementation_context.entry_keys);\n\t\t\t\t\tif (state_value.value !== undefined) {\n\t\t\t\t\t\tupdateConfigurationState(\n\t\t\t\t\t\t\tstate_value.value.properties.selected_state.entry,\n\t\t\t\t\t\t\tstate_value.value.properties.configuration\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tupdateConfigurationState(binding_context.properties.state.entry, binding_context.properties.configuration);\n\t\t\t\t\t}\n\t\t\t\t\tconst subscription = state_value.subscribe((new_state) => {\n\t\t\t\t\t\tstategroup_destructor?.destroy();\n\t\t\t\t\t\tupdateConfigurationState(new_state.properties.selected_state.entry, new_state.properties.configuration);\n\t\t\t\t\t});\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (widget_configuration instanceof api_modification.Cconfiguration_node) {\n\t\t\t\tconst selected_state = widget_configuration.properties.attributes\n\t\t\t\t\t.get(state_group_property)!\n\t\t\t\t\t.properties.type.cast(\"state group\");\n\t\t\t\tconst binding_context = selected_state;\n\t\t\t\tconst selected_state_subscription = binding_context.subscribe_selected_state({\n\t\t\t\t\ton_update: (new_state) => {\n\t\t\t\t\t\tstategroup_destructor?.destroy();\n\t\t\t\t\t\tupdateConfigurationState(new_state, selected_state.properties.node);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\tselected_state_subscription.unsubscribe();\n\t\t\t\t});\n\t\t\t} else if (widget_configuration instanceof api_widget.Cwidget_configuration_node) {\n\t\t\t\tconst widget_default_state = configuration_switch.properties.state_group.ref.properties.has_default.cast(\"yes\");\n\t\t\t\tconst state_value = getWidgetState(\n\t\t\t\t\tcontext_node,\n\t\t\t\t\tswitch_implementation_context.last_gui_widget_configuration,\n\t\t\t\t\twidget_default_state.parent,\n\t\t\t\t\tswitch_implementation_context.entry_keys\n\t\t\t\t);\n\t\t\t\tif (state_value.value === undefined) {\n\t\t\t\t\tupdateConfigurationState(\n\t\t\t\t\t\twidget_default_state.properties.state.entry,\n\t\t\t\t\t\twidget_default_state.properties.state.ref.properties.node\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tupdateConfigurationState(\n\t\t\t\t\t\tstate_value.value.properties.selected_state.entry,\n\t\t\t\t\t\tstate_value.value.properties.configuration\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst subscription = state_value.subscribe((new_value) => {\n\t\t\t\t\tupdateConfigurationState(new_value.properties.selected_state.entry, new_value.properties.configuration);\n\t\t\t\t});\n\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tunexpectedState(widget_configuration);\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction walkCollectionBindingHandler(binding_walk: api_widget.Cwidget_binding): ExpressionHandler {\n\tconst collection_name = binding_walk.properties.collection_property.entry;\n\tconst escaped_collection_name = escapeIdentifier(collection_name);\n\tconst entry_expression = visitOneOrMoreExpression(binding_walk.parent.properties.entry_expression);\n\tlet sort_expression: ExpressionHandler | undefined = undefined;\n\tswitch (binding_walk.properties.sort.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst sort = binding_walk.properties.sort.state.node;\n\t\t\tsort_expression = visitExpression(sort.properties.by);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(binding_walk.properties.sort.state);\n\t}\n\treturn {\n\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\tconst collection_implementation_context = context_selection\n\t\t\t\t.context_selection(binding_walk.parent.properties.context, implementation_context, destructor)\n\t\t\t\t.switchClientStateBinderToProperty(collection_name, destructor);\n\t\t\tconst collection = collection_implementation_context.current_binding_context.properties[\n\t\t\t\tescaped_collection_name\n\t\t\t] as api_client_state.AlanDictionary;\n\t\t\tlet result: ExpressionValue[] = [];\n\t\t\tfor (const entry of collection.values()) {\n\t\t\t\tresult = result.concat(\n\t\t\t\t\tawait entry_expression.execute(\n\t\t\t\t\t\tvisitVariable(\n\t\t\t\t\t\t\tbinding_walk.parent.properties.variable,\n\t\t\t\t\t\t\tcreateEntryContext(entry, collection_implementation_context, collection_name, destructor),\n\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tevent_value\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn result;\n\t\t},\n\t\tsubscribe: (implementation_context, callback, destructor, generate_key, event_value) => {\n\t\t\tconst collection_implementation_context = context_selection\n\t\t\t\t.context_selection(binding_walk.parent.properties.context, implementation_context, destructor)\n\t\t\t\t.switchClientStateBinderToProperty(collection_name, destructor);\n\t\t\tconst collection = collection_implementation_context.current_binding_context.properties[\n\t\t\t\tescaped_collection_name\n\t\t\t] as api_client_state.AlanDictionary;\n\n\t\t\tconst sort_mapping: Record = {};\n\t\t\tconst local_callback: TargetCallback = {\n\t\t\t\tadd: callback.add,\n\t\t\t\tupdate: () => {\n\t\t\t\t\tcallback.update!(sorted_entries);\n\t\t\t\t},\n\t\t\t};\n\t\t\tlet sorted_entries: SortedKeys = [];\n\t\t\tlet sorted = false; //Indicates if the entries are sorted by a sort definition.\n\n\t\t\tconst added_entries = new Set<[api_client_state.AlanDictionaryEntry, DestructorTree]>();\n\t\t\tconst evaluateAddedEntries = () => {\n\t\t\t\tfor (const [entry, entry_destructor] of added_entries) {\n\t\t\t\t\tif (!entry_destructor.destroyed) {\n\t\t\t\t\t\tentry_expression.subscribe(\n\t\t\t\t\t\t\tvisitVariable(\n\t\t\t\t\t\t\t\tbinding_walk.parent.properties.variable,\n\t\t\t\t\t\t\t\tcreateEntryContext(entry, collection_implementation_context, collection_name, entry_destructor),\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twrapWithKeyGenerator(local_callback, 0, sort_mapping[entry.key_value], generate_key!),\n\t\t\t\t\t\t\tentry_destructor,\n\t\t\t\t\t\t\tgenerate_key,\n\t\t\t\t\t\t\tevent_value\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tadded_entries.clear();\n\t\t\t};\n\n\t\t\tdestructor.subscribeToCollection(\n\t\t\t\tcollection,\n\t\t\t\t{\n\t\t\t\t\ton_add: (entry, entry_destructor) => {\n\t\t\t\t\t\tsort_mapping[entry.key_value] = [];\n\t\t\t\t\t\tif (!sorted) {\n\t\t\t\t\t\t\tsorted_entries.push(sort_mapping[entry.key_value]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tadded_entries.add([entry, entry_destructor]);\n\t\t\t\t\t},\n\t\t\t\t\ton_change: () => {\n\t\t\t\t\t\tmicrotaskQueue.add(evaluateAddedEntries);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tconst applySorting = (sorting: string[]) => {\n\t\t\t\tsorted = true;\n\t\t\t\tsorted_entries = [];\n\t\t\t\tfor (const key of sorting) {\n\t\t\t\t\tconst entry_sorted_keys = sort_mapping[key];\n\t\t\t\t\tif (entry_sorted_keys !== undefined) {\n\t\t\t\t\t\tsorted_entries.push(entry_sorted_keys);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlocal_callback.update?.(sorted_entries);\n\t\t\t};\n\n\t\t\tconst sortOnTopology = () => {\n\t\t\t\tconst sorting = sortEntriesOnTopology(collection_implementation_context, collection, collection_name);\n\t\t\t\tif (sorting !== undefined) {\n\t\t\t\t\tapplySorting(sorting);\n\t\t\t\t} else {\n\t\t\t\t\tsortOnEntryOrder();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst sortOnDefaultSorter = (sort_destructor: DestructorTree) => {\n\t\t\t\tconst default_sorter = sort.subscribeToDefaultSorting(collection);\n\t\t\t\tif (default_sorter !== undefined) {\n\t\t\t\t\tdefault_sorter.subscribe(sort_destructor, applySorting);\n\t\t\t\t} else {\n\t\t\t\t\tsortOnTopology();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst sortOnEntryOrder = () => {\n\t\t\t\tsorted = false;\n\t\t\t\tsorted_entries = [];\n\t\t\t\tfor (const [key] of collection) {\n\t\t\t\t\tconst entry_sorted_keys = sort_mapping[key];\n\t\t\t\t\tif (entry_sorted_keys !== undefined) {\n\t\t\t\t\t\tsorted_entries.push(entry_sorted_keys);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlocal_callback.update?.(sorted_entries);\n\t\t\t};\n\n\t\t\tif (sort_expression !== undefined) {\n\t\t\t\tsort_expression.subscribe(\n\t\t\t\t\tcollection_implementation_context,\n\t\t\t\t\t{\n\t\t\t\t\t\tadd: async (sorted_keys: string[] | undefined, _i, sort_destructor) => {\n\t\t\t\t\t\t\tif (sorted_keys !== undefined) {\n\t\t\t\t\t\t\t\tapplySorting(sorted_keys);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsortOnDefaultSorter(sort_destructor);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tdestructor,\n\t\t\t\t\tgenerate_key,\n\t\t\t\t\tevent_value\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsortOnDefaultSorter(destructor);\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction bindingSwitchHandler(binding_switch: api_widget.Cbinding__type__switch): ExpressionHandler {\n\tconst state_expressions: Record = {};\n\tconst state_group_property = binding_switch.properties.property.entry;\n\tconst escaped_state_group_property_name = escapeIdentifier(state_group_property);\n\tfor (const state of binding_switch.properties.states.values()) {\n\t\tstate_expressions[state.key.entry] = visitOneOrMoreExpression(state.properties.next);\n\t}\n\treturn {\n\t\texecute: async (implementation_context, destructor, event_value) => {\n\t\t\tconst context_selection_implementation_context = context_selection.context_selection(\n\t\t\t\tbinding_switch.parent.properties.context,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst new_visitor_context = context_selection_implementation_context.switchClientStateBinderToProperty(\n\t\t\t\tstate_group_property,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst binding_context = new_visitor_context.current_binding_context;\n\t\t\tconst bound_property = binding_context.properties[\n\t\t\t\tescaped_state_group_property_name\n\t\t\t] as api_client_state.StateGroup<{ name: string; node: any; init: any }>;\n\t\t\tconst state_group_binder = new_visitor_context.get_client_state_binder_AsStateGroupBinding(state_group_property);\n\t\t\tconst state_implementation_context = new_visitor_context.changeState({\n\t\t\t\tnew_binding_context: bound_property.state.node,\n\t\t\t\tnew_client_state_binder: state_group_binder.states[bound_property.state.name].binding,\n\t\t\t});\n\t\t\tconst variable_context = visitVariableAssignment(\n\t\t\t\tbinding_switch.properties.states.get(bound_property.state.name)!.properties.variable_assignment,\n\t\t\t\tstate_implementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst expression = state_expressions[bound_property.state.name];\n\t\t\treturn await expression.execute!(variable_context, destructor, event_value);\n\t\t},\n\t\tsubscribe: (implementation_context, callback, destructor, generate_key, event_value) => {\n\t\t\tconst context_selection_implementation_context = context_selection.context_selection(\n\t\t\t\tbinding_switch.parent.properties.context,\n\t\t\t\timplementation_context,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst new_visitor_context = context_selection_implementation_context.switchClientStateBinderToProperty(\n\t\t\t\tstate_group_property,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tconst binding_context = new_visitor_context.current_binding_context;\n\t\t\tconst bound_property = binding_context.properties[\n\t\t\t\tescaped_state_group_property_name\n\t\t\t] as api_client_state.StateGroup<{ name: string; node: any; init: any }>;\n\n\t\t\tdestructor.subscribeToStategroup(bound_property, (stategroup_destructor) => {\n\t\t\t\tconst state_group_binder =\n\t\t\t\t\tnew_visitor_context.get_client_state_binder_AsStateGroupBinding(state_group_property);\n\t\t\t\tconst state_implementation_context = new_visitor_context.changeState({\n\t\t\t\t\tnew_binding_context: bound_property.state.node,\n\t\t\t\t\tnew_client_state_binder: state_group_binder.states[bound_property.state.name].binding,\n\t\t\t\t});\n\t\t\t\tconst variable_context = visitVariableAssignment(\n\t\t\t\t\tbinding_switch.properties.states.get(bound_property.state.name)!.properties.variable_assignment,\n\t\t\t\t\tstate_implementation_context,\n\t\t\t\t\tdestructor\n\t\t\t\t);\n\n\t\t\t\tconst expression = state_expressions[bound_property.state.name];\n\t\t\t\texpression.subscribe?.(\n\t\t\t\t\tvariable_context,\n\t\t\t\t\t{\n\t\t\t\t\t\tadd: (value, i, d, _w, key) => {\n\t\t\t\t\t\t\tcallback.add(value, i, d, true, key);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tupdate: callback.update,\n\t\t\t\t\t},\n\t\t\t\t\tstategroup_destructor,\n\t\t\t\t\tgenerate_key,\n\t\t\t\t\tevent_value\n\t\t\t\t);\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction createEntryContext(\n\tcollection_entry: api_client_state.AlanDictionaryEntry,\n\timplementation_context: ImplementationVisitorContext,\n\tcollection_name: string,\n\tdestructor: DestructorTree\n) {\n\tconst key = collection_entry.key_value;\n\tlet entry_implementation_context: ImplementationVisitorContext;\n\tconst entry_context = implementation_context.get_client_state_binder_AsCollectionBinding(collection_name).entry;\n\tif (entry_context.onContext) {\n\t\tentry_implementation_context = entry_context\n\t\t\t.onContext(key, implementation_context, destructor)\n\t\t\t.switchClientStateBinder(entry_context.binding);\n\t} else {\n\t\tentry_implementation_context = implementation_context\n\t\t\t.switchBindingContext(collection_entry)\n\t\t\t.switchClientStateBinder(entry_context.binding);\n\t}\n\tconst context = entry_implementation_context.changeState({\n\t\tentry_key: collection_name + \":\" + key,\n\t});\n\treturn context;\n}\n\nfunction getNodeAtIndex(\n\tlist: api_views.Cgui_widget_configuration_list,\n\tindex: number\n): api_views.Cgui_widget_configuration_node | undefined {\n\t//NB index is 1 based\n\treturn list.properties.has_steps.switch({\n\t\tno: undefined,\n\t\tyes: ($) => {\n\t\t\tif (index <= 1) {\n\t\t\t\treturn $.properties.configuration;\n\t\t\t} else {\n\t\t\t\treturn getNodeAtIndex($.properties.tail, index - 1);\n\t\t\t}\n\t\t},\n\t});\n}\n\nfunction sortEntriesOnTopology(\n\tcollection_implementation_context: ImplementationVisitorContext,\n\tcollection: api_client_state.AlanDictionary,\n\tcollection_name: string\n): string[] | undefined {\n\tconst order_constraint =\n\t\tcollection_implementation_context.get_client_state_binder_AsCollectionBinding(collection_name).order_constraint;\n\tif (order_constraint !== undefined) {\n\t\tconst sorting: string[] = [];\n\t\tconst top = collection as api_client_state.AlanTopology;\n\t\ttop.topo_forEach(order_constraint, (entry: api_client_state.AlanDictionaryEntry) => {\n\t\t\tsorting!.push(entry.key_value);\n\t\t});\n\t\treturn sorting;\n\t} else {\n\t\treturn undefined;\n\t}\n}\n","import { api_configuration } from \"../../common\";\nimport DestructorTree from \"../DestructorTree\";\nimport { addMessage } from \"../front/messages\";\nimport { DataStoreProtocolError } from \"../interface/DatastoreProxy\";\nimport {\n\tControlCollectionProperty,\n\tControlControlProperty,\n\tControlInstructionProperty,\n\tControlMarkupProperty,\n\tControlNumberProperty,\n\tControlProperties,\n\tControlProperty,\n\tControlStateGroupProperty,\n\tControlTextProperty,\n} from \"./ControlLibrary\";\nimport { SortedKeys } from \"./ExpressionTypes\";\nimport ImplementationVisitorContext from \"./ImplementationVisitorContext\";\nimport { InstructionError } from \"./instructions/InstructionError\";\nimport { visit_control_binding } from \"./visit_control_binding\";\nimport { visitOneOrMoreExpression } from \"./visit_widget_implementation_expression\";\nimport api_controls = api_configuration.libraries.gui_definition_lib.libraries.control_bundle_lib.libraries.controls_lib.types.control_library.alan_api;\nimport api_widget = api_configuration.libraries.gui_definition_lib.types.widget.alan_api;\n\nfunction makeInstruction(\n\texpression: api_widget.Cone_or_more_expression,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n): (event: any) => Promise {\n\tlet local_implementation_context: ImplementationVisitorContext | undefined = implementation_context;\n\tconst instruction_expression = visitOneOrMoreExpression(expression);\n\n\tlet handler = async (event: any) => {\n\t\t// Do not execute the instruction if the current context is destroyed. But do not stop executing the instructions\n\t\t// once started. That's why the instruction_destructor is not a child of the destructor.\n\t\tif (local_implementation_context === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tconst instruction_destructor = DestructorTree.create();\n\t\ttry {\n\t\t\tawait instruction_expression.execute(local_implementation_context, instruction_destructor, event);\n\t\t} catch (reason) {\n\t\t\tif (reason instanceof DataStoreProtocolError) {\n\t\t\t\taddMessage(\"warning\", \"An error occurred\");\n\t\t\t} else if (!(reason instanceof InstructionError)) {\n\t\t\t\tthrow reason;\n\t\t\t}\n\t\t}\n\t\tinstruction_destructor.destroy();\n\t};\n\n\tdestructor.onDestroy(() => {\n\t\tlocal_implementation_context = undefined;\n\t\thandler = async () => {\n\t\t\t// set the handler to a noop function so that the context can be garbage collected.\n\t\t};\n\t});\n\n\treturn async (event: any) => {\n\t\tawait handler(event);\n\t};\n}\n\nconst renderQueue: {\n\twidget_implementation_node: api_widget.Cwidget_implementation_node;\n\tcontrol_context: ControlProperties;\n\timplementation_context: ImplementationVisitorContext;\n\tdestructor: DestructorTree;\n}[] = [];\nlet visiting_widget_implementation = false;\nexport function visit_widget_implementation_node(\n\twidget_implementation_node: api_widget.Cwidget_implementation_node,\n\tcontrol_context: ControlProperties,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n): void {\n\trenderQueue.push({\n\t\twidget_implementation_node: widget_implementation_node,\n\t\tcontrol_context: control_context,\n\t\timplementation_context: implementation_context,\n\t\tdestructor: destructor,\n\t});\n\tif (!visiting_widget_implementation) {\n\t\tvisiting_widget_implementation = true;\n\t\tlet head = 0;\n\t\twhile (head !== renderQueue.length) {\n\t\t\tconst item = renderQueue[head];\n\t\t\thead++;\n\t\t\tif (!item.destructor.destroyed) {\n\t\t\t\tvisitAttributes(\n\t\t\t\t\titem.widget_implementation_node,\n\t\t\t\t\titem.control_context,\n\t\t\t\t\titem.implementation_context,\n\t\t\t\t\titem.destructor\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\trenderQueue.splice(0);\n\t\tvisiting_widget_implementation = false;\n\t}\n}\n\nfunction visitAttributes(\n\twidget_implementation_node: api_widget.Cwidget_implementation_node,\n\tcontrol_context: ControlProperties,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n) {\n\tfor (const attribute of widget_implementation_node.input.context_control_node().properties.attributes.values()) {\n\t\tconst current_control_context = control_context[attribute.key];\n\t\tif (current_control_context === undefined) {\n\t\t\tthrow new Error(\"Missing property in control node: \" + attribute.key);\n\t\t}\n\t\tconst widget_attribute = widget_implementation_node.properties.attributes.get(attribute.key)?.properties.attribute;\n\t\tif (widget_attribute === undefined) {\n\t\t\tapplyControlDefaults(attribute, current_control_context, destructor);\n\t\t} else {\n\t\t\tvisitAttribute(widget_attribute, current_control_context, implementation_context, destructor);\n\t\t}\n\t}\n}\n\nexport function visitAttribute(\n\tattribute: api_widget.Cwidget_implementation_attribute,\n\tcontrol_context: ControlProperty,\n\timplementation_context: ImplementationVisitorContext,\n\tdestructor: DestructorTree\n): void {\n\tconst control_attribute = attribute.input.attribute();\n\tswitch (control_attribute.properties.type.state.name) {\n\t\tcase \"instruction\": {\n\t\t\tcontrol_context = control_context as ControlInstructionProperty;\n\t\t\tcontrol_context(makeInstruction(attribute.properties.expression, implementation_context, destructor));\n\t\t\tbreak;\n\t\t}\n\t\tcase \"markup\": {\n\t\t\tlet dom_element = control_context as ControlMarkupProperty;\n\t\t\tif (global.alan_debug) {\n\t\t\t\tlet created_element: HTMLElement;\n\t\t\t\tdom_element = () => {\n\t\t\t\t\tif (created_element === undefined) {\n\t\t\t\t\t\tcreated_element = (control_context as ControlMarkupProperty)();\n\t\t\t\t\t\t(created_element as any).alan_node = implementation_context.current_binding_context;\n\t\t\t\t\t\tif (created_element.nodeName !== \"#comment\") {\n\t\t\t\t\t\t\tcreated_element.setAttribute(\n\t\t\t\t\t\t\t\t\"data-alan-context\",\n\t\t\t\t\t\t\t\t(implementation_context.current_binding_context as any)?.path\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn created_element;\n\t\t\t\t};\n\t\t\t}\n\t\t\tvisitOneOrMoreExpression(attribute.properties.expression).subscribe(\n\t\t\t\timplementation_context,\n\t\t\t\t{\n\t\t\t\t\tadd: (\n\t\t\t\t\t\tcontrol_binding: api_widget.Ccontrol_binding,\n\t\t\t\t\t\tsub_implementation_context,\n\t\t\t\t\t\tsub_destructor,\n\t\t\t\t\t\twrap_in_dynamic_area\n\t\t\t\t\t) => {\n\t\t\t\t\t\tvisit_control_binding(\n\t\t\t\t\t\t\tcontrol_binding,\n\t\t\t\t\t\t\tdom_element,\n\t\t\t\t\t\t\tsub_implementation_context,\n\t\t\t\t\t\t\tsub_destructor,\n\t\t\t\t\t\t\twrap_in_dynamic_area\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdestructor,\n\t\t\t\tundefined\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"control\": {\n\t\t\tvisitOneOrMoreExpression(attribute.properties.expression).subscribe(\n\t\t\t\timplementation_context,\n\t\t\t\t{\n\t\t\t\t\tadd: (\n\t\t\t\t\t\twidget_implmentation_node: api_widget.Cwidget_implementation_node,\n\t\t\t\t\t\tsub_implementation_context,\n\t\t\t\t\t\tsub_destructor\n\t\t\t\t\t) => {\n\t\t\t\t\t\tvisit_widget_implementation_node(\n\t\t\t\t\t\t\twidget_implmentation_node,\n\t\t\t\t\t\t\t(control_context as ControlControlProperty)(makeControlDestructor(sub_destructor), {}),\n\t\t\t\t\t\t\tsub_implementation_context,\n\t\t\t\t\t\t\tsub_destructor\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdestructor,\n\t\t\t\tundefined\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"property\": {\n\t\t\tconst property__type__attributes = control_attribute.properties.type.state.node;\n\t\t\tswitch (property__type__attributes.properties.type.state.name) {\n\t\t\t\tcase \"collection\": {\n\t\t\t\t\tcontrol_context = control_context as ControlCollectionProperty;\n\t\t\t\t\tconst control_collection_entry = control_context.initialize(makeControlDestructor(destructor), {\n\t\t\t\t\t\tentries: new Map(),\n\t\t\t\t\t\tsort: [],\n\t\t\t\t\t});\n\n\t\t\t\t\tlet sort: (() => void) | undefined = undefined;\n\t\t\t\t\tlet sorting: SortedKeys = [];\n\t\t\t\t\tif (control_collection_entry.sort !== undefined) {\n\t\t\t\t\t\tconst flatAndSort = () => {\n\t\t\t\t\t\t\tconst sorted = flatDeep(sorting, Infinity) as string[];\n\t\t\t\t\t\t\tcontrol_collection_entry.sort!(sorted);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\t\tsort_callbacks.delete(flatAndSort);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsort = () => {\n\t\t\t\t\t\t\trequestSort(flatAndSort);\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tvisitOneOrMoreExpression(attribute.properties.expression).subscribe(\n\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tadd: async (\n\t\t\t\t\t\t\t\tvalue: api_widget.Cwidget_implementation_node | undefined,\n\t\t\t\t\t\t\t\tentry_implementation_context,\n\t\t\t\t\t\t\t\tentry_destructor,\n\t\t\t\t\t\t\t\t_wrap,\n\t\t\t\t\t\t\t\tkey: string\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\t\t\t\tconst entry_contract = control_collection_entry.add(key, makeControlDestructor(entry_destructor), {});\n\t\t\t\t\t\t\t\t\tentry_destructor.onDestroy(() => {\n\t\t\t\t\t\t\t\t\t\tentry_contract.remove();\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tvisit_widget_implementation_node(\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t\tentry_contract.entry,\n\t\t\t\t\t\t\t\t\t\tentry_implementation_context,\n\t\t\t\t\t\t\t\t\t\tentry_destructor\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tupdate: (s) => {\n\t\t\t\t\t\t\t\tsorting = s;\n\t\t\t\t\t\t\t\tsort?.();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\texpressionIdGenerator()\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"number\": {\n\t\t\t\t\tvisitOneOrMoreExpression(attribute.properties.expression).subscribe(\n\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tadd: async (value: number) => {\n\t\t\t\t\t\t\t\t(control_context as ControlNumberProperty)(value);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tundefined\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"text\": {\n\t\t\t\t\tconst setControlValue = control_context as ControlTextProperty;\n\n\t\t\t\t\tconst entries: Record = {};\n\t\t\t\t\tlet sorting: SortedKeys | undefined = undefined;\n\n\t\t\t\t\tlet updateTextValue = () => {\n\t\t\t\t\t\tconst keys = Object.keys(entries);\n\t\t\t\t\t\tif (keys.length === 0) {\n\t\t\t\t\t\t\tsetControlValue(\"\");\n\t\t\t\t\t\t} else if (keys.length === 1) {\n\t\t\t\t\t\t\tsetControlValue(entries[keys[0]]);\n\t\t\t\t\t\t} else if (sorting !== undefined) {\n\t\t\t\t\t\t\tconst flattened = flatDeep(sorting, Infinity) as string[];\n\t\t\t\t\t\t\tconst value = flattened.map((key) => entries[key] ?? \"\").join(\"\");\n\t\t\t\t\t\t\tsetControlValue(value);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tdestructor.onDestroy(() => {\n\t\t\t\t\t\tupdateTextValue = () => {\n\t\t\t\t\t\t\t//Do not update control texts when the context is destroyed.\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\n\t\t\t\t\tvisitOneOrMoreExpression(attribute.properties.expression).subscribe(\n\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tadd: async (value: string, _i, text_value_destructor, _w, key: string) => {\n\t\t\t\t\t\t\t\tif (value === undefined) {\n\t\t\t\t\t\t\t\t\tif (entries[key] !== undefined) {\n\t\t\t\t\t\t\t\t\t\tdelete entries[key];\n\t\t\t\t\t\t\t\t\t\tupdateTextValue();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tentries[key] = value.toString();\n\t\t\t\t\t\t\t\t\tupdateTextValue();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttext_value_destructor.onDestroy(() => {\n\t\t\t\t\t\t\t\t\tdelete entries[key];\n\t\t\t\t\t\t\t\t\tupdateTextValue();\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tupdate: (s) => {\n\t\t\t\t\t\t\t\tsorting = s;\n\t\t\t\t\t\t\t\tupdateTextValue();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\texpressionIdGenerator()\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state group\": {\n\t\t\t\t\tvisitOneOrMoreExpression(attribute.properties.expression).subscribe(\n\t\t\t\t\t\timplementation_context,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tadd: async (select_state: api_widget.Cstate__for, sub_implementation_context, sub_destructor) => {\n\t\t\t\t\t\t\t\tvisit_widget_implementation_node(\n\t\t\t\t\t\t\t\t\tselect_state.parent.properties.node,\n\t\t\t\t\t\t\t\t\t(control_context as ControlStateGroupProperty)[select_state.properties.state.entry](\n\t\t\t\t\t\t\t\t\t\tmakeControlDestructor(sub_destructor),\n\t\t\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tsub_implementation_context,\n\t\t\t\t\t\t\t\t\tsub_destructor\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdestructor,\n\t\t\t\t\t\tundefined\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(property__type__attributes.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(control_attribute.properties.type.state);\n\t}\n}\n\nconst sort_callbacks = new Set<() => void>();\nlet sorting = false;\nfunction requestSort(callback: () => void) {\n\tsort_callbacks.add(callback);\n\tif (sorting) {\n\t\treturn;\n\t}\n\tsorting = true;\n\trequestAnimationFrame(() => {\n\t\tfor (const callback of sort_callbacks) {\n\t\t\tcallback();\n\t\t}\n\t\tsort_callbacks.clear();\n\t\tsorting = false;\n\t});\n}\n\nexport function expressionIdGenerator() {\n\tlet counter = 0;\n\treturn () => {\n\t\tconst newId = counter.toString();\n\t\tcounter += 1;\n\t\treturn newId;\n\t};\n}\n\nfunction applyControlDefaults(\n\tattribute: api_controls.Cattributes__control_node,\n\tcurrent_control_context: ControlProperty,\n\tdestructor: DestructorTree\n) {\n\tswitch (attribute.properties.type.state.name) {\n\t\tcase \"instruction\":\n\t\t\tbreak;\n\t\tcase \"markup\":\n\t\t\tbreak;\n\t\tcase \"control\": {\n\t\t\tconst control_attribute = attribute.properties.type.state.node;\n\t\t\tconst contract = (current_control_context as ControlControlProperty)(makeControlDestructor(destructor), {});\n\t\t\tapplyControlImplementation(\n\t\t\t\tcontrol_attribute.properties.has_default.cast(\"yes\").properties.implementation,\n\t\t\t\tcontract,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"property\": {\n\t\t\tconst property = attribute.properties.type.state.node;\n\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\tcase \"collection\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"number\": {\n\t\t\t\t\tconst number_type = property.properties.type.state.node;\n\t\t\t\t\tconst number_default = number_type.properties.has_default.cast(\"yes\");\n\t\t\t\t\tswitch (number_default.properties.intialize.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst yes_intialize = number_default.properties.intialize.state.node;\n\t\t\t\t\t\t\t(current_control_context as ControlNumberProperty)(yes_intialize.properties.value.value);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"text\": {\n\t\t\t\t\tconst text_type = property.properties.type.state.node;\n\t\t\t\t\tconst text_default = text_type.properties.has_default.cast(\"yes\");\n\t\t\t\t\tswitch (text_default.properties.intialize.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst yes_intialize = text_default.properties.intialize.state.node;\n\t\t\t\t\t\t\t(current_control_context as ControlTextProperty)(yes_intialize.properties.value);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state group\": {\n\t\t\t\t\tconst state_group_type = property.properties.type.state.node;\n\t\t\t\t\tconst state_group_default = state_group_type.properties.has_default.cast(\"yes\");\n\t\t\t\t\tswitch (state_group_default.properties.intialize.state.name) {\n\t\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"yes\": {\n\t\t\t\t\t\t\tconst selected_state = state_group_default.properties.state;\n\t\t\t\t\t\t\tconst state_control_context = (current_control_context as ControlStateGroupProperty)[\n\t\t\t\t\t\t\t\tselected_state.entry\n\t\t\t\t\t\t\t](makeControlDestructor(destructor), {});\n\t\t\t\t\t\t\tfor (const state_attribute of selected_state.ref.properties.node.properties.attributes.values()) {\n\t\t\t\t\t\t\t\tapplyControlDefaults(state_attribute, state_control_context[state_attribute.key], destructor);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(attribute.properties.type.state);\n\t}\n}\n\nfunction applyControlImplementation(\n\tcontrol_default_attribute: api_controls.Ccontrol_implementation,\n\tcurrent_control_contex: ControlProperties,\n\tdestructor: DestructorTree\n) {\n\tfor (const attribute of control_default_attribute.input.node().properties.attributes.values()) {\n\t\tconst property_contract = current_control_contex[attribute.key];\n\t\tconst implementation_attribute = control_default_attribute.properties.attributes.get(attribute.key);\n\t\tif (implementation_attribute === undefined) {\n\t\t\tapplyControlDefaults(attribute, property_contract, destructor);\n\t\t} else {\n\t\t\tswitch (implementation_attribute.properties.type.state.name) {\n\t\t\t\tcase \"control\": {\n\t\t\t\t\tconst $ = implementation_attribute.properties.type.state.node;\n\t\t\t\t\tapplyControlImplementation(\n\t\t\t\t\t\t$.properties.implementation,\n\t\t\t\t\t\t(property_contract as ControlControlProperty)(makeControlDestructor(destructor), {}),\n\t\t\t\t\t\tdestructor\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"markup\": {\n\t\t\t\t\tthrow new Error(\"markup not supported\");\n\t\t\t\t}\n\t\t\t\tcase \"property\": {\n\t\t\t\t\tconst property = implementation_attribute.properties.type.state.node;\n\t\t\t\t\tswitch (property.properties.type.state.name) {\n\t\t\t\t\t\tcase \"collection\": {\n\t\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t\tapplyControlListEntries(\n\t\t\t\t\t\t\t\t$.properties.entries,\n\t\t\t\t\t\t\t\t(property_contract as ControlCollectionProperty).initialize(makeControlDestructor(destructor), {\n\t\t\t\t\t\t\t\t\tentries: new Map(),\n\t\t\t\t\t\t\t\t\tsort: [],\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t\t(property_contract as ControlNumberProperty)($.properties.value.value);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"state group\": {\n\t\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t\tapplyControlImplementation(\n\t\t\t\t\t\t\t\t$.properties.implementation,\n\t\t\t\t\t\t\t\t(property_contract as ControlStateGroupProperty)[$.properties.state.entry](\n\t\t\t\t\t\t\t\t\tmakeControlDestructor(destructor),\n\t\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tdestructor\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\tconst $ = property.properties.type.state.node;\n\t\t\t\t\t\t\t(property_contract as ControlTextProperty)($.properties.value);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tunexpectedState(property.properties.type.state);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunexpectedState(implementation_attribute.properties.type.state);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction applyControlListEntries(\n\tentries: api_controls.Centries_list,\n\tcurrent_control_context: ReturnType,\n\tindex: number,\n\tdestructor: DestructorTree\n) {\n\tswitch (entries.properties.has_steps.state.name) {\n\t\tcase \"no\":\n\t\t\tbreak;\n\t\tcase \"yes\": {\n\t\t\tconst $ = entries.properties.has_steps.state.node;\n\t\t\tapplyControlImplementation(\n\t\t\t\t$.properties.implementation,\n\t\t\t\tcurrent_control_context.add(index.toString(), makeControlDestructor(destructor), {}).entry,\n\t\t\t\tdestructor\n\t\t\t);\n\t\t\tapplyControlListEntries($.properties.tail, current_control_context, index + 1, destructor);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tunexpectedState(entries.properties.has_steps.state);\n\t}\n}\n\nfunction makeControlDestructor(destructor: DestructorTree) {\n\treturn (callback: () => void) => {\n\t\tdestructor.onDestroy(() => {\n\t\t\tcallback();\n\t\t});\n\t};\n}\n\nfunction flatDeep(arr: T[], d = 1): T[] | T {\n\treturn d > 0\n\t\t? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatDeep(val, d - 1) : val), [])\n\t\t: arr.slice();\n}\n","import DestructorTree from \"../DestructorTree\";\nexport function wrapNode(parentDom: () => Node, destructor: DestructorTree): () => HTMLElement {\n\treturn () => {\n\t\tconst control_root = parentDom();\n\t\tconst dynamic_area = document.createComment(\"--DYNAMIC AREA--\");\n\t\tlet childNodes: ChildNode[] = [];\n\t\tdynamic_area.appendChild = function (node) {\n\t\t\tif (destructor.destroyed) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t\tchildNodes.push(node as unknown as ChildNode);\n\t\t\treturn control_root.insertBefore(node, dynamic_area);\n\t\t};\n\t\tdynamic_area.insertBefore = function (node, child) {\n\t\t\tif (destructor.destroyed) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t\treturn control_root.insertBefore(node, child);\n\t\t};\n\t\tconst old_remove = dynamic_area.remove;\n\t\tdynamic_area.remove = function (...args) {\n\t\t\tfor (const i in childNodes) {\n\t\t\t\tif (childNodes[i] !== undefined) {\n\t\t\t\t\tchildNodes[i].remove();\n\t\t\t\t}\n\t\t\t}\n\t\t\tchildNodes = [];\n\t\t\told_remove.apply(dynamic_area, args);\n\t\t};\n\t\tcontrol_root.appendChild(dynamic_area);\n\t\tdestructor.onDestroy(() => {\n\t\t\tdynamic_area.remove();\n\t\t});\n\t\treturn dynamic_area as unknown as HTMLElement; //FIXME: visit_widget_implementatio_node should accepts Node instead of HTMLElement\n\t};\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t179: 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkfabric_client\"] = self[\"webpackChunkfabric_client\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [335,216], () => (__webpack_require__(8306)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","parent","child","addChild","addDependency","destroy","default","isDestructable","DestructableMap","constructor","persistant","super","map","Map","has","key","this","get","set","value","size","entries","Symbol","iterator","forEach","callbackfn","thisArg","keys","values","delete","result","clear","destroyed","toStringTag","_destroyed","__private__parent","_children","_destruction_observers","observer","Set","add","onDestroy","unsubscribe","DestructableSet","DestructorMap","DestructorPool","addThreewayDependency","local_values","DestructorSet","OnDemandEvaluatedMap","evaluate","args","key_is_destructable","value_is_destructable","SubscriptionMap","subscription","object","undefined","destructor1","destructor2","func","sub1","sub2","child1","child2","sub_child1","sub_parent","sub_child2","awaitCondition","ScalarProvider","scalarValue","onScalarValue","DictionaryProvider","MutableDictionary","createDictionary","createExpressionBuilder","createStategroupExpressionBuilder","createDictionaryExpressionBuilder","lambda","getSourceOriginFromStacktrace","MutableVariable","createVariable","None","WeakCache","And","left_source","right_source","__origin","_left_value","_right_value","_subscriber","update","left_value","subscribe","subscriber","Error","_right_subscription","right_value","g","alan_strict","source","DynamicDictionaryExpression","initialize","_value","_source_dictionary","locationPattern","error","line","stack","split","replace","location_parts","exec","sourceMapper","ExpressionBuilder","input","steps","builder","step","Object","assign","setPrototypeOf","getPrototypeOf","stateSwitch","states","origin","alan_debug","push","StateSwitch","tag","map_fn","DynamicDictionaryMap","DictionaryMap","filter","DynamicFilter","Filter","groupBy","group_fn","DynamicGroupBy","GroupBy","key_expr","GetSingleton","Get","reduce","fn","initial_value","Reduce","pipe","extra_steps_to_origin","Pipe","and","right","or","Or","fallback","fallback_value","Fallback","Entry","_subscribers","previous_value","removeFromResult","addToResult","DictionaryExpression","_entries","_size","ensure","remove","entry","scalar_source","key_exp","_dictionary_source","key_value","_","_key_subscription","getSingleton","_inverse","_subscriptions","addToGroup","group_value","prev_group_value","removeFromGroup","group","group_value_scalar","groups","$","outvalue","k","v","expression","new_value","ReductionStep","_value_subscription","updateValue","_result","setSource","accumulator","new_result","_steps","scalar","onValue","onSubscription","_on_abandoned","discard","mutable","on_abandoned","init","WeakMap","async","variable","condition","destructor","Promise","resolve","resolved","queueMicrotask","api_application_decorator","api_configuration","libraries","gui_definition_lib","model_lib","types","application","alan_api","window","root_destructor","package_fingerprint","resetModifierKeys","ClientState","client_state","properties","alt_key_pressed","ctrl_key_pressed","shift_key_pressed","meta_key_pressed","toggle_key_pressed","onload","setupErrorHandlers","title","error_message","globalFailMessage","start","unexpectedState","state","name","serverTimeInterval","renderRoot","main","document","body","innerHTML","window_name","root_window","ref","Window","windows","create","IdPathBuilder","root_view","settings","allow_deeplink","yes_allow_deeplink","node","target_window","deeplinkHandler","startListening","stopListening","navigator","onLine","network_connection_status","messages","addMessage","ononline","removeMessage","onoffline","addEventListener","handleModifierKeys","onbeforeunload","root","modified","event","altKey","ctrlKey","shiftKey","metaKey","platform_family","switch","Android","no","yes","Linux","Windows","iOS","macOS","undetermined","message","DatastoreProxy","instance","connection","disconnectWebSocket","stopSynchronizingServerTime","removeEventListener","reload_on_unexpected_error","enabled","location","reload","disabled","errorCaughtAndSent","startSynchronizingServerTime","setInterval","julian_time","getServerTime","synchronization_time","Date","now","setNowFunction","Math","round","synchronizeServerTime","clearInterval","file_storage_url","search_params","URLSearchParams","hash","substring","serialized_parameters","deserialized_parameters","atob","e","orginal_seach_params","append","url","URL","href","toString","rewriteUrlParameters","getDebug","fetch","then","response","text","sourceMappingURL","decodedSource","supportedEncodingRegexp","sourceMapStart","match","length","encodedSource","substr","sourceMapConsumer","SourceMap","SourceMapConsumer","lineNumber","columnNumber","originalPositionFor","column","getFilesFromWebserver","engine_version","UNKNOWN_CLIENT_VERSION","checkEngineVersion","datastore_connection","DatastoreConnection","application_name","getApplicationName","authentication_data","authenticate","token","devserver_port","getDevserverPort","clearDevserverPort","port","pathname","params","slice","username","raw_manifest","getFileFromWebServer","JSON","parse","manifest","api_manifest","all","path","application_model","Capplication","fingerprint","views_to_get","views","translations_to_get","translations","widgets_to_get","widgets","controls_to_get","controls","control_media_directory","control_implementations","file","test","control_styles","reports_to_get","reports","css_path","link","createElement","type","rel","head","script_source","script","src","additional_file_result","concat","schemas","hash_language","getLanguage","clearLanguage","lang_initialization_value","localStorage","getItem","platformMatch","platform","toLowerCase","search","browserMatch","browser","userAgent","languages","set_selected_language","browser_family","set_version","trim","subscribe_selected_language","on_update","documentElement","lang","selected_language","indexOf","translation","setItem","content_selection","classList","getUpdated","clearUpdated","initializeClientState","decorate","gui_model","phrases","client_bindings","c","control_name","view_name","r","report_name","t","translation_name","uri","getAuthenticationUri","request","XMLHttpRequest","appendSlash","charAt","open","setRequestHeader","status","reponse_message","responseText","uris","sort","a","b","localeCompare","new_module","modules","logo_request","logo_url","has_logo","send","stringify","files","f","handlers","set_logo_url","set_logo_sideways_url","config","logClientStateOnError","on","transact","attributes","root_queries","queries","getWindowInstance","setAuthenticationStatus","onunload","unSubscribeAll","server_connection_status","setUpdated","hash_before_destroy","catch","on_announcement","raw_body","parseServerAnnouncement","initializeDataStoreProxy","raw_collation_table","initializeCollectionTable","DataStoreProtocolError","setTimeout","application_name_phrase","parsed_message","timestamp","at","translate","julian_datetime_2_js_date","session","DestructorTree","static","_observers","subscribeToText","subscribe_function_name","callback","subscribeToValue","first","subscribeToNumber","subscribeToStategroup","stategroup","subscribeToCollection","dictionary","callbacks","children","on_add","entry_destructor","on_remove","on_change","subscribeToEntry","removed_key","child_destructor","destruction_observer","ReferenceCounter","ObservableNumber","on_empty_handlers","on_destroy_handlers","deregister","decrement","handler","persist","add_registration","increment","onEmpty","skip_first","count","setA","setB","elem","initial","Pending","Unknown","Failed","Source","Sink","TaskManager","DestructableObject","timeout_ms","tasks","executing","queue","task","promise","res","clearTimeout","timeout","execute","queued","reject","cancel","padTwo","number","year","month","day","getYear","getMonth","getDay","canonicalformat","date","time","getDate","getTime","htmlformat","hour","minute","second","getHour","getMinute","getSecond","milliseconds_in_a_day","difference_between_day_0_of_unix_and_day_0_of_julian","difference_in_seconds_between_day_0_of_unix_and_day_0_of_julian","milliseconds_in_a_second","jstimestamp_2_julian_datetime","floor","gregorian_date","js_date","UTC","gregorian_datetime","matches","s","Number","parsedDate","jsdate","getTimezoneOffset","julian_date","getFullYear","julian_datetime","getHours","getMinutes","getSeconds","d","gregorian_date_2_julian_date","date_time","gregorian_datetime_2_julian_datetime","api_cs","mapStack","Stacktrace","fromError","join","ignoreError","ignoreMessage","toLocaleLowerCase","sendMessageToServer","http_request","createClientStateStringyfier","client_state_seen","ignoreAlanObjects","AlanObject","on_error","old_console_error","console","formatStackLine","createMessageAndSendToServer","message_to_server","createApplicationStateSnapShot","include_browser_details","include_client_state","include_url","tryGetApplicationStateSnapShot","stackTraceLimit","Infinity","prepareStackTrace","structuredStackTrace","stacksize","formattedStack","taillimit","min","apply","Array","from","arg","evt","errorStack","filename","lineno","rejection","reason","options","tryserializeIdPath","id_path","has_steps","operation","is_set","collection","state_group","tail","log","isWebSocketOpen","tryGetWebSocketConnectionState","user","anonymous_session","tryGetAuthenticationStatus","open_views","open_view","context","view_context","view_definition","active","is_active_view","tryGetOpenViews","listLastInstructions","any_performance","performance","memory","jsHeapSizeLimit","totalJSHeapSize","usedJSHeapSize","browser_details","language","warn","generateClientStateReport","snapshot","encoding","TextEncoder","TextDecoder","str","buffer","encode","crypto","subtle","digest","hexCodes","view","DataView","i","byteLength","padding","paddedValue","getUint32","hex","Sha256","Utf8","strUni","strUtf","cc","charCodeAt","String","fromCharCode","msg","utf8encode","K","H","l","N","ceil","M","j","pow","W","h","sigma1","sigma0","T1","Sigma1","Ch","T2","Sigma0","Maj","toHexStr","n","x","ROTR","y","z","SECONDS_PER_MINUTE","SECONDS_PER_HOUR","parseHours","duration","parseSeconds","parseMinutes","secondsstring","NaN","parseInt","parseDateTime","datetimestring","minutes","seconds","convertToParseResult","isNaN","DECIMAL_SEPARATOR","toLocaleString","THOUSAND_SEPARATOR","NUMBER_REGEX","RegExp","THOUSAND_SEPARATOR_REGEX","numberstring","numerical_type","set_type","point_translation","gui_numerical_type","numerical_types","gui_result","representation_type","datestring","parseDate","model","unit","hours","minor_string","minor","decimal_point_modification","sign","major","major_string","number_value","popStateEventListener","message_id","uuid","generate","body_text","isTranslatedBodyOptions","isRawBodyOptions","switchOnEntryExists","warning","success","waiting","id","visitViewExpression","visitViewExpressionList","list","authenticated","not_anonymous","collectionEntry","reference","$reference","subscribeOnce","build","subscription_result_data","read_permitted","reference_result","text_property","cast","mapToIdPathBuilder","fromClientReply","referencedEntry","$property_rule","stream","Rule","query_constraint","reference_rule","property","rule","$context_rule","state_rule","state_name","case_","cases","state_context","contextExists","visitAncestor","view_open","user_id","createIdFromUser","openView","has_alternative","users_collection_path","has_dynamic_users","users_collection","vititObjectPathTail","collectionQuery","CollectionPathBuilder","filters","aggregates","has_step","removeTail","has_landing_page","initial_view_expression","initial_content","in_front","window_instance","is_view_open","registerIdPath","registerNodeContext","activate_view","english","Username","Password","dutch","active_translation","setLanguage","selected_translation","phrase","vars","asyncWarning","idPathOfView","attribute","deeplink","getDeepLink","views_name","app_id","application_identifier","Capplication_identifier","walkId","deepLinkTo","parseKeys","c_views","c_view","node_type","entryExists","orderAttribute","has_successor","has_attributes","getGuiNode","variant","definition","command","getGuiCommand","parameters","getGuiAction","getGuiGroup","gui_node","getGuiStategroup","getGuiCollection","getGuiAttribute","attribute_type","command_type","action_type","getGuiText","text_type","getNavigableGuiText","gui_text","navigable","group_type","stategroup_type","collection_type","definer","app_state","rules","gui_reference","number_type","file_type","api_model","api_client_protocol_reply","client_protocol_reply","api_client_protocol_request","client_protocol_request","api_client_reply","client_reply","api_client_request","client_request","client_request_serializer","serializer_json","client_protocol_request_serializer","InvalidTokenError","Buffered_Queue","item_queue","started_state","stop","queue_state","stopped_state","item","noop","announcement_handler","reconnect_delay","connected","first_time_connection","onHandlers","disconnect","reconnect","connect","last_client_token","protocol_requests","connectWebSocket","ws","onclose","close","queueProtocolRequest","reply","readyState","protocol_request","alternative_token","sendProtocolRequest","sendUnSubscribeMessage","Cclient_protocol_request","serialize","isWebSocketOpenOrConnecting","target","protocol","host","WebSocket","onopen","ws_id","notify","onmessage","handleMessage","Cclient_protocol_reply","data","code","new_client_token","nextClientToken","request_ws_id","serialized_request","protocol_reply","notification_result","notification_handler","client_token","announcement","MAX_SAFE_INTEGER","subscriptions","last_subscription_id","subscription_counter","query_counter","subscribeOnce_counter","sub_id","subscription_id","subscription_context","notification","Cclient_reply","exists","reSubscribeAll","decorated_request","decorateClientRequest","handleApplicationReply","old_password","new_password","collection_query","result_handlers","query_type","handleFailure","handleSuccess","mutation","onSubscribed","onError","datastore_subscription","onNotification","generateSubscriptionId","subscription_info","subscribed_handler","Cclient_request","error_handler","sendSubscriptionMessage","subscription_result","initial_state","performInBrowserHttpRequest","method","listener","warningMessage","onabort","onerror","responseType","api_report","report_protocol_types","browser_specific_http_request","post_data","report_request","response_handler","report_protocol_request","file_content","report_protocol_reply","Creport_protocol_reply","req","report_protocol_download_request","observers","CsvColumnPathBuilder","build_steps","copyBuildSteps","newBuilder","build_function","clone","escape","state_group_operation","build_step","api_application_identifier","id_path_builder","onSuccess","assert","assertion","parseLiteral","char_stream","done","equals","that","addToBuildStepArray","element","copy","reverse","entityIdPathBuilder","entity_builder","singularStep","current_builder","step_a","step_b","NodePathBuilder","rule_name","reference_name","group_name","stategroup_name","collection_entry","collection_name","entry_key","node_path","createClientIdPath","raw_path","position","entity","state_group_name","head_builder","ConditionalChildPathBuilder","addConditionalStep","new_head_builder","candidates","delink","extendPath","buildIdPath","walkNodeLocation","onTail","key_property","backend_value","backend_known","set_value","is_editable","editable","saving","createIdPathBuilderFromNode","walkNodePath","onResult","onNoResult","output","navigable_reference","resolve_status","getReferencedNode","is_selected","findEntryWithKey","ObservableType","val","observerCount","subscribeConditional","conditional","new_conditional","subtract","ObservableSet","iterable","ObservableMap","query_queue","_set","set_empty","on_done","finally","empty","requestAnimationFrame","UpdateMutationBuilder","extension","addCollectionEntry","collection_property","getCollection","create_entry","initialization","InitializeMutationBuilder","updateCollectionEntry","update_entry","deleteCollectionEntry","remove_entry","group_property","new_group","update_state","state_property","update_node","set_state","init_node","mergeWith","other","state_group_property","SubscriptionBuilder","_parent","collection_updates","include_graph_endpoints","collection_entries","key_filters","getProperty","o","entry_subscription","constrained_text","state_group_node","property_type","pendingSubscriptions","Subscription","_node","subscribed_properties","add_dependency","registration","asRegisterable","__needs_subscription","__subscriptions","createIdPathFromNode","microtaskQueue","setNodeContextToLocal","setPropertiesToNotReadable","updateNodeFromSubscriptionResult","updateEntityPermission","dequeue","iCollection","deleteServerEntry","updateNodeFromNotificationData","notification_data","walkAttributes","subscription_builder","attribute_name","needsToBeSubscribed","text_def","inferences","has_reference","def","state_group_type","collection_registrations","getCollectionRegistrations","unsubscribed_key_registrations","unsubscribed_keys","key_registration","includeGraphEndpoints","entries_subscription_builder","walkEntriesRegistrationNode","entry_registration","updates","has_ordered_graphs","is_subscribed","GraphEndpointsSubscribed","needs_subscription","att","group_needs_subscription","state_tree","state_needs_subscription","nodeUpdateQueue","component_root","createNodeSubscriptions","getToken","getUserName","clearToken","clearUsername","sessionStorage","AUTH_USER_KEY","AUTH_TOKEN_KEY","readTokenFromHash","kauth_text","kauth","uname","kauth_token","validateToken","getKauth","readTokenFromSession","login","redirectURL","action","symnam","removeItem","serialize_params","btoa","walkQueryPathStep","query_path_step","path_builder","type_state","type_group","collection_builder","walkGuiEntityPathTail","new_builder","createCollectionPathFromGuiEntityPath","object_path_tail","$has_steps","$type","property_name","dependency","createIdPathForWhereRuleObjectPath","where_rule_object_path","createNodePathForWhereRuleObjectPath","context_path","$context","sibling_path","object_path","left","createNodePathForRule","query","maximum_amount_of_entries","force_query_instead_of_candidates_query","createPropertiesDictionaryFromColumns","createFiltersFromColumns","use_for","behaviour","mandatory","optional","ui","has_validation","reference_tail_context_path","is_navigable","createNodeExistanceFilter","createNodeContainmentFilter","createFiltersForRules","reference_property","createCollectionPathBuilderFromCollectionPath","node_context","candidates$","is_key","candidates_context","referenced_node","todo_filter","mapNodePath","escape_escape_regex","escape_quote_regex","createInitializeNode","value_source","$property","is_busy_saving","yes_is_editable","yes_modified","setToSaving","$number","is_valid","is_modified","yes_is_modified","$text","text_value","isPasswordProperty","createUpdateNode","upload_status","createMutation","root_mutation","entry_mutations","createMutationContextForNode","remote_entry","getKeyBackendValue","marked_for_deletion","getKeyValue","onSucces","updatePermissions","setEntryLocationToRemote","onFailed","permission_denied","_findEntriesToInclude","save_all","visited_entries","iReference","referencedNode","isResolved","_findEntriesToIncludeFromEntry","_findEntriesToIncludeForCollection","findEntriesToInclude","findEntriesToIncludeForCollection","findEntriesToIncludeFromEntry","createCharacterAlternatives","primary_character","collation_table_inverse","buildNodePath","buildTextExpressionFromString","criterium","string_left","character","collation_table","characters","alternatives","for_","buildTextExpression","operator","rangeCriteriaLessThan","filter_range","range_filter","criteria_is_valid","smaller_than","criteria","or_equal_to","rangeCriteriaGreaterThan","greater_than","client_query","columns","toArray","property_path","dynamic_numerical_type","hasStyle","widget","references","createViewContextForQuery","has_filter","valid_criteria","operator_selected","operatord_selected","filter_set","filter_on_current_id_path","sg","filter_enabled","states_to_include","filter_definition","existence","in","range","less_than","p","client_request_decorator","client_query_to_excel_transformation","collection_query_to_table","api_download_request","textExpression","static_text","string","createSimpleColumnNameFromNodePath","onText","onReference","createImportTemplateQueryColumns","column_path_builder","collection_key_name","orderedAttributes","application_node","application_attribute","derived","base","elementary_number","causal","simple","number_header","column_name","query_property","transformation","header","next","state_group_operation_header","state_group_header","state_group_properties","has_states","orderState","successor","createTextColum","text_header","select","isKeyProperty","identity","password_property","createHeaderFields","collection_path","determineAccessType","item_operation","import_template_columns","result_node","gui_entity","query_properties","query_filters","transformation_columns","import_template_column","raw_client_request_incl_template","report_limit","Ccollection_query_to_table","switch_","current","query_definition","columns_block_builders","column_type","content","shift","getStaticDecimalsFromNumericalType","previous_step","clientQueryToExcelTransformation","Creport_protocol_download_request","mapping","createProperties","gui_collection","duplication_mapping","initializeNewNodeFromSubscriptionResult","readable","number_stage","text_stage","mutable_text","by","file_mutable","file_value","group_stage","group_node","node_data","state_group_stage","state_group_data","iState","__select","collection_value","entries_result","entry_new_node","__addEntry","from_current_context_duplication_mapping","keyInitialized","graph","graphs","reset","setUnit","numerical_type_properties","set_unit","evaluateNumericalType","binding_path","this_node","represent_as","root_context","variable_context","binding","dynamic","$dynamic","variable_assignment","assignment","ui_scalar_value_expression","label","expression_result","conversion","set_decimals","setDecimals","decimals","initialized","number_property","initialized_properties","__initialized","number_filter","hasMutationPermission","update_permitted","permitted","hasDeletePermission","delete_permitted","hasNodeMutationPermission","hasCollectionCreationPermission","results","create_permitted","requestIdleCallback","cancelIdleCallback","handle","updateMutationPermissions","nodes_to_update","remote","has_permission","has_create_permission","mutable_collection","can_create_entry","has_delete_permissions","local","doUpdatePermissions","permissions_checked_on_entries","WeakSet","entryPermissionChecked","entry_status","fromClientState","sendQueryToDataStoreTillCorrectAmountOfEntries","check_limits","collection_query_result","throttle_queries","has_result","query_limits","number_of_entries_limit","limit_exceeded","amount_of_entries","absolute_maximum","sample_size","show_all_limit","sendQueryToDataStore","is_busy_querying","queueQuery","onTransactionEnds","busy","querying","context_node","requery_needed","force_normal_query_instead_of_candidates_query","collectionContext","Status","valueOrFailed","candidates_query","selected_context","setEntriesAreNotEditable","setEntriesAreEditable","entriesAreEditable","show_all","queryLimit","sendQuery","isBusy","waitForQuery","entries_are_editable","walkQueries","on_query","$query","$attribute","$entry","delay_query","resolvingReferences","await","ResolveStatus","isBusyResolving","pad","width","len","max","padded_string","mod","nr_of_digits","value_parts","digits","serializeHours","text_hours","toFixed","serializeMinutes","text_minutes","abs_minutes","abs","has_previous_part","nr_of_hours","minutes_left","nr_of_minutes","serializeSeconds","text_seconds","abs_seconds","number_of_second_per_minute","seconds_left","nr_of_seconds","custom","num","no_locale","applyToConversion","numberToLocaleString","julian_datetime_2_gregorian_datetime","julian_date_2_gregorian_date","julian_date_2_js_date","toLocaleDateString","style","subscribed_style","__style_subscribed","expressions","ui_expression","has_style","has_state_styles","onlyEqualityTodo","user_requirement","equality","containment","alternative","determineAndTodo","todo","has_todo","requirement","requeryNodeQueries","reQuery","is_readable","set_number_backend","permissions","number_toBackendValue","number_definition","nodeEditMode","set_file_backend","file_definition","updateNodeFromSubscriptionResultData","update_permissions","$att","$command","execute_permitted","registerSubscription","iText","setServerValue","backend_reference","$$","$file","$group","$stategroup","backend_state","setServerState","iStategroup","$collection","graph_endpoints_result","ordered_graph","ordered_graphs","iGraph","setServerSourceValue","graph_endpoints","getCollectionUpdatesRegistration","$entries","subscribe_on_entries","addClientState","addRemoteEntry","entry_node","can_be_deleted","initializeKeySubscription","key_filter","getCollectionEntriesRegistration","key_registrations","getCollectionKeyRegistration","updateAmountOfRemoteEntries","value_update","reference_update","backend_state_def","$set","new_backend_state","initialization_data","$update","__server_state","queriesForCollectionFromNode","graph_endpoints_update","Collection","getInitializedEntryWithKey","existing_subscription_context","followConditionalChildPath","conditional_child_path","walkCollectionQueryEntries_impl","entries_type","entry_name","on_entry","new_path_builder","entry_id_path","getIdPathFromQueryResult","id_path_column","ce","createIdPathBuilderFromClientReplyIdPath","updateEntryFromQueryResult","target_cell","cells","source_property","Cell","unset","target_type","getPropertyForCell","source_text","updateText","source_type","source_token","source_extension","updateFile","source_number","source_textual_representation","number_property_expresion","signed_number_property","serializeNumber","division","maximum","minimum","product","remainder","sum","updateNumber","source_state","updateStategroup","getTranslation","addCellToTranslation","translation_destructor","states_to_translate","cell","subscribeToTranslation","hasResult","total_amount_of_entries","getTotalAmountOfLocalEntries","set_total_amount_of_entries","has_more_entries_than_maximum","has_entries","updateTotalAmountOfEntries","entries_indexed_on_key","getIndexedResultEntries","collection_reply","fromClientRequest","context_node_path","result_entry","addResultEntry","remoteQueryEntry","subscribeToEntryStyle","cell_name","number_cell","app_number","subscribeToCellNumericalTypeProperties","state_group_cell","subscribeToStategroupCellStyle","subscribeToEntryExpressions","isSubscribed","walkCollectionQueryEntries","removeResultEntry","updateEntriesSelection","headers","endsWith","shouldProxyJSON","generated_view","dependencies","text_reader","pipeThrough","TextDecoderStream","getReader","view_content","current_value","read","current_index","current_value_length","readValue","assertEqual","expected","actual","nextChar","readStringLiteral","ch","readStringLiteralPositions","readObjectLiteral","start_chunk","level","end_chunk","end","getContent","positions","pos","chunk","parseViewContentLiterally","initializedViews","defineProperty","parsed_view","enumerable","configurable","createViewsProxy","json","text_cell","cell_is_set","set_text","textual_representation","set_number","set_textual_representation","file_cell","target_is_set","set_token","set_extension","stategroup_cell","getDependencies","entry_with_dependencies","__id_path_dependencies","close_view","joined_collection","referenced_entry","query_entry","removeQueryEntryDependencies","client_schemas","loadControls","Cclient_state","createEmptyRemoteNode","default_language","version","report","engine_language","nodeValid","nodeModified","applyDefaultsWithUpdates","initializedCallbacks","callInitializedHandlers","transaction_requests","requests","ended","next_instruction_idx","last_instructions","nodeStatus","generateNodeReport","has_queries","child_entries","query_entries","obj","icons","refcount","__references","subcount","started","unresolved","node_status","state_location","state_line","col_children","col_query_entries","internal_key","entry_location","deleted","entry_line","registrations","entries_reg","entries_refcount","entries_subcount","updates_reg","updates_refcount","updates_subcount","key_regs","reg","key_reg","key_refcount","key_subcount","reg_obj","kind","Boolean","query_name","query_obj","getQueryEntryIndex","unknown","_$","applyingDefaults","instruction_name","instruction","last_instruction","toISOString","ignoreCollectionDefaults","getClientStateReport","shhht_supersecret_devserver_command_generator","KAUTH","readablePath","thing","Cnode","api_collation_table_decorator","Ccollation_table","primary_key","alts","primary","keyEntryMap","toStream","Text","synchronized","toVariable","total","initializedEntriesMap","entriesWithKey","isMarkedForDeletion","candidate","dummy_node","Centries__collection","original_properties","defaults_applied","proxy","Proxy","entry_reference_definition","destructable","subscriptionPending","pending","iEntry","register","CollectionInterface","amountOflocalEntries","amountOfRemoteEntriesUpdater","createAmountOfRemoteEntriesQuery","amountOfRemoteEntries","synchronize","amountOfEntries","set_amount_of_entries","isEmpty","is_empty","mutationPermissionUpdater","canCreateEntry","modified_by","engine","acc","entriesAreValid","reduceValid","cardinalityConstraintViolated","cardinality_constraint","constraint","modified_or_local","none","isValid","entries_are_valid","cardinality_constraint_violation","direct_invalid","indirect_invalid","Indirect","invalid","entries_are_invalid","find","updateServerKeyValue","addServerEntry","__remove_entry","handleEntryRemoval","last_created_entry","removeAttribute","removeEntry","updateSorting","addLocalEntry","addEntry","deleteEntry","iNode","graphNodeIsModified","getNode","isModified","clearDefaultEntries","setCollectionJoinSizeSubscriptions","collection_size","current_id","collection_key_definition","joined_collection_key_definition","key_tail","joined_entry_map","joined_entry","remove_referenced_entry","registerText","previous_key","text_destructor","old_joined_entry","entry_id","set_collection_entry","remove_collection_entry","joined_collection_destructor","linkIdPath","valid_candidate","tail_expression","descendant_object_path","tail_context","getBackendValue","query_entry_status","selected_entry","selected_entries","requery","getValue","registrationInitialized","EntryInterface","keyUnique","unique","key_unique","_registration_destructor","_destructor","registerObjectPathTail","ordering_stategroup_path","edge_state","registerStategroup","ordering_stategroup","edge_reference","cleanAttribute","cleanNode","isRegisteredOrSubscribed","getReferenceCounter","state_modified","cleanEntriesRegistrationNode","has_entries_registration","has_updates_registration","has_key_registrations","has_registered_entries","isRegistered","modified_entries","entry_modified","has_join","joined","garbageCollector","SingleTaskManager","getBackendKeyValue","default_value","ForwardProxy","backward","fproxies","edgeUpdateValue","destruct","BackwardProxy","forward","edge","bproxies","updateEdge","queryQueue","queryVertex","exp","openEntry","sub","Node","sink_state","setReferencedEntry","update_value","__update","edgeModified","getEdgeValue","getServerEdgeValue","state_in_backend","discardEdge","createBackwardProxy","createForwardProxy","nodes","Graph","pending_updates","source_key","ordering_property_path","ordering_state_group_path","ordering_states","default_state","default_","getBackwardProxy","getForwardProxy","createNode","findByKey","move","before","merge","bproxy","fproxy","_reset_as_local","_clear","force_init","other_entry","other_node","all_keys","sorted","_sorted","ordering_stategroup_name","edge_stategroup_path","createNodePathFromObjectPathTail","setServerEdgeValue","insertBeforeKey","insertBefore","entry_to_insert","before_entry","node_to_insert","before_node","insertAfter","after_entry","after_node","moveForward","moveBackward","moveToSink","moveToSource","isSaving","NodeInterface","on_value","updateIsEmpty","amount_of_entries_visible","not_empty","result_size","compareIds","path_type","isEntrySelected","has_selected_entries","is","has_entry_style","evaluateStyle","initializedStyle","style_expression","number_column","initializedNumericalTypeProperties","subscribe_decimals","getDecimalsFromNumericalTypeProperties","evaluateNumericalTypeProperty","parent_context","app_stategroup","unsetStyle","Cstate_group__type__property","subscribeToCollectionEntry","collection_entry_status","state_group_column","state_group_definition","getKeyFromIdPath","collection_def","getKeyFromNode","current_node","getIndex","buildQueryEntryIndex","getKeyFunc","query_path","index","cdef","getLocalEntry","unkown_location","__local_entry","patched_query","subscribed","context_callback","patchQuery","in_","getAmountOfLocalEntries","new_amount_of_entries","set_amount_of_entries_visible","has_columns","createResultEntry","index_key","__id_path","QueryInterface","for_query","node_context_query","registerCollection","findCollectionForQuery","iQuery","updateLastKeyInRawIdPath","new_key","createIdPathBuilderFromRawIdPath","ReferenceInterface","isMandatory","validate","propagateKeyUpdates","behaviour_specialization","selfReferenceAllowed","backendValue","entryReferenceSynchronized","setModified","sync","entryIsAllowed","setR2M","registerRelativeIdPath","referenceResolver","subscribeToReference","updateKeyInServerValue","resolved_reference","resolvable","getGuiRule","ruleExpressionBuilder","self_reference_allowed","registrationDone","this_entry","other_object","key_stream","key_node_path","key_node","col","whereRuleObjectPath","Saving","ModifiedDuringSave","__alan__saving","saving_object","selected_state","on_selected","new_selected_state","getSelectedState","StategroupInterface","deselect","notifyEntityUpdate","StateInterface","is_updating","addStateAttributes","setStickyStateGroupValue","stop_updating","setNodeLocationToRemote","other_state","setStateLocationToLocal","current_state","valueModified","getRegistrationStatus","TextInterface","__ensure","setStickyTextValue","update_graphs","references_to_me","__server_value","_graphs_for_which_is_key","Variable","ancestor_variable_path","ancestor_named_object_path","has_assignment","executeAction","view_bindings","can_use_containing_view","view_node_type","node_context_modified","history","events","execution_destructor","startOperation","executeActionStep","action_step","reinitializeOperation","action_expression_tasks","last_step","has_next_action","sendFeedback","executeActionExpression","flags","can_use_current_view","execute_action","action_interaction","execute_command","command_interaction","show_target","action_view","client_context_node","can_open_entry","view_context_node","update_properties","update_properties_interaction","target_node","SubscriptionManager","finishedAndInitialized","node_must_be_validated","parent_location","onTargetDone","should_save","save","saveAll","edit","switchOff","can_finish","updateCanFinish","checkCanFinish","on_interactive","active_action","action_active","predicate","can_finish_step","finish","old_value","unset_number","old_state","new_state","rollback","can_continue","continue","node_valid","valid_subscription","view_entity","interactive","interactionBuilders","node_to_update","actionBoundry","$implementation","implementation","optional_variable_assignment","operationVariableAssignment","update_stategroup","stategroupPropertyModifiedByUser","on_target","parameter","updating_properties","node_switch","node_expression","false_case","node_case","new_variable","true_case","walk","walk_expression","singular_node_path","getRemoteEntries","existing_context","remoteEntries","getLocalEntries","isInitialized","entriesOf","filtered_entry","node_path_tail","state_switch","ui_parametrized_node_path","cs_stategroup","cs_state","Stategroup","subscribeToSelectedState","singular_node_path_stream","node_target","visualization","bind_view","interaction","switchOn","executeObjectExpression","property_target","property_reference","new_target","interactive_callback","should_update_properties","textOn","registerNumber","numberOn","stategroup_property","stategroupOn","registerGroup","execute_operation","operation_type","registerAction","global","registerCommand","component","operation_attribute","started_operation","parameters_node","execute_operation_destructor","produce_value","object_target","state_group_target","state_to_select","target_state_group","scalar_target","target_scalar","number$","numberPropertyModifiedByUser","update_number","textPropertyModifiedByUser","update_text","file_property","fileToken","state_choice","state_to_set","executeEntryExpressionList","entry_expression","registerEntry","node_collection","new_entry","new_node","registerNewNode","delete_entry","delete_","object_expression","promiseSeries","object_expression_property","property_def","addCollectionAttribute","more_entries","cs_number","cs_text","collection_context_node","break_out","confirm","get_parent_location","todo_definition","for","createCollectionAttribute","createFileAttribute","createGroupAttribute","createNumberAttribute","createStategroupAttribute","createTextAttribute","createLocalNode","validation_result","gui_definition","reference_not_resolved","text_does_not_match_pattern","invalid_rules","validation","text_with_validation","validateText","pattern","regular_expression","integer","positive","mapToOrderedDictionary_states","first_state","remote_state","graph_constraints","canDownloadFiles","addTextAttribute","raw_attribute","addNumberAttribute","addFileAttribute","addGroupAttribute","addStategroupAttribute","raw_stategroup","raw_collection","state_node","collection_definition","key_property_name","raw_node","raw_key_property","createCandidatesQuery","isDefined","canDownloadFilesQuery","on_added","view_context_name","query_instance_name","can_download_files","added_query","navigable_text","q","entries_editable","updateEditable","findRemoteValues","scope","text_property_name","node_path_builder","collection_path_builder","init_entries","prefix","number_part","pad_length","ui_text","text_target","valid","node_position","getScope","this_text_property","text_property_to_exclude","group_nodes","state_nodes","entry_nodes","key_set","findLocalValues","remote_values","scope_id","identifier","getScopeIdentifier","sb","conditions_valid","idx","splice","subscribeToRemoteValues","incremented_value","tick_handlers","interval","onAdded","julianNow","doTickHandlersLoop","julian_now","startWhenAdded","off","getNow","nowFunction","mapCommandArguments","command_arguments","context_id_path_builder","context_id_path","arguments","createCommandExecutionRequest","applyOperationDefaults","gui_columns_binding","yes__has_filter","initial_criteria","yes__initial_criteria","now__source","has_offset","yes__has_offset","offset","static__source","parseNumber","error_prefix","ImportError","ErrorReporter","error_fields","create_record_reporter","record","error_column","validateRecord","csv_rec","reportError","base_number","number_parse_result","stategroup_column","findUsedColumns","used_columns","text_column","Sets","union","stategroup_operation_column","mergeErrorFields","fields","field","error_field_name","validateCsv","key_fields","last_key_field","records","error_reporter","missing_key_fields","difference","unused_columns","nodes_to_check_for_existence","csv_record","getRecordIdPath","parent_id_path_builder","to_check","field_for_errors_csv","saveAs","createCSVBlob","papa","unparse","target_node_def","field_name","registerNodeFromRecord","cancelDefault","number_def","group_def","stategroup_def","updateNodeFromRecord","executeCsv","record_entry_map","key_field","parent_node","reportErrorsOnNode","valid_entries","sendMutation","InstructionError","GC","getKeyFieldNames","report_error","not_valid","should_be_positive","exceeds_minimum","exceeds_maximum","no_state_selected","key_is_not_unique","csv_data","complete","skipEmptyLines","errors","importCsvFile","meta","startsWith","error_field","number_of_csv_entries","error_batch","error_fields_during_run","csv_data_batch","stringUIScalarDefault","ui_scalar_default","numberUIScalarDefault","stategroupUIScalarDefault","textDefaultExpression","has_default","$source","getUserNameOrDefault","cs_reference","reference_expression","on_candidates","mapObjectPathTailToNodePath","mapDescendantObjectPathToQueryFilters","local_candidates","remote_candidates","reference_context","cs_collection","local_entries","local_candidates_stream","tail_path","entry_filter","keyCollector","key_is_set","keyCollection","localCandidatesStream","local_candidates_subscription","max_remote_entries","col_attribute","max_candidates","queryRemoteCandidates","ui_collection_attributes","can_be_dormant","sn","createDormantFilter","autofillOnlyCandidate","text_with_default","numberDefaultExpression","gui_number","getGuiNumber","$value","getCurrentDate","getCurrentDateAndTime","model_expression","stategroupDefaultExpression","gui_stategroup","model_state_switch","textDefault","numberDefault","stategroupDefault","isLiveUpdated","live_updated_object","live_update","defaultsManager","startApplying","stopApplying","cs_node","cs_property","updating","modified_by_user","isSetByCollectionDefault","isRemote","__alan_default","definesGraphInsertionPosition","subscription_on_ignore","ignore","clearCollectionDefaults","source_collection_def","key_reference","key_reference_definition","collectionPropertyModifiedByUser","resolveMatrixSourceCollection","source_collection","source_collection_name","source_collection_node","remote_stream","querySourceCollection","$state","mapNodePathTailToNodePath","entry_subscription_builder","mapObjectPathToSubscriptionBuilder","mapDescendantObjectPathToSubscriptionBuilder","mapNodePathTailToSubscriptionBuilder","subscribeToSourceCollection","source_keys","target_keys","target_key","is_duplicate","target_text_property","cs_target_text_property","applyPropertyDefault","subscribeToChildPropertiesSetByUser","set_by_user","stategroupPropertySubscribeToSetBy","propertyEntrySubscribeToSetBy","$has_step","this_key_property","that_key_property","onSetByUser","finished","edit_mode","visitAncestorNodePath","visitGuiStaticSingularPath","gui_static_singular_path","ancestor_builder","createEmptyNodePath","queryProperty","no_step","evaluateFileNameExpression","file_name_expression","id_path_builder_to_property","property_value","state_group_expression","state_file_name_expression","file_name_prefix","tail_value","file_name","file_name_source","last_value","joinWithDot","nodeObservers","isResult","selectProperty","Cgroup__type__property","objectPathTail","propertyStep","dependencyStep","constraining_text","context_object_step","where_rule_context","sibling","$name","dynamicUser","groupNode","property_step","dependency_step","where_rule_variable_context","$has_assignment","node_step","app_root","user_name","dynamic_users","descendant_base_property_path","conditional_node_path","expected_node_path","left_node","right_node","key_path","textValue","$operation","selectedState","none_case","singular_conversions","factor","exponent","invert","unit_conversion","conversion_rule","text__type","autoIncrement","serialized_value","ui_scalar_value_expression_list","number__type","unary_expression","representation_based","jsdate_2_julian_date","binary_expression","value_function","rounding","ordinary","numberValue","fileValue","Cproperty","StickyProvider","getStickyValue","sticky_value","ancestor_node_path","collection_stream","$step","has_fallback","has_tail","tail_values","stickyvalues","isStickyProperties","setStickyValue","isSticky","analyseDefaultForStickyness","analyseExpressionForStickyness","analyseScalarValueExpression","text_definition","is_sticky","new_sticky","stategroup_definition","doMapClientRequest","doMapClientReply","doMapClientState","api_modifications","modifications","storeWidgetNumber","gui_context","entry_keys","local_value","initializeNumberValue","persistence","storageId","propertyIdentification","per_entry","per_session","session_storage","getWidgetNumber","string_value","ConfigurationValue","storeWidgetText","local_calue","initializeTextValue","getWidgetText","setWidgetState","configuration","widget_configuration","modification","Cmodifications","widgetName","createPathToWidgetRoot","initializeStategroupValue","storeState","persist_property","serialized_configuration","getWidgetState","gui_widget_configuration_node","deinitializeValue","number_values","deinitializeNumberValue","text_values","deinitializeTextValue","stategroup_values","deinitializeStategroupValue","initializeValue","pp","entry_string","check_local_storage","node_values","context_values","property_values","dont_equal_entries","getNumberLimit","number_limit","greg_date","today","with_offset","limit","has_maximum","has_minimum","MIN_SAFE_INTEGER","dependency_count","parameter_definition","executable","started_operation_destructor","command_exeute_permitted","update_executable","is_executable","permission_subscription","subscribeExecutableStatus","stopOperation","has_password_authentication","password_text_path","getPasswordToken","include_source","user_known","password_token_known","reset_uri","password_entry","resetPassword","user_context","existing_user_context","temporary_password","mutable_password","failure","encodeURIComponent","clipboard","writeText","returnInitialValue","api_app_id","isSubscribable","RegistrationVariable","_subscription","subscribable","_counter_subscription","getSubscriptionCounter","num_subs","on_registration_done","registration_status","CollectionRegistrationType","CollectionKeyRegistration","CollectionUpdatesRegistration","CollectionEntriesRegistration","EntriesRegistrationCommand","EntriesRegistrationText","EntriesRegistrationNumber","EntriesRegistrationFile","EntriesRegistrationGroup","EntriesRegistrationStategroup","EntriesRegistrationCollection","countable","counter","initReferenceCounter","initializedObjects","removeSubscriptionCounter","patched_collection","__registrations","initializeSubscribableObject","registerFile","registerCollectionUpdates","registerCollectionEntries","joinedCollections","registerJoin","registering_destructor","destructor_set","referenced_collection","target_collection","source_destructor","applyCollectionJoin","addCommandAttribute","addActionAttribute","walkIdPath","tail_node","gui_attribute","ancestor_node","id_path_from_ancestor","result_id_path","node_id_path","id_step","stepsAreEqual","backtrackCommonAncestorInIdPathAndNode","__configuration","registerGuiWidgetConfigurationNode","Query","storeEntryId","reference_counter","getEntryId","Registrant","gui_widget_configuration_node_registrants","applyRegistrant","registrant","configurations","referenced_node_destructor","entries_registration","applyEntriesRegistrant","getGuiWidgetConfigurationNodeRegistrant","entries_registration_node","entries_registration_attribute","entries_registration_text","entries_registration_group","entries_registration_stategroup","state_registrant","entries_registration_state","entries_registration_collection","createGuiWidgetConfigurationNodeRegistrant","createModelBindingPropertyPathRegistrant","createGroupRegistrant","createParentRegistrant","createStateRegistrant","createQueryPathStepRegistrant","createObjectPathTailRegistrant","createTextRegistrant","reference_config","text_registrant","createStategroupRegistrant","stategroup_registrant","group_registrant","createCollectionRegistrant","entries_config","collection_registrant","widget_list","model_binding","global_type","current_node_context_registrant","ordering_state_group_definition","edge_state_name","query_binding","query_context","$node","$current_node","query_context_registrant","state_binding","state_group_context","property_context_registrant","createWidgetExpressionRegistrant","lazy","resetModifiedState","reset_collection","$att_type","shouldResetModifiedState","resetCollectionModifiedState","gui_definition_types","api_control_library","control_bundle_lib","controls_lib","control_library","raw_schemas","client_lib","Cclient_bindings","control","Ccontrol_library","Cphrases","widget_name","Cwidget","language_name","Ctranslations","Cparameters","Csettings","views_proxy","_target","Cviews","Cgui_model","Cmain","sel_id","set_number_of_selected_entries","set_number_of_editable_selected_entries","has_unselected_entries","mapClientIdPath","non_selected_entry","selection_id","registerQueryEntry","q_entry","was_local","setCollectionLocationToRemote","setNodeLocationToLocal","setEntryLocationToLocal","api_client_state","ExpressionProvider","sortableCollections","getCollectionFromQueryPath","subscribeToSortCriteriaForDefault","getEntryContext","scalar_value","value_type","value_map","direction","on_property","text_app","number_app","stategroup_app","entry_context","ui_node_path","c_destructor","subscribeToModelBindingPropertyPath","$yes","sorting","numeric","ui_sort","has_sorting","app_collection","collection_with_sorting","sort_property","Ctext__type__columns","is_set_destructor","Cnumber__type__columns","Cstate_group__type__columns","has_result_destructor","Sync","yes_is_set","$definer","on_great_succes","column_lookup","AddColumnToLookup","current_lookup","column_properties","column_property","setToIsSetNo","prop","updateEntryBasedOnInitializationData","initializationData","updateEntryBasedOnNotificationData","notificationData","subscriptionBuilder","state_group_lookup","_refresh_interval","shouldSubscribeEntry","subscription_notification","numberModified","fileModified","stategroupModified","stategroup_modified","anyEntryModified","collection_modified","any_entry_modified","ruleValid","rulesValid","rules_valid","rule_valid","textDoesNotMatchPattern","validation_pattern","getTextValidationPattern","textKeyIsNotUnique","textReferenceIsResolved","textReferencedNodeValid","textRulesValid","textValid","reference_is_resolved","referenced_node_valid","referenced_node_not_valid","numberNotSet","numberExceedsMaximum","getUpperLimit","numberExceedsMinimum","getLowerLimit","numberShouldBePositive","mustBePositive","numberValid","not_set","fileNotSet","fileExtensionNotValid","getFileExtensionValidationPattern","fileValid","extension_not_valid","stategroupNoStateSelected","stategroupInvalidRules","stategroupStateNodeValid","stategroupValid","state_node_valid","collection_valid","graph_participation","support_self_reference","onFinishedApplyingDefaults","referencesResolved","getGuiFile","has_extension_validation","text_validation","regexp","serializerNumber","getCharacterAlternatives","createRegexFromString","regex","checkFilter","text_context","filter_text","createRegexFromFilter","criteria_valid","updateEntryFromCollectionEntry","is_new_entry","cell_type","source_value","readable_file","setSubscribed","for_candidates","collection_context","blacklist","getLocalEntriesBlacklist","self_entity","self_value","updateQueue","update_queued","updateQueries","updateEntries","node_subscription","on_node_update","localOrModified","is_local","entries_indexed","entry_index","getQueryEntryIndexForEntry","filtered","localQueryEntry","randomUUID","lut","d0","random","d1","d2","d3","setupGenerator","ScalarAlanPropertyVariable","alan_node","receive","AlanInteger","Reference","scalarStreamCache","getScalarStream","AlanStategroupVariable","getStategroupStream","AlanDictionaryVariable","_dictionary","_values","getDictionaryStream","alan_object","AlanDictionary","StateGroup","PromiseSynchronizer","promise_constructors","previous_promise","next_promise","throttle","raw_csv_string","Blob","numberFormatterCache","locale","Intl","NumberFormat","maximumFractionDigits","format","pad_string","fill_length","character_length","raw_state","when","otherwise","view_root","control_definition","control_implementation","ControlWrapper","synching","deferred_control_calls","createPropertiesWrapperConstructor","contract_prototype","instructions","control_node","contract","getProperties","control_wrapper","ControlControlWrapper","initializer","sync_wrapper","GenericSyncher","_data","propertiesConstructor","collection_data","wrapper","CollectionWrapper","entry_data","getEntryProperties","NumberPropertyWrapper","state_constructors","local_proxy","state_destructor","state_data","state_wrapper","StateWrapper","TextPropertyWrapper","instruction_length","SynchronizedProperty","sync_requested","requestSync","deferred_call","syncData","doSync","sync_callback","sync_data","entryContract","initialized_entries","entries_to_add","entries_to_remove","should_sort","entry_contract","initialized_collection","DestructorWrapper","wrap","initialized_entry","should_call_callback","wrapped_destructor","parent_data","properties_constructor","controlConstructors","property_wrappers","initialized_control","control_destructor","api_views","csr","ImplementationVisitorContext","explicit_context","_model_binding","_client_state_binder","_current_binding_context","_parent_widget_implementation_context","_view_root","_client_view","_view_context_node","_entry_keys","last_gui_widget_configuration","number_converter","id_generator","generator","IdGenerator","createIdGenerator","_explicit_context","binding_context","gui_widget_configuration","gui_model_binding","client_state_binder","client_view","current_binding_context","clientStateAsNode","raw_model_binding","client_state_binder_AsPropertiesBinding","get_view_root","get_client_view","get_client_state_binder_AsStateGroupBinding","get_client_state_binder_AsCollectionBinding","parent_widget_implementation_context","root_widget_implementation_context","switchGuiWidgetConfiguration","new_gui_widget_configuration","changeState","new_widget_configuration","switchGuiModelBinding","new_gui_model_binding","new_model_binding","switchBindingContext","new_binding_context","switchClientStateBinderToProperty","onContext","switchClientStateBinder","new_client_state_binder","new_last_gui_widget_configuration","Cgui_widget_configuration_node","new_id_generator","new_explicit_context","new_number_converter","push_widget_implementation_frame","uniqueId","next_id","ids","addQueryIfNotExistsAndGet","forQuery","query_expression","destruction_subscription","resetFilters","set_name","query_patch","query_as_refresh","has_refresh_interval","yes_has_refresh_interval","execute_query","timer","julianDateInRange","julianTimeInRange","implementation_context","Ccollection","multiple","single","instruction_handlers","Cyes__can_create_entry__collection","Cyes__can_download_files__collection","fileUpload","downloadFiles","Coff__edit_mode__yes__is_editable__collection","Con__edit_mode__yes__is_editable__collection","bindings","Centry__last_created_entry","Cresolved__joined_collection","Centry__collection_entry","Cyes__can_create_entry__entry","Centry__referenced_entry","Cyes__joined","value1","value2","Cordered_graphs","entry_to_move","Coperation__type__attributes","Cyes__can_continue","continueAction","Cyes__executable","result_gui_node","list_reports","known","writable","Cwritable","report_type_name","of_type","delete_template","file_event","Creport_types__client_state","upload_template","Cno__anonymous_session","__reference_counter","user_destructor","user_node","user_found","logout","alive","dead","Edge","Safari","Chromium","gui_state","Clanguages","Cmessages","_implementation_context","addRawMessage","Cyes__can_be_deleted","duplicate","openViewContext","entryFromEntity","Cwindows","new_client_state","Copen_views","activate","revert","Cyes__is_readable__yes__backend_known__file","file_toBackendValue","uploading","Coff__edit_mode__yes__is_editable__file","Con__edit_mode__yes__is_editable__file","Cyes__is_editable__file","deleteFromFilesResource","Cfile__type__property","addFileUploadToQueue","downloadFile","Coff__edit_mode__remote","Con__edit_mode__remote","Cyes__todo","updateTodo","others","Cyes__is_readable__yes__backend_known__number","makeNumberConverter","Cyes__modified__yes__is_editable__number","Coff__edit_mode__yes__is_editable__number","Con__edit_mode__yes__is_editable__number","Cyes__is_set__number__type__property","Cyes__exceeds_maximum","Cyes__exceeds_minimum","Cnumber__type__property","first_entry","Cquery__client_state","order_constraint","Cselected_entries","deleteQueryEntry","deselectEntry","stopDelayingQuery","Cyes__can_download_files__query","downloadFilesFromQuery","one","some","Cyes__can_show_all","Cyes__has_result","client_context","Cyes__can_create_entry__yes","Cyes__entries_are_editable","csv_import","queryFilter","removeFilters","refresh","download_ad_hoc_report","download_ad_hoc_import_template","Ctext__type__cells","Cyes__is_set__file__type__cells","downloadFileFromQuery","Cyes__is_set__number__type__cells","Cnumber__type__cells","Cyes__is_set__state_group__type__cells","Centries__yes__has_result","has_cells","Ccandidates__use_for__entries","checkEntryPermission","Cyes__is_editable__entries","Cno__is_selected__entries","selectEntry","Cyes__is_selected__entries","Cno__filter_enabled","enableStateGroupColumn","Cyes__filter_enabled","disableStateGroupColumn","Cno__is_selected__states__yes","setStateFilter","Cyes__is_selected__states__yes","unsetStateFilter","Cyes__has_default_filter__yes__has_filter__state_group","resetStateGroupFilter","Cyes__has_filter__state_group","removeStateGroupFilter","Cstate_group__type__cells","Cyes__criteria_is_valid__yes__has_filter","evaluateNumericalTypeFilter","Cno__filter_range","enableRange","Cyes__criteria_is_valid__yes__filter_range","Cno__or_equal_to__greater_than","rangeGreaterThanOrEqualTo","Cyes__or_equal_to__greater_than","rangeGreaterThan","Cno__or_equal_to__smaller_than","rangeSmallerThanOrEqualTo","Cyes__or_equal_to__smaller_than","rangeSmallerThan","Cyes__filter_range","disableRange","numberColumnRange","Cyes__has_default_filter__yes__has_filter__number","resetNumberFilter","Cyes__has_filter__number","decimal","currency","scientific","engineering","numberColumnOperator","numberColumn","removeNumberFilter","summarize","Cyes__initialized__state_group","Coff__edit_mode__yes__is_editable__state_group","Con__edit_mode__yes__is_editable__state_group","Cyes__is_set__state_group__type__property","Cstates__state_group__type__property","Cyes__create_permitted","implmentation_context","Crules","Cresolved__status","Cyes__has_default_filter__yes__has_filter__text","resetTextFilter","Cyes__has_filter__text","removeTextFilter","textColumn","Cyes__backend_known__text","mailPasswordToken","copyPasswordTokenToClipboard","Coff__edit_mode__yes__is_editable__text","Con__edit_mode__yes__is_editable__text","Cyes__is_editable__text","Cyes__navigable","Ctext__type__property","password","Cyes__can_finish_step","finishAction","Cyes__action_active","cancelAction","copy_link_to_clipboard","view_in_new_window","initializedReport","Creport_types__node","templates","download","Ctemplates","download_report","Cnumber__type__parameters","reportNumberParameter","reportTextParameter","Ctext__type__parameters","color","fixed","foreground","background","brand","accent","formatters","transformers","jsdate_2_julian_datetime","parsed_date","parseHtmlDate","parserNumber","walk_context_ancestor_path","no_has_steps","yes_has_steps","parent_implementation_context","switchModelBinding","registerModelBindingPropertyPath","collection_state","patchCollection","Cyes__has_ordered_graphs","action_attribute","Cyes__user_found","query_context_binding","initializeQueryWithModelBinding","navigable_text_property","forReference","number_binding","query_number","query_text","query_stategroup","report_type","report_types","report_number","context_selection_path","implementationVisitorContext","new_implementation_context","step_type","binding_name","binding_type_name","configuration_attribute","constrained_on_containing_binding","client_binding","configuration_attribute_name","context_selection_path_step_type","context_selection","change_context_to","ancestor_path","engine_state_binding","pushHistoryState","deeplink_hash","pushState","generateNodePathPartOfViewName","operation_name","View","window_containing_element","view_containing_element","created_element","isNonNull","ownerDocument","createElementNS","appendChild","renderView","render","moveToFront","active_element","HTMLElement","focus","moveToBack","open_views_history","deeplink_target","is_target","on_saved","subscribeOnSave","saved_node","has_active_view","active_view","node_of_view","view_definition_context","unSubscribeOnSave","clearDeepLink","addView","gui_view","view_id","added_view","view_destructor","mutable_added_view","isEntryView","unsubscribe_from_entry_key","is_entry_view","mutable_is_entry_view","generateNodeEntryKeyPartOfViewName","new_entry_key","set_entry_key","make_title","translate_title","gui_view_title","language_observer","set_title","set_entry_path","bindEntryKey","on_activated","closeInactiveViews","activeElement","ControlsAreSynchronized","contains","a_view_from_history","mutable_window","number_of_open_views","closed_views","views_to_close","history_copy","parseHash","escape_regex","context_escape","separator_regex","context_separator","keysOfIdPath","serializeHash","rewriteHash","part","next_c","identifier_cache","escaped_identifier","reserved_keywords","api_widget","api_modification","mapInstructionArgumentToModification","visitExpression","argument","instruction_implementation_context","configuration_attribute_type","binding_event","event_name","argument_context","event_selection","event_value","typed_events","has_arguments","mapArgument","view_configuration_key","view_configuration","mapArguments","typed_argument","next_argument","has_argument","first_argument","logInstruction","executeInstruction","configuration_type","configuration_instruction","number_configuration_property","storeNumber","Cconfiguration_node","Cwidget_configuration_node","state_configuration_property","setState","set_selected_state","widget_node","new_text_value","text_configuration_property","storeText","execute_configuration_intruction_handler","isNonDecoratedError","decorateInstructionError","onViewClose","onClose","onRemove","view_key","DefaultsAction","selectStateOfReferenceTail","next_tail","in_query","candidate_selection","key_of_new_node","on_save","entryInCandidateSelection","removeFilesFromUploadQueue","removeAllMessages","CSV_IMPORT_FAILED_KEY","CSV_IMPORT_SUCCESS_KEY","is_importing","transaction","importCsv","copyToClipboard","text_input","setAttribute","setSelectionRange","execCommand","copyLinkToClipboard","qes","is_busy_discarding","isBusyDiscarding","uploadFilesInQueue","executeCommand","entity_node","fileUploadQueue","containsFile","file_parent","downloadNodeFile","set_file","gui_file","download_from_files_resource","downloadNodeFiles","promises","entry_promises","entry_promise","group_promises","group_promise","state_promises","state_promise","downloadQueryFileFromDatastore","file_context","result_property","queryAbsoluteContext","downloadQueryFile","reference_entry","file_def","node_file","file_upload_queue","uploadToFilesResource","uploadFile","lastIndexOf","file_download","zip","JSZip","sanitizeFileName","generateAsync","blob","report_name_from_path","can_download","canDownloadFilesNode","nodeHasFileChildren","has_files","illegalRe","controlRe","reservedRe","windowsReservedRe","windowsTrailingRe","linuxPathSeparator","replacement","optional_node","node_of_entity","not_initialize","filter_value","mutable_state","api_report_arguments","arguments_","initializeTemplates","Creport_protocol_request","createReportGenerationRequest","post_to_report_resource","listing","template","reportContextNode","mapQueryResultsToCsv","collection_query_reply","walkEntries","entry_result","collection_block","row","parent_headers","hi","header_name","mapCollectionBlocks","getPropertyValue","csv_header","node_query","property_selection","nummerical_type","join_selection","entry_value","separator","createFields","self","root_node","initialized_report","evaluateReportValidity","download_request","Carguments","download_from_report_resource","report_generation_request","fromQuery","import_template","forImportTemplate","doUpload","reader","FileReader","readAsDataURL","message_body","cause","reinitializeRootReportTemplates","uploadFilesAndVerifyValidAgain","assertIsValid","save_handlers","saveNodeToBackend","assertEntryValid","assertCollectionIsValid","forCollection","forEntry","requerySubCollections","queriesForCollection","forNode","mutation_object","mutation_reply","yes__context_exists","save_blob","save_file_name","createObjectURL","click","revokeObjectURL","use","getQueryEntryKey","updatable_object","notify_node_update","sha256","raw_state_name","set_text_value","setStickyNumberValue","file_backend_value","mutable_file","removeFileFromQueue","file_token","noConversion","to","onceTo","local_callback","new_decimals","parent_dom_element","client_state_context","view_root_dom_element","visit_widget_expression","tryGetApplicationContext","markErrorAsDecorated","_alan_decorated","old_message","tryGetInstructionDetails","control_binding","md5","walk_view_context_parent_path_over_node","intermediate_result","view_def","entityBuilderOf","local_parent_node","visit_control_binding","wrap_in_dynamic_area","control_parent_dom_element","binding_type","let_declaration__binding_type","new_let_declaration_context","declaration","sub_implementation_context","sub_destructor","static__binding_type","wrapped_dom_element","wrapNode","control_properties","getControl","dom_element_constructor","dom_element","patchedElement","createDomElementThatDestructsOnDestructorTreeDestroy","makeControlDestructor","visit_widget_implementation_node","node_binding","window__binding_type","window_widget_name","cs_window","window_div","window_div_constructor","gui_widget_config__window","visitVariable","widget__binding_type","selected_implementation_context","gui_widget_config","client_binding_widget_type","widget_cell","Cwidget__type__cells","stageRenderCell","swich_binding_type","decorateControlError","subscribeToNodePath","reference_step","group_step","type_node","state_type","renderQueue","widget_type","widget_instance","selected_node","staticValueHandler","getListIndex","list_index","list_context","numberindex","definitions","list_counter","previous_entry","switchKeyContext","key_type","unsubscribeOnDestroy","visitScalar","binding_handler","escaped_property_name","property_context","converter","property_destructor","bindingHanlder","number__configuration","number_implementation_context","number__type__configuration","widget_number","getNumber","onNumberValue","text__configuration","text_implementation_context","bound_text_key","configuration_text","widget_text","widget_configuration_node","getText","onTextValue","subscribeWidgetText","text_modified","current_time","current_time_throttle","reexecute","clock_callback","currentTimeHandler","_d","_generate_key","phrase_type","phraseHandler","process_value","scalar_expression","expression_value","generate_key","ic","w","unaryExpressionHandler","list_expression","process_values","visitOneOrMoreExpression","list_expression_key","expressionIdGenerator","listExpressionHandler","transform","convert","wrapped_handler","transformer","transformationHandler","format_type","formatter","formattingHandler","current_context","implementation_arguments","bindToState","switch_type","parent_type","visit_widget_implementation","reference_type","bindToNodeStream","reference_rule_type","rule_type","state_context_rule_type","client_state_api","walkConfigurationAttribute","walkConfigurationNode","walk_gui_widget_configuration_list","model_binding_attribute","bindToQuery","config_node","walkWidget","registerNumberDestructor","gui_config","registerStateDestructor","registerTextDestructor","on_item","parent_dom_element_constructor","nodeName","pathDomElementWithContext","patchDomElementWithWidgetName","intermediate_visitor_context","switch_client_binding_context","visitOptionalContextDefinition","optional_context_definition","wrapped_parent_dom_element","expressionCache","cached_expression","select_state","instruction_selection","match_type","true_expression","true_","false_expression","false_","number_match","left_expression","right_expression","previous_result","match_destructor","values_equal","wrapWithDynamicArea","text_match","none_expression","from_collection","escaped_collection_name","createEntryContext","visitVariableAssignment","from_list","nodeSwitchListHandler","sort_collection","sort_context","new_sorting","sort_copy","subscribeToSortCriteriaForProperty","subscribToSortCriteriaForQueryProperty","binding_switch","state_expressions","escaped_state_group_property_name","new_visitor_context","bound_property","state_group_binder","state_implementation_context","stategroup_destructor","_w","bindingSwitchHandler","configuration_switch","switch_implementation_context","updateConfigurationState","widget_default_state","state_value","getState","selected_state_subscription","subscribe_selected_state","configurationSwitchHandler","configuration_walk","walkConfigurationListHandler","binding_walk","sort_expression","collection_implementation_context","sort_mapping","sorted_entries","added_entries","evaluateAddedEntries","wrapWithKeyGenerator","applySorting","entry_sorted_keys","sortOnDefaultSorter","sort_destructor","default_sorter","subscribeToDefaultSorting","topo_forEach","sortEntriesOnTopology","sortOnEntryOrder","sortOnTopology","sorted_keys","_i","walkCollectionBindingHandler","internalVisitExpression","visitExpressionList","has_next","expression_handler","tail_result","generated_key","multiplicity","define_context","more_variables","walk_configuration_list","walk_implementation_context","gui_configuration","states_list","walkStates","widget_entry","list_entry","getNodeAtIndex","list_destructor","entry_implementation_context","visiting_widget_implementation","widget_implementation_node","control_context","visitAttributes","context_control_node","current_control_context","widget_attribute","applyControlDefaults","visitAttribute","control_attribute","local_implementation_context","instruction_expression","instruction_destructor","makeInstruction","widget_implmentation_node","property__type__attributes","control_collection_entry","flatAndSort","flatDeep","sort_callbacks","requestSort","_wrap","setControlValue","updateTextValue","text_value_destructor","newId","applyControlImplementation","number_default","intialize","text_default","state_group_default","state_control_context","state_attribute","control_default_attribute","current_control_contex","property_contract","implementation_attribute","applyControlListEntries","arr","isArray","parentDom","control_root","dynamic_area","createComment","childNodes","old_remove","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","call","m","O","chunkIds","priority","notFulfilled","fulfilled","every","globalThis","Function","prototype","hasOwnProperty","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","chunkLoadingGlobal","bind","__webpack_exports__"],"sourceRoot":""}