atom.io 0.6.6 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/index.d.mts +7 -8
  2. package/dist/index.d.ts +7 -8
  3. package/dist/index.js +66 -93
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +66 -83
  6. package/dist/index.mjs.map +1 -1
  7. package/introspection/dist/index.d.mts +273 -0
  8. package/introspection/dist/index.d.ts +273 -0
  9. package/introspection/dist/index.js +41 -3
  10. package/introspection/dist/index.js.map +1 -1
  11. package/introspection/dist/index.mjs +41 -3
  12. package/introspection/dist/index.mjs.map +1 -1
  13. package/package.json +12 -12
  14. package/react-devtools/dist/index.d.mts +8 -10
  15. package/react-devtools/dist/index.d.ts +8 -10
  16. package/react-devtools/dist/index.js +104 -105
  17. package/react-devtools/dist/index.js.map +1 -1
  18. package/react-devtools/dist/index.mjs +105 -106
  19. package/react-devtools/dist/index.mjs.map +1 -1
  20. package/src/internal/atom-internal.ts +5 -6
  21. package/src/internal/get.ts +7 -9
  22. package/src/internal/operation.ts +14 -21
  23. package/src/internal/selector/create-read-write-selector.ts +8 -4
  24. package/src/internal/selector/create-readonly-selector.ts +1 -7
  25. package/src/internal/selector-internal.ts +1 -3
  26. package/src/internal/set.ts +1 -4
  27. package/src/internal/store.ts +19 -22
  28. package/src/internal/subscribe-internal.ts +7 -1
  29. package/src/internal/timeline-internal.ts +1 -3
  30. package/src/internal/transaction/apply-transaction.ts +9 -6
  31. package/src/internal/transaction/build-transaction.ts +6 -6
  32. package/src/internal/transaction-internal.ts +1 -7
  33. package/src/introspection/attach-timeline-family.ts +14 -4
  34. package/src/introspection/attach-transaction-logs.ts +1 -1
  35. package/src/react-devtools/AtomIODevtools.tsx +1 -2
  36. package/src/react-explorer/AtomIOExplorer.tsx +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../anvl/src/object/index.ts","../../../anvl/src/object/refinement.ts","../../../anvl/src/object/access.ts","../../../anvl/src/object/entries.ts","../../../anvl/src/object/mapObject.ts","../../../anvl/src/array/venn.ts","../../../anvl/src/array/index.ts","../../../anvl/src/function/index.ts","../../../anvl/src/nullish/index.ts","../../../anvl/src/object/sprawl.ts","../../../anvl/src/refinement/refinery.ts","../../../anvl/src/tree/differ.ts","../../../anvl/src/string/capitalize.ts","../../src/internal/atom-internal.ts","../../src/internal/get.ts","../../src/internal/is-default.ts","../../src/internal/operation.ts","../../src/internal/store.ts","../../../anvl/src/join/core-relation-data.ts","../../../anvl/src/refinement/index.ts","../../../anvl/src/join/get-related-ids.ts","../../../anvl/src/join/make-json-interface.ts","../../../anvl/src/join/relation-contents.ts","../../../anvl/src/join/relation-record.ts","../../../anvl/src/join/remove-relation.ts","../../../anvl/src/string/split.ts","../../../anvl/src/join/set-relation.ts","../../../anvl/src/join/index.ts","../../src/internal/transaction-internal.ts","../../../anvl/src/json/index.ts","../../../anvl/src/json/refine.ts","../../src/internal/families-internal.ts","../../src/internal/selector/lookup-selector-sources.ts","../../src/internal/selector/trace-selector-atoms.ts","../../src/internal/set.ts","../../src/internal/subject.ts","../../src/internal/subscribe-internal.ts","../../src/atom.ts","../../src/subscribe.ts","../../src/index.ts","../../src/introspection/attach-introspection-states.ts","../../src/introspection/attach-atom-index.ts","../../src/introspection/attach-selector-index.ts","../../src/introspection/attach-timeline-family.ts","../../src/introspection/attach-timeline-index.ts","../../src/introspection/attach-transaction-index.ts","../../src/introspection/attach-transaction-logs.ts","../../src/web-effects/storage.ts","../../src/react-devtools/AtomIODevtools.tsx","../../src/react-devtools/StateIndex.tsx","../../src/react-devtools/Button.tsx","../../src/react-devtools/StateEditor.tsx","../../../hamr/src/react-elastic-input/ElasticInput.tsx","../../../hamr/src/react-elastic-input/NumberInput.tsx","../../../anvl/src/number/clamp.ts","../../../hamr/src/react-elastic-input/TextInput.tsx","../../../hamr/src/react-json-editor/editors-by-type/utilities/array-elements.ts","../../../hamr/src/react-json-editor/editors-by-type/non-json.tsx","../../../hamr/src/react-json-editor/json-editor-internal.tsx","../../../hamr/src/react-json-editor/editors-by-type/array-editor.tsx","../../../hamr/src/react-json-editor/editors-by-type/object-editor.tsx","../../../anvl/src/json-schema/json-schema.ts","../../../anvl/src/json-schema/integer.ts","../../../anvl/src/json-schema/refs.ts","../../../anvl/src/json-schema/string-formats.ts","../../../anvl/src/json-schema/path-into.ts","../../../anvl/src/json-schema/find-sub-schema.ts","../../../anvl/src/json/cast.ts","../../../hamr/src/react-json-editor/editors-by-type/utilities/object-properties.ts","../../../hamr/src/react-json-editor/editors-by-type/primitive-editors.tsx","../../../hamr/src/react-error-boundary/ErrorBoundary.tsx","../../../hamr/src/react-error-boundary/DefaultFallback.tsx","../../../hamr/src/react-json-editor/default-components.tsx","../../../hamr/src/react-json-editor/developer-interface.tsx","../../../hamr/src/react-json-editor/index.ts","../../src/react-devtools/TimelineIndex.tsx","../../src/react-devtools/Updates.tsx","../../src/react-devtools/TransactionIndex.tsx","../../src/react-devtools/index.ts"],"sourcesContent":["import { pipe } from \"fp-ts/function\"\nimport type { Refinement } from \"fp-ts/Refinement\"\n\nimport { deepMob } from \"./deepMob\"\nimport { entriesToRecord, recordToEntries } from \"./entries\"\nimport { isPlainObject } from \"./refinement\"\nimport { includesAny, reduce, filter } from \"../array\"\nimport { isUndefined } from \"../nullish\"\n\nexport * from \"./access\"\nexport * from \"./deepMob\"\nexport * from \"./entries\"\nexport * from \"./mapObject\"\nexport * from \"./modify\"\nexport * from \"./patch\"\nexport * from \"./refinement\"\nexport * from \"./sprawl\"\n\nexport const redact =\n\t<K extends keyof any>(...args: K[]) =>\n\t<O extends Record<K, any>>(obj: O): Omit<O, K> =>\n\t\treduce<K, O>((acc, key) => (delete acc[key], acc), obj)(args)\n\nexport type Redacted<Holder, RedactProp extends keyof any> = Omit<\n\t{\n\t\t[K in keyof Holder]: Holder[K] extends (infer Item)[]\n\t\t\t? Redacted<Item, RedactProp>[]\n\t\t\t: Redacted<Omit<Holder[K], RedactProp>, RedactProp>\n\t},\n\tRedactProp\n>\nexport const redactDeep =\n\t<K extends keyof any>(...args: K[]) =>\n\t<O extends Record<K, any>>(base: O): Redacted<O, K> =>\n\t\tdeepMob(base, (node, path) =>\n\t\t\tincludesAny(args)(path)\n\t\t\t\t? {\n\t\t\t\t\t\tmeta: { pathComplete: true },\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tdata: isPlainObject(node)\n\t\t\t\t\t\t\t? redact(...args)(node as Record<keyof any, any>)\n\t\t\t\t\t\t\t: node,\n\t\t\t\t },\n\t\t)\n\nexport const select =\n\t<Key extends keyof any>(...args: Key[]) =>\n\t<Obj extends object>(\n\t\tobj: Obj,\n\t): {\n\t\t// @ts-expect-error fuk u\n\t\t[K in keyof Pick<Obj, Key>]: any extends Pick<Obj, Key>[K]\n\t\t\t? undefined\n\t\t\t: // @ts-expect-error fuk u\n\t\t\t Pick<Obj, Key>[K]\n\t} =>\n\t\t// @ts-expect-error fuk u ts\n\t\treduce<Key, Pick<Obj, Key>>(\n\t\t\t// @ts-expect-error i will fite u\n\t\t\t(acc, key) => (key in obj ? (acc[key] = obj[key as keyof Obj]) : acc, acc),\n\t\t\t// @ts-expect-error fuk u\n\t\t\t{} as Pick<Obj, Key>,\n\t\t)(args)\n\nexport const treeShake =\n\t(shouldDiscard: (val: unknown, key: keyof any) => boolean = isUndefined) =>\n\t<T extends object>(\n\t\tobj: T,\n\t): T extends Record<keyof any, unknown> ? T : Partial<T> => {\n\t\tconst newObj = {} as T\n\t\tconst entries = Object.entries(obj) as [keyof T, any][]\n\t\tentries.forEach(([key, val]) =>\n\t\t\t!shouldDiscard(val, key) ? (newObj[key] = val) : null,\n\t\t)\n\t\treturn newObj as T extends Record<keyof any, unknown> ? T : Partial<T>\n\t}\n\nexport type KeysExtending<T, V> = keyof {\n\t[K in keyof T]: T[K] extends V ? K : never\n}\n\nconst a: never | null = null\n\nexport const filterProperties =\n\t<DiscardVal, DiscardKey extends keyof any>(\n\t\tshouldDiscardVal: Refinement<unknown, DiscardVal>,\n\t\tshouldDiscardKey: Refinement<unknown, DiscardKey>,\n\t) =>\n\t<P extends Record<keyof any, any>>(\n\t\tprops: P,\n\t): DiscardVal extends never\n\t\t? DiscardKey extends never\n\t\t\t? P\n\t\t\t: Omit<P, DiscardKey>\n\t\t: Omit<P, DiscardKey | KeysExtending<P, DiscardVal>> =>\n\t\t// @ts-expect-error oh well\n\t\tpipe(\n\t\t\tprops,\n\t\t\trecordToEntries,\n\t\t\tfilter(\n\t\t\t\t(\n\t\t\t\t\tentry,\n\t\t\t\t): entry is [\n\t\t\t\t\tExclude<keyof P, DiscardKey>,\n\t\t\t\t\tExclude<P[keyof P], DiscardVal>,\n\t\t\t\t] => !shouldDiscardKey(entry[0]) || !shouldDiscardVal(entry[1]),\n\t\t\t),\n\t\t\tentriesToRecord,\n\t\t)\n\nexport const delve = (\n\tobj: Record<keyof any, any>,\n\tpath: ReadonlyArray<keyof any>,\n): Error | { found: unknown } => {\n\tconst found = path.reduce((acc, key) => acc?.[key], obj)\n\treturn found === undefined ? new Error(`Not found`) : { found }\n}\n\nexport const tweak = (\n\tobj: Record<keyof any, any>,\n\tpath: ReadonlyArray<keyof any>,\n\tvalue: unknown,\n): void =>\n\tpath.reduce((acc, key, i) => {\n\t\tif (i === path.length - 1) {\n\t\t\tacc[key] = value\n\t\t}\n\t\tif (acc[key] === undefined) {\n\t\t\tacc[key] = typeof key === `number` ? [] : {}\n\t\t}\n\t\treturn acc[key]\n\t}, obj)\n\nexport type RequireAtLeastOne<T> = {\n\t[K in keyof T]-?: Partial<Pick<T, Exclude<keyof T, K>>> & Required<Pick<T, K>>\n}[keyof T]\n\nexport type RequireExactlyOne<T> = {\n\t[K in keyof T]-?: Required<Pick<T, K>>\n}[keyof T]\n","import { pipe } from \"fp-ts/function\"\nimport type { Refinement } from \"fp-ts/Refinement\"\n\nimport { access } from \"./access\"\nimport { recordToEntries } from \"./entries\"\nimport { mob } from \"./mapObject\"\nimport { allTrue, every } from \"../array\"\nimport { pass } from \"../function\"\nimport { ifNullish } from \"../nullish\"\n\nexport type PlainObject = Record<keyof any, unknown>\nexport type EmptyObject = Record<keyof any, never>\n\nexport const isNonNullObject = (input: unknown): input is object =>\n\ttypeof input === `object` && input !== null\n\nexport const isPlainObject = (input: unknown): input is PlainObject =>\n\tisNonNullObject(input) && Object.getPrototypeOf(input) === Object.prototype\n\nexport const isEmptyObject = (input: unknown): input is EmptyObject =>\n\tisPlainObject(input) && Object.keys(input).length === 0\n\n/* prettier-ignore */\nexport const isRecord =\n\t<KEY extends keyof any, VAL>(\n\t\tisKey: Refinement<keyof any, KEY>,\n\t\tisValue: Refinement<unknown, VAL>,\n\t) =>\n\t(input: unknown): input is Record<KEY, VAL> =>\n\t\tisPlainObject(input) &&\n\t\tObject.entries(input).every(([k, v]) => isKey(k) && isValue(v))\n/* prettier-ignore-end */\n\nexport type HasPropertiesOptions = {\n\treadonly allowExtraProperties?: boolean\n}\nexport const hasProperties = <OBJ extends object>(\n\tisValue: {\n\t\t[K in keyof OBJ]: Refinement<unknown, OBJ[K]>\n\t},\n\toptions: HasPropertiesOptions = { allowExtraProperties: false },\n): Refinement<unknown, OBJ> => {\n\tconst name = `{${recordToEntries(\n\t\tisValue as Record<keyof any, Refinement<any, any>>,\n\t)\n\t\t.map(([k, v]) => String(k) + `:` + v.name)\n\t\t.join(`,`)}}`\n\n\tconst _ = {\n\t\t[name]: (input: unknown): input is OBJ =>\n\t\t\tisPlainObject(input) &&\n\t\t\tpipe(\n\t\t\t\tisValue,\n\t\t\t\tObject.entries,\n\t\t\t\tevery(([key, val]) => key in input || val(undefined)),\n\t\t\t) &&\n\t\t\tpipe(\n\t\t\t\tinput,\n\t\t\t\tmob((val, key) =>\n\t\t\t\t\tpipe(\n\t\t\t\t\t\tisValue,\n\t\t\t\t\t\taccess(key),\n\t\t\t\t\t\tifNullish(() => options.allowExtraProperties),\n\t\t\t\t\t\tpass(val),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tObject.values,\n\t\t\t\tallTrue,\n\t\t\t),\n\t}\n\treturn _[name]\n}\n\nexport const doesExtend =\n\t/* alias for hasExactProperties with allowExtraProperties */\n\t<OBJ extends object>(\n\t\tisValue: {\n\t\t\t[K in keyof OBJ]: Refinement<unknown, OBJ[K]>\n\t\t},\n\t): Refinement<unknown, OBJ> =>\n\t\thasProperties(isValue, { allowExtraProperties: true })\n\nexport const hasExactProperties =\n\t/* alias for hasProperties without allowExtraProperties */\n\t<OBJ extends object>(\n\t\tisValue: {\n\t\t\t[K in keyof OBJ]: Refinement<unknown, OBJ[K]>\n\t\t},\n\t): Refinement<unknown, OBJ> =>\n\t\thasProperties(isValue, { allowExtraProperties: false })\n","export const key =\n\t<T extends object>(k: keyof T) =>\n\t(obj: Exclude<object, null>): unknown =>\n\t\t(obj as Record<keyof any, any>)[k]\n\nexport const access = <V, T extends Record<keyof any, V>>(\n\tk: keyof any,\n): {\n\t(obj: T): T[keyof T] | undefined\n\tin: (obj: T) => T[keyof T] | undefined\n} =>\n\tObject.assign((obj: T) => obj[k as keyof T], {\n\t\tin: (obj: T) => obj[k as keyof T],\n\t})\n","export type Entries<K extends keyof any, V> = [key: K, value: V][]\n\nexport const recordToEntries = <K extends keyof any, V>(\n\tobj: Record<K, V>,\n): Entries<K, V> => Object.entries(obj) as Entries<K, V>\n\nexport const entriesToRecord = <K extends keyof any, V>(\n\tentries: Entries<K, V>,\n): Record<K, V> => Object.fromEntries(entries) as Record<K, V>\n","import { pipe } from \"fp-ts/function\"\n\nimport { entriesToRecord, recordToEntries } from \"./entries\"\nimport { map } from \"../array\"\n\nexport const mapObject = <K extends keyof any, I, O>(\n\tobj: Record<K, I>,\n\tfn: (val: I, key: K) => O,\n): Record<K, O> =>\n\tpipe(\n\t\tobj,\n\t\trecordToEntries,\n\t\tmap(([key, val]) => [key, fn(val, key)] as const),\n\t\tentriesToRecord,\n\t)\n\nexport const mob =\n\t<K extends keyof any, I, O>(fn: (val: I, key: K) => O) =>\n\t(obj: Record<K, I>): Record<K, O> =>\n\t\tmapObject(obj, fn)\n","export type VennCheck = (\n\titems: ReadonlyArray<unknown> | unknown[],\n) => (array: ReadonlyArray<unknown> | unknown[]) => boolean\n\nexport type VennTally = (\n\titems: ReadonlyArray<unknown> | unknown[],\n) => (array: ReadonlyArray<unknown> | unknown[]) => number\n\nexport const includesAll: VennCheck = (items) => (array) => {\n\tfor (const item of items) {\n\t\tif (!array.includes(item)) return false\n\t}\n\treturn true\n}\n\nexport const includesAny: VennCheck = (items) => (array) => {\n\tfor (const item of items) {\n\t\tif (array.includes(item)) return true\n\t}\n\treturn false\n}\n\nexport const excludesAll: VennCheck = (items) => (array) =>\n\t!includesAny(items)(array)\n\nexport const excludesAny: VennCheck = (items) => (array) =>\n\t!includesAll(items)(array)\n\nexport const comprises: VennCheck = (items) => (array) =>\n\tincludesAll(items)(array) && includesAll(array)(items)\n\nexport const overlaps: VennTally = (items) => (array) => {\n\tlet incidences = 0\n\tfor (const item of items) {\n\t\tif (array.includes(item)) incidences += 1\n\t}\n\treturn incidences\n}\n","export * from \"./match\"\nexport * from \"./venn\"\n\nimport type { Refinement } from \"fp-ts/Refinement\"\n\nexport const each =\n\t<T>(isType: Refinement<unknown, T>) =>\n\t(input: unknown): T[] =>\n\t\tisType(input) ? [input] : Array.isArray(input) ? input.filter(isType) : []\n\nexport const lastOf = <T>(input: ReadonlyArray<T>): T | undefined =>\n\tinput[input.length - 1]\n\nexport const isArray =\n\t<T>(isType: Refinement<unknown, T>) =>\n\t(input: unknown): input is T[] =>\n\t\tArray.isArray(input) && input.every((item) => isType(item))\n\nexport const at =\n\t<T>(index: number) =>\n\t(input: T[]): T | undefined =>\n\t\tinput.at(index)\n\nexport const content =\n\t<T>(isType: Refinement<unknown, T>) =>\n\t(input: unknown): input is T | T[] =>\n\t\tisType(input) || isArray(isType)(input)\n\nexport const join = (separator?: string) => (a: string[]): string =>\n\ta.join(separator)\n\nexport const map =\n\t<I, O>(f: (value: I, index: number, array: I[]) => O) =>\n\t(a: I[]): O[] =>\n\t\ta.map(f)\n\nexport const reduce =\n\t<I, O>(f: (acc: O, value: I, index: number, array: I[]) => O, initial: O) =>\n\t(a: I[]): O =>\n\t\ta.reduce(f, initial)\n\nexport const slice = (start: number, end?: number) => <I>(a: I[]): I[] =>\n\ta.slice(start, end)\n\nexport const using =\n\t<I, O>(a: I[]) =>\n\t(f: (acc: O, value: I, index: number, array: I[]) => O) =>\n\t(initial: O): O =>\n\t\ta.reduce(f, initial)\n\nexport const reduceRight =\n\t<I, O>(f: (acc: O, value: I, index: number, array: I[]) => O, initial: O) =>\n\t(a: I[]): O =>\n\t\ta.reduceRight(f, initial)\n\nexport const reverse = <I>(a: I[]): I[] => a.reverse()\n\nexport const sort =\n\t<I>(a: I[]) =>\n\t(f?: (x: I, y: I) => number): I[] =>\n\t\tf ? a.sort(f) : a.sort()\n\nexport const sortBy =\n\t<I>(f: (value: I) => number) =>\n\t(a: I[]): I[] =>\n\t\ta.sort((x, y) => f(x) - f(y))\n\nexport const sortByDesc =\n\t<I>(f: (value: I) => number) =>\n\t(a: I[]): I[] =>\n\t\ta.sort((x, y) => f(y) - f(x))\n\nexport const every =\n\t<I>(f: (value: I, index: number, array: I[]) => boolean = Boolean) =>\n\t(a: I[]): boolean =>\n\t\ta.every(f)\n\nexport const allTrue = every((x: boolean) => x === true)\n\nexport const addTo =\n\t<I>(a: I[]) =>\n\t(x: I): I[] =>\n\t\ta.includes(x) ? a : [...a, x]\n\nexport const isEmptyArray = (input: unknown): input is [] =>\n\tArray.isArray(input) && input.length === 0\n\nexport const isOneOf =\n\t<T>(...args: ReadonlyArray<T>) =>\n\t(input: unknown): input is T =>\n\t\targs.includes(input as T)\n\nexport const filter =\n\t<I, O extends I>(f: (value: I, index: number, array: I[]) => value is O) =>\n\t(a: I[]): O[] =>\n\t\ta.filter(f)\n","import type { Refinement } from \"fp-ts/Refinement\"\nexport * from \"./curry\"\n\nexport type ƒn = (...parameters: any[]) => any\n\nexport const doNothing = (): void => undefined\n\nexport const become =\n\t<T>(nextVersionOfThing: Modifier<T> | T) =>\n\t(originalThing: T | (() => T)): T =>\n\t\tnextVersionOfThing instanceof Function\n\t\t\t? nextVersionOfThing(\n\t\t\t\t\toriginalThing instanceof Function ? originalThing() : originalThing,\n\t\t\t )\n\t\t\t: nextVersionOfThing\n\nexport type Applicator<X, Y> = (next: Modifier<X> | X) => Modifier<Y>\nexport type Modifier<T> = (thing: T) => T\n\nexport type OneOrMany<T> = T | T[]\n\nexport const isModifier =\n\t<T>(validate: Refinement<unknown, T>) =>\n\t(sample: T): Refinement<unknown, Modifier<T>> => {\n\t\tconst sampleIsValid = validate(sample)\n\t\tif (!sampleIsValid) {\n\t\t\tthrow new Error(`Invalid test case: JSON.stringify(${sample})`)\n\t\t}\n\t\treturn (input: unknown): input is Modifier<T> => {\n\t\t\tif (typeof input !== `function`) return false\n\t\t\tconst testResult = input(sample)\n\t\t\treturn validate(testResult)\n\t\t}\n\t}\n\nexport const pass =\n\t<Params extends ReadonlyArray<any>, Out>(...params: Params) =>\n\t(fn: (...params: Params) => Out): Out =>\n\t\tfn(...params)\n\nexport const typeOf =\n\t<T>(input: unknown) =>\n\t(isType: Refinement<unknown, T>): boolean =>\n\t\tisType(input)\n\nexport const raiseError = (message: string): never => {\n\tthrow new Error(message)\n}\n\nexport type Encapsulate<T extends (...args: any[]) => any> = (\n\t...args: Parameters<T>\n) => void\n\nexport const attempt = (fn: () => void): boolean => {\n\ttry {\n\t\tfn()\n\t\treturn true\n\t} catch (_) {\n\t\treturn false\n\t}\n}\n\nexport const fallback = <T>(fn: () => T, fallbackValue: T): T => {\n\ttry {\n\t\treturn fn()\n\t} catch (_) {\n\t\treturn fallbackValue\n\t}\n}\n","import type { Refinement } from \"fp-ts/Refinement\"\n\nexport const isUndefined = (input: unknown): input is undefined =>\n\tinput === undefined\n\nexport const ifDefined = <T>(\n\tvalidate: Refinement<unknown, T>,\n): Refinement<unknown, T | undefined> =>\n\t((input) => isUndefined(input) || validate(input)) as Refinement<\n\t\tunknown,\n\t\tT | undefined\n\t>\n\nexport const isNull = (input: unknown): input is null => input === null\n\nexport const isNullish = (input: unknown): input is null | undefined =>\n\tisUndefined(input) || isNull(input)\n\nexport type NullSafeUnion<Base, Extension> = Extension extends null\n\t? Base\n\t: Base & Extension\n\nexport type NullSafeRest<MaybeArg> = MaybeArg extends null\n\t? [] | [undefined]\n\t: [MaybeArg]\n\nexport interface Discard {\n\treadonly _discard: unique symbol\n}\n\nexport const ifNullish =\n\t<X, Y>(alt: Y) =>\n\t(input: X): Exclude<X, null | undefined> | Y =>\n\t\t(input ?? alt) as Exclude<X, null | undefined> | Y\n","import { isPlainObject } from \"./refinement\"\n\n// if you found what you were looking for, return true and break\nexport type InspectionResult = Partial<{\n\tpathComplete: true\n\tjobComplete: true\n}>\nexport type InspectNode = (\n\tpath: string[],\n\tnode: unknown,\n) => InspectionResult | void\n\nexport const sprawl = (\n\ttree: Array<unknown> | object,\n\tinspector: InspectNode,\n): void => {\n\tconst walk = (path: string[], node: unknown): InspectionResult => {\n\t\tconst inspect = (path: string[], node: unknown): InspectionResult | null => {\n\t\t\t// console.log(parent)\n\t\t\tconst result = inspector(path, node)\n\t\t\tif (result) return result\n\t\t\treturn null\n\t\t}\n\t\tconst result = inspect(path, node)\n\t\tif (result?.jobComplete || result?.pathComplete) {\n\t\t\treturn result\n\t\t}\n\t\tconst childEntries = Array.isArray(node)\n\t\t\t? node.map((v, i) => [i, v])\n\t\t\t: isPlainObject(node)\n\t\t\t? Object.entries(node)\n\t\t\t: []\n\t\tfor (const [k, v] of childEntries) {\n\t\t\tconst subResult = walk([...path, k], v)\n\t\t\tif (subResult?.jobComplete) {\n\t\t\t\treturn subResult\n\t\t\t}\n\t\t}\n\t\treturn {}\n\t}\n\twalk([], tree)\n}\n\n// const aIsJson = isJson(a)\n// \t\tconst bIsJson = isJson(b)\n// \t\tif (aIsJson && bIsJson) {\n// \t\t\tconst aRefined = refineJsonType(a)\n// \t\t\tconst bRefined = refineJsonType(b)\n// \t\t\tconst typesDoMatch = aRefined.type === bRefined.type\n// \t\t\tif (typesDoMatch) {\n// \t\t\t\tconst delta = BASE_DIFF_CONFIG[aRefined.type](\n// \t\t\t\t\taRefined.data,\n// \t\t\t\t\tbRefined.data,\n// \t\t\t\t)\n// \t\t\t\treturn delta\n// \t\t\t} else {\n// \t\t\t\tconst typeA = aRefined.type\n// \t\t\t\tconst typeB = bRefined.type\n// \t\t\t\treturn {\n// \t\t\t\t\tsummary: `Type change: ${typeA} → ${typeB}`,\n// \t\t\t\t}\n// \t\t\t}\n// \t\t} else {\n","import type { Refinement } from \"fp-ts/Refinement\"\n\nimport type { ClassSignature } from \".\"\nimport { isPlainObject } from \"../object\"\n\nexport type RefinementStrategy = ClassSignature | Refinement<unknown, any>\n\nexport type Supported<Refine extends RefinementStrategy> =\n\tRefine extends Refinement<unknown, infer T>\n\t\t? T\n\t\t: Refine extends ClassSignature\n\t\t? InstanceType<Refine>\n\t\t: never\n\nexport type RefinementSupport = Record<string, RefinementStrategy>\n\nexport class Refinery<SupportedTypes extends RefinementSupport> {\n\tpublic supported: SupportedTypes\n\n\tpublic constructor(supported: SupportedTypes) {\n\t\tthis.supported = supported\n\t}\n\n\tpublic refine(input: unknown):\n\t\t| {\n\t\t\t\t[K in keyof SupportedTypes]: {\n\t\t\t\t\ttype: K\n\t\t\t\t\tdata: Supported<SupportedTypes[K]>\n\t\t\t\t}\n\t\t }[keyof SupportedTypes]\n\t\t| null {\n\t\tfor (const [key, refiner] of Object.entries(this.supported)) {\n\t\t\ttry {\n\t\t\t\tif (\n\t\t\t\t\t// @ts-expect-error that's the point\n\t\t\t\t\trefiner(input) === true &&\n\t\t\t\t\trefiner !== Boolean\n\t\t\t\t) {\n\t\t\t\t\treturn { type: key, data: input } as any\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\ttry {\n\t\t\t\t\tif (input instanceof refiner) {\n\t\t\t\t\t\treturn { type: key, data: input } as any\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n}\n\nconst jsonRefinery = new Refinery({\n\tnumber: (input: unknown): input is number => typeof input === `number`,\n\tstring: (input: unknown): input is string => typeof input === `string`,\n\tboolean: (input: unknown): input is boolean => typeof input === `boolean`,\n\tobject: isPlainObject,\n\tarray: (input: unknown): input is unknown[] => Array.isArray(input),\n\tnull: (input: unknown): input is null => input === null,\n})\n\nexport const discoverType = (input: unknown): string => {\n\tif (input === undefined) {\n\t\treturn `undefined`\n\t}\n\tconst refined = jsonRefinery.refine(input)\n\tif (refined) {\n\t\treturn refined.type\n\t}\n\treturn Object.getPrototypeOf(input).constructor.name\n}\n","import { sprawl } from \"../object\"\nimport type { Supported, Refinery } from \"../refinement/refinery\"\nimport { discoverType } from \"../refinement/refinery\"\n\nexport function diffNumber(a: number, b: number): Delta {\n\tconst sign = a < b ? `+` : `-`\n\treturn {\n\t\tsummary: `${sign}${Math.abs(a - b)} (${a} → ${b})`,\n\t}\n}\n\nexport function diffString(a: string, b: string): Delta {\n\tconst sign = a.length < b.length ? `+` : `-`\n\treturn {\n\t\tsummary: `${sign}${Math.abs(a.length - b.length)} (\"${a}\" → \"${b}\")`,\n\t}\n}\n\nexport function diffBoolean(a: boolean, b: boolean): Delta {\n\treturn {\n\t\tsummary: `${a} → ${b}`,\n\t}\n}\n\nexport function diffObject(\n\ta: Record<string, unknown>,\n\tb: Record<string, unknown>,\n\trecurse: Differ<any, any>[`diff`],\n): Delta {\n\tlet summary = ``\n\tconst added: Delta[`added`] = []\n\tconst removed: Delta[`removed`] = []\n\tconst changed: Delta[`changed`] = []\n\n\tsprawl(a, (path, nodeA) => {\n\t\tlet key: string\n\t\tfor (key of path) {\n\t\t\tconst nodeB = b[key]\n\t\t\tif (nodeB === undefined) {\n\t\t\t\tremoved.push([key, JSON.stringify(nodeA)])\n\t\t\t} else {\n\t\t\t\tconst delta = recurse(nodeA, nodeB)\n\t\t\t\tif (delta.summary !== `No Change`) {\n\t\t\t\t\tchanged.push([key, delta])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\n\tsprawl(b, (path, nodeB) => {\n\t\tlet key: string\n\t\tfor (key of path) {\n\t\t\tconst nodeA = a[key]\n\t\t\tif (nodeA === undefined) {\n\t\t\t\tadded.push([key, JSON.stringify(nodeB)])\n\t\t\t}\n\t\t}\n\t})\n\n\tsummary = `~${changed.length} +${added.length} -${removed.length}`\n\n\treturn {\n\t\tsummary,\n\t\tadded,\n\t\tremoved,\n\t\tchanged,\n\t}\n}\n\nexport function diffArray(\n\ta: unknown[],\n\tb: unknown[],\n\trecurse: Differ<any, any>[`diff`],\n): Delta {\n\treturn diffObject(a as any, b as any, recurse)\n}\n\ntype Delta = {\n\tsummary: string\n\tadded?: [path: string, addedStringifiedValue: string][]\n\tremoved?: [path: string, removedStringifiedValue: string][]\n\tchanged?: [path: string, delta: Delta][]\n}\n\ntype Diff<T> = (a: T, b: T) => Delta\ntype DiffTree<T> = (a: T, b: T, recurse: Differ<any, any>[`diff`]) => Delta\n\nexport class Differ<\n\tLeaf extends Record<string, any>,\n\tTree extends Record<string, any>,\n> {\n\tpublic leafRefinery: Refinery<Leaf>\n\tpublic treeRefinery: Refinery<Tree>\n\tpublic leafDiffers: { [K in keyof Leaf]: Diff<Supported<Leaf[K]>> }\n\tpublic treeDiffers: { [K in keyof Tree]: DiffTree<Supported<Tree[K]>> }\n\n\tpublic constructor(\n\t\tleafRefinery: Refinery<Leaf>,\n\t\ttreeRefinery: Refinery<Tree>,\n\t\tdiffFunctions: {\n\t\t\t[K in keyof Tree]: DiffTree<Supported<Tree[K]>>\n\t\t} & { [K in keyof Leaf]: Diff<Supported<Leaf[K]>> },\n\t) {\n\t\tthis.leafRefinery = leafRefinery\n\t\tthis.treeRefinery = treeRefinery\n\t\tthis.leafDiffers = {} as any\n\t\tthis.treeDiffers = {} as any\n\t\tfor (const key of Object.keys(leafRefinery.supported)) {\n\t\t\tconst diffFunction = diffFunctions[key]\n\t\t\tthis.leafDiffers[key as keyof Leaf] = diffFunction\n\t\t}\n\t\tfor (const key of Object.keys(treeRefinery.supported)) {\n\t\t\tconst diffFunction = diffFunctions[key]\n\t\t\tthis.treeDiffers[key as keyof Tree] = diffFunction\n\t\t}\n\t}\n\n\tpublic diff(a: unknown, b: unknown): Delta {\n\t\tif (a === b) {\n\t\t\treturn { summary: `No Change` }\n\t\t}\n\t\ttry {\n\t\t\tif (JSON.stringify(a) === JSON.stringify(b)) {\n\t\t\t\treturn { summary: `No Change` }\n\t\t\t}\n\t\t} catch (thrown) {\n\t\t\tconsole.error(`Error stringifying`, a, b)\n\t\t}\n\n\t\tconst aRefined = this.leafRefinery.refine(a) ?? this.treeRefinery.refine(a)\n\t\tconst bRefined = this.leafRefinery.refine(b) ?? this.treeRefinery.refine(b)\n\n\t\t// console.log({ leaf: this.leafRefinery, tree: this.treeRefinery })\n\t\t// console.log({ a, b })\n\t\t// console.log({ aRefined, bRefined })\n\n\t\tif (aRefined !== null && bRefined !== null) {\n\t\t\tif (aRefined.type === bRefined.type) {\n\t\t\t\tif (aRefined.type in this.leafDiffers) {\n\t\t\t\t\tconst delta = this.leafDiffers[aRefined.type](\n\t\t\t\t\t\taRefined.data,\n\t\t\t\t\t\tbRefined.data,\n\t\t\t\t\t)\n\t\t\t\t\treturn delta\n\t\t\t\t}\n\t\t\t\tif (aRefined.type in this.treeDiffers) {\n\t\t\t\t\tconst delta = this.treeDiffers[aRefined.type](\n\t\t\t\t\t\taRefined.data,\n\t\t\t\t\t\tbRefined.data,\n\t\t\t\t\t\t(x, y) => this.diff(x, y),\n\t\t\t\t\t)\n\t\t\t\t\treturn delta\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst typeA = discoverType(a)\n\t\tconst typeB = discoverType(b)\n\t\tif (typeA === typeB) {\n\t\t\treturn {\n\t\t\t\tsummary: `${typeA} → ${typeB}`,\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tsummary: `Type change: ${typeA} → ${typeB}`,\n\t\t}\n\t}\n}\n","export const capitalize = (str: string): string =>\n\tstr[0].toUpperCase() + str.slice(1)\n","import HAMT from \"hamt_plus\"\n\nimport { Subject } from \".\"\nimport { deposit } from \"./get\"\nimport { markAtomAsDefault } from \"./is-default\"\nimport { cacheValue, hasKeyBeenUsed } from \"./operation\"\nimport type { Store } from \"./store\"\nimport { IMPLICIT } from \"./store\"\nimport { target } from \"./transaction-internal\"\nimport type { AtomToken, FamilyMetadata, UpdateHandler } from \"..\"\nimport { setState, subscribe } from \"..\"\nimport type { AtomOptions } from \"../atom\"\n\nexport type Atom<T> = {\n\tkey: string\n\ttype: `atom`\n\tfamily?: FamilyMetadata\n\tsubject: Subject<{ newValue: T; oldValue: T }>\n\tdefault: T\n}\n\nexport function atom__INTERNAL<T>(\n\toptions: AtomOptions<T>,\n\tfamily?: FamilyMetadata,\n\tstore: Store = IMPLICIT.STORE,\n): AtomToken<T> {\n\tconst core = target(store)\n\tif (hasKeyBeenUsed(options.key, store)) {\n\t\tstore.config.logger?.error?.(\n\t\t\t`Key \"${options.key}\" already exists in the store.`,\n\t\t)\n\t\treturn deposit(core.atoms.get(options.key))\n\t}\n\tconst subject = new Subject<{ newValue: T; oldValue: T }>()\n\tconst newAtom = {\n\t\t...options,\n\t\tsubject,\n\t\ttype: `atom`,\n\t\t...(family && { family }),\n\t} as const\n\tconst initialValue =\n\t\toptions.default instanceof Function ? options.default() : options.default\n\tcore.atoms = HAMT.set(newAtom.key, newAtom, core.atoms)\n\tmarkAtomAsDefault(options.key, store)\n\tcacheValue(options.key, initialValue, store)\n\tconst token = deposit(newAtom)\n\toptions.effects?.forEach((effect) =>\n\t\teffect({\n\t\t\tsetSelf: (next) => setState(token, next, store),\n\t\t\tonSet: (handle: UpdateHandler<T>) => subscribe(token, handle, store),\n\t\t}),\n\t)\n\tstore.subject.atomCreation.next(token)\n\treturn token as AtomToken<T>\n}\n","import HAMT from \"hamt_plus\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\n\nimport type {\n\tAtom,\n\tReadonlySelector,\n\tSelector,\n\tStore,\n\tTimeline,\n\tTransaction,\n} from \".\"\nimport { target, isValueCached, readCachedValue, IMPLICIT } from \".\"\nimport type {\n\tAtomToken,\n\tReadonlySelectorToken,\n\tSelectorToken,\n\tStateToken,\n\tTimelineToken,\n\tTransactionToken,\n} from \"..\"\n\nexport const computeSelectorState = <T>(\n\tselector: ReadonlySelector<T> | Selector<T>,\n): T => selector.get()\n\nexport function lookup(\n\tkey: string,\n\tstore: Store,\n): AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown> {\n\tconst core = target(store)\n\tconst type = HAMT.has(key, core.atoms)\n\t\t? `atom`\n\t\t: HAMT.has(key, core.selectors)\n\t\t? `selector`\n\t\t: `readonly_selector`\n\treturn { key, type } as any\n}\n\nexport function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T> | null\nexport function withdraw<T>(\n\ttoken: SelectorToken<T>,\n\tstore: Store,\n): Selector<T> | null\nexport function withdraw<T>(\n\ttoken: StateToken<T>,\n\tstore: Store,\n): Atom<T> | Selector<T> | null\nexport function withdraw<T>(\n\ttoken: ReadonlySelectorToken<T>,\n\tstore: Store,\n): ReadonlySelector<T> | null\nexport function withdraw<T>(\n\ttoken: TransactionToken<T>,\n\tstore: Store,\n): Transaction<T extends ƒn ? T : never> | null\nexport function withdraw<T>(\n\ttoken: ReadonlySelectorToken<T> | StateToken<T>,\n\tstore: Store,\n): Atom<T> | ReadonlySelector<T> | Selector<T> | null\nexport function withdraw<T>(token: TimelineToken, store: Store): Timeline | null\nexport function withdraw<T>(\n\ttoken:\n\t\t| ReadonlySelectorToken<T>\n\t\t| StateToken<T>\n\t\t| TimelineToken\n\t\t| TransactionToken<T>,\n\tstore: Store,\n):\n\t| Atom<T>\n\t| ReadonlySelector<T>\n\t| Selector<T>\n\t| Timeline\n\t| Transaction<T extends ƒn ? T : never>\n\t| null {\n\tconst core = target(store)\n\treturn (\n\t\tHAMT.get(token.key, core.atoms) ??\n\t\tHAMT.get(token.key, core.selectors) ??\n\t\tHAMT.get(token.key, core.readonlySelectors) ??\n\t\tHAMT.get(token.key, core.transactions) ??\n\t\tHAMT.get(token.key, core.timelines) ??\n\t\tnull\n\t)\n}\n\nexport function deposit<T>(state: Atom<T>): AtomToken<T>\nexport function deposit<T>(state: Selector<T>): SelectorToken<T>\nexport function deposit<T>(state: Atom<T> | Selector<T>): StateToken<T>\nexport function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>\nexport function deposit<T>(\n\tstate: Transaction<T extends ƒn ? T : never>,\n): TransactionToken<T>\nexport function deposit<T>(\n\tstate: Atom<T> | ReadonlySelector<T> | Selector<T>,\n): ReadonlySelectorToken<T> | StateToken<T>\nexport function deposit<T>(\n\tstate:\n\t\t| Atom<T>\n\t\t| ReadonlySelector<T>\n\t\t| Selector<T>\n\t\t| Transaction<T extends ƒn ? T : never>,\n):\n\t| AtomToken<T>\n\t| ReadonlySelectorToken<T>\n\t| SelectorToken<T>\n\t| TransactionToken<T> {\n\treturn {\n\t\tkey: state.key,\n\t\ttype: state.type,\n\t\t...(`family` in state && { family: state.family }),\n\t} as any\n}\n\nexport const getState__INTERNAL = <T>(\n\tstate: Atom<T> | ReadonlySelector<T> | Selector<T>,\n\tstore: Store = IMPLICIT.STORE,\n): T => {\n\tif (isValueCached(state.key, store)) {\n\t\tstore.config.logger?.info(`>> read \"${state.key}\"`)\n\t\treturn readCachedValue(state.key, store)\n\t}\n\tif (state.type !== `atom`) {\n\t\tstore.config.logger?.info(`-> calc \"${state.key}\"`)\n\t\treturn computeSelectorState(state)\n\t}\n\tstore.config.logger?.error(\n\t\t`Attempted to get atom \"${state.key}\", which was never initialized in store \"${store.config.name}\".`,\n\t)\n\treturn state.default\n}\n","import type { Store } from \".\"\nimport { target, IMPLICIT, traceAllSelectorAtoms } from \".\"\n\nexport const isAtomDefault = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): boolean => {\n\tconst core = target(store)\n\treturn core.atomsThatAreDefault.has(key)\n}\n\nexport const markAtomAsDefault = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.atomsThatAreDefault = new Set(core.atomsThatAreDefault).add(key)\n}\n\nexport const markAtomAsNotDefault = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.atomsThatAreDefault = new Set(target(store).atomsThatAreDefault)\n\tcore.atomsThatAreDefault.delete(key)\n}\n\nexport const isSelectorDefault = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): boolean => {\n\tconst roots = traceAllSelectorAtoms(key, store)\n\treturn roots.every((root) => isAtomDefault(root.key, store))\n}\n","import type { Hamt } from \"hamt_plus\"\nimport HAMT from \"hamt_plus\"\n\nimport type { Atom, ReadonlySelector, Selector } from \".\"\nimport { target } from \".\"\nimport type { Store } from \"./store\"\nimport { IMPLICIT } from \"./store\"\nimport type { StateToken } from \"..\"\n\nexport type OperationProgress =\n\t| {\n\t\t\topen: false\n\t }\n\t| {\n\t\t\topen: true\n\t\t\tdone: Set<string>\n\t\t\tprev: Hamt<any, string>\n\t\t\ttime: number\n\t\t\ttoken: StateToken<any>\n\t }\n\nexport const openOperation = (token: StateToken<any>, store: Store): void => {\n\tconst core = target(store)\n\tif (core.operation.open) {\n\t\tstore.config.logger?.error(\n\t\t\t`❌ failed to setState to \"${token.key}\" during a setState for \"${core.operation.token.key}\"`,\n\t\t)\n\t\tthrow Symbol(`violation`)\n\t}\n\tcore.operation = {\n\t\topen: true,\n\t\tdone: new Set(),\n\t\tprev: store.valueMap,\n\t\ttime: Date.now(),\n\t\ttoken,\n\t}\n\tstore.config.logger?.info(\n\t\t`⭕ operation start from \"${token.key}\" in store \"${store.config.name}\"`,\n\t)\n}\nexport const closeOperation = (store: Store): void => {\n\tconst core = target(store)\n\tcore.operation = { open: false }\n\tstore.config.logger?.info(`🔴 operation done`)\n\tstore.subject.operationStatus.next(core.operation)\n}\n\nexport const isDone = (key: string, store: Store = IMPLICIT.STORE): boolean => {\n\tconst core = target(store)\n\tif (!core.operation.open) {\n\t\tstore.config.logger?.warn(\n\t\t\t`isDone called outside of an operation. This is probably a bug.`,\n\t\t)\n\t\treturn true\n\t}\n\treturn core.operation.done.has(key)\n}\nexport const markDone = (key: string, store: Store = IMPLICIT.STORE): void => {\n\tconst core = target(store)\n\tif (!core.operation.open) {\n\t\tstore.config.logger?.warn(\n\t\t\t`markDone called outside of an operation. This is probably a bug.`,\n\t\t)\n\t\treturn\n\t}\n\tcore.operation.done.add(key)\n}\nexport const recallState = <T>(\n\tstate: Atom<T> | ReadonlySelector<T> | Selector<T>,\n\tstore: Store = IMPLICIT.STORE,\n): T => {\n\tconst core = target(store)\n\tif (!core.operation.open) {\n\t\tstore.config.logger?.warn(\n\t\t\t`recall called outside of an operation. This is probably a bug.`,\n\t\t)\n\t\treturn HAMT.get(state.key, core.valueMap)\n\t}\n\treturn HAMT.get(state.key, core.operation.prev)\n}\n\nexport const cacheValue = (\n\tkey: string,\n\tvalue: unknown,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.valueMap = HAMT.set(key, value, core.valueMap)\n}\n\nexport const evictCachedValue = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.valueMap = HAMT.remove(key, core.valueMap)\n}\nexport const readCachedValue = <T>(\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): T => HAMT.get(key, target(store).valueMap)\n\nexport const isValueCached = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): boolean => HAMT.has(key, target(store).valueMap)\n\nexport const storeAtom = (\n\tatom: Atom<any>,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.atoms = HAMT.set(atom.key, atom, core.atoms)\n}\n\nexport const storeSelector = (\n\tselector: Selector<any>,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.selectors = HAMT.set(selector.key, selector, core.selectors)\n}\n\nexport const storeReadonlySelector = (\n\tselector: ReadonlySelector<any>,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.readonlySelectors = HAMT.set(\n\t\tselector.key,\n\t\tselector,\n\t\tcore.readonlySelectors,\n\t)\n}\n\nexport const hasKeyBeenUsed = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): boolean => {\n\tconst core = target(store)\n\treturn (\n\t\tHAMT.has(key, core.atoms) ||\n\t\tHAMT.has(key, core.selectors) ||\n\t\tHAMT.has(key, core.readonlySelectors)\n\t)\n}\n","import type { Hamt } from \"hamt_plus\"\nimport HAMT from \"hamt_plus\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\nimport { doNothing } from \"~/packages/anvl/src/function\"\nimport { Join } from \"~/packages/anvl/src/join\"\n\nimport { Subject } from \".\"\nimport type {\n\tAtom,\n\tOperationProgress,\n\tReadonlySelector,\n\tSelector,\n\tTransactionStatus,\n\tTimeline,\n\tTransaction,\n} from \".\"\nimport type {\n\tAtomToken,\n\tLogger,\n\tReadonlySelectorToken,\n\tSelectorToken,\n\tTimelineToken,\n\tTransactionToken,\n} from \"..\"\n\nexport type StoreCore = Pick<\n\tStore,\n\t| `atoms`\n\t| `atomsThatAreDefault`\n\t| `operation`\n\t| `readonlySelectors`\n\t| `selectorAtoms`\n\t| `selectorGraph`\n\t| `selectors`\n\t| `timelineAtoms`\n\t| `timelines`\n\t| `transactions`\n\t| `valueMap`\n>\n\nexport interface Store {\n\tatoms: Hamt<Atom<any>, string>\n\tatomsThatAreDefault: Set<string>\n\treadonlySelectors: Hamt<ReadonlySelector<any>, string>\n\tselectorAtoms: Join<null, `selectorKey`, `atomKey`>\n\tselectorGraph: Join<{ source: string }>\n\tselectors: Hamt<Selector<any>, string>\n\ttimelineAtoms: Join<null, `timelineKey`, `atomKey`>\n\ttimelines: Hamt<Timeline, string>\n\ttransactions: Hamt<Transaction<any>, string>\n\tvalueMap: Hamt<any, string>\n\n\tsubject: {\n\t\tatomCreation: Subject<AtomToken<unknown>>\n\t\tselectorCreation: Subject<\n\t\t\tReadonlySelectorToken<unknown> | SelectorToken<unknown>\n\t\t>\n\t\ttransactionCreation: Subject<TransactionToken<ƒn>>\n\t\ttimelineCreation: Subject<TimelineToken>\n\t\toperationStatus: Subject<OperationProgress>\n\t}\n\n\toperation: OperationProgress\n\ttransactionStatus: TransactionStatus<ƒn>\n\tconfig: {\n\t\tname: string\n\t\tlogger: Logger | null\n\t\tlogger__INTERNAL: Logger\n\t}\n}\n\nexport const createStore = (name: string, store: Store | null = null): Store => {\n\tconst copiedStore = {\n\t\t...(store ??\n\t\t\t(() => ({\n\t\t\t\tatomsThatAreDefault: new Set(),\n\t\t\t\tselectorAtoms: new Join({ relationType: `n:n` })\n\t\t\t\t\t.from(`selectorKey`)\n\t\t\t\t\t.to(`atomKey`),\n\t\t\t\tselectorGraph: new Join({ relationType: `n:n` }),\n\t\t\t\tvalueMap: HAMT.make<any, string>(),\n\t\t\t}))()),\n\n\t\tatoms: HAMT.make<Atom<any>, string>(),\n\t\treadonlySelectors: HAMT.make<ReadonlySelector<any>, string>(),\n\t\tselectors: HAMT.make<Selector<any>, string>(),\n\t\ttransactions: HAMT.make<Transaction<any>, string>(),\n\t\ttimelines: HAMT.make<Timeline, string>(),\n\n\t\ttimelineAtoms: new Join({ relationType: `1:n` })\n\t\t\t.from(`timelineKey`)\n\t\t\t.to(`atomKey`),\n\n\t\tsubject: {\n\t\t\tatomCreation: new Subject(),\n\t\t\tselectorCreation: new Subject(),\n\t\t\ttransactionCreation: new Subject(),\n\t\t\ttimelineCreation: new Subject(),\n\t\t\toperationStatus: new Subject(),\n\t\t},\n\n\t\toperation: {\n\t\t\topen: false,\n\t\t\t...store?.operation,\n\t\t},\n\t\ttransactionStatus: {\n\t\t\tphase: `idle`,\n\t\t\t...store?.transactionStatus,\n\t\t},\n\t\tconfig: {\n\t\t\tlogger: {\n\t\t\t\t...console,\n\t\t\t\tinfo: doNothing,\n\t\t\t\t...store?.config?.logger,\n\t\t\t},\n\t\t\tlogger__INTERNAL: console,\n\t\t\t...store?.config,\n\t\t\tname,\n\t\t},\n\t} satisfies Store\n\n\tstore?.atoms.forEach((atom) => {\n\t\tconst copiedAtom = { ...atom, subject: new Subject() } satisfies Atom<any>\n\t\tcopiedStore.atoms = HAMT.set(atom.key, copiedAtom, copiedStore.atoms)\n\t})\n\tstore?.readonlySelectors.forEach((selector) => {\n\t\tselector.install(copiedStore)\n\t})\n\tstore?.selectors.forEach((selector) => {\n\t\tselector.install(copiedStore)\n\t})\n\tstore?.transactions.forEach((tx) => {\n\t\ttx.install(copiedStore)\n\t})\n\tstore?.timelines.forEach((timeline) => {\n\t\ttimeline.install(copiedStore)\n\t})\n\n\treturn copiedStore\n}\n\nexport const IMPLICIT = {\n\tSTORE_INTERNAL: undefined as Store | undefined,\n\tget STORE(): Store {\n\t\treturn this.STORE_INTERNAL ?? (this.STORE_INTERNAL = createStore(`DEFAULT`))\n\t},\n}\n\nexport const clearStore = (store: Store = IMPLICIT.STORE): void => {\n\tconst { config } = store\n\tObject.assign(store, createStore(config.name))\n\tstore.config = config\n}\n","import { isString } from \"fp-ts/string\"\n\nimport type { Json, JsonObj } from \"~/packages/anvl/src/json\"\n\nimport { isArray } from \"../array\"\nimport { hasExactProperties, isRecord } from \"../object/refinement\"\nimport { isLiteral } from \"../refinement\"\n\nexport const RELATION_TYPES = [`1:1`, `1:n`, `n:n`] as const\n\nexport type RelationType = typeof RELATION_TYPES[number]\n\nexport const isRelationType = (x: unknown): x is RelationType =>\n\tRELATION_TYPES.includes(x as RelationType)\n\nexport type RelationData<\n\tCONTENT extends JsonObj | null = null,\n\tA extends string = `from`,\n\tB extends string = `to`,\n> = {\n\tcontents: JsonObj<string, CONTENT>\n\trelations: JsonObj<string, string[]>\n\trelationType: RelationType\n\ta: A\n\tb: B\n}\n\nexport const EMPTY_RELATION_DATA: RelationData = {\n\tcontents: {},\n\trelations: {},\n\trelationType: `n:n`,\n\ta: `from`,\n\tb: `to`,\n}\n\nexport type IsRelationDataOptions<\n\tCONTENT extends JsonObj | null = null,\n\tA extends string = `from`,\n\tB extends string = `to`,\n> = {\n\tfrom?: A\n\tto?: B\n\tisContent?: (json: Json) => json is CONTENT\n}\nexport const isRelationData =\n\t<\n\t\tCONTENT extends JsonObj | null = null,\n\t\tA extends string = `from`,\n\t\tB extends string = `to`,\n\t>({\n\t\tfrom: a = `from` as A,\n\t\tto: b = `to` as B,\n\t\tisContent,\n\t}: IsRelationDataOptions<CONTENT, A, B> = {}) =>\n\t(input: unknown): input is RelationData<CONTENT, A, B> => {\n\t\treturn hasExactProperties<RelationData<CONTENT, A, B>>({\n\t\t\tcontents: isContent\n\t\t\t\t? isRecord(isString, isContent)\n\t\t\t\t: hasExactProperties({}),\n\t\t\trelations: isRecord(isString, isArray(isString)),\n\t\t\trelationType: isRelationType,\n\t\t\ta: isLiteral(a),\n\t\t\tb: isLiteral(b),\n\t\t})(input)\n\t}\n","import type { Refinement } from \"fp-ts/Refinement\"\n\nexport * from \"./refined\"\n\nexport const canExist = (_: unknown): _ is unknown => true\nexport const cannotExist = (_: unknown): _ is never => false\n\nexport const isLiteral =\n\t<T extends boolean | number | string>(value: T): Refinement<unknown, T> =>\n\t(input: unknown): input is T =>\n\t\tinput === value\n\nexport const isWithin =\n\t<Options extends ReadonlyArray<any>>(args: Options) =>\n\t(input: unknown): input is Options[number] =>\n\t\targs.includes(input as Options[number])\n\nexport const ensure =\n\t<T>(isType: Refinement<unknown, T>) =>\n\t(input: unknown): T => {\n\t\tif (!isType(input)) {\n\t\t\tthrow new TypeError(`Expected ${input} to be of type ${isType.name}`)\n\t\t}\n\t\treturn input as T\n\t}\n\nexport const ensureAgainst =\n\t<A, B>(isType: Refinement<unknown, A>) =>\n\t(input: A | B): Exclude<A | B, A> => {\n\t\tif (isType(input)) {\n\t\t\tthrow new TypeError(`Expected ${input} to not be of type ${isType.name}`)\n\t\t}\n\t\treturn input as Exclude<A | B, A>\n\t}\n\nexport type ExtendsSome<A, B> = Refinement<unknown, A | B> & {\n\tor: <C>(isType: Refinement<unknown, C>) => ExtendsSome<unknown, A | B | C>\n}\nexport const couldBe = <A>(\n\tisTypeA: Refinement<unknown, A>,\n\tlogging = false,\n\trefinements: Refinement<unknown, any>[] = [isTypeA],\n): {\n\t(input: unknown): input is A\n\tor: <B>(isTypeB: Refinement<unknown, B>) => ExtendsSome<A, B>\n} => {\n\tconst name = `(${refinements.map((r) => r.name || `anon`).join(` | `)})`\n\tconst _ = {\n\t\t[name]: (input: unknown): input is A =>\n\t\t\trefinements.some(\n\t\t\t\t(refinement) => (\n\t\t\t\t\tlogging &&\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\trefinements.map((r) => r.name || `anon`).join(` | `),\n\t\t\t\t\t\t\t`>`,\n\t\t\t\t\t\t\trefinement.name ?? `anon`,\n\t\t\t\t\t\t\t`:`,\n\t\t\t\t\t\t\trefinement(input),\n\t\t\t\t\t\t),\n\t\t\t\t\trefinement(input)\n\t\t\t\t),\n\t\t\t),\n\t}\n\tconst checkTypes: {\n\t\t(input: unknown): input is A\n\t\tor: <B>(isTypeB: Refinement<unknown, B>) => ExtendsSome<A, B>\n\t} = Object.assign(_[name], {\n\t\tor: <B>(isTypeB: Refinement<unknown, B>): ExtendsSome<A, B> =>\n\t\t\tcouldBe(isTypeB, logging, [...refinements, isTypeB]),\n\t})\n\treturn checkTypes\n}\n\nexport const isUnion = couldBe(cannotExist)\n\nexport type ExtendsAll<A, B> = Refinement<unknown, A & B> & {\n\tand: <C>(isType: Refinement<unknown, C>) => ExtendsAll<A & B, C>\n}\n\nexport const mustBe = <A>(\n\tisTypeA: Refinement<unknown, A>,\n\tlogging = false,\n\trefinements: Refinement<unknown, any>[] = [isTypeA],\n): {\n\t(input: unknown): input is A\n\tand: <B>(isTypeB: Refinement<unknown, B>) => ExtendsAll<A, B>\n} => {\n\tconst name = `(${refinements.map((r) => r.name || `anon`).join(` & `)})`\n\tconst _ = {\n\t\t[name]: (input: unknown): input is A =>\n\t\t\trefinements.every(\n\t\t\t\t(refinement) => (\n\t\t\t\t\tlogging &&\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\trefinements.map((r) => r.name || `anon`).join(` & `),\n\t\t\t\t\t\t\t`>`,\n\t\t\t\t\t\t\trefinement.name || `anon`,\n\t\t\t\t\t\t\t`:`,\n\t\t\t\t\t\t\trefinement(input),\n\t\t\t\t\t\t),\n\t\t\t\t\trefinement(input)\n\t\t\t\t),\n\t\t\t),\n\t}\n\tconst checkTypes: {\n\t\t(input: unknown): input is A\n\t\tand: <B>(isTypeB: Refinement<unknown, B>) => ExtendsAll<A, B>\n\t} = Object.assign(_[name], {\n\t\tand: <B>(isTypeB: Refinement<unknown, B>): ExtendsAll<A, B> =>\n\t\t\tmustBe(isTypeB, logging, [...refinements, isTypeB]) as ExtendsAll<A, B>,\n\t})\n\treturn checkTypes\n}\n\nexport const isIntersection = mustBe(canExist)\n\nexport type ClassSignature = abstract new (...args: any) => any\n\nexport const isClass =\n\t<CS extends ClassSignature>(signature: CS) =>\n\t(input: unknown): input is InstanceType<ClassSignature> =>\n\t\tinput instanceof signature\n","import type { RelationData } from \"./core-relation-data\"\nimport type { JsonObj } from \"../json\"\n\nexport const getRelatedIds = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tid: string,\n): string[] => relationMap.relations[id] ?? []\n\nexport const getRelatedId = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tid: string,\n): string | undefined => {\n\tconst relations = getRelatedIds(relationMap, id)\n\tif (relations.length > 1) {\n\t\tconsole.warn(\n\t\t\t`entry with id ${id} was not expected to have multiple relations`,\n\t\t)\n\t}\n\treturn relations[0]\n}\n","import type { Json, JsonInterface, JsonObj } from \"~/packages/anvl/src/json\"\n\nimport { Join } from \".\"\nimport type { IsRelationDataOptions, RelationData } from \"./core-relation-data\"\n\nexport const makeJsonInterface = <\n\tCONTENT extends JsonObj | null = null,\n\tA extends string = `from`,\n\tB extends string = `to`,\n>(\n\tjoin: Join<CONTENT, A, B>,\n\t...params: CONTENT extends null ? [] : [(x: Json) => x is CONTENT]\n): JsonInterface<Join<CONTENT, A, B>, RelationData<CONTENT, A, B>> => {\n\tconst isContent = params[0] as (x: Json) => x is CONTENT\n\tconst { a, b } = join\n\tconst options: IsRelationDataOptions<CONTENT, A, B> = {\n\t\tfrom: a,\n\t\tto: b,\n\t\tisContent,\n\t}\n\treturn {\n\t\ttoJson: (join) => join.toJSON(),\n\t\tfromJson: (json) => Join.fromJSON(json, options),\n\t}\n}\n","import { pipe } from \"fp-ts/function\"\n\nimport type { Identified } from \"~/packages/anvl/src/id/identified\"\nimport { isEmptyObject } from \"~/packages/anvl/src/object/refinement\"\n\nimport type { RelationData } from \"./core-relation-data\"\nimport { getRelatedIds } from \"./get-related-ids\"\nimport { getRelationEntries } from \"./relation-record\"\nimport { removeRelation } from \"./remove-relation\"\nimport { setRelationWithContent } from \"./set-relation\"\nimport type { JsonObj } from \"../json\"\nimport type { NullSafeRest } from \"../nullish\"\n\nexport const makeContentId = (idA: string, idB: string): string =>\n\t[idA, idB].sort().join(`/`)\n\nexport const getContent = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tidA: string,\n\tidB: string,\n): CONTENT | undefined => relationMap.contents[makeContentId(idA, idB)]\n\nexport const setContent = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tmap: RelationData<CONTENT, A, B>,\n\tidA: string,\n\tidB: string,\n\tcontent: CONTENT,\n): RelationData<CONTENT, A, B> => ({\n\t...map,\n\tcontents: {\n\t\t...map.contents,\n\t\t[makeContentId(idA, idB)]: content,\n\t},\n})\n\nexport const getRelations = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tid: string,\n): (CONTENT extends null ? Identified : CONTENT & Identified)[] =>\n\tgetRelationEntries(relationMap, id).map(\n\t\t([id, content]) =>\n\t\t\t({\n\t\t\t\tid,\n\t\t\t\t...content,\n\t\t\t}) as CONTENT extends null ? Identified : CONTENT & Identified,\n\t)\n\nexport const setRelations = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\tsubject: { [from in A]: string } | { [to in B]: string },\n\trelations: (CONTENT extends null ? Identified : CONTENT & Identified)[],\n): RelationData<CONTENT, A, B> => {\n\tconst idA: string | undefined = (subject as { [from in A]: string })[current.a]\n\tconst idB: string | undefined = (subject as { [to in B]: string })[current.b]\n\treturn pipe(\n\t\tcurrent,\n\t\t(relationData) => {\n\t\t\tconst relatedIds = getRelatedIds(current, idA)\n\t\t\tconst removedIds = relatedIds.filter(\n\t\t\t\t(id) => !relations.some((r) => r.id === id),\n\t\t\t)\n\t\t\tlet step = relationData\n\t\t\tfor (const id of removedIds) {\n\t\t\t\tconst remove = {\n\t\t\t\t\t[current.a]: idA ?? id,\n\t\t\t\t\t[current.b]: idB ?? id,\n\t\t\t\t} as Record<A | B, string>\n\t\t\t\tstep = removeRelation(step, remove)\n\t\t\t}\n\t\t\treturn step\n\t\t},\n\t\t(relationData) => {\n\t\t\tlet step = relationData\n\t\t\tfor (const { id, ...rest } of relations) {\n\t\t\t\tconst content = isEmptyObject(rest) ? undefined : rest\n\t\t\t\tstep = setRelationWithContent(\n\t\t\t\t\tstep,\n\t\t\t\t\t{ [current.a]: idA ?? id, [current.b]: idB ?? id } as Record<\n\t\t\t\t\t\tA | B,\n\t\t\t\t\t\tstring\n\t\t\t\t\t>,\n\t\t\t\t\t// @ts-expect-error hacky\n\t\t\t\t\tcontent as NullSafeRest<CONTENT>,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn step\n\t\t},\n\t\t(relationData) => {\n\t\t\tconst newlyOrderedIds = relations.map((r) => r.id)\n\t\t\treturn {\n\t\t\t\t...relationData,\n\t\t\t\trelations: {\n\t\t\t\t\t...relationData.relations,\n\t\t\t\t\t[idA ?? idB]: newlyOrderedIds,\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t)\n}\n","import type { RelationData } from \"./core-relation-data\"\nimport { getRelatedIds } from \"./get-related-ids\"\nimport { getContent } from \"./relation-contents\"\nimport type { JsonObj } from \"../json\"\n\nexport const getRelationEntries = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tidA: string,\n): [string, CONTENT][] =>\n\tgetRelatedIds(relationMap, idA).map((idB) => [\n\t\tidB,\n\t\tgetContent(relationMap, idA, idB) as CONTENT,\n\t])\n\nexport const getRelationRecord = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tid: string,\n): Record<string, CONTENT> =>\n\tObject.fromEntries(getRelationEntries(relationMap, id))\n","import { pipe } from \"fp-ts/function\"\nimport { isString } from \"fp-ts/string\"\n\nimport type { RelationData } from \"./core-relation-data\"\nimport { isEmptyArray, isOneOf, map } from \"../array\"\nimport { comprises } from \"../array/venn\"\nimport type { JsonObj } from \"../json\"\nimport type { RequireAtLeastOne } from \"../object\"\nimport { treeShake as removeProperties } from \"../object\"\nimport { entriesToRecord, recordToEntries } from \"../object/entries\"\nimport { split } from \"../string/split\"\n\nexport const removeSpecific = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\tidA: string,\n\tidB: string,\n): RelationData<CONTENT, A, B> => {\n\tconst isIdForRemoval = isOneOf(idA, idB)\n\treturn {\n\t\t...current,\n\t\trelations: pipe(\n\t\t\tcurrent.relations,\n\t\t\trecordToEntries,\n\t\t\tmap(([id, relations]): [id: string, fewerRelations: string[]] => [\n\t\t\t\tid,\n\t\t\t\tisIdForRemoval(id)\n\t\t\t\t\t? relations.filter((relation) => !isIdForRemoval(relation))\n\t\t\t\t\t: relations,\n\t\t\t]),\n\t\t\tentriesToRecord,\n\t\t\tremoveProperties(isEmptyArray),\n\t\t),\n\t\tcontents: pipe(\n\t\t\tcurrent.contents,\n\t\t\tremoveProperties(\n\t\t\t\t(_, key) =>\n\t\t\t\t\tisString(key) && pipe(key, split(`/`), comprises([idA, idB])),\n\t\t\t),\n\t\t),\n\t}\n}\n\nexport const removeAll = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\tidToRemove: string,\n): RelationData<CONTENT, A, B> => {\n\tconst next: RelationData<CONTENT, A, B> = {\n\t\t...current,\n\t\trelations: pipe(\n\t\t\tcurrent.relations,\n\t\t\trecordToEntries,\n\t\t\tmap(([id, relations]): [id: string, fewerRelations: string[]] => [\n\t\t\t\tid,\n\t\t\t\trelations.filter((relation) => relation !== idToRemove),\n\t\t\t]),\n\t\t\tentriesToRecord,\n\t\t\tremoveProperties((val, key) => key === idToRemove || isEmptyArray(val)),\n\t\t),\n\t\tcontents: pipe(\n\t\t\tcurrent.contents,\n\t\t\tremoveProperties(\n\t\t\t\t(_, key) => isString(key) && key.split(`/`).includes(idToRemove),\n\t\t\t),\n\t\t),\n\t}\n\treturn next\n}\n\nexport const removeRelation = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\trelation: Partial<Record<A | B, string>>,\n): RelationData<CONTENT, A, B> => {\n\tconst idA: string | undefined = (relation as { [key in A | B]: string })[\n\t\tcurrent.a\n\t]\n\tconst idB: string | undefined = (relation as { [key in A | B]: string })[\n\t\tcurrent.b\n\t]\n\treturn idB ? removeSpecific(current, idA, idB) : removeAll(current, idA)\n}\n","export const split = (separator: string) => (str: string): string[] =>\n\tstr.split(separator)\n","import type { RelationData } from \"./core-relation-data\"\nimport { getRelatedId } from \"./get-related-ids\"\nimport { setContent } from \"./relation-contents\"\nimport { addTo, isEmptyArray } from \"../array\"\nimport type { JsonObj } from \"../json\"\nimport type { NullSafeRest } from \"../nullish\"\nimport { treeShake as removeProperties } from \"../object\"\n\nexport const setManyToMany = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tmap: RelationData<CONTENT, A, B>,\n\tidA: string,\n\tidB: string,\n\t...rest: NullSafeRest<CONTENT>\n): RelationData<CONTENT, A, B> => {\n\tconst next = {\n\t\t...map,\n\t\trelations: {\n\t\t\t...map.relations,\n\t\t\t[idA]: addTo(map.relations[idA] ?? [])(idB),\n\t\t\t[idB]: addTo(map.relations[idB] ?? [])(idA),\n\t\t},\n\t}\n\tconst content = rest[0] as CONTENT | undefined\n\treturn content ? setContent(next, idA, idB, content) : next\n}\n\nconst removeEmpties = removeProperties(isEmptyArray)\n\nexport const set1ToMany = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\tleaderId: string,\n\tfollowerId: string,\n\t...rest: NullSafeRest<CONTENT>\n): RelationData<CONTENT, A, B> => {\n\tconst relations = { ...current.relations }\n\tconst prevLeaderId = getRelatedId(current, followerId)\n\tconst next = {\n\t\t...current,\n\t\trelations: removeEmpties({\n\t\t\t...relations,\n\t\t\t...(prevLeaderId &&\n\t\t\t\tprevLeaderId !== leaderId && {\n\t\t\t\t\t[prevLeaderId]: relations[prevLeaderId].filter(\n\t\t\t\t\t\t(id) => id !== followerId,\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t[followerId]: [leaderId],\n\t\t\t[leaderId]: addTo(relations[leaderId] ?? [])(followerId),\n\t\t}),\n\t}\n\tconst content = rest[0] as CONTENT | undefined\n\treturn content ? setContent(next, leaderId, followerId, content) : next\n}\n\nexport const set1To1 = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\twifeId: string,\n\thusbandId: string,\n\t...rest: NullSafeRest<CONTENT>\n): RelationData<CONTENT, A, B> => {\n\tconst prevWifeId = getRelatedId(current, husbandId)\n\tconst prevHusbandId = getRelatedId(current, wifeId)\n\tconst next = {\n\t\t...current,\n\t\trelations: removeEmpties({\n\t\t\t...current.relations,\n\t\t\t...(prevWifeId && { [prevWifeId]: [] }),\n\t\t\t...(prevHusbandId && { [prevHusbandId]: [] }),\n\t\t\t[wifeId]: [husbandId],\n\t\t\t[husbandId]: [wifeId],\n\t\t}),\n\t}\n\n\tconst content = rest[0] as CONTENT | undefined\n\treturn content ? setContent(next, wifeId, husbandId, content) : next\n}\n\nexport const setRelationWithContent = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\trelation: Record<A | B, string>,\n\t...rest: NullSafeRest<CONTENT>\n): RelationData<CONTENT, A, B> => {\n\tconst { [current.a]: idA, [current.b]: idB } = relation\n\t// console.log({\n\t// current,\n\t// relation,\n\t// idA,\n\t// idB,\n\t// })\n\tswitch (current.relationType) {\n\t\tcase `1:1`:\n\t\t\treturn set1To1(current, idA, idB, ...rest)\n\t\tcase `1:n`:\n\t\t\treturn set1ToMany(current, idA, idB, ...rest)\n\t\tcase `n:n`:\n\t\t\treturn setManyToMany(current, idA, idB, ...rest)\n\t}\n}\n","import type { Refinement } from \"fp-ts/Refinement\"\n\nimport type { Identified } from \"~/packages/anvl/src/id/identified\"\n\nimport type { IsRelationDataOptions, RelationData } from \"./core-relation-data\"\nimport { EMPTY_RELATION_DATA, isRelationData } from \"./core-relation-data\"\nimport { getRelatedId, getRelatedIds } from \"./get-related-ids\"\nimport { makeJsonInterface } from \"./make-json-interface\"\nimport { getContent, getRelations, setRelations } from \"./relation-contents\"\nimport { getRelationEntries, getRelationRecord } from \"./relation-record\"\nimport { removeRelation } from \"./remove-relation\"\nimport { setRelationWithContent } from \"./set-relation\"\nimport type { Json, JsonInterface, JsonObj } from \"../json\"\nimport type { NullSafeRest, NullSafeUnion } from \"../nullish\"\n\nexport class Join<\n\tCONTENT extends JsonObj | null = null,\n\tA extends string = `from`,\n\tB extends string = `to`,\n> implements RelationData<CONTENT, A, B>\n{\n\tpublic readonly relationType: `1:1` | `1:n` | `n:n`\n\tpublic readonly a: A = `from` as A\n\tpublic readonly b: B = `to` as B\n\tpublic readonly relations: Record<string, string[]>\n\tpublic readonly contents: Record<string, CONTENT>\n\tpublic constructor(json?: Partial<RelationData<CONTENT, A, B>>) {\n\t\tObject.assign(this, {\n\t\t\t...EMPTY_RELATION_DATA,\n\t\t\t...json,\n\t\t\tmakeJsonInterface: this.makeJsonInterface,\n\t\t})\n\t}\n\tpublic toJSON(): RelationData<CONTENT, A, B> {\n\t\treturn {\n\t\t\trelationType: this.relationType,\n\t\t\trelations: this.relations,\n\t\t\tcontents: this.contents,\n\t\t\ta: this.a,\n\t\t\tb: this.b,\n\t\t}\n\t}\n\tpublic static fromJSON<\n\t\tCONTENT extends JsonObj | null,\n\t\tA extends string,\n\t\tB extends string,\n\t>(\n\t\tjson: Json,\n\t\toptions?: IsRelationDataOptions<CONTENT, A, B>,\n\t): Join<CONTENT, A, B> {\n\t\tconst isValid = isRelationData<CONTENT, A, B>(options)(json)\n\t\tif (isValid) {\n\t\t\treturn new Join<CONTENT, A, B>(json)\n\t\t}\n\t\tthrow new Error(\n\t\t\t`Saved JSON for this Join is invalid: ${JSON.stringify(json)}`,\n\t\t)\n\t}\n\n\tpublic from<AA extends string>(newA: AA): Join<CONTENT, AA, B> {\n\t\treturn new Join({ ...this, a: newA })\n\t}\n\n\tpublic to<BB extends string>(newB: BB): Join<CONTENT, A, BB> {\n\t\treturn new Join({ ...this, b: newB })\n\t}\n\n\tpublic makeJsonInterface = (\n\t\t...params: CONTENT extends null ? [] : [Refinement<unknown, CONTENT>]\n\t): JsonInterface<Join<CONTENT, A, B>, RelationData<CONTENT, A, B>> => {\n\t\treturn makeJsonInterface<CONTENT, A, B>(this, ...params)\n\t}\n\n\tpublic getRelatedId(id: string): string | undefined {\n\t\treturn getRelatedId(this, id)\n\t}\n\tpublic getRelatedIds(id: string): string[] {\n\t\treturn getRelatedIds(this, id)\n\t}\n\tpublic getContent(idA: string, idB: string): CONTENT | undefined {\n\t\treturn getContent(this, idA, idB)\n\t}\n\tpublic getRelationEntries(id: string): [string, CONTENT][] {\n\t\treturn getRelationEntries(this, id)\n\t}\n\tpublic getRelationRecord(id: string): Record<string, CONTENT> {\n\t\treturn getRelationRecord(this, id)\n\t}\n\tpublic getRelation(\n\t\tid: string,\n\t): NullSafeUnion<Identified, CONTENT> | undefined {\n\t\treturn getRelations(this, id)[0]\n\t}\n\tpublic getRelations(id: string): NullSafeUnion<Identified, CONTENT>[] {\n\t\treturn getRelations(this, id)\n\t}\n\tpublic setRelations(\n\t\tsubject: { [from in A]: string } | { [to in B]: string },\n\t\trelations: NullSafeUnion<Identified, CONTENT>[],\n\t): Join<CONTENT, A, B> {\n\t\treturn new Join(setRelations(this, subject, relations))\n\t}\n\tpublic set(\n\t\trelation: { [key in A | B]: string },\n\t\t...rest: NullSafeRest<CONTENT>\n\t): Join<CONTENT, A, B> {\n\t\treturn new Join(setRelationWithContent(this, relation, ...rest))\n\t}\n\tpublic remove(relation: Partial<Record<A | B, string>>): Join<CONTENT, A, B> {\n\t\treturn new Join(\n\t\t\tremoveRelation(this, relation as Partial<Record<A | B, string>>),\n\t\t)\n\t}\n}\n","import HAMT from \"hamt_plus\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\n\nimport type { Store, StoreCore } from \".\"\nimport {\n\tSubject,\n\tabortTransaction,\n\tapplyTransaction,\n\tbuildTransaction,\n\tdeposit,\n\tIMPLICIT,\n} from \".\"\nimport type { TransactionOptions, TransactionToken, TransactionUpdate } from \"..\"\nimport { getState, setState } from \"..\"\n\nexport type Transaction<ƒ extends ƒn> = {\n\tkey: string\n\ttype: `transaction`\n\tinstall: (store: Store) => void\n\tsubject: Subject<TransactionUpdate<ƒ>>\n\trun: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>\n}\n\nexport function transaction__INTERNAL<ƒ extends ƒn>(\n\toptions: TransactionOptions<ƒ>,\n\tstore: Store = IMPLICIT.STORE,\n): TransactionToken<ƒ> {\n\tconst newTransaction: Transaction<ƒ> = {\n\t\tkey: options.key,\n\t\ttype: `transaction`,\n\t\trun: (...params: Parameters<ƒ>) => {\n\t\t\tbuildTransaction(options.key, params, store)\n\t\t\ttry {\n\t\t\t\tconst output = options.do(\n\t\t\t\t\t{\n\t\t\t\t\t\tget: (token) => getState(token, store),\n\t\t\t\t\t\tset: (token, value) => setState(token, value, store),\n\t\t\t\t\t},\n\t\t\t\t\t...params,\n\t\t\t\t)\n\t\t\t\tapplyTransaction(output, store)\n\t\t\t\treturn output\n\t\t\t} catch (thrown) {\n\t\t\t\tabortTransaction(store)\n\t\t\t\tstore.config.logger?.error(`Transaction ${options.key} failed`, thrown)\n\t\t\t\tthrow thrown\n\t\t\t}\n\t\t},\n\t\tinstall: (store) => transaction__INTERNAL(options, store),\n\t\tsubject: new Subject(),\n\t}\n\tconst core = target(store)\n\tcore.transactions = HAMT.set(\n\t\tnewTransaction.key,\n\t\tnewTransaction,\n\t\tcore.transactions,\n\t)\n\tconst token = deposit(newTransaction)\n\tstore.subject.transactionCreation.next(token)\n\treturn token\n}\n\nexport const target = (store: Store = IMPLICIT.STORE): StoreCore =>\n\tstore.transactionStatus.phase === `building`\n\t\t? store.transactionStatus.core\n\t\t: store\n","import { pipe } from \"fp-ts/function\"\n\nexport * from \"./refine\"\nexport * from \"./json-interface\"\n\nexport const serializeSet = <T>(set: Set<T>): string =>\n\tpipe(set, Array.from, JSON.stringify)\n\nexport const deserializeSet = <T>(str: string): Set<T> =>\n\tpipe(str, JSON.parse, Array.from, (a) => new Set(a as T[]))\n\nexport type Primitive = boolean | number | string | null\n\nexport type Serializable =\n\t| Primitive\n\t| Readonly<{ [key: string]: Serializable }>\n\t| ReadonlyArray<Serializable>\n\nexport type JsonObj<\n\tKey extends string = string,\n\tValue extends Serializable = Serializable,\n> = Record<Key, Value>\n\nexport type JsonArr<Element extends Serializable = Serializable> =\n\tReadonlyArray<Element>\n\nexport type Json = JsonArr | JsonObj | Primitive\n\nexport const parseJson = <S extends Stringified<Json>>(\n\tstr: S | string,\n): S extends Stringified<infer J> ? J : Json => JSON.parse(str)\n\nexport type Stringified<J extends Json> = string & { __json: J }\n\nexport const stringifyJson = <J extends Json>(json: J): Stringified<J> =>\n\tJSON.stringify(json) as Stringified<J>\n\nexport type Empty = Record<string, never>\n\nexport const JSON_TYPE_NAMES = [\n\t`array`,\n\t`boolean`,\n\t`null`,\n\t`number`,\n\t`object`,\n\t`string`,\n] as const\n\nexport type JsonTypeName = typeof JSON_TYPE_NAMES[number]\n\nexport interface JsonTypes extends Record<JsonTypeName, Json> {\n\tarray: JsonArr\n\tboolean: boolean\n\tnull: null\n\tnumber: number\n\tobject: JsonObj\n\tstring: string\n}\n\nexport const JSON_DEFAULTS: JsonTypes = {\n\tarray: [],\n\tboolean: false,\n\tnull: null,\n\tnumber: 0,\n\tobject: {},\n\tstring: ``,\n}\n","import { isBoolean } from \"fp-ts/boolean\"\nimport { isNumber } from \"fp-ts/number\"\nimport { isString } from \"fp-ts/string\"\n\nimport { isPlainObject } from \"~/packages/anvl/src/object/refinement\"\n\nimport { stringifyJson } from \".\"\nimport type { JsonArr, JsonObj, Json } from \".\"\nimport { attempt, raiseError } from \"../function\"\n\nconst JSON_PROTOTYPES = [\n\t`Array`,\n\t`Boolean`,\n\t`Number`,\n\t`Object`,\n\t`String`,\n] as const\n\nexport type RefinedJson =\n\t| { type: `array`; data: JsonArr }\n\t| { type: `boolean`; data: boolean }\n\t| { type: `null`; data: null }\n\t| { type: `number`; data: number }\n\t| { type: `object`; data: JsonObj }\n\t| { type: `string`; data: string }\n\nexport const refineJsonType = (data: Json): RefinedJson =>\n\tdata === null\n\t\t? { type: `null`, data: null }\n\t\t: isBoolean(data)\n\t\t? { type: `boolean`, data }\n\t\t: isNumber(data)\n\t\t? { type: `number`, data }\n\t\t: isString(data)\n\t\t? { type: `string`, data }\n\t\t: Array.isArray(data)\n\t\t? { type: `array`, data }\n\t\t: isPlainObject(data)\n\t\t? { type: `object`, data }\n\t\t: raiseError(\n\t\t\t\tdata === undefined\n\t\t\t\t\t? `undefined passed to refineJsonType. This is not valid JSON.`\n\t\t\t\t\t: `${stringifyJson(data)} with prototype \"${\n\t\t\t\t\t\t\tObject.getPrototypeOf(data).constructor.name\n\t\t\t\t\t }\" passed to refineJsonType. This is not valid JSON.`,\n\t\t )\nexport const isJson = (input: unknown): input is Json => {\n\tif (input === null) return true\n\tif (input === undefined) return false\n\tconst prototype = Object.getPrototypeOf(input)?.constructor.name\n\tconst isJson = JSON_PROTOTYPES.includes(prototype)\n\treturn isJson\n}\n\nexport const isPlainJson = (input: unknown): input is Json =>\n\tattempt(() => isJson(input) && refineJsonType(input))\n","import type { Serializable } from \"~/packages/anvl/src/json\"\nimport { stringifyJson } from \"~/packages/anvl/src/json\"\n\nimport type { Store } from \".\"\nimport {\n\tSubject,\n\tatom__INTERNAL,\n\twithdraw,\n\tselector__INTERNAL,\n\ttarget,\n\tdeposit,\n\tIMPLICIT,\n} from \".\"\nimport type {\n\tAtomFamily,\n\tAtomFamilyOptions,\n\tAtomToken,\n\tFamilyMetadata,\n\tReadonlySelectorFamily,\n\tReadonlySelectorFamilyOptions,\n\tReadonlySelectorToken,\n\tSelectorFamily,\n\tSelectorFamilyOptions,\n\tSelectorToken,\n} from \"..\"\n\nexport function atomFamily__INTERNAL<T, K extends Serializable>(\n\toptions: AtomFamilyOptions<T, K>,\n\tstore: Store = IMPLICIT.STORE,\n): AtomFamily<T, K> {\n\tconst subject = new Subject<AtomToken<T>>()\n\treturn Object.assign(\n\t\t(key: K): AtomToken<T> => {\n\t\t\tconst subKey = stringifyJson(key)\n\t\t\tconst family: FamilyMetadata = { key: options.key, subKey }\n\t\t\tconst fullKey = `${options.key}(${subKey})`\n\t\t\tconst existing = withdraw({ key: fullKey, type: `atom` }, store)\n\t\t\tconst token: AtomToken<any> = existing\n\t\t\t\t? deposit(existing)\n\t\t\t\t: atom__INTERNAL<T>(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: fullKey,\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\toptions.default instanceof Function\n\t\t\t\t\t\t\t\t\t? options.default(key)\n\t\t\t\t\t\t\t\t\t: options.default,\n\t\t\t\t\t\t\teffects: options.effects?.(key),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfamily,\n\t\t\t\t\t\tstore,\n\t\t\t\t )\n\t\t\tsubject.next(token)\n\t\t\treturn token\n\t\t},\n\t\t{\n\t\t\tkey: options.key,\n\t\t\ttype: `atom_family`,\n\t\t\tsubject,\n\t\t} as const,\n\t)\n}\n\nexport function readonlySelectorFamily__INTERNAL<T, K extends Serializable>(\n\toptions: ReadonlySelectorFamilyOptions<T, K>,\n\tstore?: Store,\n): ReadonlySelectorFamily<T, K> {\n\tconst core = target(store)\n\tconst subject = new Subject<ReadonlySelectorToken<T>>()\n\treturn Object.assign(\n\t\t(key: K): ReadonlySelectorToken<T> => {\n\t\t\tconst subKey = stringifyJson(key)\n\t\t\tconst family: FamilyMetadata = { key: options.key, subKey }\n\t\t\tconst fullKey = `${options.key}(${subKey})`\n\t\t\tconst existing = core.readonlySelectors.get(fullKey)\n\t\t\tif (existing) {\n\t\t\t\treturn deposit(existing)\n\t\t\t}\n\t\t\treturn selector__INTERNAL<T>(\n\t\t\t\t{\n\t\t\t\t\tkey: fullKey,\n\t\t\t\t\tget: options.get(key),\n\t\t\t\t},\n\t\t\t\tfamily,\n\t\t\t\tstore,\n\t\t\t) as ReadonlySelectorToken<T>\n\t\t},\n\t\t{\n\t\t\tkey: options.key,\n\t\t\ttype: `readonly_selector_family`,\n\t\t\tsubject,\n\t\t} as const,\n\t) as ReadonlySelectorFamily<T, K>\n}\n\nexport function selectorFamily__INTERNAL<T, K extends Serializable>(\n\toptions: SelectorFamilyOptions<T, K>,\n\tstore?: Store,\n): SelectorFamily<T, K>\nexport function selectorFamily__INTERNAL<T, K extends Serializable>(\n\toptions: ReadonlySelectorFamilyOptions<T, K>,\n\tstore?: Store,\n): ReadonlySelectorFamily<T, K>\nexport function selectorFamily__INTERNAL<T, K extends Serializable>(\n\toptions: ReadonlySelectorFamilyOptions<T, K> | SelectorFamilyOptions<T, K>,\n\tstore: Store = IMPLICIT.STORE,\n): ReadonlySelectorFamily<T, K> | SelectorFamily<T, K> {\n\tconst isReadonly = !(`set` in options)\n\n\tif (isReadonly) {\n\t\treturn readonlySelectorFamily__INTERNAL(options, store)\n\t}\n\tconst core = target(store)\n\tconst subject = new Subject<SelectorToken<T>>()\n\n\treturn Object.assign(\n\t\t(key: K): SelectorToken<T> => {\n\t\t\tconst subKey = stringifyJson(key)\n\t\t\tconst family: FamilyMetadata = { key: options.key, subKey }\n\t\t\tconst fullKey = `${options.key}(${subKey})`\n\t\t\tconst existing = core.selectors.get(fullKey)\n\t\t\tif (existing) {\n\t\t\t\treturn deposit(existing)\n\t\t\t}\n\t\t\tconst token = selector__INTERNAL<T>(\n\t\t\t\t{\n\t\t\t\t\tkey: fullKey,\n\t\t\t\t\tget: options.get(key),\n\t\t\t\t\tset: options.set(key),\n\t\t\t\t},\n\t\t\t\tfamily,\n\t\t\t\tstore,\n\t\t\t)\n\t\t\tsubject.next(token)\n\t\t\treturn token\n\t\t},\n\t\t{\n\t\t\tkey: options.key,\n\t\t\ttype: `selector_family`,\n\t\t} as const,\n\t) as SelectorFamily<T, K>\n}\n","import type { Store } from \"..\"\nimport { target, lookup } from \"..\"\nimport type { AtomToken, ReadonlySelectorToken, SelectorToken } from \"../..\"\n\nexport const lookupSelectorSources = (\n\tkey: string,\n\tstore: Store,\n): (\n\t| AtomToken<unknown>\n\t| ReadonlySelectorToken<unknown>\n\t| SelectorToken<unknown>\n)[] =>\n\ttarget(store)\n\t\t.selectorGraph.getRelations(key)\n\t\t.filter(({ source }) => source !== key)\n\t\t.map(({ source }) => lookup(source, store))\n","import { lookupSelectorSources } from \"./lookup-selector-sources\"\nimport type { Store, AtomToken, ReadonlySelectorToken, StateToken } from \"../..\"\n\nexport const traceSelectorAtoms = (\n\tselectorKey: string,\n\tdependency: ReadonlySelectorToken<unknown> | StateToken<unknown>,\n\tstore: Store,\n): AtomToken<unknown>[] => {\n\tconst roots: AtomToken<unknown>[] = []\n\n\tconst sources = lookupSelectorSources(dependency.key, store)\n\tlet depth = 0\n\twhile (sources.length > 0) {\n\t\t// rome-ignore lint/style/noNonNullAssertion: just checked length ^^^\n\t\tconst source = sources.shift()!\n\t\t++depth\n\t\tif (depth > 999) {\n\t\t\tthrow new Error(\n\t\t\t\t`Maximum selector dependency depth exceeded in selector \"${selectorKey}\".`,\n\t\t\t)\n\t\t}\n\n\t\tif (source.type !== `atom`) {\n\t\t\tsources.push(...lookupSelectorSources(source.key, store))\n\t\t} else {\n\t\t\troots.push(source)\n\t\t}\n\t}\n\n\treturn roots\n}\n\nexport const traceAllSelectorAtoms = (\n\tselectorKey: string,\n\tstore: Store,\n): AtomToken<unknown>[] => {\n\tconst sources = lookupSelectorSources(selectorKey, store)\n\treturn sources.flatMap((source) =>\n\t\tsource.type === `atom`\n\t\t\t? source\n\t\t\t: traceSelectorAtoms(selectorKey, source, store),\n\t)\n}\n","import HAMT from \"hamt_plus\"\n\nimport { become } from \"~/packages/anvl/src/function\"\n\nimport type { Atom, Selector, Store } from \".\"\nimport {\n\tIMPLICIT,\n\tcacheValue,\n\temitUpdate,\n\tevictCachedValue,\n\tgetState__INTERNAL,\n\tisAtomDefault,\n\tisDone,\n\tmarkAtomAsNotDefault,\n\tmarkDone,\n\tstowUpdate,\n\ttarget,\n} from \".\"\n\nexport const evictDownStream = <T>(\n\tstate: Atom<T>,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tconst downstream = core.selectorAtoms.getRelations(state.key)\n\tconst downstreamKeys = downstream.map(({ id }) => id)\n\tstore.config.logger?.info(\n\t\t` || ${downstreamKeys.length} downstream:`,\n\t\tdownstreamKeys,\n\t)\n\tif (core.operation.open) {\n\t\tstore.config.logger?.info(` ||`, [...core.operation.done], `already done`)\n\t}\n\tdownstream.forEach(({ id: stateKey }) => {\n\t\tif (isDone(stateKey, store)) {\n\t\t\tstore.config.logger?.info(` || ${stateKey} already done`)\n\t\t\treturn\n\t\t}\n\t\tconst state =\n\t\t\tHAMT.get(stateKey, core.selectors) ??\n\t\t\tHAMT.get(stateKey, core.readonlySelectors)\n\t\tif (!state) {\n\t\t\tstore.config.logger?.info(\n\t\t\t\t` || ${stateKey} is an atom, and can't be downstream`,\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tevictCachedValue(stateKey, store)\n\t\tstore.config.logger?.info(` xx evicted \"${stateKey}\"`)\n\n\t\tmarkDone(stateKey, store)\n\t})\n}\n\nexport const setAtomState = <T>(\n\tatom: Atom<T>,\n\tnext: T | ((oldValue: T) => T),\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst oldValue = getState__INTERNAL(atom, store)\n\tconst newValue = become(next)(oldValue)\n\tstore.config.logger?.info(`<< setting atom \"${atom.key}\" to`, newValue)\n\tcacheValue(atom.key, newValue, store)\n\tif (isAtomDefault(atom.key, store)) {\n\t\tmarkAtomAsNotDefault(atom.key, store)\n\t}\n\tmarkDone(atom.key, store)\n\tstore.config.logger?.info(\n\t\t` || evicting caches downstream from \"${atom.key}\"`,\n\t)\n\tevictDownStream(atom, store)\n\tconst update = { oldValue, newValue }\n\tif (store.transactionStatus.phase !== `building`) {\n\t\temitUpdate(atom, update, store)\n\t} else {\n\t\tstowUpdate(atom, update, store)\n\t}\n}\nexport const setSelectorState = <T>(\n\tselector: Selector<T>,\n\tnext: T | ((oldValue: T) => T),\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst oldValue = getState__INTERNAL(selector, store)\n\tconst newValue = become(next)(oldValue)\n\n\tstore.config.logger?.info(`<< setting selector \"${selector.key}\" to`, newValue)\n\tstore.config.logger?.info(` || propagating change made to \"${selector.key}\"`)\n\n\tselector.set(newValue)\n}\nexport const setState__INTERNAL = <T>(\n\tstate: Atom<T> | Selector<T>,\n\tvalue: T | ((oldValue: T) => T),\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tif (`set` in state) {\n\t\tsetSelectorState(state, value, store)\n\t} else {\n\t\tsetAtomState(state, value, store)\n\t}\n}\n","type Subscriber<T> = (value: T) => void\n\nexport class Subject<T> {\n\tpublic subscribers: Subscriber<T>[] = []\n\n\tpublic subscribe(subscriber: Subscriber<T>): { unsubscribe: () => void } {\n\t\tthis.subscribers.push(subscriber)\n\t\tconst unsubscribe = () => this.unsubscribe(subscriber)\n\t\treturn { unsubscribe }\n\t}\n\n\tprivate unsubscribe(subscriber: Subscriber<T>) {\n\t\tconst subscriberIndex = this.subscribers.indexOf(subscriber)\n\t\tif (subscriberIndex !== -1) {\n\t\t\tthis.subscribers.splice(subscriberIndex, 1)\n\t\t}\n\t}\n\n\tpublic next(value: T): void {\n\t\tfor (const subscriber of this.subscribers) {\n\t\t\tsubscriber(value)\n\t\t}\n\t}\n}\n","import type { Atom, ReadonlySelector, Selector, Store } from \".\"\nimport {\n\tgetState__INTERNAL,\n\twithdraw,\n\trecallState,\n\ttraceAllSelectorAtoms,\n} from \".\"\nimport type { StateUpdate } from \"..\"\n\nexport const prepareUpdate = <T>(\n\tstate: Atom<T> | ReadonlySelector<T> | Selector<T>,\n\tstore: Store,\n): StateUpdate<T> => {\n\tconst oldValue = recallState(state, store)\n\tconst newValue = getState__INTERNAL(state, store)\n\treturn { newValue, oldValue }\n}\n\nexport const stowUpdate = <T>(\n\tstate: Atom<T>,\n\tupdate: StateUpdate<T>,\n\tstore: Store,\n): void => {\n\tconst { key } = state\n\tconst { logger } = store.config\n\tif (store.transactionStatus.phase !== `building`) {\n\t\tstore.config.logger?.warn(\n\t\t\t`stowUpdate called outside of a transaction. This is probably a bug.`,\n\t\t)\n\t\treturn\n\t}\n\tstore.transactionStatus.atomUpdates.push({ key, ...update })\n\tlogger?.info(`📝 ${key} stowed (`, update.oldValue, `->`, update.newValue, `)`)\n}\n\nexport const emitUpdate = <T>(\n\tstate: Atom<T> | ReadonlySelector<T> | Selector<T>,\n\tupdate: StateUpdate<T>,\n\tstore: Store,\n): void => {\n\tconst { key } = state\n\tconst { logger } = store.config\n\tlogger?.info(\n\t\t`📢 ${state.type} \"${key}\" went (`,\n\t\tupdate.oldValue,\n\t\t`->`,\n\t\tupdate.newValue,\n\t\t`)`,\n\t)\n\tstate.subject.next(update)\n}\n\nexport const subscribeToRootAtoms = <T>(\n\tstate: ReadonlySelector<T> | Selector<T>,\n\tstore: Store,\n): { unsubscribe: () => void }[] | null => {\n\tconst dependencySubscriptions =\n\t\t`default` in state\n\t\t\t? null\n\t\t\t: traceAllSelectorAtoms(state.key, store).map((atomToken) => {\n\t\t\t\t\tconst atom = withdraw(atomToken, store)\n\t\t\t\t\tif (atom === null) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Atom \"${atomToken.key}\", a dependency of selector \"${state.key}\", not found in store \"${store.config.name}\".`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\treturn atom.subject.subscribe((atomChange) => {\n\t\t\t\t\t\tstore.config.logger?.info(\n\t\t\t\t\t\t\t`📢 selector \"${state.key}\" saw root \"${atomToken.key}\" go (`,\n\t\t\t\t\t\t\tatomChange.oldValue,\n\t\t\t\t\t\t\t`->`,\n\t\t\t\t\t\t\tatomChange.newValue,\n\t\t\t\t\t\t\t`)`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tconst oldValue = recallState(state, store)\n\t\t\t\t\t\tconst newValue = getState__INTERNAL(state, store)\n\t\t\t\t\t\tstore.config.logger?.info(` <- ${state.key} became`, newValue)\n\t\t\t\t\t\tstate.subject.next({ newValue, oldValue })\n\t\t\t\t\t})\n\t\t\t })\n\treturn dependencySubscriptions\n}\n","import type { Serializable } from \"~/packages/anvl/src/json\"\n\nimport type { AtomToken } from \".\"\nimport type { Subject } from \"./internal\"\nimport { atomFamily__INTERNAL, atom__INTERNAL } from \"./internal\"\n\nexport type Effectors<T> = {\n\tsetSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void\n\tonSet: (callback: (options: { newValue: T; oldValue: T }) => void) => void\n}\n\nexport type AtomEffect<T> = (tools: Effectors<T>) => void\n\nexport type AtomOptions<T> = {\n\tkey: string\n\tdefault: T | (() => T)\n\teffects?: AtomEffect<T>[]\n}\n\nexport function atom<T>(options: AtomOptions<T>): AtomToken<T> {\n\treturn atom__INTERNAL<T>(options)\n}\n\nexport type AtomFamilyOptions<T, K extends Serializable> = {\n\tkey: string\n\tdefault: T | ((key: K) => T)\n\teffects?: (key: K) => AtomEffect<T>[]\n}\n\nexport type AtomFamily<T, K extends Serializable = Serializable> = ((\n\tkey: K,\n) => AtomToken<T>) & {\n\tkey: string\n\ttype: `atom_family`\n\tsubject: Subject<AtomToken<T>>\n}\n\nexport function atomFamily<T, K extends Serializable>(\n\toptions: AtomFamilyOptions<T, K>,\n): AtomFamily<T, K> {\n\treturn atomFamily__INTERNAL<T, K>(options)\n}\n","import type { ƒn } from \"~/packages/anvl/src/function\"\n\nimport type {\n\tReadonlySelectorToken,\n\tStateToken,\n\tTimelineToken,\n\tTimelineUpdate,\n\tTransactionToken,\n\tTransactionUpdate,\n} from \".\"\nimport type { Store } from \"./internal\"\nimport { IMPLICIT, subscribeToRootAtoms, withdraw } from \"./internal\"\n\nexport type StateUpdate<T> = { newValue: T; oldValue: T }\nexport type KeyedStateUpdate<T> = StateUpdate<T> & { key: string }\nexport type UpdateHandler<T> = (update: StateUpdate<T>) => void\n\nexport const subscribe = <T>(\n\ttoken: ReadonlySelectorToken<T> | StateToken<T>,\n\thandleUpdate: UpdateHandler<T>,\n\tstore: Store = IMPLICIT.STORE,\n): (() => void) => {\n\tconst state = withdraw<T>(token, store)\n\tif (state === null) {\n\t\tthrow new Error(\n\t\t\t`State \"${token.key}\" not found in this store. Did you forget to initialize with the \"atom\" or \"selector\" function?`,\n\t\t)\n\t}\n\tconst subscription = state.subject.subscribe(handleUpdate)\n\tstore.config.logger?.info(`👀 subscribe to \"${state.key}\"`)\n\tconst dependencySubscriptions =\n\t\tstate.type !== `atom` ? subscribeToRootAtoms(state, store) : null\n\n\tconst unsubscribe =\n\t\tdependencySubscriptions === null\n\t\t\t? () => {\n\t\t\t\t\tstore.config.logger?.info(`🙈 unsubscribe from \"${state.key}\"`)\n\t\t\t\t\tsubscription.unsubscribe()\n\t\t\t }\n\t\t\t: () => {\n\t\t\t\t\tstore.config.logger?.info(\n\t\t\t\t\t\t`🙈 unsubscribe from \"${state.key}\" and its dependencies`,\n\t\t\t\t\t)\n\t\t\t\t\tsubscription.unsubscribe()\n\t\t\t\t\tfor (const dependencySubscription of dependencySubscriptions) {\n\t\t\t\t\t\tdependencySubscription.unsubscribe()\n\t\t\t\t\t}\n\t\t\t }\n\n\treturn unsubscribe\n}\n\nexport type TransactionUpdateHandler<ƒ extends ƒn> = (\n\tdata: TransactionUpdate<ƒ>,\n) => void\n\nexport const subscribeToTransaction = <ƒ extends ƒn>(\n\ttoken: TransactionToken<ƒ>,\n\thandleUpdate: TransactionUpdateHandler<ƒ>,\n\tstore = IMPLICIT.STORE,\n): (() => void) => {\n\tconst tx = withdraw(token, store)\n\tif (tx === null) {\n\t\tthrow new Error(\n\t\t\t`Cannot subscribe to transaction \"${token.key}\": transaction not found in store \"${store.config.name}\".`,\n\t\t)\n\t}\n\tstore.config.logger?.info(`👀 subscribe to transaction \"${token.key}\"`)\n\tconst subscription = tx.subject.subscribe(handleUpdate)\n\tconst unsubscribe = () => {\n\t\tstore.config.logger?.info(`🙈 unsubscribe from transaction \"${token.key}\"`)\n\t\tsubscription.unsubscribe()\n\t}\n\treturn unsubscribe\n}\n\nexport const subscribeToTimeline = (\n\ttoken: TimelineToken,\n\thandleUpdate: (update: TimelineUpdate) => void,\n\tstore = IMPLICIT.STORE,\n): (() => void) => {\n\tconst tl = withdraw(token, store)\n\tif (tl === null) {\n\t\tthrow new Error(\n\t\t\t`Cannot subscribe to timeline \"${token.key}\": timeline not found in store \"${store.config.name}\".`,\n\t\t)\n\t}\n\tstore.config.logger?.info(`👀 subscribe to timeline \"${token.key}\"`)\n\tconst subscription = tl.subject.subscribe(handleUpdate)\n\tconst unsubscribe = () => {\n\t\tstore.config.logger?.info(`🙈 unsubscribe from timeline \"${token.key}\"`)\n\t\tsubscription.unsubscribe()\n\t}\n\treturn unsubscribe\n}\n","import { capitalize } from \"~/packages/anvl/src/string/capitalize\"\n\nimport {\n\tIMPLICIT,\n\tcloseOperation,\n\topenOperation,\n\tgetState__INTERNAL,\n\tsetState__INTERNAL,\n\tisAtomDefault,\n\tisSelectorDefault,\n\twithdraw,\n} from \"./internal\"\nimport * as __INTERNAL__ from \"./internal\"\nimport type { Store } from \"./internal/store\"\n\nexport * from \"./atom\"\nexport * from \"./logger\"\nexport * from \"./selector\"\nexport * from \"./silo\"\nexport * from \"./subscribe\"\nexport * from \"./timeline\"\nexport * from \"./transaction\"\nexport { __INTERNAL__ }\nexport type { Store } from \"./internal/store\"\nexport type { Serializable } from \"~/packages/anvl/src/json\"\n\nexport type AtomToken<_> = {\n\tkey: string\n\ttype: `atom`\n\tfamily?: FamilyMetadata\n\t__brand?: _\n}\nexport type SelectorToken<_> = {\n\tkey: string\n\ttype: `selector`\n\tfamily?: FamilyMetadata\n\t__brand?: _\n}\nexport type StateToken<T> = AtomToken<T> | SelectorToken<T>\n\nexport type ReadonlySelectorToken<_> = {\n\tkey: string\n\ttype: `readonly_selector`\n\tfamily?: FamilyMetadata\n\t__brand?: _\n}\n\nexport type FamilyMetadata = {\n\tkey: string\n\tsubKey: string\n}\n\nexport const getState = <T>(\n\ttoken: ReadonlySelectorToken<T> | StateToken<T>,\n\tstore: Store = IMPLICIT.STORE,\n): T => {\n\tconst state = withdraw<T>(token, store)\n\tif (state === null) {\n\t\tthrow new Error(\n\t\t\t`${capitalize(token.type)} \"${token.key}\" not found in store \"${\n\t\t\t\tstore.config.name\n\t\t\t}\".`,\n\t\t)\n\t}\n\treturn getState__INTERNAL(state, store)\n}\n\nexport const setState = <T, New extends T>(\n\ttoken: StateToken<T>,\n\tvalue: New | ((oldValue: T) => New),\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\ttry {\n\t\topenOperation(token, store)\n\t} catch (thrown) {\n\t\tif (!(typeof thrown === `symbol`)) {\n\t\t\tthrow thrown\n\t\t}\n\t\treturn\n\t}\n\tconst state = withdraw(token, store)\n\tif (state === null) {\n\t\tthrow new Error(\n\t\t\t`${capitalize(token.type)} \"${token.key}\" not found in store \"${\n\t\t\t\tstore.config.name\n\t\t\t}\".`,\n\t\t)\n\t}\n\tsetState__INTERNAL(state, value, store)\n\tcloseOperation(store)\n}\n\nexport const isDefault = (\n\ttoken: ReadonlySelectorToken<unknown> | StateToken<unknown>,\n\tstore: Store = IMPLICIT.STORE,\n): boolean =>\n\ttoken.type === `atom`\n\t\t? isAtomDefault(token.key, store)\n\t\t: isSelectorDefault(token.key, store)\n","import { __INTERNAL__ } from \"atom.io\"\nimport type {\n\tReadonlySelectorFamily,\n\tReadonlySelectorToken,\n\tTimelineToken,\n\tTimelineUpdate,\n\tTransactionToken,\n\tTransactionUpdate,\n} from \"atom.io\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\n\nimport { attachAtomIndex, type AtomTokenIndex } from \"./attach-atom-index\"\nimport {\n\tattachSelectorIndex,\n\ttype SelectorTokenIndex,\n} from \"./attach-selector-index\"\nimport { attachTimelineFamily } from \"./attach-timeline-family\"\nimport { attachTimelineIndex } from \"./attach-timeline-index\"\nimport { attachTransactionIndex } from \"./attach-transaction-index\"\nimport { attachTransactionLogs } from \"./attach-transaction-logs\"\nimport type { Timeline } from \"../internal\"\n\nexport const attachIntrospectionStates = (\n\tstore: __INTERNAL__.Store = __INTERNAL__.IMPLICIT.STORE,\n): {\n\tatomIndex: ReadonlySelectorToken<AtomTokenIndex>\n\tselectorIndex: ReadonlySelectorToken<SelectorTokenIndex>\n\ttransactionIndex: ReadonlySelectorToken<TransactionToken<ƒn>[]>\n\tfindTransactionLogState: ReadonlySelectorFamily<TransactionUpdate<ƒn>[]>\n\ttimelineIndex: ReadonlySelectorToken<TimelineToken[]>\n\tfindTimelineState: ReadonlySelectorFamily<Timeline>\n} => {\n\treturn {\n\t\tatomIndex: attachAtomIndex(store),\n\t\tselectorIndex: attachSelectorIndex(store),\n\t\ttransactionIndex: attachTransactionIndex(store),\n\t\tfindTransactionLogState: attachTransactionLogs(store),\n\t\ttimelineIndex: attachTimelineIndex(store),\n\t\tfindTimelineState: attachTimelineFamily(store),\n\t}\n}\n","import type { AtomToken, ReadonlySelectorToken } from \"atom.io\"\nimport { __INTERNAL__ } from \"atom.io\"\n\nimport type { StateTokenIndex } from \".\"\n\nexport type AtomTokenIndex = StateTokenIndex<AtomToken<unknown>>\n\nexport const attachAtomIndex = (\n\tstore: __INTERNAL__.Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorToken<AtomTokenIndex> => {\n\tconst atomTokenIndexState__INTERNAL =\n\t\t__INTERNAL__.atom__INTERNAL<AtomTokenIndex>(\n\t\t\t{\n\t\t\t\tkey: `👁‍🗨 Atom Token Index (Internal)`,\n\t\t\t\tdefault: () =>\n\t\t\t\t\t[...store.atoms]\n\t\t\t\t\t\t.filter(([key]) => !key.includes(`👁‍🗨`))\n\t\t\t\t\t\t.reduce<AtomTokenIndex>((acc, [key]) => {\n\t\t\t\t\t\t\tacc[key] = { key, type: `atom` }\n\t\t\t\t\t\t\treturn acc\n\t\t\t\t\t\t}, {}),\n\t\t\t\teffects: [\n\t\t\t\t\t({ setSelf }) => {\n\t\t\t\t\t\tstore.subject.atomCreation.subscribe((atomToken) => {\n\t\t\t\t\t\t\tif (store.operation.open) {\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 (atomToken.key.includes(`👁‍🗨`)) {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetSelf((state) => {\n\t\t\t\t\t\t\t\tconst { key, family } = atomToken\n\t\t\t\t\t\t\t\tif (family) {\n\t\t\t\t\t\t\t\t\tconst { key: familyKey, subKey } = family\n\t\t\t\t\t\t\t\t\tconst current = state[familyKey]\n\t\t\t\t\t\t\t\t\tif (current === undefined || `familyMembers` in current) {\n\t\t\t\t\t\t\t\t\t\tconst familyKeyState = current || {\n\t\t\t\t\t\t\t\t\t\t\tkey: familyKey,\n\t\t\t\t\t\t\t\t\t\t\tfamilyMembers: {},\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t\t\t[familyKey]: {\n\t\t\t\t\t\t\t\t\t\t\t\t...familyKeyState,\n\t\t\t\t\t\t\t\t\t\t\t\tfamilyMembers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t...familyKeyState.familyMembers,\n\t\t\t\t\t\t\t\t\t\t\t\t\t[subKey]: atomToken,\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\treturn {\n\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t[key]: atomToken,\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\tundefined,\n\t\t\tstore,\n\t\t)\n\treturn __INTERNAL__.selector__INTERNAL(\n\t\t{\n\t\t\tkey: `👁‍🗨 Atom Token Index`,\n\t\t\tget: ({ get }) => get(atomTokenIndexState__INTERNAL),\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n}\n","import { __INTERNAL__ } from \"atom.io\"\nimport type { ReadonlySelectorToken, SelectorToken } from \"atom.io\"\n\nimport type { StateTokenIndex } from \".\"\n\nexport type SelectorTokenIndex = StateTokenIndex<\n\tReadonlySelectorToken<unknown> | SelectorToken<unknown>\n>\n\nexport const attachSelectorIndex = (\n\tstore: __INTERNAL__.Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorToken<SelectorTokenIndex> => {\n\tconst readonlySelectorTokenIndexState__INTERNAL =\n\t\t__INTERNAL__.atom__INTERNAL<SelectorTokenIndex>(\n\t\t\t{\n\t\t\t\tkey: `👁‍🗨 Selector Token Index (Internal)`,\n\t\t\t\tdefault: () =>\n\t\t\t\t\tObject.assign(\n\t\t\t\t\t\t[...store.readonlySelectors]\n\t\t\t\t\t\t\t.filter(([key]) => !key.includes(`👁‍🗨`))\n\t\t\t\t\t\t\t.reduce<SelectorTokenIndex>((acc, [key]) => {\n\t\t\t\t\t\t\t\tacc[key] = { key, type: `readonly_selector` }\n\t\t\t\t\t\t\t\treturn acc\n\t\t\t\t\t\t\t}, {}),\n\t\t\t\t\t\t[...store.selectors].reduce<SelectorTokenIndex>((acc, [key]) => {\n\t\t\t\t\t\t\tacc[key] = { key, type: `selector` }\n\t\t\t\t\t\t\treturn acc\n\t\t\t\t\t\t}, {}),\n\t\t\t\t\t),\n\t\t\t\teffects: [\n\t\t\t\t\t({ setSelf }) => {\n\t\t\t\t\t\tstore.subject.selectorCreation.subscribe((selectorToken) => {\n\t\t\t\t\t\t\tif (store.operation.open) {\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 (selectorToken.key.includes(`👁‍🗨`)) {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetSelf((state) => {\n\t\t\t\t\t\t\t\tconst { key, family } = selectorToken\n\t\t\t\t\t\t\t\tif (family) {\n\t\t\t\t\t\t\t\t\tconst { key: familyKey, subKey } = family\n\t\t\t\t\t\t\t\t\tconst current = state[familyKey]\n\t\t\t\t\t\t\t\t\tif (current === undefined || `familyMembers` in current) {\n\t\t\t\t\t\t\t\t\t\tconst familyKeyState = current || {\n\t\t\t\t\t\t\t\t\t\t\tkey: familyKey,\n\t\t\t\t\t\t\t\t\t\t\tfamilyMembers: {},\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t\t\t[familyKey]: {\n\t\t\t\t\t\t\t\t\t\t\t\t...familyKeyState,\n\t\t\t\t\t\t\t\t\t\t\t\tfamilyMembers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t...familyKeyState.familyMembers,\n\t\t\t\t\t\t\t\t\t\t\t\t\t[subKey]: selectorToken,\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\treturn {\n\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t[key]: selectorToken,\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\tundefined,\n\t\t\tstore,\n\t\t)\n\treturn __INTERNAL__.selector__INTERNAL({\n\t\tkey: `👁‍🗨 Selector Token Index`,\n\t\tget: ({ get }) => get(readonlySelectorTokenIndexState__INTERNAL),\n\t})\n}\n","import type { ReadonlySelectorFamily, Store } from \"atom.io\"\nimport { __INTERNAL__ } from \"atom.io\"\n\nimport type { Timeline } from \"../internal\"\n\nexport const attachTimelineFamily = (\n\tstore: Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorFamily<Timeline> => {\n\tconst findTimelineLogState__INTERNAL = __INTERNAL__.atomFamily__INTERNAL<\n\t\tTimeline,\n\t\tstring\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Timeline Update Log (Internal)`,\n\t\t\tdefault: (key) => store.timelines.get(key),\n\t\t\teffects: (key) => [\n\t\t\t\t({ setSelf }) => {\n\t\t\t\t\tconst tl = store.timelines.get(key)\n\t\t\t\t\ttl.subject.subscribe((_) => {\n\t\t\t\t\t\tif (store.operation.open === true) {\n\t\t\t\t\t\t\tconst subscription = store.subject.operationStatus.subscribe(\n\t\t\t\t\t\t\t\t(operationStatus) => {\n\t\t\t\t\t\t\t\t\tif (operationStatus.open === false) {\n\t\t\t\t\t\t\t\t\t\tsubscription.unsubscribe()\n\t\t\t\t\t\t\t\t\t\tsetSelf({ ...tl })\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} else {\n\t\t\t\t\t\t\tsetSelf({ ...tl })\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\tstore,\n\t)\n\tconst findTimelineLogState = __INTERNAL__.selectorFamily__INTERNAL<\n\t\tTimeline,\n\t\tstring\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Timeline Update Log`,\n\t\t\tget: (key) => ({ get }) => get(findTimelineLogState__INTERNAL(key)),\n\t\t},\n\t\tstore,\n\t)\n\treturn findTimelineLogState\n}\n","import type { ReadonlySelectorToken, Store, TimelineToken } from \"atom.io\"\nimport { __INTERNAL__ } from \"atom.io\"\n\nexport const attachTimelineIndex = (\n\tstore: Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorToken<TimelineToken[]> => {\n\tconst timelineTokenIndexState__INTERNAL = __INTERNAL__.atom__INTERNAL<\n\t\tTimelineToken[]\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Timeline Token Index (Internal)`,\n\t\t\tdefault: () =>\n\t\t\t\t[...store.timelines].map(([key]) => {\n\t\t\t\t\treturn { key, type: `timeline` }\n\t\t\t\t}),\n\t\t\teffects: [\n\t\t\t\t({ setSelf }) => {\n\t\t\t\t\tstore.subject.timelineCreation.subscribe((timelineToken) => {\n\t\t\t\t\t\tsetSelf((state) => [...state, timelineToken])\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\tconst timelineTokenIndex = __INTERNAL__.selector__INTERNAL(\n\t\t{\n\t\t\tkey: `👁‍🗨 Timeline Token Index`,\n\t\t\tget: ({ get }) => get(timelineTokenIndexState__INTERNAL),\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\treturn timelineTokenIndex\n}\n","import type { ReadonlySelectorToken, TransactionToken } from \"atom.io\"\nimport { __INTERNAL__ } from \"atom.io\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\n\nexport const attachTransactionIndex = (\n\tstore: __INTERNAL__.Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorToken<TransactionToken<ƒn>[]> => {\n\tconst transactionTokenIndexState__INTERNAL = __INTERNAL__.atom__INTERNAL<\n\t\tTransactionToken<ƒn>[]\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Transaction Token Index (Internal)`,\n\t\t\tdefault: () =>\n\t\t\t\t[...store.transactions].map(([key]) => {\n\t\t\t\t\treturn { key, type: `transaction` }\n\t\t\t\t}),\n\t\t\teffects: [\n\t\t\t\t({ setSelf }) => {\n\t\t\t\t\tstore.subject.transactionCreation.subscribe((transactionToken) => {\n\t\t\t\t\t\tsetSelf((state) => [...state, transactionToken])\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\tconst transactionTokenIndex = __INTERNAL__.selector__INTERNAL(\n\t\t{\n\t\t\tkey: `👁‍🗨 Transaction Token Index`,\n\t\t\tget: ({ get }) => get(transactionTokenIndexState__INTERNAL),\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\treturn transactionTokenIndex\n}\n","import type { ReadonlySelectorFamily, TransactionUpdate } from \"atom.io\"\nimport { __INTERNAL__ } from \"atom.io\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\n\nexport const attachTransactionLogs = (\n\tstore: __INTERNAL__.Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorFamily<TransactionUpdate<ƒn>[]> => {\n\tconst findTransactionUpdateLog = __INTERNAL__.atomFamily__INTERNAL<\n\t\tTransactionUpdate<ƒn>[],\n\t\tstring\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Transaction Update Log (Internal)`,\n\t\t\tdefault: () => [],\n\t\t\teffects: (key) => [\n\t\t\t\t({ setSelf }) => {\n\t\t\t\t\tconst tx = store.transactions.get(key)\n\t\t\t\t\ttx.subject.subscribe((transactionUpdate) => {\n\t\t\t\t\t\tif (transactionUpdate.key === key) {\n\t\t\t\t\t\t\tsetSelf((state) => [...state, transactionUpdate])\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\tstore,\n\t)\n\tconst findTransactionUpdateLogState = __INTERNAL__.selectorFamily__INTERNAL<\n\t\tTransactionUpdate<ƒn>[],\n\t\tstring\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Transaction Update Log`,\n\t\t\tget: (key) => ({ get }) => get(findTransactionUpdateLog(key)),\n\t\t},\n\t\tstore,\n\t)\n\treturn findTransactionUpdateLogState\n}\n","import type { Json } from \"~/packages/anvl/src/json\"\n\nimport type { AtomEffect } from \"../index\"\n\nexport type StringInterface<T> = {\n\tstringify: (t: T) => string\n\tparse: (s: string) => T\n}\n\nexport const persistAtom =\n\t<T>(storage: Storage) =>\n\t({ stringify, parse }: StringInterface<T>) =>\n\t(key: string): AtomEffect<T> =>\n\t({ setSelf, onSet }) => {\n\t\tconst savedValue = storage.getItem(key)\n\n\t\tif (savedValue != null) setSelf(parse(savedValue))\n\n\t\tonSet(({ newValue }) => {\n\t\t\tif (newValue == null) {\n\t\t\t\tstorage.removeItem(key)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tstorage.setItem(key, stringify(newValue))\n\t\t})\n\t}\n\nexport const lazyLocalStorageEffect: <J extends Json>(\n\tkey: string,\n) => AtomEffect<J> = persistAtom(localStorage)(JSON)\n","import { useO, useIO } from \"atom.io/react\"\nimport { LayoutGroup, motion, spring } from \"framer-motion\"\nimport { useRef } from \"react\"\nimport type { FC } from \"react\"\n\nimport {\n\tatomIndex,\n\tdevtoolsAreOpenState,\n\tdevtoolsViewOptionsState,\n\tdevtoolsViewSelectionState,\n\tselectorIndex,\n} from \".\"\nimport { StateIndex } from \"./StateIndex\"\nimport { TimelineIndex } from \"./TimelineIndex\"\nimport { TransactionIndex } from \"./TransactionIndex\"\n\nimport \"./devtools.scss\"\n\nexport const AtomIODevtools: FC = () => {\n\tconst constraintsRef = useRef(null)\n\n\tconst [devtoolsAreOpen, setDevtoolsAreOpen] = useIO(devtoolsAreOpenState)\n\tconst [devtoolsView, setDevtoolsView] = useIO(devtoolsViewSelectionState)\n\tconst devtoolsViewOptions = useO(devtoolsViewOptionsState)\n\n\tconst mouseHasMoved = useRef(false)\n\n\treturn (\n\t\t<>\n\t\t\t<motion.span\n\t\t\t\tref={constraintsRef}\n\t\t\t\tclassName=\"atom_io_devtools_zone\"\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: `fixed`,\n\t\t\t\t\ttop: 0,\n\t\t\t\t\tleft: 0,\n\t\t\t\t\tright: 0,\n\t\t\t\t\tbottom: 0,\n\t\t\t\t\tpointerEvents: `none`,\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<motion.main\n\t\t\t\tdrag\n\t\t\t\tdragConstraints={constraintsRef}\n\t\t\t\tclassName=\"atom_io_devtools\"\n\t\t\t\ttransition={spring}\n\t\t\t\tstyle={\n\t\t\t\t\tdevtoolsAreOpen\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tbackgroundColor: `#0000`,\n\t\t\t\t\t\t\t\tborderColor: `#0000`,\n\t\t\t\t\t\t\t\tmaxHeight: 28,\n\t\t\t\t\t\t\t\tmaxWidth: 33,\n\t\t\t\t\t\t }\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{devtoolsAreOpen ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<motion.header>\n\t\t\t\t\t\t\t<h1>atom.io</h1>\n\t\t\t\t\t\t\t<nav>\n\t\t\t\t\t\t\t\t{devtoolsViewOptions.map((viewOption) => (\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\tkey={viewOption}\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tclassName={viewOption === devtoolsView ? `active` : ``}\n\t\t\t\t\t\t\t\t\t\tonClick={() => setDevtoolsView(viewOption)}\n\t\t\t\t\t\t\t\t\t\tdisabled={viewOption === devtoolsView}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{viewOption}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</nav>\n\t\t\t\t\t\t</motion.header>\n\t\t\t\t\t\t<motion.main>\n\t\t\t\t\t\t\t<LayoutGroup>\n\t\t\t\t\t\t\t\t{devtoolsView === `atoms` ? (\n\t\t\t\t\t\t\t\t\t<StateIndex tokenIndex={atomIndex} />\n\t\t\t\t\t\t\t\t) : devtoolsView === `selectors` ? (\n\t\t\t\t\t\t\t\t\t<StateIndex tokenIndex={selectorIndex} />\n\t\t\t\t\t\t\t\t) : devtoolsView === `transactions` ? (\n\t\t\t\t\t\t\t\t\t<TransactionIndex />\n\t\t\t\t\t\t\t\t) : devtoolsView === `timelines` ? (\n\t\t\t\t\t\t\t\t\t<TimelineIndex />\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t</LayoutGroup>\n\t\t\t\t\t\t</motion.main>\n\t\t\t\t\t</>\n\t\t\t\t) : null}\n\t\t\t\t<footer>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonMouseDown={() => (mouseHasMoved.current = false)}\n\t\t\t\t\t\tonMouseMove={() => (mouseHasMoved.current = true)}\n\t\t\t\t\t\tonMouseUp={() => {\n\t\t\t\t\t\t\tif (!mouseHasMoved.current) {\n\t\t\t\t\t\t\t\tsetDevtoolsAreOpen((open) => !open)\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\t👁‍🗨\n\t\t\t\t\t</button>\n\t\t\t\t</footer>\n\t\t\t</motion.main>\n\t\t</>\n\t)\n}\n","import type { AtomToken, ReadonlySelectorToken, SelectorToken } from \"atom.io\"\nimport { getState, selectorFamily } from \"atom.io\"\nimport { useO, useIO } from \"atom.io/react\"\nimport type { FC } from \"react\"\n\nimport { isJson, refineJsonType } from \"~/packages/anvl/src/json\"\n\nimport { findViewIsOpenState, primitiveRefinery } from \".\"\nimport { button } from \"./Button\"\nimport { StoreEditor } from \"./StateEditor\"\nimport type { FamilyNode, StateTokenIndex } from \"../introspection\"\n\nconst findStateTypeState = selectorFamily<string, { key: string }>({\n\tkey: `👁‍🗨 State Type`,\n\tget: (token) => ({ get }) => {\n\t\tlet state: unknown\n\t\ttry {\n\t\t\tstate = get(token as any)\n\t\t} catch (error) {\n\t\t\treturn `error`\n\t\t}\n\t\tif (state === undefined) return `undefined`\n\t\tif (isJson(state)) return refineJsonType(state).type\n\t\treturn Object.getPrototypeOf(state).constructor.name\n\t},\n})\n\nexport const StateIndexLeafNode: FC<{\n\tnode:\n\t\t| AtomToken<unknown>\n\t\t| ReadonlySelectorToken<unknown>\n\t\t| SelectorToken<unknown>\n\tisOpenState: AtomToken<boolean>\n\ttypeState: ReadonlySelectorToken<string>\n}> = ({ node, isOpenState, typeState }) => {\n\tconst [isOpen, setIsOpen] = useIO(isOpenState)\n\tconst state = useO(node)\n\tconst stateType = useO(typeState)\n\n\tconst isPrimitive = Boolean(primitiveRefinery.refine(state))\n\n\treturn (\n\t\t<>\n\t\t\t<header>\n\t\t\t\t<button.OpenClose\n\t\t\t\t\tisOpen={isOpen && !isPrimitive}\n\t\t\t\t\tsetIsOpen={setIsOpen}\n\t\t\t\t\tdisabled={isPrimitive}\n\t\t\t\t/>\n\t\t\t\t<label\n\t\t\t\t\tonClick={() => console.log(node, getState(node))}\n\t\t\t\t\tonKeyUp={() => console.log(node, getState(node))}\n\t\t\t\t>\n\t\t\t\t\t<h2>{node.family?.subKey ?? node.key}</h2>\n\t\t\t\t\t<span className=\"type detail\">({stateType})</span>\n\t\t\t\t</label>\n\t\t\t\t{isPrimitive ? <StoreEditor token={node} /> : null}\n\t\t\t</header>\n\t\t\t{isOpen && !isPrimitive ? (\n\t\t\t\t<main>\n\t\t\t\t\t<StoreEditor token={node} />\n\t\t\t\t</main>\n\t\t\t) : null}\n\t\t</>\n\t)\n}\nexport const StateIndexTreeNode: FC<{\n\tnode: FamilyNode<\n\t\tAtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>\n\t>\n\tisOpenState: AtomToken<boolean>\n}> = ({ node, isOpenState }) => {\n\tconst [isOpen, setIsOpen] = useIO(isOpenState)\n\tObject.entries(node.familyMembers).forEach(([key, childNode]) => {\n\t\tfindViewIsOpenState(key)\n\t\tfindStateTypeState(childNode)\n\t})\n\treturn (\n\t\t<>\n\t\t\t<header>\n\t\t\t\t<button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />\n\t\t\t\t<label>\n\t\t\t\t\t<h2>{node.key}</h2>\n\t\t\t\t\t<span className=\"type detail\"> (family)</span>\n\t\t\t\t</label>\n\t\t\t</header>\n\t\t\t{isOpen\n\t\t\t\t? Object.entries(node.familyMembers).map(([key, childNode]) => (\n\t\t\t\t\t\t<StateIndexNode\n\t\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\t\tnode={childNode}\n\t\t\t\t\t\t\tisOpenState={findViewIsOpenState(childNode.key)}\n\t\t\t\t\t\t\ttypeState={findStateTypeState(childNode)}\n\t\t\t\t\t\t/>\n\t\t\t\t ))\n\t\t\t\t: null}\n\t\t</>\n\t)\n}\n\nexport const StateIndexNode: FC<{\n\tnode: StateTokenIndex<\n\t\tAtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>\n\t>[string]\n\tisOpenState: AtomToken<boolean>\n\ttypeState: ReadonlySelectorToken<string>\n}> = ({ node, isOpenState, typeState }) => {\n\tif (node.key.startsWith(`👁‍🗨`)) {\n\t\treturn null\n\t}\n\treturn (\n\t\t<section className=\"node state\">\n\t\t\t{`type` in node ? (\n\t\t\t\t<StateIndexLeafNode\n\t\t\t\t\tnode={node}\n\t\t\t\t\tisOpenState={isOpenState}\n\t\t\t\t\ttypeState={typeState}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<StateIndexTreeNode node={node} isOpenState={isOpenState} />\n\t\t\t)}\n\t\t</section>\n\t)\n}\n\nexport const StateIndex: FC<{\n\ttokenIndex: ReadonlySelectorToken<\n\t\tStateTokenIndex<\n\t\t\t| AtomToken<unknown>\n\t\t\t| ReadonlySelectorToken<unknown>\n\t\t\t| SelectorToken<unknown>\n\t\t>\n\t>\n}> = ({ tokenIndex }) => {\n\tconst tokenIds = useO(tokenIndex)\n\treturn (\n\t\t<article className=\"index state_index\">\n\t\t\t{Object.entries(tokenIds)\n\t\t\t\t.filter(([key]) => !key.startsWith(`👁‍🗨`))\n\t\t\t\t.sort()\n\t\t\t\t.map(([key, node]) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<StateIndexNode\n\t\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\t\tnode={node}\n\t\t\t\t\t\t\tisOpenState={findViewIsOpenState(node.key)}\n\t\t\t\t\t\t\ttypeState={findStateTypeState(node)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t</article>\n\t)\n}\n","import type { FC } from \"react\"\n\nimport type { Modifier } from \"~/packages/anvl/src/function\"\n\nexport const OpenClose: FC<{\n\tisOpen: boolean\n\tsetIsOpen: (next: Modifier<boolean> | boolean) => void\n\tdisabled?: boolean\n}> = ({ isOpen, setIsOpen, disabled }) => {\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={`carat ${isOpen ? `open` : `closed`}`}\n\t\t\tonClick={() => setIsOpen((isOpen) => !isOpen)}\n\t\t\tdisabled={disabled}\n\t\t>\n\t\t\t▶\n\t\t</button>\n\t)\n}\n\nexport const button = {\n\tOpenClose,\n}\n","import type { ReadonlySelectorToken, StateToken } from \"atom.io\"\nimport { useO, useIO } from \"atom.io/react\"\nimport type { FC } from \"react\"\n\nimport { fallback } from \"~/packages/anvl/src/function\"\nimport { isJson } from \"~/packages/anvl/src/json\"\nimport { ElasticInput } from \"~/packages/hamr/src/react-elastic-input\"\nimport { JsonEditor } from \"~/packages/hamr/src/react-json-editor\"\n\nexport const StateEditor: FC<{\n\ttoken: StateToken<unknown>\n}> = ({ token }) => {\n\tconst [data, set] = useIO(token)\n\treturn isJson(data) ? (\n\t\t<JsonEditor data={data} set={set} schema={true} />\n\t) : (\n\t\t<div className=\"json_editor\">\n\t\t\t<ElasticInput\n\t\t\t\tvalue={\n\t\t\t\t\tdata instanceof Set\n\t\t\t\t\t\t? `Set { ${JSON.stringify([...data]).slice(1, -1)} }`\n\t\t\t\t\t\t: data instanceof Map\n\t\t\t\t\t\t? `Map ` + JSON.stringify([...data])\n\t\t\t\t\t\t: Object.getPrototypeOf(data).constructor.name +\n\t\t\t\t\t\t ` ` +\n\t\t\t\t\t\t fallback(() => JSON.stringify(data), `?`)\n\t\t\t\t}\n\t\t\t\tdisabled={true}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\nexport const ReadonlySelectorViewer: FC<{\n\ttoken: ReadonlySelectorToken<unknown>\n}> = ({ token }) => {\n\tconst data = useO(token)\n\treturn isJson(data) ? (\n\t\t<JsonEditor\n\t\t\tdata={data}\n\t\t\tset={() => null}\n\t\t\tschema={true}\n\t\t\tisReadonly={() => true}\n\t\t/>\n\t) : (\n\t\t<div className=\"json_editor\">\n\t\t\t<ElasticInput\n\t\t\t\tvalue={\n\t\t\t\t\tdata instanceof Set\n\t\t\t\t\t\t? `Set ` + JSON.stringify([...data])\n\t\t\t\t\t\t: data instanceof Map\n\t\t\t\t\t\t? `Map ` + JSON.stringify([...data])\n\t\t\t\t\t\t: Object.getPrototypeOf(data).constructor.name +\n\t\t\t\t\t\t ` ` +\n\t\t\t\t\t\t JSON.stringify(data)\n\t\t\t\t}\n\t\t\t\tdisabled={true}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\nexport const StoreEditor: FC<{\n\ttoken: ReadonlySelectorToken<unknown> | StateToken<unknown>\n}> = ({ token }) => {\n\tif (token.type === `readonly_selector`) {\n\t\treturn <ReadonlySelectorViewer token={token} />\n\t}\n\treturn <StateEditor token={token} />\n}\n","import type { DetailedHTMLProps, InputHTMLAttributes } from \"react\"\nimport {\n\tuseLayoutEffect,\n\tuseImperativeHandle,\n\tforwardRef,\n\tuseRef,\n\tuseState,\n} from \"react\"\n\nexport const ElasticInput = forwardRef<\n\tHTMLInputElement,\n\tDetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {\n\t\twidthPadding?: number\n\t}\n>(function ElasticInputFC(props, ref) {\n\tconst inputRef = useRef<HTMLInputElement>(null)\n\tconst spanRef = useRef<HTMLSpanElement>(null)\n\tconst [inputWidth, setInputWidth] = useState(`auto`)\n\n\tuseImperativeHandle<\n\t\tPartial<HTMLInputElement>,\n\t\tPartial<HTMLInputElement>\n\t>(ref, () => ({\n\t\tfocus: () => {\n\t\t\tinputRef.current?.focus()\n\t\t},\n\t}))\n\n\tconst extraWidth = props.type === `number` ? 15 : 0\n\n\tuseLayoutEffect(() => {\n\t\tif (spanRef.current) {\n\t\t\tsetInputWidth(`${spanRef.current.offsetWidth + extraWidth}px`)\n\t\t\tconst interval = setInterval(() => {\n\t\t\t\tif (spanRef.current) {\n\t\t\t\t\tsetInputWidth(`${spanRef.current.offsetWidth + extraWidth}px`)\n\t\t\t\t}\n\t\t\t}, 1000)\n\t\t\treturn () => clearInterval(interval)\n\t\t}\n\t}, [inputRef.current?.value, props.value])\n\n\treturn (\n\t\t<div style={{ display: `inline-block`, position: `relative` }}>\n\t\t\t<input\n\t\t\t\t{...props}\n\t\t\t\tref={inputRef}\n\t\t\t\tstyle={{\n\t\t\t\t\tpadding: 0,\n\t\t\t\t\tborderRadius: 0,\n\t\t\t\t\tborder: `none`,\n\t\t\t\t\tfontFamily: `inherit`,\n\t\t\t\t\tfontSize: `inherit`,\n\t\t\t\t\twidth: inputWidth,\n\t\t\t\t\t...props.style,\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<span\n\t\t\t\tref={spanRef}\n\t\t\t\tstyle={{\n\t\t\t\t\tpadding: props.style?.padding,\n\t\t\t\t\tposition: `absolute`,\n\t\t\t\t\tvisibility: `hidden`,\n\t\t\t\t\t// color: `red`,\n\t\t\t\t\twhiteSpace: `pre`,\n\t\t\t\t\tfontFamily: props.style?.fontFamily || `inherit`,\n\t\t\t\t\tfontSize: props.style?.fontSize || `inherit`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{props.value}\n\t\t\t</span>\n\t\t</div>\n\t)\n})\n","import type { SerializedStyles } from \"@emotion/react\"\nimport { pipe } from \"fp-ts/function\"\nimport type { FC } from \"react\"\nimport { useState, useId, useRef } from \"react\"\n\nimport { clampInto } from \"~/packages/anvl/src/number\"\n\nimport { ElasticInput } from \".\"\n\nfunction round(value: number, decimalPlaces?: number): number {\n\tif (decimalPlaces === undefined) return value\n\tconst factor = Math.pow(10, decimalPlaces)\n\treturn Math.round(value * factor) / factor\n}\nfunction roundAndPad(value: number, decimalPlaces?: number): string {\n\tconst roundedValue = round(value, decimalPlaces)\n\tconst paddedString = roundedValue.toFixed(decimalPlaces)\n\treturn paddedString\n}\n\nexport const VALID_NON_NUMBERS = [``, `-`, `.`, `-.`] as const\nexport type ValidNonNumber = typeof VALID_NON_NUMBERS[number]\nexport const isValidNonNumber = (input: string): input is ValidNonNumber =>\n\tVALID_NON_NUMBERS.includes(input as ValidNonNumber)\nexport const VALID_NON_NUMBER_INTERPRETATIONS: Readonly<\n\tRecord<ValidNonNumber, number | null>\n> = {\n\t\"\": null,\n\t\"-\": 0,\n\t\".\": 0,\n\t\"-.\": 0,\n} as const\nexport type DecimalInProgress = `${number | ``}.${number}`\nexport const isDecimalInProgress = (input: string): input is DecimalInProgress =>\n\tinput === `0` || (!isNaN(Number(input)) && input.includes(`.`))\n\nconst textToValue = (input: string, allowDecimal: boolean): number | null => {\n\tif (isValidNonNumber(input)) return VALID_NON_NUMBER_INTERPRETATIONS[input]\n\treturn allowDecimal ? parseFloat(input) : Math.round(parseFloat(input))\n}\n\nexport type NumberConstraints = {\n\tmax: number\n\tmin: number\n\tdecimalPlaces: number\n\tnullable: boolean\n}\nexport const DEFAULT_NUMBER_CONSTRAINTS: NumberConstraints = {\n\tmax: Infinity,\n\tmin: -Infinity,\n\tdecimalPlaces: 100,\n\tnullable: true,\n}\n\nconst initRefinery =\n\t<Constraints extends NumberConstraints>(constraints: Partial<Constraints>) =>\n\t(\n\t\tinput: number | null,\n\t): Constraints extends { nullable: true | undefined }\n\t\t? number | null\n\t\t: number => {\n\t\tif (input === null && constraints.nullable === true) {\n\t\t\treturn null as Constraints extends { nullable: true }\n\t\t\t\t? number | null\n\t\t\t\t: number\n\t\t}\n\t\tconst { max, min, decimalPlaces } = {\n\t\t\t...DEFAULT_NUMBER_CONSTRAINTS,\n\t\t\t...constraints,\n\t\t}\n\t\tconst constrained = pipe(input ?? 0, clampInto(min, max), (n) =>\n\t\t\tdecimalPlaces ? round(n, decimalPlaces) : n,\n\t\t)\n\t\treturn constrained\n\t}\n\nconst valueToText = (numericValue: number | null): string => {\n\tif (numericValue === null || numericValue === undefined) {\n\t\treturn ``\n\t}\n\treturn numericValue.toString()\n}\n\ntype NumberInputProps = Partial<NumberConstraints> & {\n\tautoSize?: boolean\n\tcustomCss?: SerializedStyles\n\tdisabled?: boolean\n\tid?: string\n\tlabel?: string\n\tname?: string\n\tonChange?: (e: React.ChangeEvent<HTMLInputElement>) => void\n\tonClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void\n\tplaceholder?: string\n\tset?: (newValue: number | null) => void\n\ttestId?: string\n\tvalue?: number | null\n}\n\nexport const NumberInput: FC<NumberInputProps> = ({\n\tautoSize = false,\n\tcustomCss,\n\tdecimalPlaces,\n\tdisabled = false,\n\tlabel,\n\tmax,\n\tmin,\n\tname,\n\tonChange,\n\tonClick,\n\tplaceholder = ``,\n\tset = () => null,\n\ttestId,\n\tvalue = null,\n}) => {\n\tconst id = useId()\n\tconst [temporaryEntry, setTemporaryEntry] = useState<\n\t\tDecimalInProgress | ValidNonNumber | null\n\t>(null)\n\tconst userHasMadeDeliberateChange = useRef<boolean>(false)\n\n\tconst refine = initRefinery({ max, min, decimalPlaces, nullable: true })\n\n\tconst allowDecimal = decimalPlaces === undefined || decimalPlaces > 0\n\n\tconst handleBlur = () => {\n\t\tif (userHasMadeDeliberateChange.current) {\n\t\t\tset(refine(value ?? null))\n\t\t\tsetTemporaryEntry(null)\n\t\t}\n\t\tuserHasMadeDeliberateChange.current = false\n\t}\n\n\tconst handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n\t\tif (onChange) onChange(event)\n\t\tif (set === undefined) return\n\t\tuserHasMadeDeliberateChange.current = true\n\t\tconst input = event.target.value\n\t\tif (isValidNonNumber(input) || isDecimalInProgress(input)) {\n\t\t\tsetTemporaryEntry(input)\n\t\t\tconst textInterpretation = isDecimalInProgress(input)\n\t\t\t\t? input\n\t\t\t\t: min?.toString() ?? `0`\n\t\t\tconst newValue = textToValue(textInterpretation, allowDecimal)\n\t\t\tset(refine(newValue))\n\t\t\treturn\n\t\t}\n\t\tsetTemporaryEntry(null)\n\t\tconst inputIsNumeric =\n\t\t\t(!isNaN(Number(input)) && !input.includes(` `)) ||\n\t\t\t(allowDecimal && input === `.`) ||\n\t\t\t(allowDecimal && input === `-.`) ||\n\t\t\tinput === `` ||\n\t\t\tinput === `-`\n\t\tconst numericValue = textToValue(input, allowDecimal)\n\n\t\tif (inputIsNumeric) {\n\t\t\tset(refine(numericValue))\n\t\t}\n\t}\n\n\tconst displayValue =\n\t\ttemporaryEntry ?? valueToText(value ? refine(value) : value)\n\n\treturn (\n\t\t<span css={customCss}>\n\t\t\t{label && <label htmlFor={id}>{label}</label>}\n\t\t\t{autoSize ? (\n\t\t\t\t<ElasticInput\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\tplaceholder={placeholder ?? `-`}\n\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tname={name ?? id}\n\t\t\t\t\tid={id}\n\t\t\t\t\tonClick={onClick}\n\t\t\t\t\tdata-testid={`number-input-${testId ?? id}`}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<input\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\tplaceholder={placeholder ?? `-`}\n\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tname={name ?? id}\n\t\t\t\t\tid={id}\n\t\t\t\t\tonClick={onClick}\n\t\t\t\t\tdata-testid={`number-input-${testId ?? id}`}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</span>\n\t)\n}\n","import type { Modifier } from \"../function\"\n\nexport const clampInto =\n\t(min: number, max: number): Modifier<number> =>\n\t(value) =>\n\t\tvalue < min ? min : value > max ? max : value\n","import type { SerializedStyles } from \"@emotion/react\"\nimport type { FC } from \"react\"\n\nimport { ElasticInput } from \".\"\n\nexport type TextInputProps = {\n\tvalue: string\n\tset?: (value: string) => void\n\tlabel?: string\n\tplaceholder?: string\n\tcustomCss?: SerializedStyles\n\tautoSize?: boolean\n\treadOnly?: boolean\n}\n\nexport const TextInput: FC<TextInputProps> = ({\n\tvalue,\n\tset,\n\tlabel,\n\tplaceholder,\n\tcustomCss,\n\tautoSize = false,\n}) => {\n\treturn (\n\t\t<span css={customCss}>\n\t\t\t<label>{label}</label>\n\t\t\t{autoSize ? (\n\t\t\t\t<ElasticInput\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tonChange={(e) => set?.(e.target.value)}\n\t\t\t\t\tdisabled={set === undefined}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<input\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tonChange={(e) => set?.(e.target.value)}\n\t\t\t\t\tdisabled={set === undefined}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</span>\n\t)\n}\n","import type { SetterOrUpdater } from \"recoil\"\n\nimport { become } from \"~/packages/anvl/src/function\"\nimport type { JsonArr } from \"~/packages/anvl/src/json\"\n\nexport const makeElementSetters = <T extends JsonArr>(\n\tdata: T,\n\tset: SetterOrUpdater<T>,\n): SetterOrUpdater<T[number]>[] =>\n\tdata.map(\n\t\t(value, index) => (newValue) =>\n\t\t\tset((): T => {\n\t\t\t\tconst newData = [...data]\n\t\t\t\tnewData[index] = become(newValue)(value)\n\t\t\t\treturn newData as unknown as T\n\t\t\t}),\n\t)\n","import { ElasticInput } from \"../../react-elastic-input\"\nimport type { JsonEditorProps } from \"../developer-interface\"\n\nexport const NonJsonEditor: React.FC<JsonEditorProps<never>> = ({ data }) => {\n\treturn data === undefined ? (\n\t\t<ElasticInput disabled value=\"undefined\" />\n\t) : (\n\t\t<ElasticInput\n\t\t\tdisabled\n\t\t\tvalue={\n\t\t\t\tObject.getPrototypeOf(data).constructor.name + ` ` + JSON.stringify(data)\n\t\t\t}\n\t\t/>\n\t)\n}\n","import type { SerializedStyles } from \"@emotion/react\"\nimport type { FC, ReactElement, RefObject } from \"react\"\nimport type { SetterOrUpdater } from \"recoil\"\n\nimport { doNothing } from \"~/packages/anvl/src/function\"\nimport type { Json, JsonTypes } from \"~/packages/anvl/src/json\"\nimport { isJson, refineJsonType } from \"~/packages/anvl/src/json\"\nimport type { JsonSchema } from \"~/packages/anvl/src/json-schema/json-schema\"\n\nimport { SubEditors } from \".\"\nimport type { JsonEditorComponents } from \"./default-components\"\nimport { NonJsonEditor } from \"./editors-by-type/non-json\"\nimport { ElasticInput } from \"../react-elastic-input\"\n\nexport type JsonEditorProps_INTERNAL<T extends Json> = {\n\tdata: T\n\tset: SetterOrUpdater<T>\n\tref?: RefObject<HTMLInputElement>\n\tname?: string\n\trename?: (newKey: string) => void\n\tremove?: () => void\n\trecast?: (newType: keyof JsonTypes) => void\n\tschema?: JsonSchema\n\tpath?: ReadonlyArray<number | string>\n\tisReadonly?: (path: ReadonlyArray<number | string>) => boolean\n\tisHidden?: (path: ReadonlyArray<number | string>) => boolean\n\tclassName?: string\n\tcustomCss?: SerializedStyles\n\tHeader?: FC<{ data: T; schema?: JsonSchema }>\n\tComponents: JsonEditorComponents\n}\n\nexport const JsonEditor_INTERNAL = <T extends Json>({\n\tdata,\n\tset,\n\tschema,\n\tname,\n\trename,\n\tremove,\n\trecast,\n\tpath = [],\n\tisReadonly = () => false,\n\tisHidden = () => false,\n\tclassName,\n\tcustomCss,\n\tHeader: HeaderDisplay,\n\tComponents,\n}: JsonEditorProps_INTERNAL<T>): ReactElement | null => {\n\tconst dataIsJson = isJson(data)\n\tconst refined = dataIsJson ? refineJsonType(data) : { type: `non-json`, data }\n\tconst SubEditor = dataIsJson ? SubEditors[refined.type] : NonJsonEditor\n\n\tconst disabled = isReadonly(path)\n\n\treturn isHidden(path) ? null : (\n\t\t<Components.ErrorBoundary>\n\t\t\t<Components.EditorWrapper className={className} customCss={customCss}>\n\t\t\t\t{remove && (\n\t\t\t\t\t<Components.Button\n\t\t\t\t\t\tonClick={disabled ? doNothing : remove}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Components.DeleteIcon />\n\t\t\t\t\t</Components.Button>\n\t\t\t\t)}\n\t\t\t\t{HeaderDisplay && <HeaderDisplay data={data} schema={schema} />}\n\t\t\t\t{rename && (\n\t\t\t\t\t<Components.KeyWrapper>\n\t\t\t\t\t\t<ElasticInput\n\t\t\t\t\t\t\tvalue={name}\n\t\t\t\t\t\t\tonChange={disabled ? doNothing : (e) => rename(e.target.value)}\n\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Components.KeyWrapper>\n\t\t\t\t)}\n\t\t\t\t<SubEditor\n\t\t\t\t\tdata={refined.data}\n\t\t\t\t\tset={set}\n\t\t\t\t\tschema={schema}\n\t\t\t\t\tremove={remove}\n\t\t\t\t\trename={rename}\n\t\t\t\t\tpath={path}\n\t\t\t\t\tisReadonly={isReadonly}\n\t\t\t\t\tisHidden={isHidden}\n\t\t\t\t\tComponents={Components}\n\t\t\t\t/>\n\t\t\t\t{recast && dataIsJson ? (\n\t\t\t\t\t<select\n\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t\t? doNothing\n\t\t\t\t\t\t\t\t: (e) => recast(e.target.value as keyof JsonTypes)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={refined.type}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t>\n\t\t\t\t\t\t{Object.keys(SubEditors).map((type) => (\n\t\t\t\t\t\t\t<option key={type} value={type}>\n\t\t\t\t\t\t\t\t{type}\n\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</select>\n\t\t\t\t) : null}\n\t\t\t</Components.EditorWrapper>\n\t\t</Components.ErrorBoundary>\n\t)\n}\n","import type { ReactElement } from \"react\"\n\nimport type { JsonArr } from \"~/packages/anvl/src/json\"\n\nimport { makeElementSetters } from \"./utilities/array-elements\"\nimport type { JsonEditorProps_INTERNAL } from \"../json-editor-internal\"\nimport { JsonEditor_INTERNAL } from \"../json-editor-internal\"\n\nexport const ArrayEditor = <_ extends JsonArr>({\n\tpath = [],\n\tisReadonly = () => false,\n\tisHidden = () => false,\n\tdata,\n\tset,\n\tComponents,\n}: JsonEditorProps_INTERNAL<JsonArr>): ReactElement => {\n\tconst setElement = makeElementSetters(data, set)\n\treturn (\n\t\t<>\n\t\t\t{data.map((element, index) => {\n\t\t\t\tconst newPath = [...path, index]\n\t\t\t\treturn (\n\t\t\t\t\t<JsonEditor_INTERNAL\n\t\t\t\t\t\tkey={newPath.join(``)}\n\t\t\t\t\t\tpath={newPath}\n\t\t\t\t\t\tisReadonly={isReadonly}\n\t\t\t\t\t\tisHidden={isHidden}\n\t\t\t\t\t\tdata={element}\n\t\t\t\t\t\tset={setElement[index]}\n\t\t\t\t\t\tComponents={Components}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})}\n\t\t</>\n\t)\n}\n","import { useRef } from \"react\"\nimport type { FC, ReactElement } from \"react\"\n\nimport { doNothing } from \"~/packages/anvl/src/function\"\nimport type { JsonObj } from \"~/packages/anvl/src/json\"\nimport { findSubSchema } from \"~/packages/anvl/src/json-schema/find-sub-schema\"\nimport { isObjectSchema } from \"~/packages/anvl/src/json-schema/json-schema\"\nimport { isPlainObject } from \"~/packages/anvl/src/object/refinement\"\nimport { isLiteral } from \"~/packages/anvl/src/refinement\"\n\nimport {\n\tmakePropertyCreationInterface,\n\tmakePropertyRecasters,\n\tmakePropertyRemovers,\n\tmakePropertyRenamers,\n\tmakePropertySetters,\n\tmakePropertySorter,\n} from \"./utilities/object-properties\"\nimport { ElasticInput } from \"../../react-elastic-input\"\nimport type { JsonEditorComponents } from \"../default-components\"\nimport type { JsonEditorProps_INTERNAL } from \"../json-editor-internal\"\nimport { JsonEditor_INTERNAL } from \"../json-editor-internal\"\n\nexport type PropertyAdderProps = {\n\taddProperty: () => void\n\tdisabled: boolean\n\tpropertyKey: string\n\tComponents: JsonEditorComponents\n}\n\nexport const PropertyAdder: FC<PropertyAdderProps> = ({\n\taddProperty,\n\tdisabled,\n\tpropertyKey,\n\tComponents,\n}) => (\n\t<Components.MissingPropertyWrapper>\n\t\t<ElasticInput disabled defaultValue={propertyKey} />\n\t\t{` `}\n\t\t<ElasticInput disabled defaultValue=\"is missing\" />\n\t\t<Components.Button onClick={() => addProperty()} disabled={disabled}>\n\t\t\t+\n\t\t</Components.Button>\n\t</Components.MissingPropertyWrapper>\n)\n\nexport const ObjectEditor = <T extends JsonObj>({\n\tschema,\n\tpath = [],\n\tisReadonly = () => false,\n\tisHidden = () => false,\n\tdata,\n\tset,\n\tComponents,\n}: JsonEditorProps_INTERNAL<T>): ReactElement => {\n\tconst disabled = isReadonly(path)\n\n\tconst stableKeyMap = useRef<Record<keyof T, keyof T>>(\n\t\tObject.keys(data).reduce((acc, key: keyof T) => {\n\t\t\tacc[key] = key\n\t\t\treturn acc\n\t\t}, {} as Record<keyof T, keyof T>),\n\t)\n\n\tconst setProperty = makePropertySetters(data, set)\n\tconst renameProperty = makePropertyRenamers(data, set, stableKeyMap)\n\tconst removeProperty = makePropertyRemovers(data, set)\n\tconst recastProperty = makePropertyRecasters(data, set)\n\tconst sortProperties = makePropertySorter(data, set)\n\tconst makePropertyAdder = makePropertyCreationInterface(data, set)\n\n\tconst subSchema = isPlainObject(schema) ? findSubSchema(schema)(path) : true\n\tconst schemaKeys: ReadonlyArray<string> | true = isLiteral(true)(subSchema)\n\t\t? true\n\t\t: isObjectSchema(subSchema)\n\t\t? Object.keys(subSchema.properties ?? {})\n\t\t: []\n\tconst dataKeys: ReadonlyArray<string> = Object.keys(data)\n\tconst [unofficialKeys, officialKeys] = dataKeys.reduce(\n\t\t([unofficial, official], key) => {\n\t\t\tconst isOfficial = schemaKeys === true || schemaKeys.includes(key)\n\t\t\treturn isOfficial\n\t\t\t\t? [unofficial, [...official, key]]\n\t\t\t\t: [[...unofficial, key], official]\n\t\t},\n\t\t[[], []] as [string[], string[]],\n\t)\n\tconst missingKeys: ReadonlyArray<string> =\n\t\tschemaKeys === true\n\t\t\t? []\n\t\t\t: schemaKeys.filter((key) => !dataKeys.includes(key))\n\n\treturn (\n\t\t<>\n\t\t\t<Components.Button onClick={() => sortProperties()} disabled={disabled}>\n\t\t\t\tSort\n\t\t\t</Components.Button>\n\t\t\t<Components.ObjectWrapper>\n\t\t\t\t<div className=\"json_editor_properties\">\n\t\t\t\t\t{[...missingKeys, ...officialKeys, ...unofficialKeys].map((key) => {\n\t\t\t\t\t\tconst originalKey = stableKeyMap.current[key]\n\t\t\t\t\t\tconst newPath = [...path, key]\n\t\t\t\t\t\tconst originalPath = [...path, originalKey]\n\t\t\t\t\t\tconst isOfficial = schemaKeys === true || schemaKeys.includes(key)\n\t\t\t\t\t\tconst isMissing = missingKeys.includes(key)\n\n\t\t\t\t\t\treturn isMissing ? (\n\t\t\t\t\t\t\t<PropertyAdder\n\t\t\t\t\t\t\t\tkey={key + `IsMissing`}\n\t\t\t\t\t\t\t\tpropertyKey={key}\n\t\t\t\t\t\t\t\taddProperty={makePropertyAdder(key, `string`)}\n\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t\tComponents={Components}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<JsonEditor_INTERNAL\n\t\t\t\t\t\t\t\tkey={originalPath.join(`.`)}\n\t\t\t\t\t\t\t\tschema={schema}\n\t\t\t\t\t\t\t\tpath={newPath}\n\t\t\t\t\t\t\t\tname={key}\n\t\t\t\t\t\t\t\tisReadonly={isReadonly}\n\t\t\t\t\t\t\t\tisHidden={isHidden}\n\t\t\t\t\t\t\t\tdata={data[key as keyof T]}\n\t\t\t\t\t\t\t\tset={setProperty[key as keyof T]}\n\t\t\t\t\t\t\t\trename={renameProperty[key as keyof T]}\n\t\t\t\t\t\t\t\tremove={removeProperty[key as keyof T]}\n\t\t\t\t\t\t\t\trecast={recastProperty[key as keyof T]}\n\t\t\t\t\t\t\t\tclassName={`json_editor_property ${\n\t\t\t\t\t\t\t\t\tisOfficial ? `json_editor_official` : `json_editor_unofficial`\n\t\t\t\t\t\t\t\t}`}\n\t\t\t\t\t\t\t\tComponents={Components}\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</div>\n\t\t\t\t<Components.Button\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t? doNothing\n\t\t\t\t\t\t\t: () => makePropertyAdder(`new_property`, `string`)()\n\t\t\t\t\t}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t>\n\t\t\t\t\t+\n\t\t\t\t</Components.Button>\n\t\t\t</Components.ObjectWrapper>\n\t\t</>\n\t)\n}\n","import { isBoolean } from \"fp-ts/boolean\"\nimport { isNumber } from \"fp-ts/number\"\nimport type { Refinement } from \"fp-ts/Refinement\"\nimport { isString } from \"fp-ts/string\"\n\nimport type { integer } from \"./integer\"\nimport { isInteger } from \"./integer\"\nimport type { JsonSchemaRef } from \"./refs\"\nimport { isJsonSchemaRef } from \"./refs\"\nimport type { JsonSchemaStringFormat } from \"./string-formats\"\nimport { JSON_SCHEMA_STRING_FORMATS } from \"./string-formats\"\nimport { isArray } from \"../array\"\nimport { JSON_TYPE_NAMES } from \"../json\"\nimport { ifDefined } from \"../nullish\"\nimport { doesExtend, isRecord } from \"../object/refinement\"\nimport {\n\tisLiteral,\n\tisWithin,\n\tcouldBe,\n\tisIntersection,\n\tisUnion,\n} from \"../refinement\"\nimport type { Refined } from \"../refinement/refined\"\n\n/* eslint-disable max-lines */\n\nexport const JSON_SCHEMA_TYPE_NAMES = [...JSON_TYPE_NAMES, `integer`] as const\nexport type JsonSchemaTypeName = typeof JSON_SCHEMA_TYPE_NAMES[number]\n\nexport const JSON_SCHEMA_META_TYPE_NAMES = [\n\t...JSON_SCHEMA_TYPE_NAMES,\n\t`any`,\n\t`never`,\n] as const\nexport type JsonSchemaMetaTypeName = typeof JSON_SCHEMA_META_TYPE_NAMES[number]\n\nexport const JSON_SCHEMA_LOGIC_MODES = [\n\t`union`,\n\t`exclusive`,\n\t`intersection`,\n\t`negation`,\n\t`conditional`,\n] as const\nexport type JsonSchemaLogicMode = typeof JSON_SCHEMA_LOGIC_MODES[number]\n\nexport interface JsonSchemaSystem\n\textends Record<JsonSchemaLogicMode & JsonSchemaMetaTypeName, any> {\n\tarray: ArraySchema\n\tboolean: BooleanSchema\n\tinteger: IntegerSchema\n\tnull: NullSchema\n\tnumber: NumberSchema\n\tobject: ObjectSchema\n\tstring: StringSchema\n\tany: true\n\tnever: false\n\tunion: UnionSchema\n\texclusive: ExclusiveSchema\n\tintersection: IntersectionSchema\n\tnegation: NegationSchema\n\tconditional: ConditionalSchema\n}\n\n// export const JSON_SCHEMA_SYSTEM: JsonSchemaSystem = {\n// array: { type: `array` },\n// boolean: { type: `boolean` },\n// integer: { type: `integer` },\n// null: { type: `null` },\n// number: { type: `number` },\n// object: { type: `object` },\n// string: { type: `string` },\n// any: true,\n// never: false,\n// union: { anyOf: [true] },\n// exclusive: { oneOf: [true] },\n// intersection: { allOf: [true] },\n// negation: { not: false },\n// conditional: { if: true, then: true, else: false },\n// } as const\n\nexport const JSON_SCHEMA_REFINERY: {\n\t[K in JsonSchemaLogicMode & JsonSchemaMetaTypeName]: Refinement<\n\t\tunknown,\n\t\tJsonSchemaSystem[K]\n\t>\n} = {\n\tarray: isArraySchema,\n\tboolean: isBooleanSchema,\n\tinteger: isIntegerSchema,\n\tnull: isNullSchema,\n\tnumber: isNumberSchema,\n\tobject: isObjectSchema,\n\tstring: isStringSchema,\n\tany: isLiteral(true),\n\tnever: isLiteral(false),\n\tunion: isUnionSchema,\n\tintersection: isIntersectionSchema,\n\tnegation: isNegationSchema,\n\tconditional: isConditionalSchema,\n}\n\nexport type StringSchema = {\n\ttype: `string`\n\tenum?: string[]\n\tminLength?: integer\n\tmaxLength?: integer\n\tpattern?: string\n\tformat?: JsonSchemaStringFormat\n}\nexport const stringSchemaStructure = {\n\ttype: isLiteral(`string`),\n\tenum: ifDefined(isArray(isString)),\n\tminLength: ifDefined(isInteger),\n\tmaxLength: ifDefined(isInteger),\n\tpattern: ifDefined(isString),\n\tformat: ifDefined(isWithin(JSON_SCHEMA_STRING_FORMATS)),\n}\nexport function isStringSchema(input: unknown): input is StringSchema {\n\treturn doesExtend(stringSchemaStructure)(input)\n}\n\nexport const numberSchemaStructure = {\n\ttype: isLiteral(`number`),\n\tenum: ifDefined(isArray(isNumber)),\n\tminimum: ifDefined(isNumber),\n\tmaximum: ifDefined(isNumber),\n\texclusiveMinimum: ifDefined(isNumber),\n\texclusiveMaximum: ifDefined(isNumber),\n\tmultipleOf: ifDefined(isNumber),\n}\nexport type NumberSchema = Refined<typeof numberSchemaStructure>\nexport function isNumberSchema(input: unknown): input is NumberSchema {\n\treturn doesExtend(numberSchemaStructure)(input)\n}\n\nexport const integerSchemaStructure = {\n\ttype: isLiteral(`integer`),\n\tenum: ifDefined(isArray(isInteger)),\n\tminimum: ifDefined(isInteger),\n\tmaximum: ifDefined(isInteger),\n\texclusiveMinimum: ifDefined(isInteger),\n\texclusiveMaximum: ifDefined(isInteger),\n\tmultipleOf: ifDefined(isInteger),\n}\nexport type IntegerSchema = Refined<typeof integerSchemaStructure>\nexport function isIntegerSchema(input: unknown): input is IntegerSchema {\n\treturn doesExtend(integerSchemaStructure)(input)\n}\n\nexport const booleanSchemaStructure = {\n\ttype: isLiteral(`boolean`),\n\tenum: ifDefined(isArray(isBoolean)),\n}\nexport type BooleanSchema = Refined<typeof booleanSchemaStructure>\nexport function isBooleanSchema(input: unknown): input is BooleanSchema {\n\treturn doesExtend(booleanSchemaStructure)(input)\n}\n\nexport const nullSchemaStructure = {\n\ttype: isLiteral(`null`),\n}\nexport type NullSchema = Refined<typeof nullSchemaStructure>\nexport function isNullSchema(input: unknown): input is NullSchema {\n\treturn doesExtend(nullSchemaStructure)(input)\n}\n\nexport type ObjectSchema = {\n\ttype: `object`\n\tproperties?: Record<string, JsonSchema>\n\tpatternProperties?: Record<string, JsonSchema>\n\trequired?: string[]\n\tadditionalProperties?: JsonSchema\n\tpropertyNames?: JsonSchema\n\tminProperties?: integer\n\tmaxProperties?: integer\n\tdependentSchemas?: Record<string, JsonSchema>\n}\nexport const objectSchemaStructure = {\n\ttype: isLiteral(`object`),\n\tproperties: ifDefined(isRecord(isString, isJsonSchema)),\n\trequired: ifDefined(isArray(isString)),\n\tadditionalProperties: ifDefined(isJsonSchema),\n\tpropertyNames: ifDefined(isStringSchema),\n\tminProperties: ifDefined(isInteger),\n\tmaxProperties: ifDefined(isInteger),\n\tdependentSchemas: ifDefined(isRecord(isString, isJsonSchema)),\n}\nexport function isObjectSchema(input: unknown): input is ObjectSchema {\n\treturn doesExtend(objectSchemaStructure)(input)\n}\n\nexport type ArraySchema = {\n\ttype: `array`\n\titems?: JsonSchema | JsonSchema[]\n\tminItems?: integer\n\tmaxItems?: integer\n\tuniqueItems?: boolean\n}\nexport const arraySchemaStructure = {\n\ttype: isLiteral(`array`),\n\titems: ifDefined(couldBe(isJsonSchema).or(isArray(isJsonSchema))),\n\tminItems: ifDefined(isInteger),\n\tmaxItems: ifDefined(isInteger),\n\tuniqueItems: ifDefined(isBoolean),\n}\nexport function isArraySchema(input: unknown): input is ArraySchema {\n\treturn doesExtend(arraySchemaStructure)(input)\n}\n\nexport type UnionSchema = { anyOf: JsonSchema[] }\nexport const unionSchemaStructure = { anyOf: isArray(isJsonSchema) }\nexport function isUnionSchema(input: unknown): input is UnionSchema {\n\treturn doesExtend(unionSchemaStructure)(input)\n}\nexport type IntersectionSchema = {\n\tallOf: JsonSchema[] | ReadonlyArray<JsonSchema>\n}\nexport type ExclusiveSchema = {\n\toneOf: JsonSchema[] | ReadonlyArray<JsonSchema>\n}\nexport const exclusiveSchemaStructure = { oneOf: isArray(isJsonSchema) }\nexport function isExclusiveSchema(input: unknown): input is ExclusiveSchema {\n\treturn doesExtend(exclusiveSchemaStructure)(input)\n}\n\nexport const intersectionSchemaStructure = { allOf: isArray(isJsonSchema) }\nexport function isIntersectionSchema(\n\tinput: unknown,\n): input is IntersectionSchema {\n\treturn doesExtend(intersectionSchemaStructure)(input)\n}\n\nexport type ConditionalSchema = {\n\tif: JsonSchema\n\tthen?: JsonSchema\n\telse?: JsonSchema\n}\nexport const conditionalSchemaStructure = {\n\tif: isJsonSchema,\n\tthen: ifDefined(isJsonSchema),\n\telse: ifDefined(isJsonSchema),\n}\nexport function isConditionalSchema(input: unknown): input is ConditionalSchema {\n\treturn doesExtend(conditionalSchemaStructure)(input)\n}\n\nexport type NegationSchema = { not: JsonSchema }\nexport const negationSchemaStructure = { not: isJsonSchema }\nexport function isNegationSchema(input: unknown): input is NegationSchema {\n\treturn doesExtend(negationSchemaStructure)(input)\n}\n\nexport type MixedSchema = Partial<\n\tOmit<ArraySchema, `type`> &\n\t\tOmit<BooleanSchema, `enum` | `type`> &\n\t\tOmit<IntegerSchema, `enum` | `type`> &\n\t\tOmit<NullSchema, `type`> &\n\t\tOmit<NumberSchema, `enum` | `type`> &\n\t\tOmit<ObjectSchema, `type`> &\n\t\tOmit<StringSchema, `enum` | `type`>\n> & {\n\ttype: ReadonlyArray<JsonSchemaTypeName>\n\tenum?: ReadonlyArray<integer | boolean | number | string>\n}\nexport const mixedSchemaStructure = {\n\t...arraySchemaStructure,\n\t...booleanSchemaStructure,\n\t...integerSchemaStructure,\n\t...nullSchemaStructure,\n\t...numberSchemaStructure,\n\t...objectSchemaStructure,\n\t...stringSchemaStructure,\n\ttype: isArray(isWithin(JSON_SCHEMA_TYPE_NAMES)),\n\tenum: ifDefined(\n\t\tisArray(isUnion.or(isInteger).or(isBoolean).or(isNumber).or(isString)),\n\t),\n}\nexport function isMixedSchema(input: unknown): input is MixedSchema {\n\treturn doesExtend(mixedSchemaStructure)(input)\n}\n\nexport type JsonSchemaCore =\n\t| ArraySchema\n\t| BooleanSchema\n\t| ConditionalSchema\n\t| ExclusiveSchema\n\t| IntegerSchema\n\t| IntersectionSchema\n\t| MixedSchema\n\t| NegationSchema\n\t| NullSchema\n\t| NumberSchema\n\t| ObjectSchema\n\t| StringSchema\n\t| UnionSchema\n\nexport const isJsonSchemaCore = isUnion\n\t.or(isArraySchema)\n\t.or(isBooleanSchema)\n\t.or(isConditionalSchema)\n\t.or(isExclusiveSchema)\n\t.or(isIntegerSchema)\n\t.or(isIntersectionSchema)\n\t.or(isMixedSchema)\n\t.or(isNegationSchema)\n\t.or(isNullSchema)\n\t.or(isNumberSchema)\n\t.or(isObjectSchema)\n\t.or(isStringSchema)\n\t.or(isUnionSchema)\n\nexport type JsonSchemaLeaf =\n\t| BooleanSchema\n\t| IntegerSchema\n\t| NullSchema\n\t| NumberSchema\n\t| StringSchema\nexport function isJsonSchemaLeaf(input: unknown): input is JsonSchemaLeaf {\n\treturn isUnion\n\t\t.or(isBooleanSchema)\n\t\t.or(isIntegerSchema)\n\t\t.or(isNullSchema)\n\t\t.or(isNumberSchema)\n\t\t.or(isStringSchema)(input)\n}\n\nexport type JsonSchemaTree =\n\t| ArraySchema\n\t| ConditionalSchema\n\t| ExclusiveSchema\n\t| IntersectionSchema\n\t| MixedSchema\n\t| NegationSchema\n\t| ObjectSchema\n\t| UnionSchema\nexport function isJsonSchemaTree(input: unknown): input is JsonSchemaTree {\n\treturn isUnion\n\t\t.or(isArraySchema)\n\t\t.or(isMixedSchema)\n\t\t.or(isObjectSchema)\n\t\t.or(isUnionSchema)\n\t\t.or(isIntersectionSchema)\n\t\t.or(isExclusiveSchema)\n\t\t.or(isConditionalSchema)\n\t\t.or(isNegationSchema)(input)\n}\n\nexport type JsonSchemaRoot = {\n\t$id?: string\n\t$schema?: string\n\t$defs?: Record<string, JsonSchema>\n\tdefinitions?: Record<string, JsonSchema>\n}\n\nexport const isJsonSchemaRoot = doesExtend({\n\t$id: ifDefined(isString),\n\t$schema: ifDefined(isString),\n})\n\n/* prettier-ignore */\nexport type JsonSchemaObject = JsonSchemaCore & JsonSchemaRoot\nexport const isJsonSchemaObject = isIntersection\n\t.and(isJsonSchemaCore)\n\t.and(isJsonSchemaRoot)\n\nexport type JsonSchema = JsonSchemaObject | JsonSchemaRef | boolean\nexport function isJsonSchema(input: unknown): input is JsonSchema {\n\treturn couldBe(isJsonSchemaObject).or(isBoolean).or(isJsonSchemaRef)(input)\n}\n","import { pipe } from \"fp-ts/function\"\n\nexport type IntegerBrand = { readonly integer: unique symbol /* virtual */ }\nexport type integer = IntegerBrand & number\nexport const isInteger = (input: unknown): input is integer =>\n\tNumber.isInteger(input as number)\n\nexport const parseInteger = (input: unknown): integer => {\n\tif (isInteger(input)) return input\n\tthrow new IntegerParseError(input)\n}\n\nexport class Fraction extends Number {\n\tpublic readonly numerator: integer\n\tpublic readonly denominator: integer\n\n\tpublic constructor(n: integer | number, d: integer | number) {\n\t\tsuper(n / d)\n\t\tif (d === 0) {\n\t\t\tthrow new Error(`Denominator cannot be zero`)\n\t\t}\n\t\tthis.numerator = parseInteger(n)\n\t\tthis.denominator = parseInteger(d)\n\t}\n\tpublic readonly [Symbol.toPrimitive]: () => number = () =>\n\t\tthis.numerator / this.denominator\n}\n\nexport const Frac = (n: integer | number, d: integer | number): Fraction =>\n\tnew Fraction(n, d)\n\nexport const isFraction = (input: unknown): input is Fraction =>\n\tinput instanceof Fraction\n\nexport class IntegerParseError extends Error {\n\tpublic constructor(value: unknown) {\n\t\tsuper(`Could not parse integer from ${JSON.stringify(value)}`)\n\t}\n}\n\nexport type IntegerParseResult =\n\t| {\n\t\t\tvalue: integer\n\t\t\terror: null\n\t\t\tround: null\n\t\t\tupper: null\n\t\t\tlower: null\n\t\t\tratio: null\n\t }\n\t| {\n\t\t\tvalue: null\n\t\t\terror: IntegerParseError\n\t\t\tround: integer\n\t\t\tupper: integer\n\t\t\tlower: integer\n\t\t\tratio: Fraction | null\n\t }\n\nexport const Int = Object.assign((input: unknown) => parseInteger(input), {\n\tfrom: (input: unknown): IntegerParseResult =>\n\t\tpipe(input, String, parseFloat, (num) =>\n\t\t\tisInteger(num)\n\t\t\t\t? {\n\t\t\t\t\t\tvalue: num,\n\t\t\t\t\t\terror: null,\n\t\t\t\t\t\tround: null,\n\t\t\t\t\t\tupper: null,\n\t\t\t\t\t\tlower: null,\n\t\t\t\t\t\tratio: null,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tvalue: null,\n\t\t\t\t\t\terror: new IntegerParseError(input),\n\t\t\t\t\t\tround: Math.round(num) as integer,\n\t\t\t\t\t\tupper: Math.ceil(num) as integer,\n\t\t\t\t\t\tlower: Math.floor(num) as integer,\n\t\t\t\t\t\tratio: null,\n\t\t\t\t },\n\t\t),\n\n\tformula: <\n\t\tI extends Record<\n\t\t\tkeyof any,\n\t\t\tFraction | Fraction[] | integer | integer[] | number[] | number\n\t\t>,\n\t\tO extends Record<\n\t\t\tkeyof any,\n\t\t\tFraction | Fraction[] | integer | integer[] | number[] | number\n\t\t>,\n\t>(\n\t\tfm: (\n\t\t\tinput: {\n\t\t\t\t[K in keyof I]: I[K] extends (Fraction | integer)[] ? number[] : number\n\t\t\t},\n\t\t) => O,\n\t) => {\n\t\treturn (input: I): O => {\n\t\t\treturn fm(\n\t\t\t\tinput as {\n\t\t\t\t\t[K in keyof I]: I[K] extends (Fraction | integer)[] ? number[] : number\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\t},\n})\n\nexport function asNumber(input: Fraction | integer | number): number\nexport function asNumber(input: Fraction[] | integer[] | number[]): number[]\nexport function asNumber<\n\tR extends Record<\n\t\tkeyof any,\n\t\tFraction | Fraction[] | integer | integer[] | number[] | number\n\t>,\n>(input: R): {\n\t[K in keyof R]: R[K] extends Fraction | integer | number ? number : number[]\n}\nexport function asNumber(input: unknown): unknown {\n\treturn input as any\n}\n\nexport const a = asNumber(new Fraction(1, 2))\nexport const b = asNumber([new Fraction(1, 2)])\nexport const c = asNumber({ a: new Fraction(1, 2) })\n","import { isString } from \"fp-ts/string\"\n\nimport type { Substitute } from \"~/packages/anvl/src/tree/substitute\"\n\nimport { Int } from \"./integer\"\nimport type { JsonSchema } from \"./json-schema\"\nimport { isJsonSchema } from \"./json-schema\"\nimport { delve } from \"../object\"\nimport { doesExtend } from \"../object/refinement\"\n\nexport type JsonSchemaRef = {\n\t$ref: string\n}\nexport function isJsonSchemaRef(input: unknown): input is JsonSchemaRef {\n\treturn doesExtend({\n\t\t$ref: isString,\n\t})(input)\n}\n\nexport type ReffedJsonSchema = Substitute<\n\tJsonSchema,\n\tJsonSchema,\n\tJsonSchema | JsonSchemaRef\n>\n\nexport const colorPalette: ReffedJsonSchema = {\n\t$defs: {\n\t\tcolorChannel: {\n\t\t\ttype: `integer`,\n\t\t\tminimum: Int(0),\n\t\t\tmaximum: Int(255),\n\t\t},\n\t\tcolor: {\n\t\t\ttype: `object`,\n\t\t\tproperties: {\n\t\t\t\tred: { $ref: `#/$defs/colorChannel` },\n\t\t\t\tgreen: { $ref: `#/$defs/colorChannel` },\n\t\t\t\tblue: { $ref: `#/$defs/colorChannel` },\n\t\t\t},\n\t\t},\n\t},\n\ttype: `array`,\n\titems: {\n\t\t$ref: `#/$defs/color`,\n\t},\n} as const\n\ntype RetrieveRefOptions = {\n\trefNode: JsonSchemaRef\n\trefMap?: Record<string, JsonSchema>\n\troot: ReffedJsonSchema\n}\ntype RetrieveRefResult = {\n\tnode: JsonSchema\n\trefMap: Record<string, JsonSchema>\n}\n\nexport const retrieveRef = ({\n\trefNode: { $ref },\n\trefMap = {},\n\troot,\n}: RetrieveRefOptions): RetrieveRefResult => {\n\tif (typeof root === `boolean`) {\n\t\tthrow new TypeError(`The root is a boolean and cannot be indexed`)\n\t}\n\tif ($ref in refMap) return { node: refMap[$ref], refMap }\n\tconst [_, ...refPath] = $ref.split(`/`)\n\tconst discovery = delve(root, refPath)\n\tif (discovery instanceof Error) throw discovery\n\tlet node = discovery.found\n\twhile (isJsonSchemaRef(node)) {\n\t\tconst result = retrieveRef({ refNode: node, refMap, root })\n\t\tnode = result.node\n\t\trefMap = result.refMap\n\t}\n\tif (isJsonSchema(node)) {\n\t\treturn { node, refMap: { ...refMap, [$ref]: node } }\n\t}\n\tthrow new TypeError(`The refNode is not a JsonSchema`)\n}\n","// import net from \"net\"\n\nimport { isString } from \"fp-ts/string\"\n\nimport { attempt } from \"../function\"\n\nexport const JSON_SCHEMA_STRING_FORMATS = [\n\t`date-time`,\n\t`date`,\n\t`email`,\n\t`hostname`,\n\t`ipv4`,\n\t`ipv6`,\n\t`regex`,\n\t`time`,\n\t`uri-reference`,\n\t`uri-template`,\n\t`uri`,\n\t`uuid`,\n] as const\n\nexport type JsonSchemaStringFormat = typeof JSON_SCHEMA_STRING_FORMATS[number]\n\nexport type date_time = string & { readonly date_time: unique symbol }\nexport type date = string & { readonly date: unique symbol }\nexport type email = string & { readonly email: unique symbol }\nexport type hostname = string & { readonly hostname: unique symbol }\nexport type ipv4 = string & { readonly ipv4: unique symbol }\nexport type ipv6 = string & { readonly ipv6: unique symbol }\nexport type regex = string & { readonly regex: unique symbol }\nexport type time = string & { readonly time: unique symbol }\nexport type uri_reference = string & { readonly uri_reference: unique symbol }\nexport type uri_template = string & { readonly uri_template: unique symbol }\nexport type uri = string & { readonly uri: unique symbol }\nexport type uuid = string & { readonly uuid: unique symbol }\n\nexport const isDateTime = (input: unknown): input is date_time =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^([+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24:?00)([.,]\\d+(?!:))?)?(\\17[0-5]\\d([.,]\\d+)?)?([zZ]|([+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/,\n\t)?.length === 1\n\nexport const isDate = (input: unknown): input is date =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^([+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6]))))?$/,\n\t)?.length === 1\n\nexport const isEmail = (input: unknown): input is email =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n\t)?.length === 1\n\nexport const isHostname = (input: unknown): input is hostname =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^(?=.{1,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)/,\n\t)?.length === 1\n\nexport const isIpv4 = (input: unknown): input is ipv4 =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,\n\t)?.length === 1\n\nexport const isIpv6 = (input: unknown): input is ipv6 => isString(input) // && net.isIPv6(input)\n\nexport const isRegex = (input: unknown): input is regex =>\n\tisString(input) && attempt(() => new RegExp(input))\n\nexport const isTime = (input: unknown): input is time =>\n\tisString(input) &&\n\tinput.match(/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\\.\\d+)?$/)\n\t\t?.length === 1\n\nexport const isUriReference = (input: unknown): input is uri_reference =>\n\tisString(input) &&\n\tinput.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/)\n\t\t?.length === 1\n\nexport const isUriTemplate = (input: unknown): input is uri_template =>\n\tisString(input) &&\n\tinput.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/)\n\t\t?.length === 1\n\nexport const isUri = (input: unknown): input is uri =>\n\tisString(input) &&\n\tinput.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/)\n\t\t?.length === 1\n\nexport const isUuid = (input: unknown): input is uuid =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,\n\t)?.length === 1\n","export const expandPathForSchema = (\n\tpath: (keyof any)[],\n): (number | string)[] | Error => {\n\ttry {\n\t\treturn path.flatMap((key) => {\n\t\t\tswitch (typeof key) {\n\t\t\t\tcase `string`:\n\t\t\t\t\treturn [`properties`, key]\n\t\t\t\tcase `number`:\n\t\t\t\t\treturn [`items`, key]\n\t\t\t\tcase `symbol`:\n\t\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\t`The key ${String(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t)} is not a valid JSON key; expected string or number, got symbol`,\n\t\t\t\t\t)\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\t`The key ${key} is not a valid JSON key; expected string or number, got ${typeof key}`,\n\t\t\t\t\t)\n\t\t\t}\n\t\t})\n\t} catch (caught) {\n\t\tif (caught instanceof TypeError) return caught\n\t\tthrow caught\n\t}\n}\n","import { isJsonSchema } from \"./json-schema\"\nimport { expandPathForSchema } from \"./path-into\"\nimport { isJsonSchemaRef, retrieveRef } from \"./refs\"\nimport type { ReffedJsonSchema } from \"./refs\"\n\nexport const findSubSchema = (\n\tschema: ReffedJsonSchema,\n): ((\n\tpath: (number | string)[] | ReadonlyArray<number | string>,\n) => Error | ReffedJsonSchema) => {\n\tif (typeof schema === `boolean`) {\n\t\tthrow new Error(`The schema does not contain subSchemas`)\n\t}\n\treturn (path: string[]) => {\n\t\tconst pathIntoSchema = expandPathForSchema(path)\n\t\tif (pathIntoSchema instanceof Error) return pathIntoSchema\n\t\tif (typeof schema === `boolean`) {\n\t\t\treturn new TypeError(`The schema is not a JsonSchema`)\n\t\t}\n\t\tconst { node, refMap } = pathIntoSchema.reduce(\n\t\t\t({ node, refMap = undefined }, key) => (\n\t\t\t\tconsole.log({ node, key }),\n\t\t\t\tisJsonSchemaRef(node)\n\t\t\t\t\t? retrieveRef({ refNode: node, root: schema, refMap })\n\t\t\t\t\t: { node: node[key], refMap }\n\t\t\t),\n\t\t\t{ node: schema, refMap: undefined },\n\t\t)\n\t\tif (node instanceof Error) throw node\n\n\t\tlet subSchema = node\n\t\twhile (isJsonSchemaRef(subSchema)) {\n\t\t\tconsole.log({ subSchema })\n\t\t\tsubSchema = retrieveRef({ refNode: subSchema, root: schema, refMap }).node\n\t\t}\n\t\tconsole.log({ subSchema })\n\n\t\tif (isJsonSchema(subSchema)) {\n\t\t\treturn subSchema\n\t\t}\n\t\tthrow new TypeError(`The subSchema is not a JsonSchema`)\n\t}\n}\n","import type {\n\tJson,\n\tJsonArr,\n\tJsonObj,\n\tSerializable,\n} from \"~/packages/anvl/src/json\"\nimport { refineJsonType } from \"~/packages/anvl/src/json\"\n\nexport const stringToBoolean = (str: string): boolean => str === `true`\nexport const stringToNumber = (str: string): number => Number(str)\nexport const stringToArray = (str: string): string[] => str.split(`,`)\nexport const stringToObject = (str: string): JsonObj => {\n\ttry {\n\t\treturn JSON.parse(str)\n\t} catch (e) {\n\t\treturn { [str]: str }\n\t}\n}\n\nexport const objectToString = (obj: JsonObj): string => JSON.stringify(obj)\nexport const objectToBoolean = (obj: JsonObj): boolean => obj.true === true\nexport const objectToNumber = (obj: JsonObj): number =>\n\tNumber(obj.number ?? obj.size ?? obj.count ?? 0)\nexport const objectToArray = <T extends Serializable>(\n\tobj: JsonObj<string, T>,\n): [key: string, value: T][] => Object.entries(obj)\n\nexport const booleanToString = (bool: boolean): string => bool.toString()\nexport const booleanToNumber = (bool: boolean): number => +bool\nexport const booleanToObject = (bool: boolean): JsonObj => ({\n\t[bool.toString()]: bool,\n})\nexport const booleanToArray = (bool: boolean): boolean[] => [bool]\n\nexport const numberToString = (num: number): string => num.toString()\nexport const numberToBoolean = (num: number): boolean => num === 1\nexport const numberToObject = (num: number): JsonObj => ({\n\tnumber: num,\n})\nexport const numberToArray = (num: number): null[] => Array(num).fill(null)\n\nexport const arrayToString = (arr: JsonArr): string => arr.join(`,`)\nexport const arrayToNumber = (arr: JsonArr): number => arr.length\nexport const arrayToBoolean = (arr: JsonArr): boolean =>\n\ttypeof arr[0] === `boolean` ? arr[0] : arr.length > 0\nexport const arrayToObject = <T extends Serializable>(\n\tarr: JsonArr<T>,\n): JsonObj<`${number}`, T> =>\n\tarr.reduce((acc, cur, idx) => {\n\t\tacc[`${idx}`] = cur\n\t\treturn acc\n\t}, {} as JsonObj<`${number}`, T>)\n\nexport const nullToString = (): string => ``\nexport const nullToNumber = (): number => 0\nexport const nullToBoolean = (): boolean => false\nexport const nullToArray = (): JsonArr => []\nexport const nullToObject = (): JsonObj => ({})\n\nexport const cast = (\n\tinput: Json,\n): {\n\tto: {\n\t\tarray: () => JsonArr\n\t\tboolean: () => boolean\n\t\tnumber: () => number\n\t\tobject: () => JsonObj\n\t\tstring: () => string\n\t\tnull: () => null\n\t}\n} => {\n\tconst json = refineJsonType(input)\n\treturn {\n\t\tto: {\n\t\t\tarray: () => {\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase `array`:\n\t\t\t\t\t\treturn json.data\n\t\t\t\t\tcase `object`:\n\t\t\t\t\t\treturn objectToArray(json.data)\n\t\t\t\t\tcase `string`:\n\t\t\t\t\t\treturn stringToArray(json.data)\n\t\t\t\t\tcase `boolean`:\n\t\t\t\t\t\treturn booleanToArray(json.data)\n\t\t\t\t\tcase `number`:\n\t\t\t\t\t\treturn numberToArray(json.data)\n\t\t\t\t\tcase `null`:\n\t\t\t\t\t\treturn nullToArray()\n\t\t\t\t}\n\t\t\t},\n\t\t\tboolean: () => {\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase `array`:\n\t\t\t\t\t\treturn arrayToBoolean(json.data)\n\t\t\t\t\tcase `object`:\n\t\t\t\t\t\treturn objectToBoolean(json.data)\n\t\t\t\t\tcase `string`:\n\t\t\t\t\t\treturn stringToBoolean(json.data)\n\t\t\t\t\tcase `boolean`:\n\t\t\t\t\t\treturn json.data\n\t\t\t\t\tcase `number`:\n\t\t\t\t\t\treturn numberToBoolean(json.data)\n\t\t\t\t\tcase `null`:\n\t\t\t\t\t\treturn nullToBoolean()\n\t\t\t\t}\n\t\t\t},\n\t\t\tnumber: () => {\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase `array`:\n\t\t\t\t\t\treturn arrayToNumber(json.data)\n\t\t\t\t\tcase `object`:\n\t\t\t\t\t\treturn objectToNumber(json.data)\n\t\t\t\t\tcase `string`:\n\t\t\t\t\t\treturn stringToNumber(json.data)\n\t\t\t\t\tcase `boolean`:\n\t\t\t\t\t\treturn booleanToNumber(json.data)\n\t\t\t\t\tcase `number`:\n\t\t\t\t\t\treturn json.data\n\t\t\t\t\tcase `null`:\n\t\t\t\t\t\treturn nullToNumber()\n\t\t\t\t}\n\t\t\t},\n\t\t\tobject: () => {\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase `array`:\n\t\t\t\t\t\treturn arrayToObject(json.data)\n\t\t\t\t\tcase `object`:\n\t\t\t\t\t\treturn json.data\n\t\t\t\t\tcase `string`:\n\t\t\t\t\t\treturn stringToObject(json.data)\n\t\t\t\t\tcase `boolean`:\n\t\t\t\t\t\treturn booleanToObject(json.data)\n\t\t\t\t\tcase `number`:\n\t\t\t\t\t\treturn numberToObject(json.data)\n\t\t\t\t\tcase `null`:\n\t\t\t\t\t\treturn nullToObject()\n\t\t\t\t}\n\t\t\t},\n\t\t\tstring: () => {\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase `array`:\n\t\t\t\t\t\treturn arrayToString(json.data)\n\t\t\t\t\tcase `object`:\n\t\t\t\t\t\treturn objectToString(json.data)\n\t\t\t\t\tcase `string`:\n\t\t\t\t\t\treturn json.data\n\t\t\t\t\tcase `boolean`:\n\t\t\t\t\t\treturn booleanToString(json.data)\n\t\t\t\t\tcase `number`:\n\t\t\t\t\t\treturn numberToString(json.data)\n\t\t\t\t\tcase `null`:\n\t\t\t\t\t\treturn nullToString()\n\t\t\t\t}\n\t\t\t},\n\t\t\tnull: () => null,\n\t\t},\n\t}\n}\n","import type { MutableRefObject } from \"react\"\nimport type { SetterOrUpdater } from \"recoil\"\n\nimport { become } from \"~/packages/anvl/src/function\"\nimport { JSON_DEFAULTS } from \"~/packages/anvl/src/json\"\nimport type { Json, JsonObj, JsonTypeName } from \"~/packages/anvl/src/json\"\nimport { cast } from \"~/packages/anvl/src/json/cast\"\nimport { mapObject } from \"~/packages/anvl/src/object\"\n\nexport const makePropertySetters = <T extends JsonObj>(\n\tdata: T,\n\tset: SetterOrUpdater<T>,\n): { [K in keyof T]: SetterOrUpdater<T[K]> } =>\n\tmapObject<keyof T, any, SetterOrUpdater<any>>(\n\t\tdata,\n\t\t(value, key) => (newValue) =>\n\t\t\tset({ ...data, [key]: become(newValue)(value[key]) }),\n\t)\n\nexport const makePropertyRenamers = <T extends JsonObj>(\n\tdata: T,\n\tset: SetterOrUpdater<T>,\n\tstableKeyMapRef: MutableRefObject<{ [K in keyof T]: keyof T }>,\n): { [K in keyof T]: (newKey: string) => void } =>\n\tmapObject<keyof T, any, (newKey: string) => void>(\n\t\tdata,\n\t\t(value, key) => (newKey) =>\n\t\t\tObject.hasOwn(data, newKey)\n\t\t\t\t? null\n\t\t\t\t: set(() => {\n\t\t\t\t\t\tconst entries = Object.entries(data)\n\t\t\t\t\t\tconst index = entries.findIndex(([k]) => k === key)\n\t\t\t\t\t\tentries[index] = [newKey, value]\n\t\t\t\t\t\tconst stableKeyMap = stableKeyMapRef.current\n\t\t\t\t\t\tstableKeyMapRef.current = {\n\t\t\t\t\t\t\t...stableKeyMap,\n\t\t\t\t\t\t\t[newKey]: stableKeyMap[key],\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn Object.fromEntries(entries) as T\n\t\t\t\t }),\n\t)\n\nexport const makePropertyRemovers = <T extends JsonObj>(\n\tdata: T,\n\tset: SetterOrUpdater<T>,\n): { [K in keyof T]: () => void } =>\n\tmapObject<keyof T, any, () => void>(\n\t\tdata,\n\t\t(_, key) => () =>\n\t\t\tset(() => {\n\t\t\t\tconst { [key]: _, ...rest } = data\n\t\t\t\treturn rest as T\n\t\t\t}),\n\t)\n\nexport const makePropertyRecasters = <T extends JsonObj>(\n\tdata: T,\n\tset: SetterOrUpdater<T>,\n): { [K in keyof T]: (newType: JsonTypeName) => void } =>\n\tmapObject<keyof T, any, (newType: JsonTypeName) => void>(\n\t\tdata,\n\t\t(value, key) => (newType) =>\n\t\t\tset(() => ({\n\t\t\t\t...data,\n\t\t\t\t[key]: cast(value).to[newType](),\n\t\t\t})),\n\t)\n\nexport const makePropertyCreationInterface =\n\t<T extends JsonObj>(\n\t\tdata: T,\n\t\tset: SetterOrUpdater<T>,\n\t): ((key: string, type: JsonTypeName) => (value?: Json) => void) =>\n\t(key, type) =>\n\t(value) =>\n\t\tset({ ...data, [key]: value ?? JSON_DEFAULTS[type] })\n\nexport const makePropertySorter =\n\t<T extends JsonObj>(\n\t\tdata: T,\n\t\tset: SetterOrUpdater<T>,\n\t\tsortFn?: (a: string, b: string) => number,\n\t): (() => void) =>\n\t() => {\n\t\tconst sortedKeys = Object.keys(data).sort(sortFn)\n\t\tconst sortedObj = {} as Record<string, unknown>\n\t\tsortedKeys.forEach((key) => (sortedObj[key] = data[key]))\n\t\tset(sortedObj as T)\n\t}\n\n// export const sortPropertiesAlphabetically = <T extends JsonObj>(data: T): T =>\n// sortProperties(data, (a, b) => a.localeCompare(b))\n\nexport const deleteProperty =\n\t<T extends JsonObj>(\n\t\tdata: T,\n\t\tset: SetterOrUpdater<T>,\n\t): ((key: keyof T) => void) =>\n\t(key) => {\n\t\tconst { [key]: _, ...rest } = data\n\t\tset(rest as T)\n\t}\n\nexport const addProperty =\n\t<T extends JsonObj>(\n\t\tdata: T,\n\t\tset: SetterOrUpdater<T>,\n\t): ((key?: string, value?: Json) => void) =>\n\t(key, value) => {\n\t\tconst newKey = key ?? `newProperty`\n\t\tconst newValue = value ?? ``\n\t\tset({ ...data, [newKey]: newValue })\n\t}\n","import type { ReactElement } from \"react\"\n\nimport { NumberInput, TextInput } from \"../../react-elastic-input\"\nimport type { JsonEditorProps_INTERNAL } from \"../json-editor-internal\"\n\nexport const BooleanEditor = ({\n\tdata,\n\tset,\n\tComponents,\n}: JsonEditorProps_INTERNAL<boolean>): ReactElement => (\n\t<Components.BooleanWrapper>\n\t\t<input\n\t\t\ttype=\"checkbox\"\n\t\t\tchecked={data}\n\t\t\tonChange={(event) => set(event.target.checked)}\n\t\t/>\n\t</Components.BooleanWrapper>\n)\n\nexport const NullEditor = ({\n\tComponents,\n}: JsonEditorProps_INTERNAL<null>): ReactElement => (\n\t<Components.NullWrapper>\n\t\t<></>\n\t</Components.NullWrapper>\n)\n\nexport const NumberEditor = ({\n\tpath = [],\n\tisReadonly = () => false,\n\tdata,\n\tset,\n\tComponents,\n}: JsonEditorProps_INTERNAL<number>): ReactElement => (\n\t<Components.NumberWrapper>\n\t\t<NumberInput\n\t\t\tvalue={data}\n\t\t\tset={isReadonly(path) ? undefined : (newValue) => set(Number(newValue))}\n\t\t\tautoSize={true}\n\t\t/>\n\t</Components.NumberWrapper>\n)\n\nexport const StringEditor = ({\n\tpath = [],\n\tisReadonly = () => false,\n\tdata,\n\tset,\n\tComponents,\n}: JsonEditorProps_INTERNAL<string>): ReactElement => {\n\treturn (\n\t\t<Components.StringWrapper>\n\t\t\t<TextInput\n\t\t\t\tvalue={data}\n\t\t\t\tset={isReadonly(path) ? undefined : set}\n\t\t\t\tautoSize={true}\n\t\t\t/>\n\t\t</Components.StringWrapper>\n\t)\n}\n","import type { ErrorInfo, ReactNode, FC } from \"react\"\nimport { useId, Component } from \"react\"\nimport { atomFamily, useRecoilState, useResetRecoilState } from \"recoil\"\n\nimport type { FallbackProps } from \"./DefaultFallback\"\nimport { DefaultFallback } from \"./DefaultFallback\"\n\nexport type ErrorBoundaryState = {\n\terror?: Error | string\n\terrorInfo?: ErrorInfo\n}\n\nexport type ErrorBoundaryProps = {\n\tchildren: ReactNode\n\tonError?: (error: Error | string, errorInfo: ErrorInfo) => void\n\tFallback?: FC<FallbackProps>\n}\n\nexport class ErrorBoundary extends Component<\n\tErrorBoundaryProps,\n\tErrorBoundaryState\n> {\n\tpublic constructor(props: ErrorBoundaryProps) {\n\t\tsuper(props)\n\t\tthis.state = { error: undefined, errorInfo: undefined }\n\t\t// We can filter or add information\n\t\t// to airbrake notifications here:\n\t}\n\n\tpublic override componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n\t\tthis.props.onError?.(error, errorInfo)\n\t\tthis.setState({\n\t\t\terror,\n\t\t\terrorInfo,\n\t\t})\n\t}\n\n\tpublic override render(): ReactNode {\n\t\tconst { error, errorInfo } = this.state\n\t\tconst { children, Fallback = DefaultFallback } = this.props\n\n\t\treturn errorInfo ? (\n\t\t\t<Fallback error={error} errorInfo={errorInfo} />\n\t\t) : (\n\t\t\t(children as ReactNode)\n\t\t)\n\t}\n}\n\nexport const findErrorBoundaryState = atomFamily<ErrorBoundaryState, string>({\n\tkey: `errorBoundary`,\n\tdefault: { error: undefined, errorInfo: undefined },\n})\n\nexport const RecoverableErrorBoundary: FC<ErrorBoundaryProps> = ({\n\tchildren,\n\tFallback = DefaultFallback,\n}) => {\n\tconst nodeId = useId()\n\tconst [{ error }, setError] = useRecoilState(findErrorBoundaryState(nodeId))\n\tconst resetError = useResetRecoilState(findErrorBoundaryState(nodeId))\n\tconst hasError = Boolean(error)\n\n\treturn hasError ? (\n\t\t<div>\n\t\t\t<button type=\"button\" onClick={resetError}>\n\t\t\t\tReset\n\t\t\t</button>\n\t\t\t<ErrorBoundary Fallback={Fallback}>{children}</ErrorBoundary>\n\t\t</div>\n\t) : (\n\t\t<ErrorBoundary\n\t\t\tFallback={Fallback}\n\t\t\tonError={(newError, newErrorInfo) =>\n\t\t\t\tsetError({ error: newError, errorInfo: newErrorInfo })\n\t\t\t}\n\t\t>\n\t\t\t{children}\n\t\t</ErrorBoundary>\n\t)\n}\n","import type { ErrorInfo, FC } from \"react\"\n\nexport type FallbackProps = {\n\terror?: Error | string\n\terrorInfo?: ErrorInfo\n}\n\nexport const DefaultFallback: FC<FallbackProps> = ({ error, errorInfo }) => {\n\tconst component = errorInfo?.componentStack.split(` `).filter(Boolean)[2]\n\tconst message =\n\t\terror?.toString() ?? errorInfo?.componentStack ?? `Unknown error`\n\treturn (\n\t\t<div\n\t\t\tdata-testid=\"error-boundary\"\n\t\t\tstyle={{\n\t\t\t\tflex: `1`,\n\t\t\t\tbackground: `black`,\n\t\t\t\tbackgroundImage: `url(./src/assets/kablooey.gif)`,\n\t\t\t\tbackgroundPosition: `center`,\n\t\t\t\t// backgroundRepeat: `no-repeat`,\n\t\t\t\tbackgroundSize: `overlay`,\n\t\t\t}}\n\t\t>\n\t\t\t{/* <img src=\"./src/assets/kablooey.gif\" alt=\"error\" /> */}\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tmargin: `50px`,\n\t\t\t\t\tmarginTop: `0`,\n\t\t\t\t\tpadding: `50px`,\n\t\t\t\t\tborder: `1px solid dashed`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbackground: `black`,\n\t\t\t\t\t\tcolor: `white`,\n\t\t\t\t\t\tpadding: 10,\n\t\t\t\t\t\tpaddingTop: 5,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{`⚠️ `}\n\t\t\t\t\t<span style={{ color: `#fc0`, fontWeight: 700 }}>{component}</span>\n\t\t\t\t\t{` ⚠️ `}\n\t\t\t\t\t{message}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n","import type { SerializedStyles } from \"@emotion/react\"\nimport type { StyledComponent } from \"@emotion/styled\"\nimport type { FC, ReactNode } from \"react\"\n\nimport { ErrorBoundary } from \"../react-error-boundary\"\n\nexport type Dict<T> = Record<string, T>\n\nexport type WrapperComponent<T extends Dict<unknown> = Dict<unknown>> = FC<\n\tT & { children: ReactNode }\n>\n\nexport type WC<T extends Dict<unknown> = Dict<unknown>> = WrapperComponent<T>\n\nexport type JsonEditorComponents = {\n\tErrorBoundary: WC\n\n\tButton: WC<{ onClick: () => void; disabled: boolean }>\n\tDeleteIcon: FC\n\n\tEditorLayout: FC<{\n\t\tDeleteButton?: FC\n\t\tHeader?: FC\n\t\tKeyInput?: FC\n\t\tTypeSelect?: FC\n\t\tValueEditor: FC\n\t\tWrapper: WC\n\t}>\n\tEditorWrapper: WC<{ customCss?: SerializedStyles; className?: string }>\n\n\tArrayWrapper: WC\n\tObjectWrapper: WC\n\tStringWrapper: WC\n\tNumberWrapper: WC\n\tBooleanWrapper: WC\n\tNullWrapper: WC\n\n\tMiscastPropertyWrapper: WC\n\tMissingPropertyWrapper: WC\n\tOfficialPropertyWrapper: WC\n\tUnofficialPropertyWrapper: WC\n\tIllegalPropertyWrapper: WC\n\tKeyWrapper: WC\n}\n\nexport const DEFAULT_JSON_EDITOR_COMPONENTS: JsonEditorComponents = {\n\tErrorBoundary: ({ children }) => <ErrorBoundary>{children}</ErrorBoundary>,\n\tButton: ({ onClick, children, disabled }) => (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName=\"json_editor_button\"\n\t\t\tonClick={onClick}\n\t\t\tdisabled={disabled}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t),\n\tEditorWrapper: ({ children, customCss, className }) => (\n\t\t<div className={`json_editor` + ` ` + className ?? ``} css={customCss}>\n\t\t\t{children}\n\t\t</div>\n\t),\n\tEditorLayout: ({\n\t\tDeleteButton,\n\t\tHeader,\n\t\tKeyInput,\n\t\tTypeSelect,\n\t\tValueEditor,\n\t\tWrapper,\n\t}) => {\n\t\treturn (\n\t\t\t<Wrapper>\n\t\t\t\t{DeleteButton && <DeleteButton />}\n\t\t\t\t{Header && <Header />}\n\t\t\t\t{KeyInput && <KeyInput />}\n\t\t\t\t{TypeSelect && <TypeSelect />}\n\t\t\t\t<ValueEditor />\n\t\t\t</Wrapper>\n\t\t)\n\t},\n\tArrayWrapper: ({ children }) => (\n\t\t<div className=\"json_editor_array\">{children}</div>\n\t),\n\tObjectWrapper: ({ children }) => (\n\t\t<div className=\"json_editor_object\">{children}</div>\n\t),\n\tStringWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_string\">{children}</span>\n\t),\n\tNumberWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_number\">{children}</span>\n\t),\n\tBooleanWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_boolean\">{children}</span>\n\t),\n\tNullWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_null\">{children}</span>\n\t),\n\tMissingPropertyWrapper: ({ children }) => (\n\t\t<div className=\"json_editor_property json_editor_missing\">{children}</div>\n\t),\n\tMiscastPropertyWrapper: ({ children }) => (\n\t\t<div className=\"json_editor_property json_editor_miscast\">{children}</div>\n\t),\n\tIllegalPropertyWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_property json_editor_illegal\">{children}</span>\n\t),\n\tOfficialPropertyWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_property json_editor_official\">{children}</span>\n\t),\n\tUnofficialPropertyWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_property json_editor_unofficial\">\n\t\t\t{children}\n\t\t</span>\n\t),\n\tDeleteIcon: () => (\n\t\t<span className=\"json_editor_icon json_editor_delete\">x</span>\n\t),\n\tKeyWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_key\">{children}</span>\n\t),\n}\n","import type { SerializedStyles } from \"@emotion/react\"\nimport Ajv from \"ajv\"\nimport type { FC, ReactElement, RefObject } from \"react\"\nimport { useMemo } from \"react\"\nimport type { SetterOrUpdater } from \"recoil\"\n\nimport type { Json, JsonTypes } from \"~/packages/anvl/src/json\"\nimport type { JsonSchema } from \"~/packages/anvl/src/json-schema/json-schema\"\n\nimport type { JsonEditorComponents } from \"./default-components\"\nimport { DEFAULT_JSON_EDITOR_COMPONENTS } from \"./default-components\"\nimport { ArrayEditor } from \"./editors-by-type/array-editor\"\nimport { ObjectEditor } from \"./editors-by-type/object-editor\"\nimport {\n\tBooleanEditor,\n\tNullEditor,\n\tNumberEditor,\n\tStringEditor,\n} from \"./editors-by-type/primitive-editors\"\nimport type { JsonEditorProps_INTERNAL } from \"./json-editor-internal\"\nimport { JsonEditor_INTERNAL } from \"./json-editor-internal\"\n\nexport const SubEditors: Record<\n\tkeyof JsonTypes,\n\tFC<JsonEditorProps_INTERNAL<any>>\n> = {\n\tarray: ArrayEditor,\n\tboolean: BooleanEditor,\n\tnull: NullEditor,\n\tnumber: NumberEditor,\n\tobject: ObjectEditor,\n\tstring: StringEditor,\n}\n\nexport type JsonEditorProps<T extends Json> = {\n\tdata: T\n\tset: SetterOrUpdater<T>\n\tref?: RefObject<HTMLInputElement>\n\tname?: string\n\trename?: (newKey: string) => void\n\tremove?: () => void\n\tschema?: JsonSchema\n\tpath?: ReadonlyArray<number | string>\n\tisReadonly?: (path: ReadonlyArray<number | string>) => boolean\n\tisHidden?: (path: ReadonlyArray<number | string>) => boolean\n\tclassName?: string\n\tcustomCss?: SerializedStyles\n\tHeader?: FC<{ data: T; schema?: JsonSchema }>\n\tComponents?: Partial<JsonEditorComponents>\n}\n\nexport const JsonEditor = <T extends Json>({\n\tdata,\n\tset,\n\tschema = true,\n\tname,\n\trename,\n\tremove,\n\tisReadonly = () => false,\n\tisHidden = () => false,\n\t// isIllegal = () => false,\n\tclassName,\n\tcustomCss,\n\tHeader,\n\tComponents: CustomComponents = {},\n}: JsonEditorProps<T>): ReactElement => {\n\tconst Components = {\n\t\t...DEFAULT_JSON_EDITOR_COMPONENTS,\n\t\t...CustomComponents,\n\t}\n\n\tconst ajv = new Ajv({ allErrors: true, verbose: true })\n\tconst validate = useMemo(() => {\n\t\treturn ajv.compile(schema)\n\t}, [schema])\n\tconst validationResults = validate(data)\n\n\treturn (\n\t\t<JsonEditor_INTERNAL\n\t\t\tdata={data}\n\t\t\tset={set}\n\t\t\tname={name}\n\t\t\tschema={schema}\n\t\t\trename={rename}\n\t\t\tremove={remove}\n\t\t\tpath={[]}\n\t\t\tisReadonly={isReadonly}\n\t\t\tisHidden={isHidden}\n\t\t\tclassName={className}\n\t\t\tcustomCss={customCss}\n\t\t\tHeader={Header}\n\t\t\tComponents={Components}\n\t\t/>\n\t)\n}\n","import type { FC } from \"react\"\n\nimport type { JsonTypes } from \"~/packages/anvl/src/json\"\n\nimport { ArrayEditor } from \"./editors-by-type/array-editor\"\nimport { ObjectEditor } from \"./editors-by-type/object-editor\"\nimport {\n\tBooleanEditor,\n\tNullEditor,\n\tNumberEditor,\n\tStringEditor,\n} from \"./editors-by-type/primitive-editors\"\nimport type { JsonEditorProps_INTERNAL } from \"./json-editor-internal\"\n\nexport * from \"./default-components\"\nexport * from \"./developer-interface\"\n\nexport const SubEditors: Record<\n\tkeyof JsonTypes,\n\tFC<JsonEditorProps_INTERNAL<any>>\n> = {\n\tarray: ArrayEditor,\n\tboolean: BooleanEditor,\n\tnull: NullEditor,\n\tnumber: NumberEditor,\n\tobject: ObjectEditor,\n\tstring: StringEditor,\n}\n","import {\n\tundo,\n\ttype AtomToken,\n\ttype ReadonlySelectorToken,\n\ttype TimelineToken,\n\tredo,\n} from \"atom.io\"\nimport { useIO, useO } from \"atom.io/react\"\nimport { Fragment, type FC } from \"react\"\n\nimport { findTimelineState, findViewIsOpenState, timelineIndex } from \".\"\nimport { button } from \"./Button\"\nimport { article } from \"./Updates\"\nimport type { Timeline } from \"../internal\"\n\nexport const YouAreHere: FC = () => {\n\treturn <span className=\"you_are_here\">you are here</span>\n}\n\nexport const TimelineLog: FC<{\n\ttoken: TimelineToken\n\tisOpenState: AtomToken<boolean>\n\ttimelineState: ReadonlySelectorToken<Timeline>\n}> = ({ token, isOpenState, timelineState }) => {\n\tconst timeline = useO(timelineState)\n\tconst [isOpen, setIsOpen] = useIO(isOpenState)\n\n\treturn (\n\t\t<section className=\"node timeline_log\">\n\t\t\t<header>\n\t\t\t\t<button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />\n\t\t\t\t<label>\n\t\t\t\t\t<h2>{token.key}</h2>\n\t\t\t\t\t<span className=\"detail length\">\n\t\t\t\t\t\t({timeline.at}/{timeline.history.length})\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"gap\" />\n\t\t\t\t\t<nav>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={() => undo(token)}\n\t\t\t\t\t\t\tdisabled={timeline.at === 0}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tundo\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={() => redo(token)}\n\t\t\t\t\t\t\tdisabled={timeline.at === timeline.history.length}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tredo\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</nav>\n\t\t\t\t</label>\n\t\t\t</header>\n\t\t\t{isOpen ? (\n\t\t\t\t<main>\n\t\t\t\t\t{timeline.history.map((update, index) => (\n\t\t\t\t\t\t<Fragment key={update.key + index + timeline.at}>\n\t\t\t\t\t\t\t{index === timeline.at ? <YouAreHere /> : null}\n\t\t\t\t\t\t\t<article.TimelineUpdate timelineUpdate={update} />\n\t\t\t\t\t\t\t{index === timeline.history.length - 1 &&\n\t\t\t\t\t\t\ttimeline.at === timeline.history.length ? (\n\t\t\t\t\t\t\t\t<YouAreHere />\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t))}\n\t\t\t\t</main>\n\t\t\t) : null}\n\t\t</section>\n\t)\n}\n\nexport const TimelineIndex: FC = () => {\n\tconst tokenIds = useO(timelineIndex)\n\treturn (\n\t\t<article className=\"index timeline_index\">\n\t\t\t{tokenIds\n\t\t\t\t.filter((token) => !token.key.startsWith(`👁‍🗨`))\n\t\t\t\t.map((token) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TimelineLog\n\t\t\t\t\t\t\tkey={token.key}\n\t\t\t\t\t\t\ttoken={token}\n\t\t\t\t\t\t\tisOpenState={findViewIsOpenState(token.key)}\n\t\t\t\t\t\t\ttimelineState={findTimelineState(token.key)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t</article>\n\t)\n}\n","import type { ƒn } from \"~/packages/anvl/src/function\"\nimport { discoverType } from \"~/packages/anvl/src/refinement/refinery\"\n\nimport { prettyJson } from \".\"\nimport type { KeyedStateUpdate } from \"../subscribe\"\nimport type { TimelineUpdate } from \"../timeline\"\nimport type { TransactionUpdate } from \"../transaction\"\n\nconst AtomUpdateFC: React.FC<{\n\tserialNumber: number\n\tatomUpdate: KeyedStateUpdate<unknown>\n}> = ({ atomUpdate }) => {\n\treturn (\n\t\t<article\n\t\t\tkey={atomUpdate.key}\n\t\t\tclassName=\"node atom_update\"\n\t\t\tonClick={() => console.log(atomUpdate)}\n\t\t\tonKeyUp={() => console.log(atomUpdate)}\n\t\t>\n\t\t\t<span className=\"detail\">{atomUpdate.key}: </span>\n\t\t\t<span>\n\t\t\t\t<span className=\"summary\">\n\t\t\t\t\t{prettyJson.diff(atomUpdate.oldValue, atomUpdate.newValue).summary}\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</article>\n\t)\n}\n\nconst TransactionUpdateFC: React.FC<{\n\tserialNumber: number\n\ttransactionUpdate: TransactionUpdate<ƒn>\n}> = ({ serialNumber, transactionUpdate }) => {\n\treturn (\n\t\t<article className=\"node transaction_update\">\n\t\t\t<header>\n\t\t\t\t<h4>{serialNumber}</h4>\n\t\t\t</header>\n\t\t\t<main>\n\t\t\t\t<section className=\"transaction_params\">\n\t\t\t\t\t<span className=\"detail\">params: </span>\n\t\t\t\t\t{transactionUpdate.params.map((param, index) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<article\n\t\t\t\t\t\t\t\tkey={`param` + index}\n\t\t\t\t\t\t\t\tclassName=\"node transaction_param\"\n\t\t\t\t\t\t\t\tonClick={() => console.log(transactionUpdate)}\n\t\t\t\t\t\t\t\tonKeyUp={() => console.log(transactionUpdate)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span className=\"detail\">{discoverType(param)}: </span>\n\t\t\t\t\t\t\t\t<span className=\"summary\">\n\t\t\t\t\t\t\t\t\t{typeof param === `object` &&\n\t\t\t\t\t\t\t\t\t`type` in param &&\n\t\t\t\t\t\t\t\t\t`target` in param ? (\n\t\t\t\t\t\t\t\t\t\t<>{JSON.stringify(param.type)}</>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<>{JSON.stringify(param)}</>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</article>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</section>\n\t\t\t\t<section className=\"node transaction_output\">\n\t\t\t\t\t<span className=\"detail\">output: </span>\n\t\t\t\t\t<span className=\"detail\">\n\t\t\t\t\t\t{discoverType(transactionUpdate.output)}\n\t\t\t\t\t</span>\n\t\t\t\t\t{transactionUpdate.output ? (\n\t\t\t\t\t\t<span className=\"summary\">\n\t\t\t\t\t\t\t: {JSON.stringify(transactionUpdate.output)}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t</section>\n\t\t\t\t<section className=\"transaction_impact\">\n\t\t\t\t\t<span className=\"detail\">impact: </span>\n\t\t\t\t\t{transactionUpdate.atomUpdates\n\t\t\t\t\t\t.filter((token) => !token.key.startsWith(`👁‍🗨`))\n\t\t\t\t\t\t.map((atomUpdate, index) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<article.AtomUpdate\n\t\t\t\t\t\t\t\t\tkey={`${transactionUpdate.key}:${index}:${atomUpdate.key}`}\n\t\t\t\t\t\t\t\t\tserialNumber={index}\n\t\t\t\t\t\t\t\t\tatomUpdate={atomUpdate}\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</section>\n\t\t\t</main>\n\t\t</article>\n\t)\n}\n\nexport const TimelineUpdateFC: React.FC<{\n\ttimelineUpdate: TimelineUpdate\n}> = ({ timelineUpdate }) => {\n\treturn (\n\t\t<article className=\"node timeline_update\">\n\t\t\t<header>\n\t\t\t\t<h4>\n\t\t\t\t\t{timelineUpdate.timestamp}: {timelineUpdate.type} ({timelineUpdate.key}\n\t\t\t\t\t)\n\t\t\t\t</h4>\n\t\t\t</header>\n\t\t\t<main>\n\t\t\t\t{timelineUpdate.type === `transaction_update` ? (\n\t\t\t\t\ttimelineUpdate.atomUpdates\n\t\t\t\t\t\t.filter((token) => !token.key.startsWith(`👁‍🗨`))\n\t\t\t\t\t\t.map((atomUpdate, index) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<article.AtomUpdate\n\t\t\t\t\t\t\t\t\tkey={`${timelineUpdate.key}:${index}:${atomUpdate.key}`}\n\t\t\t\t\t\t\t\t\tserialNumber={index}\n\t\t\t\t\t\t\t\t\tatomUpdate={atomUpdate}\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) : timelineUpdate.type === `selector_update` ? (\n\t\t\t\t\ttimelineUpdate.atomUpdates\n\t\t\t\t\t\t.filter((token) => !token.key.startsWith(`👁‍🗨`))\n\t\t\t\t\t\t.map((atomUpdate, index) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<article.AtomUpdate\n\t\t\t\t\t\t\t\t\tkey={`${timelineUpdate.key}:${index}:${atomUpdate.key}`}\n\t\t\t\t\t\t\t\t\tserialNumber={index}\n\t\t\t\t\t\t\t\t\tatomUpdate={atomUpdate}\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) : timelineUpdate.type === `atom_update` ? (\n\t\t\t\t\t<article.AtomUpdate\n\t\t\t\t\t\tserialNumber={timelineUpdate.timestamp}\n\t\t\t\t\t\tatomUpdate={timelineUpdate}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t</main>\n\t\t</article>\n\t)\n}\n\nexport const article = {\n\tAtomUpdate: AtomUpdateFC,\n\tTransactionUpdate: TransactionUpdateFC,\n\tTimelineUpdate: TimelineUpdateFC,\n}\n","import type {\n\tAtomToken,\n\tReadonlySelectorToken,\n\tTransactionToken,\n\tTransactionUpdate,\n} from \"atom.io\"\nimport { useIO, useO } from \"atom.io/react\"\nimport type { FC } from \"react\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\n\nimport {\n\tfindTransactionLogState,\n\tfindViewIsOpenState,\n\ttransactionIndex,\n} from \".\"\nimport { button } from \"./Button\"\nimport { article } from \"./Updates\"\n\nexport const TransactionLog: FC<{\n\ttoken: TransactionToken<ƒn>\n\tisOpenState: AtomToken<boolean>\n\tlogState: ReadonlySelectorToken<TransactionUpdate<ƒn>[]>\n}> = ({ token, isOpenState, logState }) => {\n\tconst log = useO(logState)\n\tconst [isOpen, setIsOpen] = useIO(isOpenState)\n\n\treturn (\n\t\t<section className=\"node transaction_log\">\n\t\t\t<header>\n\t\t\t\t<button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />\n\t\t\t\t<label>\n\t\t\t\t\t<h2>{token.key}</h2>\n\t\t\t\t\t<span className=\"detail length\">({log.length})</span>\n\t\t\t\t</label>\n\t\t\t</header>\n\t\t\t{isOpen ? (\n\t\t\t\t<main>\n\t\t\t\t\t{log.map((update, index) => (\n\t\t\t\t\t\t<article.TransactionUpdate\n\t\t\t\t\t\t\tkey={update.key + index}\n\t\t\t\t\t\t\tserialNumber={index}\n\t\t\t\t\t\t\ttransactionUpdate={update}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</main>\n\t\t\t) : null}\n\t\t</section>\n\t)\n}\n\nexport const TransactionIndex: FC = () => {\n\tconst tokenIds = useO(transactionIndex)\n\treturn (\n\t\t<article className=\"index transaction_index\">\n\t\t\t{tokenIds\n\t\t\t\t.filter((token) => !token.key.startsWith(`👁‍🗨`))\n\t\t\t\t.map((token) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TransactionLog\n\t\t\t\t\t\t\tkey={token.key}\n\t\t\t\t\t\t\ttoken={token}\n\t\t\t\t\t\t\tisOpenState={findViewIsOpenState(token.key)}\n\t\t\t\t\t\t\tlogState={findTransactionLogState(token.key)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t</article>\n\t)\n}\n","import { isPlainObject } from \"~/packages/anvl/src/object\"\nimport { Refinery } from \"~/packages/anvl/src/refinement/refinery\"\nimport {\n\tdiffArray,\n\tdiffBoolean,\n\tdiffNumber,\n\tdiffObject,\n\tdiffString,\n\tDiffer,\n} from \"~/packages/anvl/src/tree/differ\"\n\nimport { atom, atomFamily } from \"..\"\nimport { attachIntrospectionStates } from \"../introspection\"\nimport { lazyLocalStorageEffect } from \"../web-effects\"\n\nexport * from \"./AtomIODevtools\"\n\nexport const {\n\tatomIndex,\n\tselectorIndex,\n\ttransactionIndex,\n\tfindTransactionLogState,\n\ttimelineIndex,\n\tfindTimelineState,\n} = attachIntrospectionStates()\n\nexport const devtoolsAreOpenState = atom<boolean>({\n\tkey: `👁‍🗨 Devtools Are Open`,\n\tdefault: true,\n\teffects: [lazyLocalStorageEffect(`👁‍🗨 Devtools Are Open`)],\n})\n\ntype DevtoolsView = `atoms` | `selectors` | `timelines` | `transactions`\n\nexport const devtoolsViewSelectionState = atom<DevtoolsView>({\n\tkey: `👁‍🗨 Devtools View Selection`,\n\tdefault: `atoms`,\n\teffects: [lazyLocalStorageEffect(`👁‍🗨 Devtools View`)],\n})\n\nexport const devtoolsViewOptionsState = atom<DevtoolsView[]>({\n\tkey: `👁‍🗨 Devtools View Options`,\n\tdefault: [`atoms`, `selectors`, `transactions`, `timelines`],\n\teffects: [lazyLocalStorageEffect(`👁‍🗨 Devtools View Options`)],\n})\n\nexport const findViewIsOpenState = atomFamily<boolean, string>({\n\tkey: `👁‍🗨 Devtools View Is Open`,\n\tdefault: false,\n\teffects: (key) => [lazyLocalStorageEffect(key + `:view-is-open`)],\n})\n\nexport const primitiveRefinery = new Refinery({\n\tnumber: (input: unknown): input is number => typeof input === `number`,\n\tstring: (input: unknown): input is string => typeof input === `string`,\n\tboolean: (input: unknown): input is boolean => typeof input === `boolean`,\n\tnull: (input: unknown): input is null => input === null,\n})\n\nexport const jsonTreeRefinery = new Refinery({\n\tobject: isPlainObject,\n\tarray: (input: unknown): input is unknown[] => Array.isArray(input),\n})\n\nexport const prettyJson = new Differ(primitiveRefinery, jsonTreeRefinery, {\n\tnumber: diffNumber,\n\tstring: diffString,\n\tboolean: diffBoolean,\n\tnull: () => ({ summary: `No Change` }),\n\tobject: diffObject,\n\tarray: diffArray,\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAAA,a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pD,CAAC;AAEM,IAAM,mBAAmB,IAAI,SAAS;AAAA,EAC5C,QAAQ;AAAA,EACR,OAAO,CAAC,UAAuC,MAAM,QAAQ,KAAK;AACnE,CAAC;AAEM,IAAM,aAAa,IAAI,OAAO,mBAAmB,kBAAkB;AAAA,EACzE,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM,OAAO,EAAE,SAAS,YAAY;AAAA,EACpC,QAAQ;AAAA,EACR,OAAO;AACR,CAAC;","names":["pipe","pipe","a","a","pipe","path","node","result","e","a","b","_a","HAMT","_a","HAMT","HAMT","_a","a","b","_a","a","b","join","pipe","pipe","isString","pipe","isString","map","_a","map","id","pipe","_a","_a","HAMT","atom","_a","HAMT","HAMT","HAMT","_a","HAMT","pipe","isString","isString","_a","isJson","_a","HAMT","_a","_b","state","HAMT","atom","_a","atom","_a","__INTERNAL__","__INTERNAL__","__INTERNAL__","__INTERNAL__","__INTERNAL__","__INTERNAL__","__INTERNAL__","__INTERNAL__","__INTERNAL__","useO","useIO","useRef","useO","useIO","isOpen","jsxDEV","_a","pipe","useState","useRef","jsxDEV","pipe","useState","useRef","_a","jsxDEV","jsxDEV","jsxDEV","jsxDEV","jsxDEV","useRef","isBoolean","isNumber","isString","pipe","pipe","isString","isString","isString","isString","isNumber","isBoolean","isString","isBoolean","node","refMap","_a","_a","_","Fragment","jsxDEV","_a","useRef","Fragment","jsxDEV","useId","atomFamily","jsxDEV","_a","jsxDEV","_a","atomFamily","jsxDEV","jsxDEV","jsxDEV","jsxDEV","Fragment","jsxDEV","_a","useIO","useO","useIO","useO","Fragment","Fragment","jsxDEV","jsxDEV","useO","useIO","Fragment","useIO","useO","jsxDEV","useO","useIO","Fragment","jsxDEV","useRef","useIO","useO"]}
1
+ {"version":3,"sources":["../../../anvl/src/object/index.ts","../../../anvl/src/object/refinement.ts","../../../anvl/src/object/access.ts","../../../anvl/src/object/entries.ts","../../../anvl/src/object/mapObject.ts","../../../anvl/src/array/venn.ts","../../../anvl/src/array/index.ts","../../../anvl/src/function/index.ts","../../../anvl/src/nullish/index.ts","../../../anvl/src/object/sprawl.ts","../../../anvl/src/refinement/refinery.ts","../../../anvl/src/tree/differ.ts","../../../anvl/src/string/capitalize.ts","../../src/internal/get.ts","../../src/internal/is-default.ts","../../../anvl/src/join/core-relation-data.ts","../../../anvl/src/refinement/index.ts","../../../anvl/src/join/get-related-ids.ts","../../../anvl/src/join/make-json-interface.ts","../../../anvl/src/join/relation-contents.ts","../../../anvl/src/join/relation-record.ts","../../../anvl/src/join/remove-relation.ts","../../../anvl/src/string/split.ts","../../../anvl/src/join/set-relation.ts","../../../anvl/src/join/index.ts","../../src/internal/store.ts","../../src/internal/operation.ts","../../src/internal/transaction-internal.ts","../../src/internal/atom-internal.ts","../../../anvl/src/json/index.ts","../../../anvl/src/json/refine.ts","../../src/internal/families-internal.ts","../../src/internal/selector/lookup-selector-sources.ts","../../src/internal/selector/trace-selector-atoms.ts","../../src/internal/set.ts","../../src/internal/subject.ts","../../src/internal/subscribe-internal.ts","../../src/atom.ts","../../src/subscribe.ts","../../src/index.ts","../../src/introspection/attach-introspection-states.ts","../../src/introspection/attach-atom-index.ts","../../src/introspection/attach-selector-index.ts","../../src/introspection/attach-timeline-family.ts","../../src/introspection/attach-timeline-index.ts","../../src/introspection/attach-transaction-index.ts","../../src/introspection/attach-transaction-logs.ts","../../src/web-effects/storage.ts","../../src/react-devtools/AtomIODevtools.tsx","../../src/react-devtools/StateIndex.tsx","../../src/react-devtools/Button.tsx","../../src/react-devtools/StateEditor.tsx","../../../hamr/src/react-elastic-input/ElasticInput.tsx","../../../hamr/src/react-elastic-input/NumberInput.tsx","../../../anvl/src/number/clamp.ts","../../../hamr/src/react-elastic-input/TextInput.tsx","../../../hamr/src/react-json-editor/editors-by-type/utilities/array-elements.ts","../../../hamr/src/react-json-editor/editors-by-type/non-json.tsx","../../../hamr/src/react-json-editor/json-editor-internal.tsx","../../../hamr/src/react-json-editor/editors-by-type/array-editor.tsx","../../../hamr/src/react-json-editor/editors-by-type/object-editor.tsx","../../../anvl/src/json-schema/json-schema.ts","../../../anvl/src/json-schema/integer.ts","../../../anvl/src/json-schema/refs.ts","../../../anvl/src/json-schema/string-formats.ts","../../../anvl/src/json-schema/path-into.ts","../../../anvl/src/json-schema/find-sub-schema.ts","../../../anvl/src/json/cast.ts","../../../hamr/src/react-json-editor/editors-by-type/utilities/object-properties.ts","../../../hamr/src/react-json-editor/editors-by-type/primitive-editors.tsx","../../../hamr/src/react-error-boundary/ReactErrorBoundary.tsx","../../../hamr/src/react-error-boundary/DefaultFallback.tsx","../../../hamr/src/react-json-editor/default-components.tsx","../../../hamr/src/react-json-editor/developer-interface.tsx","../../../hamr/src/react-json-editor/index.ts","../../src/react-devtools/TimelineIndex.tsx","../../src/react-devtools/Updates.tsx","../../src/react-devtools/TransactionIndex.tsx","../../src/react-devtools/index.ts"],"sourcesContent":["import { pipe } from \"fp-ts/function\"\nimport type { Refinement } from \"fp-ts/Refinement\"\n\nimport { deepMob } from \"./deepMob\"\nimport { entriesToRecord, recordToEntries } from \"./entries\"\nimport { isPlainObject } from \"./refinement\"\nimport { includesAny, reduce, filter } from \"../array\"\nimport { isUndefined } from \"../nullish\"\n\nexport * from \"./access\"\nexport * from \"./deepMob\"\nexport * from \"./entries\"\nexport * from \"./mapObject\"\nexport * from \"./modify\"\nexport * from \"./patch\"\nexport * from \"./refinement\"\nexport * from \"./sprawl\"\n\nexport const redact =\n\t<K extends keyof any>(...args: K[]) =>\n\t<O extends Record<K, any>>(obj: O): Omit<O, K> =>\n\t\treduce<K, O>((acc, key) => (delete acc[key], acc), obj)(args)\n\nexport type Redacted<Holder, RedactProp extends keyof any> = Omit<\n\t{\n\t\t[K in keyof Holder]: Holder[K] extends (infer Item)[]\n\t\t\t? Redacted<Item, RedactProp>[]\n\t\t\t: Redacted<Omit<Holder[K], RedactProp>, RedactProp>\n\t},\n\tRedactProp\n>\nexport const redactDeep =\n\t<K extends keyof any>(...args: K[]) =>\n\t<O extends Record<K, any>>(base: O): Redacted<O, K> =>\n\t\tdeepMob(base, (node, path) =>\n\t\t\tincludesAny(args)(path)\n\t\t\t\t? {\n\t\t\t\t\t\tmeta: { pathComplete: true },\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tdata: isPlainObject(node)\n\t\t\t\t\t\t\t? redact(...args)(node as Record<keyof any, any>)\n\t\t\t\t\t\t\t: node,\n\t\t\t\t },\n\t\t)\n\nexport const select =\n\t<Key extends keyof any>(...args: Key[]) =>\n\t<Obj extends object>(\n\t\tobj: Obj,\n\t): {\n\t\t// @ts-expect-error fuk u\n\t\t[K in keyof Pick<Obj, Key>]: any extends Pick<Obj, Key>[K]\n\t\t\t? undefined\n\t\t\t: // @ts-expect-error fuk u\n\t\t\t Pick<Obj, Key>[K]\n\t} =>\n\t\t// @ts-expect-error fuk u ts\n\t\treduce<Key, Pick<Obj, Key>>(\n\t\t\t// @ts-expect-error i will fite u\n\t\t\t(acc, key) => (key in obj ? (acc[key] = obj[key as keyof Obj]) : acc, acc),\n\t\t\t// @ts-expect-error fuk u\n\t\t\t{} as Pick<Obj, Key>,\n\t\t)(args)\n\nexport const treeShake =\n\t(shouldDiscard: (val: unknown, key: keyof any) => boolean = isUndefined) =>\n\t<T extends object>(\n\t\tobj: T,\n\t): T extends Record<keyof any, unknown> ? T : Partial<T> => {\n\t\tconst newObj = {} as T\n\t\tconst entries = Object.entries(obj) as [keyof T, any][]\n\t\tentries.forEach(([key, val]) =>\n\t\t\t!shouldDiscard(val, key) ? (newObj[key] = val) : null,\n\t\t)\n\t\treturn newObj as T extends Record<keyof any, unknown> ? T : Partial<T>\n\t}\n\nexport type KeysExtending<T, V> = keyof {\n\t[K in keyof T]: T[K] extends V ? K : never\n}\n\nconst a: never | null = null\n\nexport const filterProperties =\n\t<DiscardVal, DiscardKey extends keyof any>(\n\t\tshouldDiscardVal: Refinement<unknown, DiscardVal>,\n\t\tshouldDiscardKey: Refinement<unknown, DiscardKey>,\n\t) =>\n\t<P extends Record<keyof any, any>>(\n\t\tprops: P,\n\t): DiscardVal extends never\n\t\t? DiscardKey extends never\n\t\t\t? P\n\t\t\t: Omit<P, DiscardKey>\n\t\t: Omit<P, DiscardKey | KeysExtending<P, DiscardVal>> =>\n\t\t// @ts-expect-error oh well\n\t\tpipe(\n\t\t\tprops,\n\t\t\trecordToEntries,\n\t\t\tfilter(\n\t\t\t\t(\n\t\t\t\t\tentry,\n\t\t\t\t): entry is [\n\t\t\t\t\tExclude<keyof P, DiscardKey>,\n\t\t\t\t\tExclude<P[keyof P], DiscardVal>,\n\t\t\t\t] => !shouldDiscardKey(entry[0]) || !shouldDiscardVal(entry[1]),\n\t\t\t),\n\t\t\tentriesToRecord,\n\t\t)\n\nexport const delve = (\n\tobj: Record<keyof any, any>,\n\tpath: ReadonlyArray<keyof any>,\n): Error | { found: unknown } => {\n\tconst found = path.reduce((acc, key) => acc?.[key], obj)\n\treturn found === undefined ? new Error(`Not found`) : { found }\n}\n\nexport const tweak = (\n\tobj: Record<keyof any, any>,\n\tpath: ReadonlyArray<keyof any>,\n\tvalue: unknown,\n): void =>\n\tpath.reduce((acc, key, i) => {\n\t\tif (i === path.length - 1) {\n\t\t\tacc[key] = value\n\t\t}\n\t\tif (acc[key] === undefined) {\n\t\t\tacc[key] = typeof key === `number` ? [] : {}\n\t\t}\n\t\treturn acc[key]\n\t}, obj)\n\nexport type RequireAtLeastOne<T> = {\n\t[K in keyof T]-?: Partial<Pick<T, Exclude<keyof T, K>>> & Required<Pick<T, K>>\n}[keyof T]\n\nexport type RequireExactlyOne<T> = {\n\t[K in keyof T]-?: Required<Pick<T, K>>\n}[keyof T]\n","import { pipe } from \"fp-ts/function\"\nimport type { Refinement } from \"fp-ts/Refinement\"\n\nimport { access } from \"./access\"\nimport { recordToEntries } from \"./entries\"\nimport { mob } from \"./mapObject\"\nimport { allTrue, every } from \"../array\"\nimport { pass } from \"../function\"\nimport { ifNullish } from \"../nullish\"\n\nexport type PlainObject = Record<keyof any, unknown>\nexport type EmptyObject = Record<keyof any, never>\n\nexport const isNonNullObject = (input: unknown): input is object =>\n\ttypeof input === `object` && input !== null\n\nexport const isPlainObject = (input: unknown): input is PlainObject =>\n\tisNonNullObject(input) && Object.getPrototypeOf(input) === Object.prototype\n\nexport const isEmptyObject = (input: unknown): input is EmptyObject =>\n\tisPlainObject(input) && Object.keys(input).length === 0\n\n/* prettier-ignore */\nexport const isRecord =\n\t<KEY extends keyof any, VAL>(\n\t\tisKey: Refinement<keyof any, KEY>,\n\t\tisValue: Refinement<unknown, VAL>,\n\t) =>\n\t(input: unknown): input is Record<KEY, VAL> =>\n\t\tisPlainObject(input) &&\n\t\tObject.entries(input).every(([k, v]) => isKey(k) && isValue(v))\n/* prettier-ignore-end */\n\nexport type HasPropertiesOptions = {\n\treadonly allowExtraProperties?: boolean\n}\nexport const hasProperties = <OBJ extends object>(\n\tisValue: {\n\t\t[K in keyof OBJ]: Refinement<unknown, OBJ[K]>\n\t},\n\toptions: HasPropertiesOptions = { allowExtraProperties: false },\n): Refinement<unknown, OBJ> => {\n\tconst name = `{${recordToEntries(\n\t\tisValue as Record<keyof any, Refinement<any, any>>,\n\t)\n\t\t.map(([k, v]) => String(k) + `:` + v.name)\n\t\t.join(`,`)}}`\n\n\tconst _ = {\n\t\t[name]: (input: unknown): input is OBJ =>\n\t\t\tisPlainObject(input) &&\n\t\t\tpipe(\n\t\t\t\tisValue,\n\t\t\t\tObject.entries,\n\t\t\t\tevery(([key, val]) => key in input || val(undefined)),\n\t\t\t) &&\n\t\t\tpipe(\n\t\t\t\tinput,\n\t\t\t\tmob((val, key) =>\n\t\t\t\t\tpipe(\n\t\t\t\t\t\tisValue,\n\t\t\t\t\t\taccess(key),\n\t\t\t\t\t\tifNullish(() => options.allowExtraProperties),\n\t\t\t\t\t\tpass(val),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tObject.values,\n\t\t\t\tallTrue,\n\t\t\t),\n\t}\n\treturn _[name]\n}\n\nexport const doesExtend =\n\t/* alias for hasExactProperties with allowExtraProperties */\n\t<OBJ extends object>(\n\t\tisValue: {\n\t\t\t[K in keyof OBJ]: Refinement<unknown, OBJ[K]>\n\t\t},\n\t): Refinement<unknown, OBJ> =>\n\t\thasProperties(isValue, { allowExtraProperties: true })\n\nexport const hasExactProperties =\n\t/* alias for hasProperties without allowExtraProperties */\n\t<OBJ extends object>(\n\t\tisValue: {\n\t\t\t[K in keyof OBJ]: Refinement<unknown, OBJ[K]>\n\t\t},\n\t): Refinement<unknown, OBJ> =>\n\t\thasProperties(isValue, { allowExtraProperties: false })\n","export const key =\n\t<T extends object>(k: keyof T) =>\n\t(obj: Exclude<object, null>): unknown =>\n\t\t(obj as Record<keyof any, any>)[k]\n\nexport const access = <V, T extends Record<keyof any, V>>(\n\tk: keyof any,\n): {\n\t(obj: T): T[keyof T] | undefined\n\tin: (obj: T) => T[keyof T] | undefined\n} =>\n\tObject.assign((obj: T) => obj[k as keyof T], {\n\t\tin: (obj: T) => obj[k as keyof T],\n\t})\n","export type Entries<K extends keyof any, V> = [key: K, value: V][]\n\nexport const recordToEntries = <K extends keyof any, V>(\n\tobj: Record<K, V>,\n): Entries<K, V> => Object.entries(obj) as Entries<K, V>\n\nexport const entriesToRecord = <K extends keyof any, V>(\n\tentries: Entries<K, V>,\n): Record<K, V> => Object.fromEntries(entries) as Record<K, V>\n","import { pipe } from \"fp-ts/function\"\n\nimport { entriesToRecord, recordToEntries } from \"./entries\"\nimport { map } from \"../array\"\n\nexport const mapObject = <K extends keyof any, I, O>(\n\tobj: Record<K, I>,\n\tfn: (val: I, key: K) => O,\n): Record<K, O> =>\n\tpipe(\n\t\tobj,\n\t\trecordToEntries,\n\t\tmap(([key, val]) => [key, fn(val, key)] as const),\n\t\tentriesToRecord,\n\t)\n\nexport const mob =\n\t<K extends keyof any, I, O>(fn: (val: I, key: K) => O) =>\n\t(obj: Record<K, I>): Record<K, O> =>\n\t\tmapObject(obj, fn)\n","export type VennCheck = (\n\titems: ReadonlyArray<unknown> | unknown[],\n) => (array: ReadonlyArray<unknown> | unknown[]) => boolean\n\nexport type VennTally = (\n\titems: ReadonlyArray<unknown> | unknown[],\n) => (array: ReadonlyArray<unknown> | unknown[]) => number\n\nexport const includesAll: VennCheck = (items) => (array) => {\n\tfor (const item of items) {\n\t\tif (!array.includes(item)) return false\n\t}\n\treturn true\n}\n\nexport const includesAny: VennCheck = (items) => (array) => {\n\tfor (const item of items) {\n\t\tif (array.includes(item)) return true\n\t}\n\treturn false\n}\n\nexport const excludesAll: VennCheck = (items) => (array) =>\n\t!includesAny(items)(array)\n\nexport const excludesAny: VennCheck = (items) => (array) =>\n\t!includesAll(items)(array)\n\nexport const comprises: VennCheck = (items) => (array) =>\n\tincludesAll(items)(array) && includesAll(array)(items)\n\nexport const overlaps: VennTally = (items) => (array) => {\n\tlet incidences = 0\n\tfor (const item of items) {\n\t\tif (array.includes(item)) incidences += 1\n\t}\n\treturn incidences\n}\n","export * from \"./match\"\nexport * from \"./venn\"\n\nimport type { Refinement } from \"fp-ts/Refinement\"\n\nexport const each =\n\t<T>(isType: Refinement<unknown, T>) =>\n\t(input: unknown): T[] =>\n\t\tisType(input) ? [input] : Array.isArray(input) ? input.filter(isType) : []\n\nexport const lastOf = <T>(input: ReadonlyArray<T>): T | undefined =>\n\tinput[input.length - 1]\n\nexport const isArray =\n\t<T>(isType: Refinement<unknown, T>) =>\n\t(input: unknown): input is T[] =>\n\t\tArray.isArray(input) && input.every((item) => isType(item))\n\nexport const at =\n\t<T>(index: number) =>\n\t(input: T[]): T | undefined =>\n\t\tinput.at(index)\n\nexport const content =\n\t<T>(isType: Refinement<unknown, T>) =>\n\t(input: unknown): input is T | T[] =>\n\t\tisType(input) || isArray(isType)(input)\n\nexport const join = (separator?: string) => (a: string[]): string =>\n\ta.join(separator)\n\nexport const map =\n\t<I, O>(f: (value: I, index: number, array: I[]) => O) =>\n\t(a: I[]): O[] =>\n\t\ta.map(f)\n\nexport const reduce =\n\t<I, O>(f: (acc: O, value: I, index: number, array: I[]) => O, initial: O) =>\n\t(a: I[]): O =>\n\t\ta.reduce(f, initial)\n\nexport const slice = (start: number, end?: number) => <I>(a: I[]): I[] =>\n\ta.slice(start, end)\n\nexport const using =\n\t<I, O>(a: I[]) =>\n\t(f: (acc: O, value: I, index: number, array: I[]) => O) =>\n\t(initial: O): O =>\n\t\ta.reduce(f, initial)\n\nexport const reduceRight =\n\t<I, O>(f: (acc: O, value: I, index: number, array: I[]) => O, initial: O) =>\n\t(a: I[]): O =>\n\t\ta.reduceRight(f, initial)\n\nexport const reverse = <I>(a: I[]): I[] => a.reverse()\n\nexport const sort =\n\t<I>(a: I[]) =>\n\t(f?: (x: I, y: I) => number): I[] =>\n\t\tf ? a.sort(f) : a.sort()\n\nexport const sortBy =\n\t<I>(f: (value: I) => number) =>\n\t(a: I[]): I[] =>\n\t\ta.sort((x, y) => f(x) - f(y))\n\nexport const sortByDesc =\n\t<I>(f: (value: I) => number) =>\n\t(a: I[]): I[] =>\n\t\ta.sort((x, y) => f(y) - f(x))\n\nexport const every =\n\t<I>(f: (value: I, index: number, array: I[]) => boolean = Boolean) =>\n\t(a: I[]): boolean =>\n\t\ta.every(f)\n\nexport const allTrue = every((x: boolean) => x === true)\n\nexport const addTo =\n\t<I>(a: I[]) =>\n\t(x: I): I[] =>\n\t\ta.includes(x) ? a : [...a, x]\n\nexport const isEmptyArray = (input: unknown): input is [] =>\n\tArray.isArray(input) && input.length === 0\n\nexport const isOneOf =\n\t<T>(...args: ReadonlyArray<T>) =>\n\t(input: unknown): input is T =>\n\t\targs.includes(input as T)\n\nexport const filter =\n\t<I, O extends I>(f: (value: I, index: number, array: I[]) => value is O) =>\n\t(a: I[]): O[] =>\n\t\ta.filter(f)\n","import type { Refinement } from \"fp-ts/Refinement\"\nexport * from \"./curry\"\n\nexport type ƒn = (...parameters: any[]) => any\n\nexport const doNothing = (): void => undefined\n\nexport const become =\n\t<T>(nextVersionOfThing: Modifier<T> | T) =>\n\t(originalThing: T | (() => T)): T =>\n\t\tnextVersionOfThing instanceof Function\n\t\t\t? nextVersionOfThing(\n\t\t\t\t\toriginalThing instanceof Function ? originalThing() : originalThing,\n\t\t\t )\n\t\t\t: nextVersionOfThing\n\nexport type Applicator<X, Y> = (next: Modifier<X> | X) => Modifier<Y>\nexport type Modifier<T> = (thing: T) => T\n\nexport type OneOrMany<T> = T | T[]\n\nexport const isModifier =\n\t<T>(validate: Refinement<unknown, T>) =>\n\t(sample: T): Refinement<unknown, Modifier<T>> => {\n\t\tconst sampleIsValid = validate(sample)\n\t\tif (!sampleIsValid) {\n\t\t\tthrow new Error(`Invalid test case: JSON.stringify(${sample})`)\n\t\t}\n\t\treturn (input: unknown): input is Modifier<T> => {\n\t\t\tif (typeof input !== `function`) return false\n\t\t\tconst testResult = input(sample)\n\t\t\treturn validate(testResult)\n\t\t}\n\t}\n\nexport const pass =\n\t<Params extends ReadonlyArray<any>, Out>(...params: Params) =>\n\t(fn: (...params: Params) => Out): Out =>\n\t\tfn(...params)\n\nexport const typeOf =\n\t<T>(input: unknown) =>\n\t(isType: Refinement<unknown, T>): boolean =>\n\t\tisType(input)\n\nexport const raiseError = (message: string): never => {\n\tthrow new Error(message)\n}\n\nexport type Encapsulate<T extends (...args: any[]) => any> = (\n\t...args: Parameters<T>\n) => void\n\nexport const attempt = (fn: () => void): boolean => {\n\ttry {\n\t\tfn()\n\t\treturn true\n\t} catch (_) {\n\t\treturn false\n\t}\n}\n\nexport const fallback = <T>(fn: () => T, fallbackValue: T): T => {\n\ttry {\n\t\treturn fn()\n\t} catch (_) {\n\t\treturn fallbackValue\n\t}\n}\n","import type { Refinement } from \"fp-ts/Refinement\"\n\nexport const isUndefined = (input: unknown): input is undefined =>\n\tinput === undefined\n\nexport const ifDefined = <T>(\n\tvalidate: Refinement<unknown, T>,\n): Refinement<unknown, T | undefined> =>\n\t((input) => isUndefined(input) || validate(input)) as Refinement<\n\t\tunknown,\n\t\tT | undefined\n\t>\n\nexport const isNull = (input: unknown): input is null => input === null\n\nexport const isNullish = (input: unknown): input is null | undefined =>\n\tisUndefined(input) || isNull(input)\n\nexport type NullSafeUnion<Base, Extension> = Extension extends null\n\t? Base\n\t: Base & Extension\n\nexport type NullSafeRest<MaybeArg> = MaybeArg extends null\n\t? [] | [undefined]\n\t: [MaybeArg]\n\nexport interface Discard {\n\treadonly _discard: unique symbol\n}\n\nexport const ifNullish =\n\t<X, Y>(alt: Y) =>\n\t(input: X): Exclude<X, null | undefined> | Y =>\n\t\t(input ?? alt) as Exclude<X, null | undefined> | Y\n","import { isPlainObject } from \"./refinement\"\n\n// if you found what you were looking for, return true and break\nexport type InspectionResult = Partial<{\n\tpathComplete: true\n\tjobComplete: true\n}>\nexport type InspectNode = (\n\tpath: string[],\n\tnode: unknown,\n) => InspectionResult | void\n\nexport const sprawl = (\n\ttree: Array<unknown> | object,\n\tinspector: InspectNode,\n): void => {\n\tconst walk = (path: string[], node: unknown): InspectionResult => {\n\t\tconst inspect = (path: string[], node: unknown): InspectionResult | null => {\n\t\t\t// console.log(parent)\n\t\t\tconst result = inspector(path, node)\n\t\t\tif (result) return result\n\t\t\treturn null\n\t\t}\n\t\tconst result = inspect(path, node)\n\t\tif (result?.jobComplete || result?.pathComplete) {\n\t\t\treturn result\n\t\t}\n\t\tconst childEntries = Array.isArray(node)\n\t\t\t? node.map((v, i) => [i, v])\n\t\t\t: isPlainObject(node)\n\t\t\t? Object.entries(node)\n\t\t\t: []\n\t\tfor (const [k, v] of childEntries) {\n\t\t\tconst subResult = walk([...path, k], v)\n\t\t\tif (subResult?.jobComplete) {\n\t\t\t\treturn subResult\n\t\t\t}\n\t\t}\n\t\treturn {}\n\t}\n\twalk([], tree)\n}\n\n// const aIsJson = isJson(a)\n// \t\tconst bIsJson = isJson(b)\n// \t\tif (aIsJson && bIsJson) {\n// \t\t\tconst aRefined = refineJsonType(a)\n// \t\t\tconst bRefined = refineJsonType(b)\n// \t\t\tconst typesDoMatch = aRefined.type === bRefined.type\n// \t\t\tif (typesDoMatch) {\n// \t\t\t\tconst delta = BASE_DIFF_CONFIG[aRefined.type](\n// \t\t\t\t\taRefined.data,\n// \t\t\t\t\tbRefined.data,\n// \t\t\t\t)\n// \t\t\t\treturn delta\n// \t\t\t} else {\n// \t\t\t\tconst typeA = aRefined.type\n// \t\t\t\tconst typeB = bRefined.type\n// \t\t\t\treturn {\n// \t\t\t\t\tsummary: `Type change: ${typeA} → ${typeB}`,\n// \t\t\t\t}\n// \t\t\t}\n// \t\t} else {\n","import type { Refinement } from \"fp-ts/Refinement\"\n\nimport type { ClassSignature } from \".\"\nimport { isPlainObject } from \"../object\"\n\nexport type RefinementStrategy = ClassSignature | Refinement<unknown, any>\n\nexport type Supported<Refine extends RefinementStrategy> =\n\tRefine extends Refinement<unknown, infer T>\n\t\t? T\n\t\t: Refine extends ClassSignature\n\t\t? InstanceType<Refine>\n\t\t: never\n\nexport type RefinementSupport = Record<string, RefinementStrategy>\n\nexport class Refinery<SupportedTypes extends RefinementSupport> {\n\tpublic supported: SupportedTypes\n\n\tpublic constructor(supported: SupportedTypes) {\n\t\tthis.supported = supported\n\t}\n\n\tpublic refine(input: unknown):\n\t\t| {\n\t\t\t\t[K in keyof SupportedTypes]: {\n\t\t\t\t\ttype: K\n\t\t\t\t\tdata: Supported<SupportedTypes[K]>\n\t\t\t\t}\n\t\t }[keyof SupportedTypes]\n\t\t| null {\n\t\tfor (const [key, refiner] of Object.entries(this.supported)) {\n\t\t\ttry {\n\t\t\t\tif (\n\t\t\t\t\t// @ts-expect-error that's the point\n\t\t\t\t\trefiner(input) === true &&\n\t\t\t\t\trefiner !== Boolean\n\t\t\t\t) {\n\t\t\t\t\treturn { type: key, data: input } as any\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\ttry {\n\t\t\t\t\tif (input instanceof refiner) {\n\t\t\t\t\t\treturn { type: key, data: input } as any\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n}\n\nconst jsonRefinery = new Refinery({\n\tnumber: (input: unknown): input is number => typeof input === `number`,\n\tstring: (input: unknown): input is string => typeof input === `string`,\n\tboolean: (input: unknown): input is boolean => typeof input === `boolean`,\n\tobject: isPlainObject,\n\tarray: (input: unknown): input is unknown[] => Array.isArray(input),\n\tnull: (input: unknown): input is null => input === null,\n})\n\nexport const discoverType = (input: unknown): string => {\n\tif (input === undefined) {\n\t\treturn `undefined`\n\t}\n\tconst refined = jsonRefinery.refine(input)\n\tif (refined) {\n\t\treturn refined.type\n\t}\n\treturn Object.getPrototypeOf(input).constructor.name\n}\n","import { sprawl } from \"../object\"\nimport type { Supported, Refinery } from \"../refinement/refinery\"\nimport { discoverType } from \"../refinement/refinery\"\n\nexport function diffNumber(a: number, b: number): Delta {\n\tconst sign = a < b ? `+` : `-`\n\treturn {\n\t\tsummary: `${sign}${Math.abs(a - b)} (${a} → ${b})`,\n\t}\n}\n\nexport function diffString(a: string, b: string): Delta {\n\tconst sign = a.length < b.length ? `+` : `-`\n\treturn {\n\t\tsummary: `${sign}${Math.abs(a.length - b.length)} (\"${a}\" → \"${b}\")`,\n\t}\n}\n\nexport function diffBoolean(a: boolean, b: boolean): Delta {\n\treturn {\n\t\tsummary: `${a} → ${b}`,\n\t}\n}\n\nexport function diffObject(\n\ta: Record<string, unknown>,\n\tb: Record<string, unknown>,\n\trecurse: Differ<any, any>[`diff`],\n): Delta {\n\tlet summary = ``\n\tconst added: Delta[`added`] = []\n\tconst removed: Delta[`removed`] = []\n\tconst changed: Delta[`changed`] = []\n\n\tsprawl(a, (path, nodeA) => {\n\t\tlet key: string\n\t\tfor (key of path) {\n\t\t\tconst nodeB = b[key]\n\t\t\tif (nodeB === undefined) {\n\t\t\t\tremoved.push([key, JSON.stringify(nodeA)])\n\t\t\t} else {\n\t\t\t\tconst delta = recurse(nodeA, nodeB)\n\t\t\t\tif (delta.summary !== `No Change`) {\n\t\t\t\t\tchanged.push([key, delta])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\n\tsprawl(b, (path, nodeB) => {\n\t\tlet key: string\n\t\tfor (key of path) {\n\t\t\tconst nodeA = a[key]\n\t\t\tif (nodeA === undefined) {\n\t\t\t\tadded.push([key, JSON.stringify(nodeB)])\n\t\t\t}\n\t\t}\n\t})\n\n\tsummary = `~${changed.length} +${added.length} -${removed.length}`\n\n\treturn {\n\t\tsummary,\n\t\tadded,\n\t\tremoved,\n\t\tchanged,\n\t}\n}\n\nexport function diffArray(\n\ta: unknown[],\n\tb: unknown[],\n\trecurse: Differ<any, any>[`diff`],\n): Delta {\n\treturn diffObject(a as any, b as any, recurse)\n}\n\ntype Delta = {\n\tsummary: string\n\tadded?: [path: string, addedStringifiedValue: string][]\n\tremoved?: [path: string, removedStringifiedValue: string][]\n\tchanged?: [path: string, delta: Delta][]\n}\n\ntype Diff<T> = (a: T, b: T) => Delta\ntype DiffTree<T> = (a: T, b: T, recurse: Differ<any, any>[`diff`]) => Delta\n\nexport class Differ<\n\tLeaf extends Record<string, any>,\n\tTree extends Record<string, any>,\n> {\n\tpublic leafRefinery: Refinery<Leaf>\n\tpublic treeRefinery: Refinery<Tree>\n\tpublic leafDiffers: { [K in keyof Leaf]: Diff<Supported<Leaf[K]>> }\n\tpublic treeDiffers: { [K in keyof Tree]: DiffTree<Supported<Tree[K]>> }\n\n\tpublic constructor(\n\t\tleafRefinery: Refinery<Leaf>,\n\t\ttreeRefinery: Refinery<Tree>,\n\t\tdiffFunctions: {\n\t\t\t[K in keyof Tree]: DiffTree<Supported<Tree[K]>>\n\t\t} & { [K in keyof Leaf]: Diff<Supported<Leaf[K]>> },\n\t) {\n\t\tthis.leafRefinery = leafRefinery\n\t\tthis.treeRefinery = treeRefinery\n\t\tthis.leafDiffers = {} as any\n\t\tthis.treeDiffers = {} as any\n\t\tfor (const key of Object.keys(leafRefinery.supported)) {\n\t\t\tconst diffFunction = diffFunctions[key]\n\t\t\tthis.leafDiffers[key as keyof Leaf] = diffFunction\n\t\t}\n\t\tfor (const key of Object.keys(treeRefinery.supported)) {\n\t\t\tconst diffFunction = diffFunctions[key]\n\t\t\tthis.treeDiffers[key as keyof Tree] = diffFunction\n\t\t}\n\t}\n\n\tpublic diff(a: unknown, b: unknown): Delta {\n\t\tif (a === b) {\n\t\t\treturn { summary: `No Change` }\n\t\t}\n\t\ttry {\n\t\t\tif (JSON.stringify(a) === JSON.stringify(b)) {\n\t\t\t\treturn { summary: `No Change` }\n\t\t\t}\n\t\t} catch (thrown) {\n\t\t\tconsole.error(`Error stringifying`, a, b)\n\t\t}\n\n\t\tconst aRefined = this.leafRefinery.refine(a) ?? this.treeRefinery.refine(a)\n\t\tconst bRefined = this.leafRefinery.refine(b) ?? this.treeRefinery.refine(b)\n\n\t\t// console.log({ leaf: this.leafRefinery, tree: this.treeRefinery })\n\t\t// console.log({ a, b })\n\t\t// console.log({ aRefined, bRefined })\n\n\t\tif (aRefined !== null && bRefined !== null) {\n\t\t\tif (aRefined.type === bRefined.type) {\n\t\t\t\tif (aRefined.type in this.leafDiffers) {\n\t\t\t\t\tconst delta = this.leafDiffers[aRefined.type](\n\t\t\t\t\t\taRefined.data,\n\t\t\t\t\t\tbRefined.data,\n\t\t\t\t\t)\n\t\t\t\t\treturn delta\n\t\t\t\t}\n\t\t\t\tif (aRefined.type in this.treeDiffers) {\n\t\t\t\t\tconst delta = this.treeDiffers[aRefined.type](\n\t\t\t\t\t\taRefined.data,\n\t\t\t\t\t\tbRefined.data,\n\t\t\t\t\t\t(x, y) => this.diff(x, y),\n\t\t\t\t\t)\n\t\t\t\t\treturn delta\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst typeA = discoverType(a)\n\t\tconst typeB = discoverType(b)\n\t\tif (typeA === typeB) {\n\t\t\treturn {\n\t\t\t\tsummary: `${typeA} → ${typeB}`,\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tsummary: `Type change: ${typeA} → ${typeB}`,\n\t\t}\n\t}\n}\n","export const capitalize = (str: string): string =>\n\tstr[0].toUpperCase() + str.slice(1)\n","import type { ƒn } from \"~/packages/anvl/src/function\"\n\nimport type {\n\tAtom,\n\tReadonlySelector,\n\tSelector,\n\tStore,\n\tTimeline,\n\tTransaction,\n} from \".\"\nimport { target, isValueCached, readCachedValue, IMPLICIT } from \".\"\nimport type {\n\tAtomToken,\n\tReadonlySelectorToken,\n\tSelectorToken,\n\tStateToken,\n\tTimelineToken,\n\tTransactionToken,\n} from \"..\"\n\nexport const computeSelectorState = <T>(\n\tselector: ReadonlySelector<T> | Selector<T>,\n): T => selector.get()\n\nexport function lookup(\n\tkey: string,\n\tstore: Store,\n): AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown> {\n\tconst core = target(store)\n\tconst type = core.atoms.has(key)\n\t\t? `atom`\n\t\t: core.selectors.has(key)\n\t\t? `selector`\n\t\t: `readonly_selector`\n\treturn { key, type } as any\n}\n\nexport function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T> | null\nexport function withdraw<T>(\n\ttoken: SelectorToken<T>,\n\tstore: Store,\n): Selector<T> | null\nexport function withdraw<T>(\n\ttoken: StateToken<T>,\n\tstore: Store,\n): Atom<T> | Selector<T> | null\nexport function withdraw<T>(\n\ttoken: ReadonlySelectorToken<T>,\n\tstore: Store,\n): ReadonlySelector<T> | null\nexport function withdraw<T>(\n\ttoken: TransactionToken<T>,\n\tstore: Store,\n): Transaction<T extends ƒn ? T : never> | null\nexport function withdraw<T>(\n\ttoken: ReadonlySelectorToken<T> | StateToken<T>,\n\tstore: Store,\n): Atom<T> | ReadonlySelector<T> | Selector<T> | null\nexport function withdraw<T>(token: TimelineToken, store: Store): Timeline | null\nexport function withdraw<T>(\n\ttoken:\n\t\t| ReadonlySelectorToken<T>\n\t\t| StateToken<T>\n\t\t| TimelineToken\n\t\t| TransactionToken<T>,\n\tstore: Store,\n):\n\t| Atom<T>\n\t| ReadonlySelector<T>\n\t| Selector<T>\n\t| Timeline\n\t| Transaction<T extends ƒn ? T : never>\n\t| null {\n\tconst core = target(store)\n\treturn (\n\t\tcore.atoms.get(token.key) ??\n\t\tcore.selectors.get(token.key) ??\n\t\tcore.readonlySelectors.get(token.key) ??\n\t\tcore.transactions.get(token.key) ??\n\t\tcore.timelines.get(token.key) ??\n\t\tnull\n\t)\n}\n\nexport function deposit<T>(state: Atom<T>): AtomToken<T>\nexport function deposit<T>(state: Selector<T>): SelectorToken<T>\nexport function deposit<T>(state: Atom<T> | Selector<T>): StateToken<T>\nexport function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>\nexport function deposit<T>(\n\tstate: Transaction<T extends ƒn ? T : never>,\n): TransactionToken<T>\nexport function deposit<T>(\n\tstate: Atom<T> | ReadonlySelector<T> | Selector<T>,\n): ReadonlySelectorToken<T> | StateToken<T>\nexport function deposit<T>(\n\tstate:\n\t\t| Atom<T>\n\t\t| ReadonlySelector<T>\n\t\t| Selector<T>\n\t\t| Transaction<T extends ƒn ? T : never>,\n):\n\t| AtomToken<T>\n\t| ReadonlySelectorToken<T>\n\t| SelectorToken<T>\n\t| TransactionToken<T> {\n\treturn {\n\t\tkey: state.key,\n\t\ttype: state.type,\n\t\t...(`family` in state && { family: state.family }),\n\t} as any\n}\n\nexport const getState__INTERNAL = <T>(\n\tstate: Atom<T> | ReadonlySelector<T> | Selector<T>,\n\tstore: Store = IMPLICIT.STORE,\n): T => {\n\tif (isValueCached(state.key, store)) {\n\t\tstore.config.logger?.info(`>> read \"${state.key}\"`)\n\t\treturn readCachedValue(state.key, store)\n\t}\n\tif (state.type !== `atom`) {\n\t\tstore.config.logger?.info(`-> calc \"${state.key}\"`)\n\t\treturn computeSelectorState(state)\n\t}\n\tstore.config.logger?.error(\n\t\t`Attempted to get atom \"${state.key}\", which was never initialized in store \"${store.config.name}\".`,\n\t)\n\treturn state.default\n}\n","import type { Store } from \".\"\nimport { target, IMPLICIT, traceAllSelectorAtoms } from \".\"\n\nexport const isAtomDefault = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): boolean => {\n\tconst core = target(store)\n\treturn core.atomsThatAreDefault.has(key)\n}\n\nexport const markAtomAsDefault = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.atomsThatAreDefault = new Set(core.atomsThatAreDefault).add(key)\n}\n\nexport const markAtomAsNotDefault = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.atomsThatAreDefault = new Set(target(store).atomsThatAreDefault)\n\tcore.atomsThatAreDefault.delete(key)\n}\n\nexport const isSelectorDefault = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): boolean => {\n\tconst roots = traceAllSelectorAtoms(key, store)\n\treturn roots.every((root) => isAtomDefault(root.key, store))\n}\n","import { isString } from \"fp-ts/string\"\n\nimport type { Json, JsonObj } from \"~/packages/anvl/src/json\"\n\nimport { isArray } from \"../array\"\nimport { hasExactProperties, isRecord } from \"../object/refinement\"\nimport { isLiteral } from \"../refinement\"\n\nexport const RELATION_TYPES = [`1:1`, `1:n`, `n:n`] as const\n\nexport type RelationType = typeof RELATION_TYPES[number]\n\nexport const isRelationType = (x: unknown): x is RelationType =>\n\tRELATION_TYPES.includes(x as RelationType)\n\nexport type RelationData<\n\tCONTENT extends JsonObj | null = null,\n\tA extends string = `from`,\n\tB extends string = `to`,\n> = {\n\tcontents: JsonObj<string, CONTENT>\n\trelations: JsonObj<string, string[]>\n\trelationType: RelationType\n\ta: A\n\tb: B\n}\n\nexport const EMPTY_RELATION_DATA: RelationData = {\n\tcontents: {},\n\trelations: {},\n\trelationType: `n:n`,\n\ta: `from`,\n\tb: `to`,\n}\n\nexport type IsRelationDataOptions<\n\tCONTENT extends JsonObj | null = null,\n\tA extends string = `from`,\n\tB extends string = `to`,\n> = {\n\tfrom?: A\n\tto?: B\n\tisContent?: (json: Json) => json is CONTENT\n}\nexport const isRelationData =\n\t<\n\t\tCONTENT extends JsonObj | null = null,\n\t\tA extends string = `from`,\n\t\tB extends string = `to`,\n\t>({\n\t\tfrom: a = `from` as A,\n\t\tto: b = `to` as B,\n\t\tisContent,\n\t}: IsRelationDataOptions<CONTENT, A, B> = {}) =>\n\t(input: unknown): input is RelationData<CONTENT, A, B> => {\n\t\treturn hasExactProperties<RelationData<CONTENT, A, B>>({\n\t\t\tcontents: isContent\n\t\t\t\t? isRecord(isString, isContent)\n\t\t\t\t: hasExactProperties({}),\n\t\t\trelations: isRecord(isString, isArray(isString)),\n\t\t\trelationType: isRelationType,\n\t\t\ta: isLiteral(a),\n\t\t\tb: isLiteral(b),\n\t\t})(input)\n\t}\n","import type { Refinement } from \"fp-ts/Refinement\"\n\nexport * from \"./refined\"\n\nexport const canExist = (_: unknown): _ is unknown => true\nexport const cannotExist = (_: unknown): _ is never => false\n\nexport const isLiteral =\n\t<T extends boolean | number | string>(value: T): Refinement<unknown, T> =>\n\t(input: unknown): input is T =>\n\t\tinput === value\n\nexport const isWithin =\n\t<Options extends ReadonlyArray<any>>(args: Options) =>\n\t(input: unknown): input is Options[number] =>\n\t\targs.includes(input as Options[number])\n\nexport const ensure =\n\t<T>(isType: Refinement<unknown, T>) =>\n\t(input: unknown): T => {\n\t\tif (!isType(input)) {\n\t\t\tthrow new TypeError(`Expected ${input} to be of type ${isType.name}`)\n\t\t}\n\t\treturn input as T\n\t}\n\nexport const ensureAgainst =\n\t<A, B>(isType: Refinement<unknown, A>) =>\n\t(input: A | B): Exclude<A | B, A> => {\n\t\tif (isType(input)) {\n\t\t\tthrow new TypeError(`Expected ${input} to not be of type ${isType.name}`)\n\t\t}\n\t\treturn input as Exclude<A | B, A>\n\t}\n\nexport type ExtendsSome<A, B> = Refinement<unknown, A | B> & {\n\tor: <C>(isType: Refinement<unknown, C>) => ExtendsSome<unknown, A | B | C>\n}\nexport const couldBe = <A>(\n\tisTypeA: Refinement<unknown, A>,\n\tlogging = false,\n\trefinements: Refinement<unknown, any>[] = [isTypeA],\n): {\n\t(input: unknown): input is A\n\tor: <B>(isTypeB: Refinement<unknown, B>) => ExtendsSome<A, B>\n} => {\n\tconst name = `(${refinements.map((r) => r.name || `anon`).join(` | `)})`\n\tconst _ = {\n\t\t[name]: (input: unknown): input is A =>\n\t\t\trefinements.some(\n\t\t\t\t(refinement) => (\n\t\t\t\t\tlogging &&\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\trefinements.map((r) => r.name || `anon`).join(` | `),\n\t\t\t\t\t\t\t`>`,\n\t\t\t\t\t\t\trefinement.name ?? `anon`,\n\t\t\t\t\t\t\t`:`,\n\t\t\t\t\t\t\trefinement(input),\n\t\t\t\t\t\t),\n\t\t\t\t\trefinement(input)\n\t\t\t\t),\n\t\t\t),\n\t}\n\tconst checkTypes: {\n\t\t(input: unknown): input is A\n\t\tor: <B>(isTypeB: Refinement<unknown, B>) => ExtendsSome<A, B>\n\t} = Object.assign(_[name], {\n\t\tor: <B>(isTypeB: Refinement<unknown, B>): ExtendsSome<A, B> =>\n\t\t\tcouldBe(isTypeB, logging, [...refinements, isTypeB]),\n\t})\n\treturn checkTypes\n}\n\nexport const isUnion = couldBe(cannotExist)\n\nexport type ExtendsAll<A, B> = Refinement<unknown, A & B> & {\n\tand: <C>(isType: Refinement<unknown, C>) => ExtendsAll<A & B, C>\n}\n\nexport const mustBe = <A>(\n\tisTypeA: Refinement<unknown, A>,\n\tlogging = false,\n\trefinements: Refinement<unknown, any>[] = [isTypeA],\n): {\n\t(input: unknown): input is A\n\tand: <B>(isTypeB: Refinement<unknown, B>) => ExtendsAll<A, B>\n} => {\n\tconst name = `(${refinements.map((r) => r.name || `anon`).join(` & `)})`\n\tconst _ = {\n\t\t[name]: (input: unknown): input is A =>\n\t\t\trefinements.every(\n\t\t\t\t(refinement) => (\n\t\t\t\t\tlogging &&\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\trefinements.map((r) => r.name || `anon`).join(` & `),\n\t\t\t\t\t\t\t`>`,\n\t\t\t\t\t\t\trefinement.name || `anon`,\n\t\t\t\t\t\t\t`:`,\n\t\t\t\t\t\t\trefinement(input),\n\t\t\t\t\t\t),\n\t\t\t\t\trefinement(input)\n\t\t\t\t),\n\t\t\t),\n\t}\n\tconst checkTypes: {\n\t\t(input: unknown): input is A\n\t\tand: <B>(isTypeB: Refinement<unknown, B>) => ExtendsAll<A, B>\n\t} = Object.assign(_[name], {\n\t\tand: <B>(isTypeB: Refinement<unknown, B>): ExtendsAll<A, B> =>\n\t\t\tmustBe(isTypeB, logging, [...refinements, isTypeB]) as ExtendsAll<A, B>,\n\t})\n\treturn checkTypes\n}\n\nexport const isIntersection = mustBe(canExist)\n\nexport type ClassSignature = abstract new (...args: any) => any\n\nexport const isClass =\n\t<CS extends ClassSignature>(signature: CS) =>\n\t(input: unknown): input is InstanceType<ClassSignature> =>\n\t\tinput instanceof signature\n","import type { RelationData } from \"./core-relation-data\"\nimport type { JsonObj } from \"../json\"\n\nexport const getRelatedIds = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tid: string,\n): string[] => relationMap.relations[id] ?? []\n\nexport const getRelatedId = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tid: string,\n): string | undefined => {\n\tconst relations = getRelatedIds(relationMap, id)\n\tif (relations.length > 1) {\n\t\tconsole.warn(\n\t\t\t`entry with id ${id} was not expected to have multiple relations`,\n\t\t)\n\t}\n\treturn relations[0]\n}\n","import type { Json, JsonInterface, JsonObj } from \"~/packages/anvl/src/json\"\n\nimport { Join } from \".\"\nimport type { IsRelationDataOptions, RelationData } from \"./core-relation-data\"\n\nexport const makeJsonInterface = <\n\tCONTENT extends JsonObj | null = null,\n\tA extends string = `from`,\n\tB extends string = `to`,\n>(\n\tjoin: Join<CONTENT, A, B>,\n\t...params: CONTENT extends null ? [] : [(x: Json) => x is CONTENT]\n): JsonInterface<Join<CONTENT, A, B>, RelationData<CONTENT, A, B>> => {\n\tconst isContent = params[0] as (x: Json) => x is CONTENT\n\tconst { a, b } = join\n\tconst options: IsRelationDataOptions<CONTENT, A, B> = {\n\t\tfrom: a,\n\t\tto: b,\n\t\tisContent,\n\t}\n\treturn {\n\t\ttoJson: (join) => join.toJSON(),\n\t\tfromJson: (json) => Join.fromJSON(json, options),\n\t}\n}\n","import { pipe } from \"fp-ts/function\"\n\nimport type { Identified } from \"~/packages/anvl/src/id/identified\"\nimport { isEmptyObject } from \"~/packages/anvl/src/object/refinement\"\n\nimport type { RelationData } from \"./core-relation-data\"\nimport { getRelatedIds } from \"./get-related-ids\"\nimport { getRelationEntries } from \"./relation-record\"\nimport { removeRelation } from \"./remove-relation\"\nimport { setRelationWithContent } from \"./set-relation\"\nimport type { JsonObj } from \"../json\"\nimport type { NullSafeRest } from \"../nullish\"\n\nexport const makeContentId = (idA: string, idB: string): string =>\n\t[idA, idB].sort().join(`/`)\n\nexport const getContent = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tidA: string,\n\tidB: string,\n): CONTENT | undefined => relationMap.contents[makeContentId(idA, idB)]\n\nexport const setContent = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tmap: RelationData<CONTENT, A, B>,\n\tidA: string,\n\tidB: string,\n\tcontent: CONTENT,\n): RelationData<CONTENT, A, B> => ({\n\t...map,\n\tcontents: {\n\t\t...map.contents,\n\t\t[makeContentId(idA, idB)]: content,\n\t},\n})\n\nexport const getRelations = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tid: string,\n): (CONTENT extends null ? Identified : CONTENT & Identified)[] =>\n\tgetRelationEntries(relationMap, id).map(\n\t\t([id, content]) =>\n\t\t\t({\n\t\t\t\tid,\n\t\t\t\t...content,\n\t\t\t}) as CONTENT extends null ? Identified : CONTENT & Identified,\n\t)\n\nexport const setRelations = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\tsubject: { [from in A]: string } | { [to in B]: string },\n\trelations: (CONTENT extends null ? Identified : CONTENT & Identified)[],\n): RelationData<CONTENT, A, B> => {\n\tconst idA: string | undefined = (subject as { [from in A]: string })[current.a]\n\tconst idB: string | undefined = (subject as { [to in B]: string })[current.b]\n\treturn pipe(\n\t\tcurrent,\n\t\t(relationData) => {\n\t\t\tconst relatedIds = getRelatedIds(current, idA)\n\t\t\tconst removedIds = relatedIds.filter(\n\t\t\t\t(id) => !relations.some((r) => r.id === id),\n\t\t\t)\n\t\t\tlet step = relationData\n\t\t\tfor (const id of removedIds) {\n\t\t\t\tconst remove = {\n\t\t\t\t\t[current.a]: idA ?? id,\n\t\t\t\t\t[current.b]: idB ?? id,\n\t\t\t\t} as Record<A | B, string>\n\t\t\t\tstep = removeRelation(step, remove)\n\t\t\t}\n\t\t\treturn step\n\t\t},\n\t\t(relationData) => {\n\t\t\tlet step = relationData\n\t\t\tfor (const { id, ...rest } of relations) {\n\t\t\t\tconst content = isEmptyObject(rest) ? undefined : rest\n\t\t\t\tstep = setRelationWithContent(\n\t\t\t\t\tstep,\n\t\t\t\t\t{ [current.a]: idA ?? id, [current.b]: idB ?? id } as Record<\n\t\t\t\t\t\tA | B,\n\t\t\t\t\t\tstring\n\t\t\t\t\t>,\n\t\t\t\t\t// @ts-expect-error hacky\n\t\t\t\t\tcontent as NullSafeRest<CONTENT>,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn step\n\t\t},\n\t\t(relationData) => {\n\t\t\tconst newlyOrderedIds = relations.map((r) => r.id)\n\t\t\treturn {\n\t\t\t\t...relationData,\n\t\t\t\trelations: {\n\t\t\t\t\t...relationData.relations,\n\t\t\t\t\t[idA ?? idB]: newlyOrderedIds,\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t)\n}\n","import type { RelationData } from \"./core-relation-data\"\nimport { getRelatedIds } from \"./get-related-ids\"\nimport { getContent } from \"./relation-contents\"\nimport type { JsonObj } from \"../json\"\n\nexport const getRelationEntries = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tidA: string,\n): [string, CONTENT][] =>\n\tgetRelatedIds(relationMap, idA).map((idB) => [\n\t\tidB,\n\t\tgetContent(relationMap, idA, idB) as CONTENT,\n\t])\n\nexport const getRelationRecord = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\trelationMap: RelationData<CONTENT, A, B>,\n\tid: string,\n): Record<string, CONTENT> =>\n\tObject.fromEntries(getRelationEntries(relationMap, id))\n","import { pipe } from \"fp-ts/function\"\nimport { isString } from \"fp-ts/string\"\n\nimport type { RelationData } from \"./core-relation-data\"\nimport { isEmptyArray, isOneOf, map } from \"../array\"\nimport { comprises } from \"../array/venn\"\nimport type { JsonObj } from \"../json\"\nimport type { RequireAtLeastOne } from \"../object\"\nimport { treeShake as removeProperties } from \"../object\"\nimport { entriesToRecord, recordToEntries } from \"../object/entries\"\nimport { split } from \"../string/split\"\n\nexport const removeSpecific = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\tidA: string,\n\tidB: string,\n): RelationData<CONTENT, A, B> => {\n\tconst isIdForRemoval = isOneOf(idA, idB)\n\treturn {\n\t\t...current,\n\t\trelations: pipe(\n\t\t\tcurrent.relations,\n\t\t\trecordToEntries,\n\t\t\tmap(([id, relations]): [id: string, fewerRelations: string[]] => [\n\t\t\t\tid,\n\t\t\t\tisIdForRemoval(id)\n\t\t\t\t\t? relations.filter((relation) => !isIdForRemoval(relation))\n\t\t\t\t\t: relations,\n\t\t\t]),\n\t\t\tentriesToRecord,\n\t\t\tremoveProperties(isEmptyArray),\n\t\t),\n\t\tcontents: pipe(\n\t\t\tcurrent.contents,\n\t\t\tremoveProperties(\n\t\t\t\t(_, key) =>\n\t\t\t\t\tisString(key) && pipe(key, split(`/`), comprises([idA, idB])),\n\t\t\t),\n\t\t),\n\t}\n}\n\nexport const removeAll = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\tidToRemove: string,\n): RelationData<CONTENT, A, B> => {\n\tconst next: RelationData<CONTENT, A, B> = {\n\t\t...current,\n\t\trelations: pipe(\n\t\t\tcurrent.relations,\n\t\t\trecordToEntries,\n\t\t\tmap(([id, relations]): [id: string, fewerRelations: string[]] => [\n\t\t\t\tid,\n\t\t\t\trelations.filter((relation) => relation !== idToRemove),\n\t\t\t]),\n\t\t\tentriesToRecord,\n\t\t\tremoveProperties((val, key) => key === idToRemove || isEmptyArray(val)),\n\t\t),\n\t\tcontents: pipe(\n\t\t\tcurrent.contents,\n\t\t\tremoveProperties(\n\t\t\t\t(_, key) => isString(key) && key.split(`/`).includes(idToRemove),\n\t\t\t),\n\t\t),\n\t}\n\treturn next\n}\n\nexport const removeRelation = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\trelation: Partial<Record<A | B, string>>,\n): RelationData<CONTENT, A, B> => {\n\tconst idA: string | undefined = (relation as { [key in A | B]: string })[\n\t\tcurrent.a\n\t]\n\tconst idB: string | undefined = (relation as { [key in A | B]: string })[\n\t\tcurrent.b\n\t]\n\treturn idB ? removeSpecific(current, idA, idB) : removeAll(current, idA)\n}\n","export const split = (separator: string) => (str: string): string[] =>\n\tstr.split(separator)\n","import type { RelationData } from \"./core-relation-data\"\nimport { getRelatedId } from \"./get-related-ids\"\nimport { setContent } from \"./relation-contents\"\nimport { addTo, isEmptyArray } from \"../array\"\nimport type { JsonObj } from \"../json\"\nimport type { NullSafeRest } from \"../nullish\"\nimport { treeShake as removeProperties } from \"../object\"\n\nexport const setManyToMany = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tmap: RelationData<CONTENT, A, B>,\n\tidA: string,\n\tidB: string,\n\t...rest: NullSafeRest<CONTENT>\n): RelationData<CONTENT, A, B> => {\n\tconst next = {\n\t\t...map,\n\t\trelations: {\n\t\t\t...map.relations,\n\t\t\t[idA]: addTo(map.relations[idA] ?? [])(idB),\n\t\t\t[idB]: addTo(map.relations[idB] ?? [])(idA),\n\t\t},\n\t}\n\tconst content = rest[0] as CONTENT | undefined\n\treturn content ? setContent(next, idA, idB, content) : next\n}\n\nconst removeEmpties = removeProperties(isEmptyArray)\n\nexport const set1ToMany = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\tleaderId: string,\n\tfollowerId: string,\n\t...rest: NullSafeRest<CONTENT>\n): RelationData<CONTENT, A, B> => {\n\tconst relations = { ...current.relations }\n\tconst prevLeaderId = getRelatedId(current, followerId)\n\tconst next = {\n\t\t...current,\n\t\trelations: removeEmpties({\n\t\t\t...relations,\n\t\t\t...(prevLeaderId &&\n\t\t\t\tprevLeaderId !== leaderId && {\n\t\t\t\t\t[prevLeaderId]: relations[prevLeaderId].filter(\n\t\t\t\t\t\t(id) => id !== followerId,\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t[followerId]: [leaderId],\n\t\t\t[leaderId]: addTo(relations[leaderId] ?? [])(followerId),\n\t\t}),\n\t}\n\tconst content = rest[0] as CONTENT | undefined\n\treturn content ? setContent(next, leaderId, followerId, content) : next\n}\n\nexport const set1To1 = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\twifeId: string,\n\thusbandId: string,\n\t...rest: NullSafeRest<CONTENT>\n): RelationData<CONTENT, A, B> => {\n\tconst prevWifeId = getRelatedId(current, husbandId)\n\tconst prevHusbandId = getRelatedId(current, wifeId)\n\tconst next = {\n\t\t...current,\n\t\trelations: removeEmpties({\n\t\t\t...current.relations,\n\t\t\t...(prevWifeId && { [prevWifeId]: [] }),\n\t\t\t...(prevHusbandId && { [prevHusbandId]: [] }),\n\t\t\t[wifeId]: [husbandId],\n\t\t\t[husbandId]: [wifeId],\n\t\t}),\n\t}\n\n\tconst content = rest[0] as CONTENT | undefined\n\treturn content ? setContent(next, wifeId, husbandId, content) : next\n}\n\nexport const setRelationWithContent = <\n\tCONTENT extends JsonObj | null,\n\tA extends string,\n\tB extends string,\n>(\n\tcurrent: RelationData<CONTENT, A, B>,\n\trelation: Record<A | B, string>,\n\t...rest: NullSafeRest<CONTENT>\n): RelationData<CONTENT, A, B> => {\n\tconst { [current.a]: idA, [current.b]: idB } = relation\n\t// console.log({\n\t// current,\n\t// relation,\n\t// idA,\n\t// idB,\n\t// })\n\tswitch (current.relationType) {\n\t\tcase `1:1`:\n\t\t\treturn set1To1(current, idA, idB, ...rest)\n\t\tcase `1:n`:\n\t\t\treturn set1ToMany(current, idA, idB, ...rest)\n\t\tcase `n:n`:\n\t\t\treturn setManyToMany(current, idA, idB, ...rest)\n\t}\n}\n","import type { Refinement } from \"fp-ts/Refinement\"\n\nimport type { Identified } from \"~/packages/anvl/src/id/identified\"\n\nimport type { IsRelationDataOptions, RelationData } from \"./core-relation-data\"\nimport { EMPTY_RELATION_DATA, isRelationData } from \"./core-relation-data\"\nimport { getRelatedId, getRelatedIds } from \"./get-related-ids\"\nimport { makeJsonInterface } from \"./make-json-interface\"\nimport { getContent, getRelations, setRelations } from \"./relation-contents\"\nimport { getRelationEntries, getRelationRecord } from \"./relation-record\"\nimport { removeRelation } from \"./remove-relation\"\nimport { setRelationWithContent } from \"./set-relation\"\nimport type { Json, JsonInterface, JsonObj } from \"../json\"\nimport type { NullSafeRest, NullSafeUnion } from \"../nullish\"\n\nexport class Join<\n\tCONTENT extends JsonObj | null = null,\n\tA extends string = `from`,\n\tB extends string = `to`,\n> implements RelationData<CONTENT, A, B>\n{\n\tpublic readonly relationType: `1:1` | `1:n` | `n:n`\n\tpublic readonly a: A = `from` as A\n\tpublic readonly b: B = `to` as B\n\tpublic readonly relations: Record<string, string[]>\n\tpublic readonly contents: Record<string, CONTENT>\n\tpublic constructor(json?: Partial<RelationData<CONTENT, A, B>>) {\n\t\tObject.assign(this, {\n\t\t\t...EMPTY_RELATION_DATA,\n\t\t\t...json,\n\t\t\tmakeJsonInterface: this.makeJsonInterface,\n\t\t})\n\t}\n\tpublic toJSON(): RelationData<CONTENT, A, B> {\n\t\treturn {\n\t\t\trelationType: this.relationType,\n\t\t\trelations: this.relations,\n\t\t\tcontents: this.contents,\n\t\t\ta: this.a,\n\t\t\tb: this.b,\n\t\t}\n\t}\n\tpublic static fromJSON<\n\t\tCONTENT extends JsonObj | null,\n\t\tA extends string,\n\t\tB extends string,\n\t>(\n\t\tjson: Json,\n\t\toptions?: IsRelationDataOptions<CONTENT, A, B>,\n\t): Join<CONTENT, A, B> {\n\t\tconst isValid = isRelationData<CONTENT, A, B>(options)(json)\n\t\tif (isValid) {\n\t\t\treturn new Join<CONTENT, A, B>(json)\n\t\t}\n\t\tthrow new Error(\n\t\t\t`Saved JSON for this Join is invalid: ${JSON.stringify(json)}`,\n\t\t)\n\t}\n\n\tpublic from<AA extends string>(newA: AA): Join<CONTENT, AA, B> {\n\t\treturn new Join({ ...this, a: newA })\n\t}\n\n\tpublic to<BB extends string>(newB: BB): Join<CONTENT, A, BB> {\n\t\treturn new Join({ ...this, b: newB })\n\t}\n\n\tpublic makeJsonInterface = (\n\t\t...params: CONTENT extends null ? [] : [Refinement<unknown, CONTENT>]\n\t): JsonInterface<Join<CONTENT, A, B>, RelationData<CONTENT, A, B>> => {\n\t\treturn makeJsonInterface<CONTENT, A, B>(this, ...params)\n\t}\n\n\tpublic getRelatedId(id: string): string | undefined {\n\t\treturn getRelatedId(this, id)\n\t}\n\tpublic getRelatedIds(id: string): string[] {\n\t\treturn getRelatedIds(this, id)\n\t}\n\tpublic getContent(idA: string, idB: string): CONTENT | undefined {\n\t\treturn getContent(this, idA, idB)\n\t}\n\tpublic getRelationEntries(id: string): [string, CONTENT][] {\n\t\treturn getRelationEntries(this, id)\n\t}\n\tpublic getRelationRecord(id: string): Record<string, CONTENT> {\n\t\treturn getRelationRecord(this, id)\n\t}\n\tpublic getRelation(\n\t\tid: string,\n\t): NullSafeUnion<Identified, CONTENT> | undefined {\n\t\treturn getRelations(this, id)[0]\n\t}\n\tpublic getRelations(id: string): NullSafeUnion<Identified, CONTENT>[] {\n\t\treturn getRelations(this, id)\n\t}\n\tpublic setRelations(\n\t\tsubject: { [from in A]: string } | { [to in B]: string },\n\t\trelations: NullSafeUnion<Identified, CONTENT>[],\n\t): Join<CONTENT, A, B> {\n\t\treturn new Join(setRelations(this, subject, relations))\n\t}\n\tpublic set(\n\t\trelation: { [key in A | B]: string },\n\t\t...rest: NullSafeRest<CONTENT>\n\t): Join<CONTENT, A, B> {\n\t\treturn new Join(setRelationWithContent(this, relation, ...rest))\n\t}\n\tpublic remove(relation: Partial<Record<A | B, string>>): Join<CONTENT, A, B> {\n\t\treturn new Join(\n\t\t\tremoveRelation(this, relation as Partial<Record<A | B, string>>),\n\t\t)\n\t}\n}\n","import type { ƒn } from \"~/packages/anvl/src/function\"\nimport { doNothing } from \"~/packages/anvl/src/function\"\nimport { Join } from \"~/packages/anvl/src/join\"\n\nimport { Subject } from \".\"\nimport type {\n\tAtom,\n\tOperationProgress,\n\tReadonlySelector,\n\tSelector,\n\tTransactionStatus,\n\tTimeline,\n\tTransaction,\n} from \".\"\nimport type {\n\tAtomToken,\n\tLogger,\n\tReadonlySelectorToken,\n\tSelectorToken,\n\tTimelineToken,\n\tTransactionToken,\n} from \"..\"\n\nexport type StoreCore = Pick<\n\tStore,\n\t| `atoms`\n\t| `atomsThatAreDefault`\n\t| `operation`\n\t| `readonlySelectors`\n\t| `selectorAtoms`\n\t| `selectorGraph`\n\t| `selectors`\n\t| `timelineAtoms`\n\t| `timelines`\n\t| `transactions`\n\t| `valueMap`\n>\n\nexport interface Store {\n\tatoms: Map<string, Atom<any>>\n\tatomsThatAreDefault: Set<string>\n\treadonlySelectors: Map<string, ReadonlySelector<any>>\n\tselectorAtoms: Join<null, `selectorKey`, `atomKey`>\n\tselectorGraph: Join<{ source: string }>\n\tselectors: Map<string, Selector<any>>\n\ttimelineAtoms: Join<null, `timelineKey`, `atomKey`>\n\ttimelines: Map<string, Timeline>\n\ttransactions: Map<string, Transaction<any>>\n\tvalueMap: Map<string, any>\n\n\tsubject: {\n\t\tatomCreation: Subject<AtomToken<unknown>>\n\t\tselectorCreation: Subject<\n\t\t\tReadonlySelectorToken<unknown> | SelectorToken<unknown>\n\t\t>\n\t\ttransactionCreation: Subject<TransactionToken<ƒn>>\n\t\ttimelineCreation: Subject<TimelineToken>\n\t\toperationStatus: Subject<OperationProgress>\n\t}\n\n\toperation: OperationProgress\n\ttransactionStatus: TransactionStatus<ƒn>\n\tconfig: {\n\t\tname: string\n\t\tlogger: Logger | null\n\t\tlogger__INTERNAL: Logger\n\t}\n}\n\nexport const createStore = (name: string, store: Store | null = null): Store => {\n\tconst created = {\n\t\t...(store ??\n\t\t\t(() => ({\n\t\t\t\tatomsThatAreDefault: new Set(),\n\t\t\t\tselectorAtoms: new Join({ relationType: `n:n` })\n\t\t\t\t\t.from(`selectorKey`)\n\t\t\t\t\t.to(`atomKey`),\n\t\t\t\tselectorGraph: new Join({ relationType: `n:n` }),\n\t\t\t}))()),\n\n\t\tvalueMap: new Map(store?.valueMap),\n\t\tatoms: new Map(),\n\t\treadonlySelectors: new Map(),\n\t\tselectors: new Map(),\n\t\ttransactions: new Map(),\n\t\ttimelines: new Map(),\n\n\t\ttimelineAtoms: new Join({ relationType: `1:n` })\n\t\t\t.from(`timelineKey`)\n\t\t\t.to(`atomKey`),\n\n\t\tsubject: {\n\t\t\tatomCreation: new Subject(),\n\t\t\tselectorCreation: new Subject(),\n\t\t\ttransactionCreation: new Subject(),\n\t\t\ttimelineCreation: new Subject(),\n\t\t\toperationStatus: new Subject(),\n\t\t},\n\n\t\toperation: {\n\t\t\topen: false,\n\t\t\t...store?.operation,\n\t\t},\n\t\ttransactionStatus: {\n\t\t\tphase: `idle`,\n\t\t\t...store?.transactionStatus,\n\t\t},\n\t\tconfig: {\n\t\t\tlogger: {\n\t\t\t\t...console,\n\t\t\t\tinfo: doNothing,\n\t\t\t\t...store?.config?.logger,\n\t\t\t},\n\t\t\tlogger__INTERNAL: console,\n\t\t\t...store?.config,\n\t\t\tname,\n\t\t},\n\t} satisfies Store\n\n\tstore?.atoms.forEach((atom) => {\n\t\tconst copiedAtom = { ...atom, subject: new Subject() } satisfies Atom<any>\n\t\tcreated.atoms.set(atom.key, copiedAtom)\n\t})\n\tstore?.readonlySelectors.forEach((selector) => {\n\t\tselector.install(created)\n\t})\n\tstore?.selectors.forEach((selector) => {\n\t\tselector.install(created)\n\t})\n\tstore?.transactions.forEach((tx) => {\n\t\ttx.install(created)\n\t})\n\tstore?.timelines.forEach((timeline) => {\n\t\ttimeline.install(created)\n\t})\n\n\treturn created\n}\n\nexport const IMPLICIT = {\n\tSTORE_INTERNAL: undefined as Store | undefined,\n\tget STORE(): Store {\n\t\treturn this.STORE_INTERNAL ?? (this.STORE_INTERNAL = createStore(`DEFAULT`))\n\t},\n}\n\nexport const clearStore = (store: Store = IMPLICIT.STORE): void => {\n\tconst { config } = store\n\tObject.assign(store, createStore(config.name))\n\tstore.config = config\n}\n","import type { Atom, ReadonlySelector, Selector } from \".\"\nimport { target } from \".\"\nimport type { Store } from \"./store\"\nimport { IMPLICIT } from \"./store\"\nimport type { StateToken } from \"..\"\n\nexport type OperationProgress =\n\t| {\n\t\t\topen: false\n\t }\n\t| {\n\t\t\topen: true\n\t\t\tdone: Set<string>\n\t\t\tprev: Map<string, any>\n\t\t\ttime: number\n\t\t\ttoken: StateToken<any>\n\t }\n\nexport const openOperation = (token: StateToken<any>, store: Store): void => {\n\tconst core = target(store)\n\tif (core.operation.open) {\n\t\tstore.config.logger?.error(\n\t\t\t`❌ failed to setState to \"${token.key}\" during a setState for \"${core.operation.token.key}\"`,\n\t\t)\n\t\tthrow Symbol(`violation`)\n\t}\n\tcore.operation = {\n\t\topen: true,\n\t\tdone: new Set(),\n\t\tprev: new Map(store.valueMap),\n\t\ttime: Date.now(),\n\t\ttoken,\n\t}\n\tstore.config.logger?.info(\n\t\t`⭕ operation start from \"${token.key}\" in store \"${store.config.name}\"`,\n\t)\n}\nexport const closeOperation = (store: Store): void => {\n\tconst core = target(store)\n\tcore.operation = { open: false }\n\tstore.config.logger?.info(`🔴 operation done`)\n\tstore.subject.operationStatus.next(core.operation)\n}\n\nexport const isDone = (key: string, store: Store = IMPLICIT.STORE): boolean => {\n\tconst core = target(store)\n\tif (!core.operation.open) {\n\t\tstore.config.logger?.warn(\n\t\t\t`isDone called outside of an operation. This is probably a bug.`,\n\t\t)\n\t\treturn true\n\t}\n\treturn core.operation.done.has(key)\n}\nexport const markDone = (key: string, store: Store = IMPLICIT.STORE): void => {\n\tconst core = target(store)\n\tif (!core.operation.open) {\n\t\tstore.config.logger?.warn(\n\t\t\t`markDone called outside of an operation. This is probably a bug.`,\n\t\t)\n\t\treturn\n\t}\n\tcore.operation.done.add(key)\n}\nexport const recallState = <T>(\n\tstate: Atom<T> | ReadonlySelector<T> | Selector<T>,\n\tstore: Store = IMPLICIT.STORE,\n): T => {\n\tconst core = target(store)\n\tif (!core.operation.open) {\n\t\tstore.config.logger?.warn(\n\t\t\t`recall called outside of an operation. This is probably a bug.`,\n\t\t)\n\t\treturn core.valueMap.get(state.key)\n\t}\n\treturn core.operation.prev.get(state.key)\n}\n\nexport const cacheValue = (\n\tkey: string,\n\tvalue: unknown,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.valueMap.set(key, value)\n}\n\nexport const evictCachedValue = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.valueMap.delete(key)\n}\nexport const readCachedValue = <T>(\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): T => target(store).valueMap.get(key)\n\nexport const isValueCached = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): boolean => target(store).valueMap.has(key)\n\nexport const storeAtom = (\n\tatom: Atom<any>,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.atoms.set(atom.key, atom)\n}\n\nexport const storeSelector = (\n\tselector: Selector<any>,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.selectors.set(selector.key, selector)\n}\n\nexport const storeReadonlySelector = (\n\tselector: ReadonlySelector<any>,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tcore.readonlySelectors.set(selector.key, selector)\n}\n\nexport const hasKeyBeenUsed = (\n\tkey: string,\n\tstore: Store = IMPLICIT.STORE,\n): boolean => {\n\tconst core = target(store)\n\treturn (\n\t\tcore.atoms.has(key) ||\n\t\tcore.selectors.has(key) ||\n\t\tcore.readonlySelectors.has(key)\n\t)\n}\n","import type { ƒn } from \"~/packages/anvl/src/function\"\n\nimport type { Store, StoreCore } from \".\"\nimport {\n\tSubject,\n\tabortTransaction,\n\tapplyTransaction,\n\tbuildTransaction,\n\tdeposit,\n\tIMPLICIT,\n} from \".\"\nimport type { TransactionOptions, TransactionToken, TransactionUpdate } from \"..\"\nimport { getState, setState } from \"..\"\n\nexport type Transaction<ƒ extends ƒn> = {\n\tkey: string\n\ttype: `transaction`\n\tinstall: (store: Store) => void\n\tsubject: Subject<TransactionUpdate<ƒ>>\n\trun: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>\n}\n\nexport function transaction__INTERNAL<ƒ extends ƒn>(\n\toptions: TransactionOptions<ƒ>,\n\tstore: Store = IMPLICIT.STORE,\n): TransactionToken<ƒ> {\n\tconst newTransaction: Transaction<ƒ> = {\n\t\tkey: options.key,\n\t\ttype: `transaction`,\n\t\trun: (...params: Parameters<ƒ>) => {\n\t\t\tbuildTransaction(options.key, params, store)\n\t\t\ttry {\n\t\t\t\tconst output = options.do(\n\t\t\t\t\t{\n\t\t\t\t\t\tget: (token) => getState(token, store),\n\t\t\t\t\t\tset: (token, value) => setState(token, value, store),\n\t\t\t\t\t},\n\t\t\t\t\t...params,\n\t\t\t\t)\n\t\t\t\tapplyTransaction(output, store)\n\t\t\t\treturn output\n\t\t\t} catch (thrown) {\n\t\t\t\tabortTransaction(store)\n\t\t\t\tstore.config.logger?.error(`Transaction ${options.key} failed`, thrown)\n\t\t\t\tthrow thrown\n\t\t\t}\n\t\t},\n\t\tinstall: (store) => transaction__INTERNAL(options, store),\n\t\tsubject: new Subject(),\n\t}\n\tconst core = target(store)\n\tcore.transactions.set(newTransaction.key, newTransaction)\n\tconst token = deposit(newTransaction)\n\tstore.subject.transactionCreation.next(token)\n\treturn token\n}\n\nexport const target = (store: Store = IMPLICIT.STORE): StoreCore =>\n\tstore.transactionStatus.phase === `building`\n\t\t? store.transactionStatus.core\n\t\t: store\n","import { Subject } from \".\"\nimport { deposit } from \"./get\"\nimport { markAtomAsDefault } from \"./is-default\"\nimport { cacheValue } from \"./operation\"\nimport type { Store } from \"./store\"\nimport { IMPLICIT } from \"./store\"\nimport { target } from \"./transaction-internal\"\nimport type { AtomToken, FamilyMetadata, UpdateHandler } from \"..\"\nimport { setState, subscribe } from \"..\"\nimport type { AtomOptions } from \"../atom\"\n\nexport type Atom<T> = {\n\tkey: string\n\ttype: `atom`\n\tfamily?: FamilyMetadata\n\tsubject: Subject<{ newValue: T; oldValue: T }>\n\tdefault: T\n}\n\nexport function atom__INTERNAL<T>(\n\toptions: AtomOptions<T>,\n\tfamily?: FamilyMetadata,\n\tstore: Store = IMPLICIT.STORE,\n): AtomToken<T> {\n\tconst core = target(store)\n\tconst existing = core.atoms.get(options.key)\n\tif (existing) {\n\t\tstore.config.logger?.error?.(\n\t\t\t`Key \"${options.key}\" already exists in the store.`,\n\t\t)\n\t\treturn deposit(existing)\n\t}\n\tconst subject = new Subject<{ newValue: T; oldValue: T }>()\n\tconst newAtom = {\n\t\t...options,\n\t\tsubject,\n\t\ttype: `atom`,\n\t\t...(family && { family }),\n\t} as const\n\tconst initialValue =\n\t\toptions.default instanceof Function ? options.default() : options.default\n\tcore.atoms.set(newAtom.key, newAtom)\n\tmarkAtomAsDefault(options.key, store)\n\tcacheValue(options.key, initialValue, store)\n\tconst token = deposit(newAtom)\n\toptions.effects?.forEach((effect) =>\n\t\teffect({\n\t\t\tsetSelf: (next) => setState(token, next, store),\n\t\t\tonSet: (handle: UpdateHandler<T>) => subscribe(token, handle, store),\n\t\t}),\n\t)\n\tstore.subject.atomCreation.next(token)\n\treturn token as AtomToken<T>\n}\n","import { pipe } from \"fp-ts/function\"\n\nexport * from \"./refine\"\nexport * from \"./json-interface\"\n\nexport const serializeSet = <T>(set: Set<T>): string =>\n\tpipe(set, Array.from, JSON.stringify)\n\nexport const deserializeSet = <T>(str: string): Set<T> =>\n\tpipe(str, JSON.parse, Array.from, (a) => new Set(a as T[]))\n\nexport type Primitive = boolean | number | string | null\n\nexport type Serializable =\n\t| Primitive\n\t| Readonly<{ [key: string]: Serializable }>\n\t| ReadonlyArray<Serializable>\n\nexport type JsonObj<\n\tKey extends string = string,\n\tValue extends Serializable = Serializable,\n> = Record<Key, Value>\n\nexport type JsonArr<Element extends Serializable = Serializable> =\n\tReadonlyArray<Element>\n\nexport type Json = JsonArr | JsonObj | Primitive\n\nexport const parseJson = <S extends Stringified<Json>>(\n\tstr: S | string,\n): S extends Stringified<infer J> ? J : Json => JSON.parse(str)\n\nexport type Stringified<J extends Json> = string & { __json: J }\n\nexport const stringifyJson = <J extends Json>(json: J): Stringified<J> =>\n\tJSON.stringify(json) as Stringified<J>\n\nexport type Empty = Record<string, never>\n\nexport const JSON_TYPE_NAMES = [\n\t`array`,\n\t`boolean`,\n\t`null`,\n\t`number`,\n\t`object`,\n\t`string`,\n] as const\n\nexport type JsonTypeName = typeof JSON_TYPE_NAMES[number]\n\nexport interface JsonTypes extends Record<JsonTypeName, Json> {\n\tarray: JsonArr\n\tboolean: boolean\n\tnull: null\n\tnumber: number\n\tobject: JsonObj\n\tstring: string\n}\n\nexport const JSON_DEFAULTS: JsonTypes = {\n\tarray: [],\n\tboolean: false,\n\tnull: null,\n\tnumber: 0,\n\tobject: {},\n\tstring: ``,\n}\n","import { isBoolean } from \"fp-ts/boolean\"\nimport { isNumber } from \"fp-ts/number\"\nimport { isString } from \"fp-ts/string\"\n\nimport { isPlainObject } from \"~/packages/anvl/src/object/refinement\"\n\nimport { stringifyJson } from \".\"\nimport type { JsonArr, JsonObj, Json } from \".\"\nimport { attempt, raiseError } from \"../function\"\n\nconst JSON_PROTOTYPES = [\n\t`Array`,\n\t`Boolean`,\n\t`Number`,\n\t`Object`,\n\t`String`,\n] as const\n\nexport type RefinedJson =\n\t| { type: `array`; data: JsonArr }\n\t| { type: `boolean`; data: boolean }\n\t| { type: `null`; data: null }\n\t| { type: `number`; data: number }\n\t| { type: `object`; data: JsonObj }\n\t| { type: `string`; data: string }\n\nexport const refineJsonType = (data: Json): RefinedJson =>\n\tdata === null\n\t\t? { type: `null`, data: null }\n\t\t: isBoolean(data)\n\t\t? { type: `boolean`, data }\n\t\t: isNumber(data)\n\t\t? { type: `number`, data }\n\t\t: isString(data)\n\t\t? { type: `string`, data }\n\t\t: Array.isArray(data)\n\t\t? { type: `array`, data }\n\t\t: isPlainObject(data)\n\t\t? { type: `object`, data }\n\t\t: raiseError(\n\t\t\t\tdata === undefined\n\t\t\t\t\t? `undefined passed to refineJsonType. This is not valid JSON.`\n\t\t\t\t\t: `${stringifyJson(data)} with prototype \"${\n\t\t\t\t\t\t\tObject.getPrototypeOf(data).constructor.name\n\t\t\t\t\t }\" passed to refineJsonType. This is not valid JSON.`,\n\t\t )\nexport const isJson = (input: unknown): input is Json => {\n\tif (input === null) return true\n\tif (input === undefined) return false\n\tconst prototype = Object.getPrototypeOf(input)?.constructor.name\n\tconst isJson = JSON_PROTOTYPES.includes(prototype)\n\treturn isJson\n}\n\nexport const isPlainJson = (input: unknown): input is Json =>\n\tattempt(() => isJson(input) && refineJsonType(input))\n","import type { Serializable } from \"~/packages/anvl/src/json\"\nimport { stringifyJson } from \"~/packages/anvl/src/json\"\n\nimport type { Store } from \".\"\nimport {\n\tSubject,\n\tatom__INTERNAL,\n\twithdraw,\n\tselector__INTERNAL,\n\ttarget,\n\tdeposit,\n\tIMPLICIT,\n} from \".\"\nimport type {\n\tAtomFamily,\n\tAtomFamilyOptions,\n\tAtomToken,\n\tFamilyMetadata,\n\tReadonlySelectorFamily,\n\tReadonlySelectorFamilyOptions,\n\tReadonlySelectorToken,\n\tSelectorFamily,\n\tSelectorFamilyOptions,\n\tSelectorToken,\n} from \"..\"\n\nexport function atomFamily__INTERNAL<T, K extends Serializable>(\n\toptions: AtomFamilyOptions<T, K>,\n\tstore: Store = IMPLICIT.STORE,\n): AtomFamily<T, K> {\n\tconst subject = new Subject<AtomToken<T>>()\n\treturn Object.assign(\n\t\t(key: K): AtomToken<T> => {\n\t\t\tconst subKey = stringifyJson(key)\n\t\t\tconst family: FamilyMetadata = { key: options.key, subKey }\n\t\t\tconst fullKey = `${options.key}(${subKey})`\n\t\t\tconst existing = withdraw({ key: fullKey, type: `atom` }, store)\n\t\t\tconst token: AtomToken<any> = existing\n\t\t\t\t? deposit(existing)\n\t\t\t\t: atom__INTERNAL<T>(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: fullKey,\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\toptions.default instanceof Function\n\t\t\t\t\t\t\t\t\t? options.default(key)\n\t\t\t\t\t\t\t\t\t: options.default,\n\t\t\t\t\t\t\teffects: options.effects?.(key),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfamily,\n\t\t\t\t\t\tstore,\n\t\t\t\t )\n\t\t\tsubject.next(token)\n\t\t\treturn token\n\t\t},\n\t\t{\n\t\t\tkey: options.key,\n\t\t\ttype: `atom_family`,\n\t\t\tsubject,\n\t\t} as const,\n\t)\n}\n\nexport function readonlySelectorFamily__INTERNAL<T, K extends Serializable>(\n\toptions: ReadonlySelectorFamilyOptions<T, K>,\n\tstore?: Store,\n): ReadonlySelectorFamily<T, K> {\n\tconst core = target(store)\n\tconst subject = new Subject<ReadonlySelectorToken<T>>()\n\treturn Object.assign(\n\t\t(key: K): ReadonlySelectorToken<T> => {\n\t\t\tconst subKey = stringifyJson(key)\n\t\t\tconst family: FamilyMetadata = { key: options.key, subKey }\n\t\t\tconst fullKey = `${options.key}(${subKey})`\n\t\t\tconst existing = core.readonlySelectors.get(fullKey)\n\t\t\tif (existing) {\n\t\t\t\treturn deposit(existing)\n\t\t\t}\n\t\t\treturn selector__INTERNAL<T>(\n\t\t\t\t{\n\t\t\t\t\tkey: fullKey,\n\t\t\t\t\tget: options.get(key),\n\t\t\t\t},\n\t\t\t\tfamily,\n\t\t\t\tstore,\n\t\t\t) as ReadonlySelectorToken<T>\n\t\t},\n\t\t{\n\t\t\tkey: options.key,\n\t\t\ttype: `readonly_selector_family`,\n\t\t\tsubject,\n\t\t} as const,\n\t) as ReadonlySelectorFamily<T, K>\n}\n\nexport function selectorFamily__INTERNAL<T, K extends Serializable>(\n\toptions: SelectorFamilyOptions<T, K>,\n\tstore?: Store,\n): SelectorFamily<T, K>\nexport function selectorFamily__INTERNAL<T, K extends Serializable>(\n\toptions: ReadonlySelectorFamilyOptions<T, K>,\n\tstore?: Store,\n): ReadonlySelectorFamily<T, K>\nexport function selectorFamily__INTERNAL<T, K extends Serializable>(\n\toptions: ReadonlySelectorFamilyOptions<T, K> | SelectorFamilyOptions<T, K>,\n\tstore: Store = IMPLICIT.STORE,\n): ReadonlySelectorFamily<T, K> | SelectorFamily<T, K> {\n\tconst isReadonly = !(`set` in options)\n\n\tif (isReadonly) {\n\t\treturn readonlySelectorFamily__INTERNAL(options, store)\n\t}\n\tconst core = target(store)\n\tconst subject = new Subject<SelectorToken<T>>()\n\n\treturn Object.assign(\n\t\t(key: K): SelectorToken<T> => {\n\t\t\tconst subKey = stringifyJson(key)\n\t\t\tconst family: FamilyMetadata = { key: options.key, subKey }\n\t\t\tconst fullKey = `${options.key}(${subKey})`\n\t\t\tconst existing = core.selectors.get(fullKey)\n\t\t\tif (existing) {\n\t\t\t\treturn deposit(existing)\n\t\t\t}\n\t\t\tconst token = selector__INTERNAL<T>(\n\t\t\t\t{\n\t\t\t\t\tkey: fullKey,\n\t\t\t\t\tget: options.get(key),\n\t\t\t\t\tset: options.set(key),\n\t\t\t\t},\n\t\t\t\tfamily,\n\t\t\t\tstore,\n\t\t\t)\n\t\t\tsubject.next(token)\n\t\t\treturn token\n\t\t},\n\t\t{\n\t\t\tkey: options.key,\n\t\t\ttype: `selector_family`,\n\t\t} as const,\n\t) as SelectorFamily<T, K>\n}\n","import type { Store } from \"..\"\nimport { target, lookup } from \"..\"\nimport type { AtomToken, ReadonlySelectorToken, SelectorToken } from \"../..\"\n\nexport const lookupSelectorSources = (\n\tkey: string,\n\tstore: Store,\n): (\n\t| AtomToken<unknown>\n\t| ReadonlySelectorToken<unknown>\n\t| SelectorToken<unknown>\n)[] =>\n\ttarget(store)\n\t\t.selectorGraph.getRelations(key)\n\t\t.filter(({ source }) => source !== key)\n\t\t.map(({ source }) => lookup(source, store))\n","import { lookupSelectorSources } from \"./lookup-selector-sources\"\nimport type { Store, AtomToken, ReadonlySelectorToken, StateToken } from \"../..\"\n\nexport const traceSelectorAtoms = (\n\tselectorKey: string,\n\tdependency: ReadonlySelectorToken<unknown> | StateToken<unknown>,\n\tstore: Store,\n): AtomToken<unknown>[] => {\n\tconst roots: AtomToken<unknown>[] = []\n\n\tconst sources = lookupSelectorSources(dependency.key, store)\n\tlet depth = 0\n\twhile (sources.length > 0) {\n\t\t// rome-ignore lint/style/noNonNullAssertion: just checked length ^^^\n\t\tconst source = sources.shift()!\n\t\t++depth\n\t\tif (depth > 999) {\n\t\t\tthrow new Error(\n\t\t\t\t`Maximum selector dependency depth exceeded in selector \"${selectorKey}\".`,\n\t\t\t)\n\t\t}\n\n\t\tif (source.type !== `atom`) {\n\t\t\tsources.push(...lookupSelectorSources(source.key, store))\n\t\t} else {\n\t\t\troots.push(source)\n\t\t}\n\t}\n\n\treturn roots\n}\n\nexport const traceAllSelectorAtoms = (\n\tselectorKey: string,\n\tstore: Store,\n): AtomToken<unknown>[] => {\n\tconst sources = lookupSelectorSources(selectorKey, store)\n\treturn sources.flatMap((source) =>\n\t\tsource.type === `atom`\n\t\t\t? source\n\t\t\t: traceSelectorAtoms(selectorKey, source, store),\n\t)\n}\n","import { become } from \"~/packages/anvl/src/function\"\n\nimport type { Atom, Selector, Store } from \".\"\nimport {\n\tIMPLICIT,\n\tcacheValue,\n\temitUpdate,\n\tevictCachedValue,\n\tgetState__INTERNAL,\n\tisAtomDefault,\n\tisDone,\n\tmarkAtomAsNotDefault,\n\tmarkDone,\n\tstowUpdate,\n\ttarget,\n} from \".\"\n\nexport const evictDownStream = <T>(\n\tstate: Atom<T>,\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst core = target(store)\n\tconst downstream = core.selectorAtoms.getRelations(state.key)\n\tconst downstreamKeys = downstream.map(({ id }) => id)\n\tstore.config.logger?.info(\n\t\t` || ${downstreamKeys.length} downstream:`,\n\t\tdownstreamKeys,\n\t)\n\tif (core.operation.open) {\n\t\tstore.config.logger?.info(` ||`, [...core.operation.done], `already done`)\n\t}\n\tdownstream.forEach(({ id: stateKey }) => {\n\t\tif (isDone(stateKey, store)) {\n\t\t\tstore.config.logger?.info(` || ${stateKey} already done`)\n\t\t\treturn\n\t\t}\n\t\tconst state =\n\t\t\tcore.selectors.get(stateKey) ?? core.readonlySelectors.get(stateKey)\n\t\tif (!state) {\n\t\t\tstore.config.logger?.info(\n\t\t\t\t` || ${stateKey} is an atom, and can't be downstream`,\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tevictCachedValue(stateKey, store)\n\t\tstore.config.logger?.info(` xx evicted \"${stateKey}\"`)\n\n\t\tmarkDone(stateKey, store)\n\t})\n}\n\nexport const setAtomState = <T>(\n\tatom: Atom<T>,\n\tnext: T | ((oldValue: T) => T),\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst oldValue = getState__INTERNAL(atom, store)\n\tconst newValue = become(next)(oldValue)\n\tstore.config.logger?.info(`<< setting atom \"${atom.key}\" to`, newValue)\n\tcacheValue(atom.key, newValue, store)\n\tif (isAtomDefault(atom.key, store)) {\n\t\tmarkAtomAsNotDefault(atom.key, store)\n\t}\n\tmarkDone(atom.key, store)\n\tstore.config.logger?.info(\n\t\t` || evicting caches downstream from \"${atom.key}\"`,\n\t)\n\tevictDownStream(atom, store)\n\tconst update = { oldValue, newValue }\n\tif (store.transactionStatus.phase !== `building`) {\n\t\temitUpdate(atom, update, store)\n\t} else {\n\t\tstowUpdate(atom, update, store)\n\t}\n}\nexport const setSelectorState = <T>(\n\tselector: Selector<T>,\n\tnext: T | ((oldValue: T) => T),\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tconst oldValue = getState__INTERNAL(selector, store)\n\tconst newValue = become(next)(oldValue)\n\n\tstore.config.logger?.info(`<< setting selector \"${selector.key}\" to`, newValue)\n\tstore.config.logger?.info(` || propagating change made to \"${selector.key}\"`)\n\n\tselector.set(newValue)\n}\nexport const setState__INTERNAL = <T>(\n\tstate: Atom<T> | Selector<T>,\n\tvalue: T | ((oldValue: T) => T),\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\tif (`set` in state) {\n\t\tsetSelectorState(state, value, store)\n\t} else {\n\t\tsetAtomState(state, value, store)\n\t}\n}\n","type Subscriber<T> = (value: T) => void\n\nexport class Subject<T> {\n\tpublic subscribers: Subscriber<T>[] = []\n\n\tpublic subscribe(subscriber: Subscriber<T>): { unsubscribe: () => void } {\n\t\tthis.subscribers.push(subscriber)\n\t\tconst unsubscribe = () => this.unsubscribe(subscriber)\n\t\treturn { unsubscribe }\n\t}\n\n\tprivate unsubscribe(subscriber: Subscriber<T>) {\n\t\tconst subscriberIndex = this.subscribers.indexOf(subscriber)\n\t\tif (subscriberIndex !== -1) {\n\t\t\tthis.subscribers.splice(subscriberIndex, 1)\n\t\t}\n\t}\n\n\tpublic next(value: T): void {\n\t\tfor (const subscriber of this.subscribers) {\n\t\t\tsubscriber(value)\n\t\t}\n\t}\n}\n","import type { Atom, ReadonlySelector, Selector, Store } from \".\"\nimport {\n\tgetState__INTERNAL,\n\twithdraw,\n\trecallState,\n\ttraceAllSelectorAtoms,\n} from \".\"\nimport type { StateUpdate } from \"..\"\n\nexport const prepareUpdate = <T>(\n\tstate: Atom<T> | ReadonlySelector<T> | Selector<T>,\n\tstore: Store,\n): StateUpdate<T> => {\n\tconst oldValue = recallState(state, store)\n\tconst newValue = getState__INTERNAL(state, store)\n\treturn { newValue, oldValue }\n}\n\nexport const stowUpdate = <T>(\n\tstate: Atom<T>,\n\tupdate: StateUpdate<T>,\n\tstore: Store,\n): void => {\n\tconst { key } = state\n\tconst { logger } = store.config\n\tif (store.transactionStatus.phase !== `building`) {\n\t\tstore.config.logger?.warn(\n\t\t\t`stowUpdate called outside of a transaction. This is probably a bug.`,\n\t\t)\n\t\treturn\n\t}\n\tstore.transactionStatus.atomUpdates.push({ key, ...update })\n\tlogger?.info(`📝 ${key} stowed (`, update.oldValue, `->`, update.newValue, `)`)\n}\n\nexport const emitUpdate = <T>(\n\tstate: Atom<T> | ReadonlySelector<T> | Selector<T>,\n\tupdate: StateUpdate<T>,\n\tstore: Store,\n): void => {\n\tconst { key } = state\n\tconst { logger } = store.config\n\tlogger?.info(\n\t\t`📢 ${state.type} \"${key}\" went (`,\n\t\tupdate.oldValue,\n\t\t`->`,\n\t\tupdate.newValue,\n\t\t`)`,\n\t)\n\tstate.subject.next(update)\n}\n\nexport const subscribeToRootAtoms = <T>(\n\tstate: ReadonlySelector<T> | Selector<T>,\n\tstore: Store,\n): { unsubscribe: () => void }[] | null => {\n\tconst dependencySubscriptions =\n\t\t`default` in state\n\t\t\t? null\n\t\t\t: traceAllSelectorAtoms(state.key, store).map((atomToken) => {\n\t\t\t\t\tconst atom = withdraw(atomToken, store)\n\t\t\t\t\tif (atom === null) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Atom \"${atomToken.key}\", a dependency of selector \"${state.key}\", not found in store \"${store.config.name}\".`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\treturn atom.subject.subscribe((atomChange) => {\n\t\t\t\t\t\tstore.config.logger?.info(\n\t\t\t\t\t\t\t`📢 selector \"${state.key}\" saw root \"${atomToken.key}\" go (`,\n\t\t\t\t\t\t\tatomChange.oldValue,\n\t\t\t\t\t\t\t`->`,\n\t\t\t\t\t\t\tatomChange.newValue,\n\t\t\t\t\t\t\t`)`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tconst oldValue = recallState(state, store)\n\t\t\t\t\t\tconst newValue = getState__INTERNAL(state, store)\n\t\t\t\t\t\tstore.config.logger?.info(\n\t\t\t\t\t\t\t` <- \"${state.key}\" went (`,\n\t\t\t\t\t\t\toldValue,\n\t\t\t\t\t\t\t`->`,\n\t\t\t\t\t\t\tnewValue,\n\t\t\t\t\t\t\t`)`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tstate.subject.next({ newValue, oldValue })\n\t\t\t\t\t})\n\t\t\t })\n\treturn dependencySubscriptions\n}\n","import type { Serializable } from \"~/packages/anvl/src/json\"\n\nimport type { AtomToken } from \".\"\nimport type { Subject } from \"./internal\"\nimport { atomFamily__INTERNAL, atom__INTERNAL } from \"./internal\"\n\nexport type Effectors<T> = {\n\tsetSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void\n\tonSet: (callback: (options: { newValue: T; oldValue: T }) => void) => void\n}\n\nexport type AtomEffect<T> = (tools: Effectors<T>) => void\n\nexport type AtomOptions<T> = {\n\tkey: string\n\tdefault: T | (() => T)\n\teffects?: AtomEffect<T>[]\n}\n\nexport function atom<T>(options: AtomOptions<T>): AtomToken<T> {\n\treturn atom__INTERNAL<T>(options)\n}\n\nexport type AtomFamilyOptions<T, K extends Serializable> = {\n\tkey: string\n\tdefault: T | ((key: K) => T)\n\teffects?: (key: K) => AtomEffect<T>[]\n}\n\nexport type AtomFamily<T, K extends Serializable = Serializable> = ((\n\tkey: K,\n) => AtomToken<T>) & {\n\tkey: string\n\ttype: `atom_family`\n\tsubject: Subject<AtomToken<T>>\n}\n\nexport function atomFamily<T, K extends Serializable>(\n\toptions: AtomFamilyOptions<T, K>,\n): AtomFamily<T, K> {\n\treturn atomFamily__INTERNAL<T, K>(options)\n}\n","import type { ƒn } from \"~/packages/anvl/src/function\"\n\nimport type {\n\tReadonlySelectorToken,\n\tStateToken,\n\tTimelineToken,\n\tTimelineUpdate,\n\tTransactionToken,\n\tTransactionUpdate,\n} from \".\"\nimport type { Store } from \"./internal\"\nimport { IMPLICIT, subscribeToRootAtoms, withdraw } from \"./internal\"\n\nexport type StateUpdate<T> = { newValue: T; oldValue: T }\nexport type KeyedStateUpdate<T> = StateUpdate<T> & { key: string }\nexport type UpdateHandler<T> = (update: StateUpdate<T>) => void\n\nexport const subscribe = <T>(\n\ttoken: ReadonlySelectorToken<T> | StateToken<T>,\n\thandleUpdate: UpdateHandler<T>,\n\tstore: Store = IMPLICIT.STORE,\n): (() => void) => {\n\tconst state = withdraw<T>(token, store)\n\tif (state === null) {\n\t\tthrow new Error(\n\t\t\t`State \"${token.key}\" not found in this store. Did you forget to initialize with the \"atom\" or \"selector\" function?`,\n\t\t)\n\t}\n\tconst subscription = state.subject.subscribe(handleUpdate)\n\tstore.config.logger?.info(`👀 subscribe to \"${state.key}\"`)\n\tconst dependencySubscriptions =\n\t\tstate.type !== `atom` ? subscribeToRootAtoms(state, store) : null\n\n\tconst unsubscribe =\n\t\tdependencySubscriptions === null\n\t\t\t? () => {\n\t\t\t\t\tstore.config.logger?.info(`🙈 unsubscribe from \"${state.key}\"`)\n\t\t\t\t\tsubscription.unsubscribe()\n\t\t\t }\n\t\t\t: () => {\n\t\t\t\t\tstore.config.logger?.info(\n\t\t\t\t\t\t`🙈 unsubscribe from \"${state.key}\" and its dependencies`,\n\t\t\t\t\t)\n\t\t\t\t\tsubscription.unsubscribe()\n\t\t\t\t\tfor (const dependencySubscription of dependencySubscriptions) {\n\t\t\t\t\t\tdependencySubscription.unsubscribe()\n\t\t\t\t\t}\n\t\t\t }\n\n\treturn unsubscribe\n}\n\nexport type TransactionUpdateHandler<ƒ extends ƒn> = (\n\tdata: TransactionUpdate<ƒ>,\n) => void\n\nexport const subscribeToTransaction = <ƒ extends ƒn>(\n\ttoken: TransactionToken<ƒ>,\n\thandleUpdate: TransactionUpdateHandler<ƒ>,\n\tstore = IMPLICIT.STORE,\n): (() => void) => {\n\tconst tx = withdraw(token, store)\n\tif (tx === null) {\n\t\tthrow new Error(\n\t\t\t`Cannot subscribe to transaction \"${token.key}\": transaction not found in store \"${store.config.name}\".`,\n\t\t)\n\t}\n\tstore.config.logger?.info(`👀 subscribe to transaction \"${token.key}\"`)\n\tconst subscription = tx.subject.subscribe(handleUpdate)\n\tconst unsubscribe = () => {\n\t\tstore.config.logger?.info(`🙈 unsubscribe from transaction \"${token.key}\"`)\n\t\tsubscription.unsubscribe()\n\t}\n\treturn unsubscribe\n}\n\nexport const subscribeToTimeline = (\n\ttoken: TimelineToken,\n\thandleUpdate: (update: TimelineUpdate) => void,\n\tstore = IMPLICIT.STORE,\n): (() => void) => {\n\tconst tl = withdraw(token, store)\n\tif (tl === null) {\n\t\tthrow new Error(\n\t\t\t`Cannot subscribe to timeline \"${token.key}\": timeline not found in store \"${store.config.name}\".`,\n\t\t)\n\t}\n\tstore.config.logger?.info(`👀 subscribe to timeline \"${token.key}\"`)\n\tconst subscription = tl.subject.subscribe(handleUpdate)\n\tconst unsubscribe = () => {\n\t\tstore.config.logger?.info(`🙈 unsubscribe from timeline \"${token.key}\"`)\n\t\tsubscription.unsubscribe()\n\t}\n\treturn unsubscribe\n}\n","import { capitalize } from \"~/packages/anvl/src/string/capitalize\"\n\nimport {\n\tIMPLICIT,\n\tcloseOperation,\n\topenOperation,\n\tgetState__INTERNAL,\n\tsetState__INTERNAL,\n\tisAtomDefault,\n\tisSelectorDefault,\n\twithdraw,\n} from \"./internal\"\nimport * as __INTERNAL__ from \"./internal\"\nimport type { Store } from \"./internal/store\"\n\nexport * from \"./atom\"\nexport * from \"./logger\"\nexport * from \"./selector\"\nexport * from \"./silo\"\nexport * from \"./subscribe\"\nexport * from \"./timeline\"\nexport * from \"./transaction\"\nexport { __INTERNAL__ }\nexport type { Store } from \"./internal/store\"\nexport type { Serializable } from \"~/packages/anvl/src/json\"\n\nexport type AtomToken<_> = {\n\tkey: string\n\ttype: `atom`\n\tfamily?: FamilyMetadata\n\t__brand?: _\n}\nexport type SelectorToken<_> = {\n\tkey: string\n\ttype: `selector`\n\tfamily?: FamilyMetadata\n\t__brand?: _\n}\nexport type StateToken<T> = AtomToken<T> | SelectorToken<T>\n\nexport type ReadonlySelectorToken<_> = {\n\tkey: string\n\ttype: `readonly_selector`\n\tfamily?: FamilyMetadata\n\t__brand?: _\n}\n\nexport type FamilyMetadata = {\n\tkey: string\n\tsubKey: string\n}\n\nexport const getState = <T>(\n\ttoken: ReadonlySelectorToken<T> | StateToken<T>,\n\tstore: Store = IMPLICIT.STORE,\n): T => {\n\tconst state = withdraw<T>(token, store)\n\tif (state === null) {\n\t\tthrow new Error(\n\t\t\t`${capitalize(token.type)} \"${token.key}\" not found in store \"${\n\t\t\t\tstore.config.name\n\t\t\t}\".`,\n\t\t)\n\t}\n\treturn getState__INTERNAL(state, store)\n}\n\nexport const setState = <T, New extends T>(\n\ttoken: StateToken<T>,\n\tvalue: New | ((oldValue: T) => New),\n\tstore: Store = IMPLICIT.STORE,\n): void => {\n\ttry {\n\t\topenOperation(token, store)\n\t} catch (thrown) {\n\t\tif (!(typeof thrown === `symbol`)) {\n\t\t\tthrow thrown\n\t\t}\n\t\treturn\n\t}\n\tconst state = withdraw(token, store)\n\tif (state === null) {\n\t\tthrow new Error(\n\t\t\t`${capitalize(token.type)} \"${token.key}\" not found in store \"${\n\t\t\t\tstore.config.name\n\t\t\t}\".`,\n\t\t)\n\t}\n\tsetState__INTERNAL(state, value, store)\n\tcloseOperation(store)\n}\n\nexport const isDefault = (\n\ttoken: ReadonlySelectorToken<unknown> | StateToken<unknown>,\n\tstore: Store = IMPLICIT.STORE,\n): boolean =>\n\ttoken.type === `atom`\n\t\t? isAtomDefault(token.key, store)\n\t\t: isSelectorDefault(token.key, store)\n","import { __INTERNAL__ } from \"atom.io\"\nimport type {\n\tReadonlySelectorFamily,\n\tReadonlySelectorToken,\n\tTimelineToken,\n\tTimelineUpdate,\n\tTransactionToken,\n\tTransactionUpdate,\n} from \"atom.io\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\n\nimport { attachAtomIndex, type AtomTokenIndex } from \"./attach-atom-index\"\nimport {\n\tattachSelectorIndex,\n\ttype SelectorTokenIndex,\n} from \"./attach-selector-index\"\nimport { attachTimelineFamily } from \"./attach-timeline-family\"\nimport { attachTimelineIndex } from \"./attach-timeline-index\"\nimport { attachTransactionIndex } from \"./attach-transaction-index\"\nimport { attachTransactionLogs } from \"./attach-transaction-logs\"\nimport type { Timeline } from \"../internal\"\n\nexport const attachIntrospectionStates = (\n\tstore: __INTERNAL__.Store = __INTERNAL__.IMPLICIT.STORE,\n): {\n\tatomIndex: ReadonlySelectorToken<AtomTokenIndex>\n\tselectorIndex: ReadonlySelectorToken<SelectorTokenIndex>\n\ttransactionIndex: ReadonlySelectorToken<TransactionToken<ƒn>[]>\n\tfindTransactionLogState: ReadonlySelectorFamily<TransactionUpdate<ƒn>[]>\n\ttimelineIndex: ReadonlySelectorToken<TimelineToken[]>\n\tfindTimelineState: ReadonlySelectorFamily<Timeline>\n} => {\n\treturn {\n\t\tatomIndex: attachAtomIndex(store),\n\t\tselectorIndex: attachSelectorIndex(store),\n\t\ttransactionIndex: attachTransactionIndex(store),\n\t\tfindTransactionLogState: attachTransactionLogs(store),\n\t\ttimelineIndex: attachTimelineIndex(store),\n\t\tfindTimelineState: attachTimelineFamily(store),\n\t}\n}\n","import type { AtomToken, ReadonlySelectorToken } from \"atom.io\"\nimport { __INTERNAL__ } from \"atom.io\"\n\nimport type { StateTokenIndex } from \".\"\n\nexport type AtomTokenIndex = StateTokenIndex<AtomToken<unknown>>\n\nexport const attachAtomIndex = (\n\tstore: __INTERNAL__.Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorToken<AtomTokenIndex> => {\n\tconst atomTokenIndexState__INTERNAL =\n\t\t__INTERNAL__.atom__INTERNAL<AtomTokenIndex>(\n\t\t\t{\n\t\t\t\tkey: `👁‍🗨 Atom Token Index (Internal)`,\n\t\t\t\tdefault: () =>\n\t\t\t\t\t[...store.atoms]\n\t\t\t\t\t\t.filter(([key]) => !key.includes(`👁‍🗨`))\n\t\t\t\t\t\t.reduce<AtomTokenIndex>((acc, [key]) => {\n\t\t\t\t\t\t\tacc[key] = { key, type: `atom` }\n\t\t\t\t\t\t\treturn acc\n\t\t\t\t\t\t}, {}),\n\t\t\t\teffects: [\n\t\t\t\t\t({ setSelf }) => {\n\t\t\t\t\t\tstore.subject.atomCreation.subscribe((atomToken) => {\n\t\t\t\t\t\t\tif (store.operation.open) {\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 (atomToken.key.includes(`👁‍🗨`)) {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetSelf((state) => {\n\t\t\t\t\t\t\t\tconst { key, family } = atomToken\n\t\t\t\t\t\t\t\tif (family) {\n\t\t\t\t\t\t\t\t\tconst { key: familyKey, subKey } = family\n\t\t\t\t\t\t\t\t\tconst current = state[familyKey]\n\t\t\t\t\t\t\t\t\tif (current === undefined || `familyMembers` in current) {\n\t\t\t\t\t\t\t\t\t\tconst familyKeyState = current || {\n\t\t\t\t\t\t\t\t\t\t\tkey: familyKey,\n\t\t\t\t\t\t\t\t\t\t\tfamilyMembers: {},\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t\t\t[familyKey]: {\n\t\t\t\t\t\t\t\t\t\t\t\t...familyKeyState,\n\t\t\t\t\t\t\t\t\t\t\t\tfamilyMembers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t...familyKeyState.familyMembers,\n\t\t\t\t\t\t\t\t\t\t\t\t\t[subKey]: atomToken,\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\treturn {\n\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t[key]: atomToken,\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\tundefined,\n\t\t\tstore,\n\t\t)\n\treturn __INTERNAL__.selector__INTERNAL(\n\t\t{\n\t\t\tkey: `👁‍🗨 Atom Token Index`,\n\t\t\tget: ({ get }) => get(atomTokenIndexState__INTERNAL),\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n}\n","import { __INTERNAL__ } from \"atom.io\"\nimport type { ReadonlySelectorToken, SelectorToken } from \"atom.io\"\n\nimport type { StateTokenIndex } from \".\"\n\nexport type SelectorTokenIndex = StateTokenIndex<\n\tReadonlySelectorToken<unknown> | SelectorToken<unknown>\n>\n\nexport const attachSelectorIndex = (\n\tstore: __INTERNAL__.Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorToken<SelectorTokenIndex> => {\n\tconst readonlySelectorTokenIndexState__INTERNAL =\n\t\t__INTERNAL__.atom__INTERNAL<SelectorTokenIndex>(\n\t\t\t{\n\t\t\t\tkey: `👁‍🗨 Selector Token Index (Internal)`,\n\t\t\t\tdefault: () =>\n\t\t\t\t\tObject.assign(\n\t\t\t\t\t\t[...store.readonlySelectors]\n\t\t\t\t\t\t\t.filter(([key]) => !key.includes(`👁‍🗨`))\n\t\t\t\t\t\t\t.reduce<SelectorTokenIndex>((acc, [key]) => {\n\t\t\t\t\t\t\t\tacc[key] = { key, type: `readonly_selector` }\n\t\t\t\t\t\t\t\treturn acc\n\t\t\t\t\t\t\t}, {}),\n\t\t\t\t\t\t[...store.selectors].reduce<SelectorTokenIndex>((acc, [key]) => {\n\t\t\t\t\t\t\tacc[key] = { key, type: `selector` }\n\t\t\t\t\t\t\treturn acc\n\t\t\t\t\t\t}, {}),\n\t\t\t\t\t),\n\t\t\t\teffects: [\n\t\t\t\t\t({ setSelf }) => {\n\t\t\t\t\t\tstore.subject.selectorCreation.subscribe((selectorToken) => {\n\t\t\t\t\t\t\tif (store.operation.open) {\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 (selectorToken.key.includes(`👁‍🗨`)) {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetSelf((state) => {\n\t\t\t\t\t\t\t\tconst { key, family } = selectorToken\n\t\t\t\t\t\t\t\tif (family) {\n\t\t\t\t\t\t\t\t\tconst { key: familyKey, subKey } = family\n\t\t\t\t\t\t\t\t\tconst current = state[familyKey]\n\t\t\t\t\t\t\t\t\tif (current === undefined || `familyMembers` in current) {\n\t\t\t\t\t\t\t\t\t\tconst familyKeyState = current || {\n\t\t\t\t\t\t\t\t\t\t\tkey: familyKey,\n\t\t\t\t\t\t\t\t\t\t\tfamilyMembers: {},\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t\t\t[familyKey]: {\n\t\t\t\t\t\t\t\t\t\t\t\t...familyKeyState,\n\t\t\t\t\t\t\t\t\t\t\t\tfamilyMembers: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t...familyKeyState.familyMembers,\n\t\t\t\t\t\t\t\t\t\t\t\t\t[subKey]: selectorToken,\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\treturn {\n\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t[key]: selectorToken,\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\tundefined,\n\t\t\tstore,\n\t\t)\n\treturn __INTERNAL__.selector__INTERNAL({\n\t\tkey: `👁‍🗨 Selector Token Index`,\n\t\tget: ({ get }) => get(readonlySelectorTokenIndexState__INTERNAL),\n\t})\n}\n","import type { ReadonlySelectorFamily, Store } from \"atom.io\"\nimport { __INTERNAL__, timeline } from \"atom.io\"\n\nimport { withdraw, type Timeline, Subject } from \"../internal\"\n\nexport const attachTimelineFamily = (\n\tstore: Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorFamily<Timeline> => {\n\tconst findTimelineLogState__INTERNAL = __INTERNAL__.atomFamily__INTERNAL<\n\t\tTimeline,\n\t\tstring\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Timeline Update Log (Internal)`,\n\t\t\tdefault: (key) =>\n\t\t\t\tstore.timelines.get(key) ?? {\n\t\t\t\t\tkey: ``,\n\t\t\t\t\tat: 0,\n\t\t\t\t\ttimeTraveling: false,\n\t\t\t\t\thistory: [],\n\t\t\t\t\tselectorTime: null,\n\t\t\t\t\ttransactionKey: null,\n\t\t\t\t\tinstall: () => {},\n\t\t\t\t\tsubject: new Subject(),\n\t\t\t\t},\n\t\t\teffects: (key) => [\n\t\t\t\t({ setSelf }) => {\n\t\t\t\t\tconst tl = store.timelines.get(key)\n\t\t\t\t\ttl?.subject.subscribe((_) => {\n\t\t\t\t\t\tif (store.operation.open === true) {\n\t\t\t\t\t\t\tconst subscription = store.subject.operationStatus.subscribe(\n\t\t\t\t\t\t\t\t(operationStatus) => {\n\t\t\t\t\t\t\t\t\tif (operationStatus.open === false) {\n\t\t\t\t\t\t\t\t\t\tsubscription.unsubscribe()\n\t\t\t\t\t\t\t\t\t\tsetSelf({ ...tl })\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} else {\n\t\t\t\t\t\t\tsetSelf({ ...tl })\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\tstore,\n\t)\n\tconst findTimelineLogState = __INTERNAL__.selectorFamily__INTERNAL<\n\t\tTimeline,\n\t\tstring\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Timeline Update Log`,\n\t\t\tget: (key) => ({ get }) => get(findTimelineLogState__INTERNAL(key)),\n\t\t},\n\t\tstore,\n\t)\n\treturn findTimelineLogState\n}\n","import type { ReadonlySelectorToken, Store, TimelineToken } from \"atom.io\"\nimport { __INTERNAL__ } from \"atom.io\"\n\nexport const attachTimelineIndex = (\n\tstore: Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorToken<TimelineToken[]> => {\n\tconst timelineTokenIndexState__INTERNAL = __INTERNAL__.atom__INTERNAL<\n\t\tTimelineToken[]\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Timeline Token Index (Internal)`,\n\t\t\tdefault: () =>\n\t\t\t\t[...store.timelines].map(([key]) => {\n\t\t\t\t\treturn { key, type: `timeline` }\n\t\t\t\t}),\n\t\t\teffects: [\n\t\t\t\t({ setSelf }) => {\n\t\t\t\t\tstore.subject.timelineCreation.subscribe((timelineToken) => {\n\t\t\t\t\t\tsetSelf((state) => [...state, timelineToken])\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\tconst timelineTokenIndex = __INTERNAL__.selector__INTERNAL(\n\t\t{\n\t\t\tkey: `👁‍🗨 Timeline Token Index`,\n\t\t\tget: ({ get }) => get(timelineTokenIndexState__INTERNAL),\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\treturn timelineTokenIndex\n}\n","import type { ReadonlySelectorToken, TransactionToken } from \"atom.io\"\nimport { __INTERNAL__ } from \"atom.io\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\n\nexport const attachTransactionIndex = (\n\tstore: __INTERNAL__.Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorToken<TransactionToken<ƒn>[]> => {\n\tconst transactionTokenIndexState__INTERNAL = __INTERNAL__.atom__INTERNAL<\n\t\tTransactionToken<ƒn>[]\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Transaction Token Index (Internal)`,\n\t\t\tdefault: () =>\n\t\t\t\t[...store.transactions].map(([key]) => {\n\t\t\t\t\treturn { key, type: `transaction` }\n\t\t\t\t}),\n\t\t\teffects: [\n\t\t\t\t({ setSelf }) => {\n\t\t\t\t\tstore.subject.transactionCreation.subscribe((transactionToken) => {\n\t\t\t\t\t\tsetSelf((state) => [...state, transactionToken])\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\tconst transactionTokenIndex = __INTERNAL__.selector__INTERNAL(\n\t\t{\n\t\t\tkey: `👁‍🗨 Transaction Token Index`,\n\t\t\tget: ({ get }) => get(transactionTokenIndexState__INTERNAL),\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\treturn transactionTokenIndex\n}\n","import type { ReadonlySelectorFamily, TransactionUpdate } from \"atom.io\"\nimport { __INTERNAL__ } from \"atom.io\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\n\nexport const attachTransactionLogs = (\n\tstore: __INTERNAL__.Store = __INTERNAL__.IMPLICIT.STORE,\n): ReadonlySelectorFamily<TransactionUpdate<ƒn>[]> => {\n\tconst findTransactionUpdateLog = __INTERNAL__.atomFamily__INTERNAL<\n\t\tTransactionUpdate<ƒn>[],\n\t\tstring\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Transaction Update Log (Internal)`,\n\t\t\tdefault: () => [],\n\t\t\teffects: (key) => [\n\t\t\t\t({ setSelf }) => {\n\t\t\t\t\tconst tx = store.transactions.get(key)\n\t\t\t\t\ttx?.subject.subscribe((transactionUpdate) => {\n\t\t\t\t\t\tif (transactionUpdate.key === key) {\n\t\t\t\t\t\t\tsetSelf((state) => [...state, transactionUpdate])\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\tstore,\n\t)\n\tconst findTransactionUpdateLogState = __INTERNAL__.selectorFamily__INTERNAL<\n\t\tTransactionUpdate<ƒn>[],\n\t\tstring\n\t>(\n\t\t{\n\t\t\tkey: `👁‍🗨 Transaction Update Log`,\n\t\t\tget: (key) => ({ get }) => get(findTransactionUpdateLog(key)),\n\t\t},\n\t\tstore,\n\t)\n\treturn findTransactionUpdateLogState\n}\n","import type { Json } from \"~/packages/anvl/src/json\"\n\nimport type { AtomEffect } from \"../index\"\n\nexport type StringInterface<T> = {\n\tstringify: (t: T) => string\n\tparse: (s: string) => T\n}\n\nexport const persistAtom =\n\t<T>(storage: Storage) =>\n\t({ stringify, parse }: StringInterface<T>) =>\n\t(key: string): AtomEffect<T> =>\n\t({ setSelf, onSet }) => {\n\t\tconst savedValue = storage.getItem(key)\n\n\t\tif (savedValue != null) setSelf(parse(savedValue))\n\n\t\tonSet(({ newValue }) => {\n\t\t\tif (newValue == null) {\n\t\t\t\tstorage.removeItem(key)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tstorage.setItem(key, stringify(newValue))\n\t\t})\n\t}\n\nexport const lazyLocalStorageEffect: <J extends Json>(\n\tkey: string,\n) => AtomEffect<J> = persistAtom(localStorage)(JSON)\n","import { useO, useIO } from \"atom.io/react\"\nimport { LayoutGroup, motion, spring } from \"framer-motion\"\nimport { useRef } from \"react\"\n\nimport {\n\tatomIndex,\n\tdevtoolsAreOpenState,\n\tdevtoolsViewOptionsState,\n\tdevtoolsViewSelectionState,\n\tselectorIndex,\n} from \".\"\nimport { StateIndex } from \"./StateIndex\"\nimport { TimelineIndex } from \"./TimelineIndex\"\nimport { TransactionIndex } from \"./TransactionIndex\"\n\nimport \"./devtools.scss\"\n\nexport const AtomIODevtools = (): JSX.Element => {\n\tconst constraintsRef = useRef(null)\n\n\tconst [devtoolsAreOpen, setDevtoolsAreOpen] = useIO(devtoolsAreOpenState)\n\tconst [devtoolsView, setDevtoolsView] = useIO(devtoolsViewSelectionState)\n\tconst devtoolsViewOptions = useO(devtoolsViewOptionsState)\n\n\tconst mouseHasMoved = useRef(false)\n\n\treturn (\n\t\t<>\n\t\t\t<motion.span\n\t\t\t\tref={constraintsRef}\n\t\t\t\tclassName=\"atom_io_devtools_zone\"\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: `fixed`,\n\t\t\t\t\ttop: 0,\n\t\t\t\t\tleft: 0,\n\t\t\t\t\tright: 0,\n\t\t\t\t\tbottom: 0,\n\t\t\t\t\tpointerEvents: `none`,\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<motion.main\n\t\t\t\tdrag\n\t\t\t\tdragConstraints={constraintsRef}\n\t\t\t\tclassName=\"atom_io_devtools\"\n\t\t\t\ttransition={spring}\n\t\t\t\tstyle={\n\t\t\t\t\tdevtoolsAreOpen\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tbackgroundColor: `#0000`,\n\t\t\t\t\t\t\t\tborderColor: `#0000`,\n\t\t\t\t\t\t\t\tmaxHeight: 28,\n\t\t\t\t\t\t\t\tmaxWidth: 33,\n\t\t\t\t\t\t }\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{devtoolsAreOpen ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<motion.header>\n\t\t\t\t\t\t\t<h1>atom.io</h1>\n\t\t\t\t\t\t\t<nav>\n\t\t\t\t\t\t\t\t{devtoolsViewOptions.map((viewOption) => (\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\tkey={viewOption}\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tclassName={viewOption === devtoolsView ? `active` : ``}\n\t\t\t\t\t\t\t\t\t\tonClick={() => setDevtoolsView(viewOption)}\n\t\t\t\t\t\t\t\t\t\tdisabled={viewOption === devtoolsView}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{viewOption}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</nav>\n\t\t\t\t\t\t</motion.header>\n\t\t\t\t\t\t<motion.main>\n\t\t\t\t\t\t\t<LayoutGroup>\n\t\t\t\t\t\t\t\t{devtoolsView === `atoms` ? (\n\t\t\t\t\t\t\t\t\t<StateIndex tokenIndex={atomIndex} />\n\t\t\t\t\t\t\t\t) : devtoolsView === `selectors` ? (\n\t\t\t\t\t\t\t\t\t<StateIndex tokenIndex={selectorIndex} />\n\t\t\t\t\t\t\t\t) : devtoolsView === `transactions` ? (\n\t\t\t\t\t\t\t\t\t<TransactionIndex />\n\t\t\t\t\t\t\t\t) : devtoolsView === `timelines` ? (\n\t\t\t\t\t\t\t\t\t<TimelineIndex />\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t</LayoutGroup>\n\t\t\t\t\t\t</motion.main>\n\t\t\t\t\t</>\n\t\t\t\t) : null}\n\t\t\t\t<footer>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonMouseDown={() => (mouseHasMoved.current = false)}\n\t\t\t\t\t\tonMouseMove={() => (mouseHasMoved.current = true)}\n\t\t\t\t\t\tonMouseUp={() => {\n\t\t\t\t\t\t\tif (!mouseHasMoved.current) {\n\t\t\t\t\t\t\t\tsetDevtoolsAreOpen((open) => !open)\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\t👁‍🗨\n\t\t\t\t\t</button>\n\t\t\t\t</footer>\n\t\t\t</motion.main>\n\t\t</>\n\t)\n}\n","import type { AtomToken, ReadonlySelectorToken, SelectorToken } from \"atom.io\"\nimport { getState, selectorFamily } from \"atom.io\"\nimport { useO, useIO } from \"atom.io/react\"\nimport type { FC } from \"react\"\n\nimport { isJson, refineJsonType } from \"~/packages/anvl/src/json\"\n\nimport { findViewIsOpenState, primitiveRefinery } from \".\"\nimport { button } from \"./Button\"\nimport { StoreEditor } from \"./StateEditor\"\nimport type { FamilyNode, StateTokenIndex } from \"../introspection\"\n\nconst findStateTypeState = selectorFamily<string, { key: string }>({\n\tkey: `👁‍🗨 State Type`,\n\tget: (token) => ({ get }) => {\n\t\tlet state: unknown\n\t\ttry {\n\t\t\tstate = get(token as any)\n\t\t} catch (error) {\n\t\t\treturn `error`\n\t\t}\n\t\tif (state === undefined) return `undefined`\n\t\tif (isJson(state)) return refineJsonType(state).type\n\t\treturn Object.getPrototypeOf(state).constructor.name\n\t},\n})\n\nexport const StateIndexLeafNode: FC<{\n\tnode:\n\t\t| AtomToken<unknown>\n\t\t| ReadonlySelectorToken<unknown>\n\t\t| SelectorToken<unknown>\n\tisOpenState: AtomToken<boolean>\n\ttypeState: ReadonlySelectorToken<string>\n}> = ({ node, isOpenState, typeState }) => {\n\tconst [isOpen, setIsOpen] = useIO(isOpenState)\n\tconst state = useO(node)\n\tconst stateType = useO(typeState)\n\n\tconst isPrimitive = Boolean(primitiveRefinery.refine(state))\n\n\treturn (\n\t\t<>\n\t\t\t<header>\n\t\t\t\t<button.OpenClose\n\t\t\t\t\tisOpen={isOpen && !isPrimitive}\n\t\t\t\t\tsetIsOpen={setIsOpen}\n\t\t\t\t\tdisabled={isPrimitive}\n\t\t\t\t/>\n\t\t\t\t<label\n\t\t\t\t\tonClick={() => console.log(node, getState(node))}\n\t\t\t\t\tonKeyUp={() => console.log(node, getState(node))}\n\t\t\t\t>\n\t\t\t\t\t<h2>{node.family?.subKey ?? node.key}</h2>\n\t\t\t\t\t<span className=\"type detail\">({stateType})</span>\n\t\t\t\t</label>\n\t\t\t\t{isPrimitive ? <StoreEditor token={node} /> : null}\n\t\t\t</header>\n\t\t\t{isOpen && !isPrimitive ? (\n\t\t\t\t<main>\n\t\t\t\t\t<StoreEditor token={node} />\n\t\t\t\t</main>\n\t\t\t) : null}\n\t\t</>\n\t)\n}\nexport const StateIndexTreeNode: FC<{\n\tnode: FamilyNode<\n\t\tAtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>\n\t>\n\tisOpenState: AtomToken<boolean>\n}> = ({ node, isOpenState }) => {\n\tconst [isOpen, setIsOpen] = useIO(isOpenState)\n\tObject.entries(node.familyMembers).forEach(([key, childNode]) => {\n\t\tfindViewIsOpenState(key)\n\t\tfindStateTypeState(childNode)\n\t})\n\treturn (\n\t\t<>\n\t\t\t<header>\n\t\t\t\t<button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />\n\t\t\t\t<label>\n\t\t\t\t\t<h2>{node.key}</h2>\n\t\t\t\t\t<span className=\"type detail\"> (family)</span>\n\t\t\t\t</label>\n\t\t\t</header>\n\t\t\t{isOpen\n\t\t\t\t? Object.entries(node.familyMembers).map(([key, childNode]) => (\n\t\t\t\t\t\t<StateIndexNode\n\t\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\t\tnode={childNode}\n\t\t\t\t\t\t\tisOpenState={findViewIsOpenState(childNode.key)}\n\t\t\t\t\t\t\ttypeState={findStateTypeState(childNode)}\n\t\t\t\t\t\t/>\n\t\t\t\t ))\n\t\t\t\t: null}\n\t\t</>\n\t)\n}\n\nexport const StateIndexNode: FC<{\n\tnode: StateTokenIndex<\n\t\tAtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>\n\t>[string]\n\tisOpenState: AtomToken<boolean>\n\ttypeState: ReadonlySelectorToken<string>\n}> = ({ node, isOpenState, typeState }) => {\n\tif (node.key.startsWith(`👁‍🗨`)) {\n\t\treturn null\n\t}\n\treturn (\n\t\t<section className=\"node state\">\n\t\t\t{`type` in node ? (\n\t\t\t\t<StateIndexLeafNode\n\t\t\t\t\tnode={node}\n\t\t\t\t\tisOpenState={isOpenState}\n\t\t\t\t\ttypeState={typeState}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<StateIndexTreeNode node={node} isOpenState={isOpenState} />\n\t\t\t)}\n\t\t</section>\n\t)\n}\n\nexport const StateIndex: FC<{\n\ttokenIndex: ReadonlySelectorToken<\n\t\tStateTokenIndex<\n\t\t\t| AtomToken<unknown>\n\t\t\t| ReadonlySelectorToken<unknown>\n\t\t\t| SelectorToken<unknown>\n\t\t>\n\t>\n}> = ({ tokenIndex }) => {\n\tconst tokenIds = useO(tokenIndex)\n\treturn (\n\t\t<article className=\"index state_index\">\n\t\t\t{Object.entries(tokenIds)\n\t\t\t\t.filter(([key]) => !key.startsWith(`👁‍🗨`))\n\t\t\t\t.sort()\n\t\t\t\t.map(([key, node]) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<StateIndexNode\n\t\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\t\tnode={node}\n\t\t\t\t\t\t\tisOpenState={findViewIsOpenState(node.key)}\n\t\t\t\t\t\t\ttypeState={findStateTypeState(node)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t</article>\n\t)\n}\n","import type { FC } from \"react\"\n\nimport type { Modifier } from \"~/packages/anvl/src/function\"\n\nexport const OpenClose: FC<{\n\tisOpen: boolean\n\tsetIsOpen: (next: Modifier<boolean> | boolean) => void\n\tdisabled?: boolean\n}> = ({ isOpen, setIsOpen, disabled }) => {\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={`carat ${isOpen ? `open` : `closed`}`}\n\t\t\tonClick={() => setIsOpen((isOpen) => !isOpen)}\n\t\t\tdisabled={disabled}\n\t\t>\n\t\t\t▶\n\t\t</button>\n\t)\n}\n\nexport const button = {\n\tOpenClose,\n}\n","import type { ReadonlySelectorToken, StateToken } from \"atom.io\"\nimport { useO, useIO } from \"atom.io/react\"\nimport type { FC } from \"react\"\n\nimport { fallback } from \"~/packages/anvl/src/function\"\nimport { isJson } from \"~/packages/anvl/src/json\"\nimport { ElasticInput } from \"~/packages/hamr/src/react-elastic-input\"\nimport { JsonEditor } from \"~/packages/hamr/src/react-json-editor\"\n\nexport const StateEditor: FC<{\n\ttoken: StateToken<unknown>\n}> = ({ token }) => {\n\tconst [data, set] = useIO(token)\n\treturn isJson(data) ? (\n\t\t<JsonEditor data={data} set={set} schema={true} />\n\t) : (\n\t\t<div className=\"json_editor\">\n\t\t\t<ElasticInput\n\t\t\t\tvalue={\n\t\t\t\t\tdata instanceof Set\n\t\t\t\t\t\t? `Set { ${JSON.stringify([...data]).slice(1, -1)} }`\n\t\t\t\t\t\t: data instanceof Map\n\t\t\t\t\t\t? `Map ` + JSON.stringify([...data])\n\t\t\t\t\t\t: Object.getPrototypeOf(data).constructor.name +\n\t\t\t\t\t\t ` ` +\n\t\t\t\t\t\t fallback(() => JSON.stringify(data), `?`)\n\t\t\t\t}\n\t\t\t\tdisabled={true}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\nexport const ReadonlySelectorViewer: FC<{\n\ttoken: ReadonlySelectorToken<unknown>\n}> = ({ token }) => {\n\tconst data = useO(token)\n\treturn isJson(data) ? (\n\t\t<JsonEditor\n\t\t\tdata={data}\n\t\t\tset={() => null}\n\t\t\tschema={true}\n\t\t\tisReadonly={() => true}\n\t\t/>\n\t) : (\n\t\t<div className=\"json_editor\">\n\t\t\t<ElasticInput\n\t\t\t\tvalue={\n\t\t\t\t\tdata instanceof Set\n\t\t\t\t\t\t? `Set ` + JSON.stringify([...data])\n\t\t\t\t\t\t: data instanceof Map\n\t\t\t\t\t\t? `Map ` + JSON.stringify([...data])\n\t\t\t\t\t\t: Object.getPrototypeOf(data).constructor.name +\n\t\t\t\t\t\t ` ` +\n\t\t\t\t\t\t JSON.stringify(data)\n\t\t\t\t}\n\t\t\t\tdisabled={true}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\nexport const StoreEditor: FC<{\n\ttoken: ReadonlySelectorToken<unknown> | StateToken<unknown>\n}> = ({ token }) => {\n\tif (token.type === `readonly_selector`) {\n\t\treturn <ReadonlySelectorViewer token={token} />\n\t}\n\treturn <StateEditor token={token} />\n}\n","import type { DetailedHTMLProps, InputHTMLAttributes } from \"react\"\nimport {\n\tuseLayoutEffect,\n\tuseImperativeHandle,\n\tforwardRef,\n\tuseRef,\n\tuseState,\n} from \"react\"\n\nexport const ElasticInput = forwardRef<\n\tHTMLInputElement,\n\tDetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {\n\t\twidthPadding?: number\n\t}\n>(function ElasticInputFC(props, ref) {\n\tconst inputRef = useRef<HTMLInputElement>(null)\n\tconst spanRef = useRef<HTMLSpanElement>(null)\n\tconst [inputWidth, setInputWidth] = useState(`auto`)\n\n\tuseImperativeHandle<\n\t\tPartial<HTMLInputElement>,\n\t\tPartial<HTMLInputElement>\n\t>(ref, () => ({\n\t\tfocus: () => {\n\t\t\tinputRef.current?.focus()\n\t\t},\n\t}))\n\n\tconst extraWidth = props.type === `number` ? 15 : 0\n\n\tuseLayoutEffect(() => {\n\t\tif (spanRef.current) {\n\t\t\tsetInputWidth(`${spanRef.current.offsetWidth + extraWidth}px`)\n\t\t\tconst interval = setInterval(() => {\n\t\t\t\tif (spanRef.current) {\n\t\t\t\t\tsetInputWidth(`${spanRef.current.offsetWidth + extraWidth}px`)\n\t\t\t\t}\n\t\t\t}, 1000)\n\t\t\treturn () => clearInterval(interval)\n\t\t}\n\t}, [inputRef.current?.value, props.value])\n\n\treturn (\n\t\t<div style={{ display: `inline-block`, position: `relative` }}>\n\t\t\t<input\n\t\t\t\t{...props}\n\t\t\t\tref={inputRef}\n\t\t\t\tstyle={{\n\t\t\t\t\tpadding: 0,\n\t\t\t\t\tborderRadius: 0,\n\t\t\t\t\tborder: `none`,\n\t\t\t\t\tfontFamily: `inherit`,\n\t\t\t\t\tfontSize: `inherit`,\n\t\t\t\t\twidth: inputWidth,\n\t\t\t\t\t...props.style,\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<span\n\t\t\t\tref={spanRef}\n\t\t\t\tstyle={{\n\t\t\t\t\tpadding: props.style?.padding,\n\t\t\t\t\tposition: `absolute`,\n\t\t\t\t\tvisibility: `hidden`,\n\t\t\t\t\t// color: `red`,\n\t\t\t\t\twhiteSpace: `pre`,\n\t\t\t\t\tfontFamily: props.style?.fontFamily || `inherit`,\n\t\t\t\t\tfontSize: props.style?.fontSize || `inherit`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{props.value}\n\t\t\t</span>\n\t\t</div>\n\t)\n})\n","import type { SerializedStyles } from \"@emotion/react\"\nimport { pipe } from \"fp-ts/function\"\nimport type { FC } from \"react\"\nimport { useState, useId, useRef } from \"react\"\n\nimport { clampInto } from \"~/packages/anvl/src/number\"\n\nimport { ElasticInput } from \".\"\n\nfunction round(value: number, decimalPlaces?: number): number {\n\tif (decimalPlaces === undefined) return value\n\tconst factor = Math.pow(10, decimalPlaces)\n\treturn Math.round(value * factor) / factor\n}\nfunction roundAndPad(value: number, decimalPlaces?: number): string {\n\tconst roundedValue = round(value, decimalPlaces)\n\tconst paddedString = roundedValue.toFixed(decimalPlaces)\n\treturn paddedString\n}\n\nexport const VALID_NON_NUMBERS = [``, `-`, `.`, `-.`] as const\nexport type ValidNonNumber = typeof VALID_NON_NUMBERS[number]\nexport const isValidNonNumber = (input: string): input is ValidNonNumber =>\n\tVALID_NON_NUMBERS.includes(input as ValidNonNumber)\nexport const VALID_NON_NUMBER_INTERPRETATIONS: Readonly<\n\tRecord<ValidNonNumber, number | null>\n> = {\n\t\"\": null,\n\t\"-\": 0,\n\t\".\": 0,\n\t\"-.\": 0,\n} as const\nexport type DecimalInProgress = `${number | ``}.${number}`\nexport const isDecimalInProgress = (input: string): input is DecimalInProgress =>\n\tinput === `0` || (!isNaN(Number(input)) && input.includes(`.`))\n\nconst textToValue = (input: string, allowDecimal: boolean): number | null => {\n\tif (isValidNonNumber(input)) return VALID_NON_NUMBER_INTERPRETATIONS[input]\n\treturn allowDecimal ? parseFloat(input) : Math.round(parseFloat(input))\n}\n\nexport type NumberConstraints = {\n\tmax: number\n\tmin: number\n\tdecimalPlaces: number\n\tnullable: boolean\n}\nexport const DEFAULT_NUMBER_CONSTRAINTS: NumberConstraints = {\n\tmax: Infinity,\n\tmin: -Infinity,\n\tdecimalPlaces: 100,\n\tnullable: true,\n}\n\nconst initRefinery =\n\t<Constraints extends NumberConstraints>(constraints: Partial<Constraints>) =>\n\t(\n\t\tinput: number | null,\n\t): Constraints extends { nullable: true | undefined }\n\t\t? number | null\n\t\t: number => {\n\t\tif (input === null && constraints.nullable === true) {\n\t\t\treturn null as Constraints extends { nullable: true }\n\t\t\t\t? number | null\n\t\t\t\t: number\n\t\t}\n\t\tconst { max, min, decimalPlaces } = {\n\t\t\t...DEFAULT_NUMBER_CONSTRAINTS,\n\t\t\t...constraints,\n\t\t}\n\t\tconst constrained = pipe(input ?? 0, clampInto(min, max), (n) =>\n\t\t\tdecimalPlaces ? round(n, decimalPlaces) : n,\n\t\t)\n\t\treturn constrained\n\t}\n\nconst valueToText = (numericValue: number | null): string => {\n\tif (numericValue === null || numericValue === undefined) {\n\t\treturn ``\n\t}\n\treturn numericValue.toString()\n}\n\ntype NumberInputProps = Partial<NumberConstraints> & {\n\tautoSize?: boolean\n\tcustomCss?: SerializedStyles\n\tdisabled?: boolean\n\tid?: string\n\tlabel?: string\n\tname?: string\n\tonChange?: (e: React.ChangeEvent<HTMLInputElement>) => void\n\tonClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void\n\tplaceholder?: string\n\tset?: (newValue: number | null) => void\n\ttestId?: string\n\tvalue?: number | null\n}\n\nexport const NumberInput: FC<NumberInputProps> = ({\n\tautoSize = false,\n\tcustomCss,\n\tdecimalPlaces,\n\tdisabled = false,\n\tlabel,\n\tmax,\n\tmin,\n\tname,\n\tonChange,\n\tonClick,\n\tplaceholder = ``,\n\tset = () => null,\n\ttestId,\n\tvalue = null,\n}) => {\n\tconst id = useId()\n\tconst [temporaryEntry, setTemporaryEntry] = useState<\n\t\tDecimalInProgress | ValidNonNumber | null\n\t>(null)\n\tconst userHasMadeDeliberateChange = useRef<boolean>(false)\n\n\tconst refine = initRefinery({ max, min, decimalPlaces, nullable: true })\n\n\tconst allowDecimal = decimalPlaces === undefined || decimalPlaces > 0\n\n\tconst handleBlur = () => {\n\t\tif (userHasMadeDeliberateChange.current) {\n\t\t\tset(refine(value ?? null))\n\t\t\tsetTemporaryEntry(null)\n\t\t}\n\t\tuserHasMadeDeliberateChange.current = false\n\t}\n\n\tconst handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n\t\tif (onChange) onChange(event)\n\t\tif (set === undefined) return\n\t\tuserHasMadeDeliberateChange.current = true\n\t\tconst input = event.target.value\n\t\tif (isValidNonNumber(input) || isDecimalInProgress(input)) {\n\t\t\tsetTemporaryEntry(input)\n\t\t\tconst textInterpretation = isDecimalInProgress(input)\n\t\t\t\t? input\n\t\t\t\t: min?.toString() ?? `0`\n\t\t\tconst newValue = textToValue(textInterpretation, allowDecimal)\n\t\t\tset(refine(newValue))\n\t\t\treturn\n\t\t}\n\t\tsetTemporaryEntry(null)\n\t\tconst inputIsNumeric =\n\t\t\t(!isNaN(Number(input)) && !input.includes(` `)) ||\n\t\t\t(allowDecimal && input === `.`) ||\n\t\t\t(allowDecimal && input === `-.`) ||\n\t\t\tinput === `` ||\n\t\t\tinput === `-`\n\t\tconst numericValue = textToValue(input, allowDecimal)\n\n\t\tif (inputIsNumeric) {\n\t\t\tset(refine(numericValue))\n\t\t}\n\t}\n\n\tconst displayValue =\n\t\ttemporaryEntry ?? valueToText(value ? refine(value) : value)\n\n\treturn (\n\t\t<span css={customCss}>\n\t\t\t{label && <label htmlFor={id}>{label}</label>}\n\t\t\t{autoSize ? (\n\t\t\t\t<ElasticInput\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\tplaceholder={placeholder ?? `-`}\n\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tname={name ?? id}\n\t\t\t\t\tid={id}\n\t\t\t\t\tonClick={onClick}\n\t\t\t\t\tdata-testid={`number-input-${testId ?? id}`}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<input\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\tplaceholder={placeholder ?? `-`}\n\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tname={name ?? id}\n\t\t\t\t\tid={id}\n\t\t\t\t\tonClick={onClick}\n\t\t\t\t\tdata-testid={`number-input-${testId ?? id}`}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</span>\n\t)\n}\n","import type { Modifier } from \"../function\"\n\nexport const clampInto =\n\t(min: number, max: number): Modifier<number> =>\n\t(value) =>\n\t\tvalue < min ? min : value > max ? max : value\n","import type { SerializedStyles } from \"@emotion/react\"\nimport type { FC } from \"react\"\n\nimport { ElasticInput } from \".\"\n\nexport type TextInputProps = {\n\tvalue: string\n\tset?: (value: string) => void\n\tlabel?: string\n\tplaceholder?: string\n\tcustomCss?: SerializedStyles\n\tautoSize?: boolean\n\treadOnly?: boolean\n}\n\nexport const TextInput: FC<TextInputProps> = ({\n\tvalue,\n\tset,\n\tlabel,\n\tplaceholder,\n\tcustomCss,\n\tautoSize = false,\n}) => {\n\treturn (\n\t\t<span css={customCss}>\n\t\t\t<label>{label}</label>\n\t\t\t{autoSize ? (\n\t\t\t\t<ElasticInput\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tonChange={(e) => set?.(e.target.value)}\n\t\t\t\t\tdisabled={set === undefined}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<input\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tonChange={(e) => set?.(e.target.value)}\n\t\t\t\t\tdisabled={set === undefined}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</span>\n\t)\n}\n","import type { SetterOrUpdater } from \"recoil\"\n\nimport { become } from \"~/packages/anvl/src/function\"\nimport type { JsonArr } from \"~/packages/anvl/src/json\"\n\nexport const makeElementSetters = <T extends JsonArr>(\n\tdata: T,\n\tset: SetterOrUpdater<T>,\n): SetterOrUpdater<T[number]>[] =>\n\tdata.map(\n\t\t(value, index) => (newValue) =>\n\t\t\tset((): T => {\n\t\t\t\tconst newData = [...data]\n\t\t\t\tnewData[index] = become(newValue)(value)\n\t\t\t\treturn newData as unknown as T\n\t\t\t}),\n\t)\n","import { ElasticInput } from \"../../react-elastic-input\"\nimport type { JsonEditorProps } from \"../developer-interface\"\n\nexport const NonJsonEditor: React.FC<JsonEditorProps<never>> = ({ data }) => {\n\treturn data === undefined ? (\n\t\t<ElasticInput disabled value=\"undefined\" />\n\t) : (\n\t\t<ElasticInput\n\t\t\tdisabled\n\t\t\tvalue={\n\t\t\t\tObject.getPrototypeOf(data).constructor.name + ` ` + JSON.stringify(data)\n\t\t\t}\n\t\t/>\n\t)\n}\n","import type { SerializedStyles } from \"@emotion/react\"\nimport type { FC, ReactElement, RefObject } from \"react\"\nimport type { SetterOrUpdater } from \"recoil\"\n\nimport { doNothing } from \"~/packages/anvl/src/function\"\nimport type { Json, JsonTypes } from \"~/packages/anvl/src/json\"\nimport { isJson, refineJsonType } from \"~/packages/anvl/src/json\"\nimport type { JsonSchema } from \"~/packages/anvl/src/json-schema/json-schema\"\n\nimport { SubEditors } from \".\"\nimport type { JsonEditorComponents } from \"./default-components\"\nimport { NonJsonEditor } from \"./editors-by-type/non-json\"\nimport { ElasticInput } from \"../react-elastic-input\"\n\nexport type JsonEditorProps_INTERNAL<T extends Json> = {\n\tdata: T\n\tset: SetterOrUpdater<T>\n\tref?: RefObject<HTMLInputElement>\n\tname?: string\n\trename?: (newKey: string) => void\n\tremove?: () => void\n\trecast?: (newType: keyof JsonTypes) => void\n\tschema?: JsonSchema\n\tpath?: ReadonlyArray<number | string>\n\tisReadonly?: (path: ReadonlyArray<number | string>) => boolean\n\tisHidden?: (path: ReadonlyArray<number | string>) => boolean\n\tclassName?: string\n\tcustomCss?: SerializedStyles\n\tHeader?: FC<{ data: T; schema?: JsonSchema }>\n\tComponents: JsonEditorComponents\n}\n\nexport const JsonEditor_INTERNAL = <T extends Json>({\n\tdata,\n\tset,\n\tschema,\n\tname,\n\trename,\n\tremove,\n\trecast,\n\tpath = [],\n\tisReadonly = () => false,\n\tisHidden = () => false,\n\tclassName,\n\tcustomCss,\n\tHeader: HeaderDisplay,\n\tComponents,\n}: JsonEditorProps_INTERNAL<T>): ReactElement | null => {\n\tconst dataIsJson = isJson(data)\n\tconst refined = dataIsJson ? refineJsonType(data) : { type: `non-json`, data }\n\tconst SubEditor = dataIsJson ? SubEditors[refined.type] : NonJsonEditor\n\n\tconst disabled = isReadonly(path)\n\n\treturn isHidden(path) ? null : (\n\t\t<Components.ErrorBoundary>\n\t\t\t<Components.EditorWrapper className={className} customCss={customCss}>\n\t\t\t\t{remove && (\n\t\t\t\t\t<Components.Button\n\t\t\t\t\t\tonClick={disabled ? doNothing : remove}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Components.DeleteIcon />\n\t\t\t\t\t</Components.Button>\n\t\t\t\t)}\n\t\t\t\t{HeaderDisplay && <HeaderDisplay data={data} schema={schema} />}\n\t\t\t\t{rename && (\n\t\t\t\t\t<Components.KeyWrapper>\n\t\t\t\t\t\t<ElasticInput\n\t\t\t\t\t\t\tvalue={name}\n\t\t\t\t\t\t\tonChange={disabled ? doNothing : (e) => rename(e.target.value)}\n\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Components.KeyWrapper>\n\t\t\t\t)}\n\t\t\t\t<SubEditor\n\t\t\t\t\tdata={refined.data}\n\t\t\t\t\tset={set}\n\t\t\t\t\tschema={schema}\n\t\t\t\t\tremove={remove}\n\t\t\t\t\trename={rename}\n\t\t\t\t\tpath={path}\n\t\t\t\t\tisReadonly={isReadonly}\n\t\t\t\t\tisHidden={isHidden}\n\t\t\t\t\tComponents={Components}\n\t\t\t\t/>\n\t\t\t\t{recast && dataIsJson ? (\n\t\t\t\t\t<select\n\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t\t? doNothing\n\t\t\t\t\t\t\t\t: (e) => recast(e.target.value as keyof JsonTypes)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={refined.type}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t>\n\t\t\t\t\t\t{Object.keys(SubEditors).map((type) => (\n\t\t\t\t\t\t\t<option key={type} value={type}>\n\t\t\t\t\t\t\t\t{type}\n\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</select>\n\t\t\t\t) : null}\n\t\t\t</Components.EditorWrapper>\n\t\t</Components.ErrorBoundary>\n\t)\n}\n","import type { ReactElement } from \"react\"\n\nimport type { JsonArr } from \"~/packages/anvl/src/json\"\n\nimport { makeElementSetters } from \"./utilities/array-elements\"\nimport type { JsonEditorProps_INTERNAL } from \"../json-editor-internal\"\nimport { JsonEditor_INTERNAL } from \"../json-editor-internal\"\n\nexport const ArrayEditor = <_ extends JsonArr>({\n\tpath = [],\n\tisReadonly = () => false,\n\tisHidden = () => false,\n\tdata,\n\tset,\n\tComponents,\n}: JsonEditorProps_INTERNAL<JsonArr>): ReactElement => {\n\tconst setElement = makeElementSetters(data, set)\n\treturn (\n\t\t<>\n\t\t\t{data.map((element, index) => {\n\t\t\t\tconst newPath = [...path, index]\n\t\t\t\treturn (\n\t\t\t\t\t<JsonEditor_INTERNAL\n\t\t\t\t\t\tkey={newPath.join(``)}\n\t\t\t\t\t\tpath={newPath}\n\t\t\t\t\t\tisReadonly={isReadonly}\n\t\t\t\t\t\tisHidden={isHidden}\n\t\t\t\t\t\tdata={element}\n\t\t\t\t\t\tset={setElement[index]}\n\t\t\t\t\t\tComponents={Components}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})}\n\t\t</>\n\t)\n}\n","import { useRef } from \"react\"\nimport type { FC, ReactElement } from \"react\"\n\nimport { doNothing } from \"~/packages/anvl/src/function\"\nimport type { JsonObj } from \"~/packages/anvl/src/json\"\nimport { findSubSchema } from \"~/packages/anvl/src/json-schema/find-sub-schema\"\nimport { isObjectSchema } from \"~/packages/anvl/src/json-schema/json-schema\"\nimport { isPlainObject } from \"~/packages/anvl/src/object/refinement\"\nimport { isLiteral } from \"~/packages/anvl/src/refinement\"\n\nimport {\n\tmakePropertyCreationInterface,\n\tmakePropertyRecasters,\n\tmakePropertyRemovers,\n\tmakePropertyRenamers,\n\tmakePropertySetters,\n\tmakePropertySorter,\n} from \"./utilities/object-properties\"\nimport { ElasticInput } from \"../../react-elastic-input\"\nimport type { JsonEditorComponents } from \"../default-components\"\nimport type { JsonEditorProps_INTERNAL } from \"../json-editor-internal\"\nimport { JsonEditor_INTERNAL } from \"../json-editor-internal\"\n\nexport type PropertyAdderProps = {\n\taddProperty: () => void\n\tdisabled: boolean\n\tpropertyKey: string\n\tComponents: JsonEditorComponents\n}\n\nexport const PropertyAdder: FC<PropertyAdderProps> = ({\n\taddProperty,\n\tdisabled,\n\tpropertyKey,\n\tComponents,\n}) => (\n\t<Components.MissingPropertyWrapper>\n\t\t<ElasticInput disabled defaultValue={propertyKey} />\n\t\t{` `}\n\t\t<ElasticInput disabled defaultValue=\"is missing\" />\n\t\t<Components.Button onClick={() => addProperty()} disabled={disabled}>\n\t\t\t+\n\t\t</Components.Button>\n\t</Components.MissingPropertyWrapper>\n)\n\nexport const ObjectEditor = <T extends JsonObj>({\n\tschema,\n\tpath = [],\n\tisReadonly = () => false,\n\tisHidden = () => false,\n\tdata,\n\tset,\n\tComponents,\n}: JsonEditorProps_INTERNAL<T>): ReactElement => {\n\tconst disabled = isReadonly(path)\n\n\tconst stableKeyMap = useRef<Record<keyof T, keyof T>>(\n\t\tObject.keys(data).reduce((acc, key: keyof T) => {\n\t\t\tacc[key] = key\n\t\t\treturn acc\n\t\t}, {} as Record<keyof T, keyof T>),\n\t)\n\n\tconst setProperty = makePropertySetters(data, set)\n\tconst renameProperty = makePropertyRenamers(data, set, stableKeyMap)\n\tconst removeProperty = makePropertyRemovers(data, set)\n\tconst recastProperty = makePropertyRecasters(data, set)\n\tconst sortProperties = makePropertySorter(data, set)\n\tconst makePropertyAdder = makePropertyCreationInterface(data, set)\n\n\tconst subSchema = isPlainObject(schema) ? findSubSchema(schema)(path) : true\n\tconst schemaKeys: ReadonlyArray<string> | true = isLiteral(true)(subSchema)\n\t\t? true\n\t\t: isObjectSchema(subSchema)\n\t\t? Object.keys(subSchema.properties ?? {})\n\t\t: []\n\tconst dataKeys: ReadonlyArray<string> = Object.keys(data)\n\tconst [unofficialKeys, officialKeys] = dataKeys.reduce(\n\t\t([unofficial, official], key) => {\n\t\t\tconst isOfficial = schemaKeys === true || schemaKeys.includes(key)\n\t\t\treturn isOfficial\n\t\t\t\t? [unofficial, [...official, key]]\n\t\t\t\t: [[...unofficial, key], official]\n\t\t},\n\t\t[[], []] as [string[], string[]],\n\t)\n\tconst missingKeys: ReadonlyArray<string> =\n\t\tschemaKeys === true\n\t\t\t? []\n\t\t\t: schemaKeys.filter((key) => !dataKeys.includes(key))\n\n\treturn (\n\t\t<>\n\t\t\t<Components.Button onClick={() => sortProperties()} disabled={disabled}>\n\t\t\t\tSort\n\t\t\t</Components.Button>\n\t\t\t<Components.ObjectWrapper>\n\t\t\t\t<div className=\"json_editor_properties\">\n\t\t\t\t\t{[...missingKeys, ...officialKeys, ...unofficialKeys].map((key) => {\n\t\t\t\t\t\tconst originalKey = stableKeyMap.current[key]\n\t\t\t\t\t\tconst newPath = [...path, key]\n\t\t\t\t\t\tconst originalPath = [...path, originalKey]\n\t\t\t\t\t\tconst isOfficial = schemaKeys === true || schemaKeys.includes(key)\n\t\t\t\t\t\tconst isMissing = missingKeys.includes(key)\n\n\t\t\t\t\t\treturn isMissing ? (\n\t\t\t\t\t\t\t<PropertyAdder\n\t\t\t\t\t\t\t\tkey={key + `IsMissing`}\n\t\t\t\t\t\t\t\tpropertyKey={key}\n\t\t\t\t\t\t\t\taddProperty={makePropertyAdder(key, `string`)}\n\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t\tComponents={Components}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<JsonEditor_INTERNAL\n\t\t\t\t\t\t\t\tkey={originalPath.join(`.`)}\n\t\t\t\t\t\t\t\tschema={schema}\n\t\t\t\t\t\t\t\tpath={newPath}\n\t\t\t\t\t\t\t\tname={key}\n\t\t\t\t\t\t\t\tisReadonly={isReadonly}\n\t\t\t\t\t\t\t\tisHidden={isHidden}\n\t\t\t\t\t\t\t\tdata={data[key as keyof T]}\n\t\t\t\t\t\t\t\tset={setProperty[key as keyof T]}\n\t\t\t\t\t\t\t\trename={renameProperty[key as keyof T]}\n\t\t\t\t\t\t\t\tremove={removeProperty[key as keyof T]}\n\t\t\t\t\t\t\t\trecast={recastProperty[key as keyof T]}\n\t\t\t\t\t\t\t\tclassName={`json_editor_property ${\n\t\t\t\t\t\t\t\t\tisOfficial ? `json_editor_official` : `json_editor_unofficial`\n\t\t\t\t\t\t\t\t}`}\n\t\t\t\t\t\t\t\tComponents={Components}\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</div>\n\t\t\t\t<Components.Button\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t? doNothing\n\t\t\t\t\t\t\t: () => makePropertyAdder(`new_property`, `string`)()\n\t\t\t\t\t}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t>\n\t\t\t\t\t+\n\t\t\t\t</Components.Button>\n\t\t\t</Components.ObjectWrapper>\n\t\t</>\n\t)\n}\n","import { isBoolean } from \"fp-ts/boolean\"\nimport { isNumber } from \"fp-ts/number\"\nimport type { Refinement } from \"fp-ts/Refinement\"\nimport { isString } from \"fp-ts/string\"\n\nimport type { integer } from \"./integer\"\nimport { isInteger } from \"./integer\"\nimport type { JsonSchemaRef } from \"./refs\"\nimport { isJsonSchemaRef } from \"./refs\"\nimport type { JsonSchemaStringFormat } from \"./string-formats\"\nimport { JSON_SCHEMA_STRING_FORMATS } from \"./string-formats\"\nimport { isArray } from \"../array\"\nimport { JSON_TYPE_NAMES } from \"../json\"\nimport { ifDefined } from \"../nullish\"\nimport { doesExtend, isRecord } from \"../object/refinement\"\nimport {\n\tisLiteral,\n\tisWithin,\n\tcouldBe,\n\tisIntersection,\n\tisUnion,\n} from \"../refinement\"\nimport type { Refined } from \"../refinement/refined\"\n\n/* eslint-disable max-lines */\n\nexport const JSON_SCHEMA_TYPE_NAMES = [...JSON_TYPE_NAMES, `integer`] as const\nexport type JsonSchemaTypeName = typeof JSON_SCHEMA_TYPE_NAMES[number]\n\nexport const JSON_SCHEMA_META_TYPE_NAMES = [\n\t...JSON_SCHEMA_TYPE_NAMES,\n\t`any`,\n\t`never`,\n] as const\nexport type JsonSchemaMetaTypeName = typeof JSON_SCHEMA_META_TYPE_NAMES[number]\n\nexport const JSON_SCHEMA_LOGIC_MODES = [\n\t`union`,\n\t`exclusive`,\n\t`intersection`,\n\t`negation`,\n\t`conditional`,\n] as const\nexport type JsonSchemaLogicMode = typeof JSON_SCHEMA_LOGIC_MODES[number]\n\nexport interface JsonSchemaSystem\n\textends Record<JsonSchemaLogicMode & JsonSchemaMetaTypeName, any> {\n\tarray: ArraySchema\n\tboolean: BooleanSchema\n\tinteger: IntegerSchema\n\tnull: NullSchema\n\tnumber: NumberSchema\n\tobject: ObjectSchema\n\tstring: StringSchema\n\tany: true\n\tnever: false\n\tunion: UnionSchema\n\texclusive: ExclusiveSchema\n\tintersection: IntersectionSchema\n\tnegation: NegationSchema\n\tconditional: ConditionalSchema\n}\n\n// export const JSON_SCHEMA_SYSTEM: JsonSchemaSystem = {\n// array: { type: `array` },\n// boolean: { type: `boolean` },\n// integer: { type: `integer` },\n// null: { type: `null` },\n// number: { type: `number` },\n// object: { type: `object` },\n// string: { type: `string` },\n// any: true,\n// never: false,\n// union: { anyOf: [true] },\n// exclusive: { oneOf: [true] },\n// intersection: { allOf: [true] },\n// negation: { not: false },\n// conditional: { if: true, then: true, else: false },\n// } as const\n\nexport const JSON_SCHEMA_REFINERY: {\n\t[K in JsonSchemaLogicMode & JsonSchemaMetaTypeName]: Refinement<\n\t\tunknown,\n\t\tJsonSchemaSystem[K]\n\t>\n} = {\n\tarray: isArraySchema,\n\tboolean: isBooleanSchema,\n\tinteger: isIntegerSchema,\n\tnull: isNullSchema,\n\tnumber: isNumberSchema,\n\tobject: isObjectSchema,\n\tstring: isStringSchema,\n\tany: isLiteral(true),\n\tnever: isLiteral(false),\n\tunion: isUnionSchema,\n\tintersection: isIntersectionSchema,\n\tnegation: isNegationSchema,\n\tconditional: isConditionalSchema,\n}\n\nexport type StringSchema = {\n\ttype: `string`\n\tenum?: string[]\n\tminLength?: integer\n\tmaxLength?: integer\n\tpattern?: string\n\tformat?: JsonSchemaStringFormat\n}\nexport const stringSchemaStructure = {\n\ttype: isLiteral(`string`),\n\tenum: ifDefined(isArray(isString)),\n\tminLength: ifDefined(isInteger),\n\tmaxLength: ifDefined(isInteger),\n\tpattern: ifDefined(isString),\n\tformat: ifDefined(isWithin(JSON_SCHEMA_STRING_FORMATS)),\n}\nexport function isStringSchema(input: unknown): input is StringSchema {\n\treturn doesExtend(stringSchemaStructure)(input)\n}\n\nexport const numberSchemaStructure = {\n\ttype: isLiteral(`number`),\n\tenum: ifDefined(isArray(isNumber)),\n\tminimum: ifDefined(isNumber),\n\tmaximum: ifDefined(isNumber),\n\texclusiveMinimum: ifDefined(isNumber),\n\texclusiveMaximum: ifDefined(isNumber),\n\tmultipleOf: ifDefined(isNumber),\n}\nexport type NumberSchema = Refined<typeof numberSchemaStructure>\nexport function isNumberSchema(input: unknown): input is NumberSchema {\n\treturn doesExtend(numberSchemaStructure)(input)\n}\n\nexport const integerSchemaStructure = {\n\ttype: isLiteral(`integer`),\n\tenum: ifDefined(isArray(isInteger)),\n\tminimum: ifDefined(isInteger),\n\tmaximum: ifDefined(isInteger),\n\texclusiveMinimum: ifDefined(isInteger),\n\texclusiveMaximum: ifDefined(isInteger),\n\tmultipleOf: ifDefined(isInteger),\n}\nexport type IntegerSchema = Refined<typeof integerSchemaStructure>\nexport function isIntegerSchema(input: unknown): input is IntegerSchema {\n\treturn doesExtend(integerSchemaStructure)(input)\n}\n\nexport const booleanSchemaStructure = {\n\ttype: isLiteral(`boolean`),\n\tenum: ifDefined(isArray(isBoolean)),\n}\nexport type BooleanSchema = Refined<typeof booleanSchemaStructure>\nexport function isBooleanSchema(input: unknown): input is BooleanSchema {\n\treturn doesExtend(booleanSchemaStructure)(input)\n}\n\nexport const nullSchemaStructure = {\n\ttype: isLiteral(`null`),\n}\nexport type NullSchema = Refined<typeof nullSchemaStructure>\nexport function isNullSchema(input: unknown): input is NullSchema {\n\treturn doesExtend(nullSchemaStructure)(input)\n}\n\nexport type ObjectSchema = {\n\ttype: `object`\n\tproperties?: Record<string, JsonSchema>\n\tpatternProperties?: Record<string, JsonSchema>\n\trequired?: string[]\n\tadditionalProperties?: JsonSchema\n\tpropertyNames?: JsonSchema\n\tminProperties?: integer\n\tmaxProperties?: integer\n\tdependentSchemas?: Record<string, JsonSchema>\n}\nexport const objectSchemaStructure = {\n\ttype: isLiteral(`object`),\n\tproperties: ifDefined(isRecord(isString, isJsonSchema)),\n\trequired: ifDefined(isArray(isString)),\n\tadditionalProperties: ifDefined(isJsonSchema),\n\tpropertyNames: ifDefined(isStringSchema),\n\tminProperties: ifDefined(isInteger),\n\tmaxProperties: ifDefined(isInteger),\n\tdependentSchemas: ifDefined(isRecord(isString, isJsonSchema)),\n}\nexport function isObjectSchema(input: unknown): input is ObjectSchema {\n\treturn doesExtend(objectSchemaStructure)(input)\n}\n\nexport type ArraySchema = {\n\ttype: `array`\n\titems?: JsonSchema | JsonSchema[]\n\tminItems?: integer\n\tmaxItems?: integer\n\tuniqueItems?: boolean\n}\nexport const arraySchemaStructure = {\n\ttype: isLiteral(`array`),\n\titems: ifDefined(couldBe(isJsonSchema).or(isArray(isJsonSchema))),\n\tminItems: ifDefined(isInteger),\n\tmaxItems: ifDefined(isInteger),\n\tuniqueItems: ifDefined(isBoolean),\n}\nexport function isArraySchema(input: unknown): input is ArraySchema {\n\treturn doesExtend(arraySchemaStructure)(input)\n}\n\nexport type UnionSchema = { anyOf: JsonSchema[] }\nexport const unionSchemaStructure = { anyOf: isArray(isJsonSchema) }\nexport function isUnionSchema(input: unknown): input is UnionSchema {\n\treturn doesExtend(unionSchemaStructure)(input)\n}\nexport type IntersectionSchema = {\n\tallOf: JsonSchema[] | ReadonlyArray<JsonSchema>\n}\nexport type ExclusiveSchema = {\n\toneOf: JsonSchema[] | ReadonlyArray<JsonSchema>\n}\nexport const exclusiveSchemaStructure = { oneOf: isArray(isJsonSchema) }\nexport function isExclusiveSchema(input: unknown): input is ExclusiveSchema {\n\treturn doesExtend(exclusiveSchemaStructure)(input)\n}\n\nexport const intersectionSchemaStructure = { allOf: isArray(isJsonSchema) }\nexport function isIntersectionSchema(\n\tinput: unknown,\n): input is IntersectionSchema {\n\treturn doesExtend(intersectionSchemaStructure)(input)\n}\n\nexport type ConditionalSchema = {\n\tif: JsonSchema\n\tthen?: JsonSchema\n\telse?: JsonSchema\n}\nexport const conditionalSchemaStructure = {\n\tif: isJsonSchema,\n\tthen: ifDefined(isJsonSchema),\n\telse: ifDefined(isJsonSchema),\n}\nexport function isConditionalSchema(input: unknown): input is ConditionalSchema {\n\treturn doesExtend(conditionalSchemaStructure)(input)\n}\n\nexport type NegationSchema = { not: JsonSchema }\nexport const negationSchemaStructure = { not: isJsonSchema }\nexport function isNegationSchema(input: unknown): input is NegationSchema {\n\treturn doesExtend(negationSchemaStructure)(input)\n}\n\nexport type MixedSchema = Partial<\n\tOmit<ArraySchema, `type`> &\n\t\tOmit<BooleanSchema, `enum` | `type`> &\n\t\tOmit<IntegerSchema, `enum` | `type`> &\n\t\tOmit<NullSchema, `type`> &\n\t\tOmit<NumberSchema, `enum` | `type`> &\n\t\tOmit<ObjectSchema, `type`> &\n\t\tOmit<StringSchema, `enum` | `type`>\n> & {\n\ttype: ReadonlyArray<JsonSchemaTypeName>\n\tenum?: ReadonlyArray<integer | boolean | number | string>\n}\nexport const mixedSchemaStructure = {\n\t...arraySchemaStructure,\n\t...booleanSchemaStructure,\n\t...integerSchemaStructure,\n\t...nullSchemaStructure,\n\t...numberSchemaStructure,\n\t...objectSchemaStructure,\n\t...stringSchemaStructure,\n\ttype: isArray(isWithin(JSON_SCHEMA_TYPE_NAMES)),\n\tenum: ifDefined(\n\t\tisArray(isUnion.or(isInteger).or(isBoolean).or(isNumber).or(isString)),\n\t),\n}\nexport function isMixedSchema(input: unknown): input is MixedSchema {\n\treturn doesExtend(mixedSchemaStructure)(input)\n}\n\nexport type JsonSchemaCore =\n\t| ArraySchema\n\t| BooleanSchema\n\t| ConditionalSchema\n\t| ExclusiveSchema\n\t| IntegerSchema\n\t| IntersectionSchema\n\t| MixedSchema\n\t| NegationSchema\n\t| NullSchema\n\t| NumberSchema\n\t| ObjectSchema\n\t| StringSchema\n\t| UnionSchema\n\nexport const isJsonSchemaCore = isUnion\n\t.or(isArraySchema)\n\t.or(isBooleanSchema)\n\t.or(isConditionalSchema)\n\t.or(isExclusiveSchema)\n\t.or(isIntegerSchema)\n\t.or(isIntersectionSchema)\n\t.or(isMixedSchema)\n\t.or(isNegationSchema)\n\t.or(isNullSchema)\n\t.or(isNumberSchema)\n\t.or(isObjectSchema)\n\t.or(isStringSchema)\n\t.or(isUnionSchema)\n\nexport type JsonSchemaLeaf =\n\t| BooleanSchema\n\t| IntegerSchema\n\t| NullSchema\n\t| NumberSchema\n\t| StringSchema\nexport function isJsonSchemaLeaf(input: unknown): input is JsonSchemaLeaf {\n\treturn isUnion\n\t\t.or(isBooleanSchema)\n\t\t.or(isIntegerSchema)\n\t\t.or(isNullSchema)\n\t\t.or(isNumberSchema)\n\t\t.or(isStringSchema)(input)\n}\n\nexport type JsonSchemaTree =\n\t| ArraySchema\n\t| ConditionalSchema\n\t| ExclusiveSchema\n\t| IntersectionSchema\n\t| MixedSchema\n\t| NegationSchema\n\t| ObjectSchema\n\t| UnionSchema\nexport function isJsonSchemaTree(input: unknown): input is JsonSchemaTree {\n\treturn isUnion\n\t\t.or(isArraySchema)\n\t\t.or(isMixedSchema)\n\t\t.or(isObjectSchema)\n\t\t.or(isUnionSchema)\n\t\t.or(isIntersectionSchema)\n\t\t.or(isExclusiveSchema)\n\t\t.or(isConditionalSchema)\n\t\t.or(isNegationSchema)(input)\n}\n\nexport type JsonSchemaRoot = {\n\t$id?: string\n\t$schema?: string\n\t$defs?: Record<string, JsonSchema>\n\tdefinitions?: Record<string, JsonSchema>\n}\n\nexport const isJsonSchemaRoot = doesExtend({\n\t$id: ifDefined(isString),\n\t$schema: ifDefined(isString),\n})\n\n/* prettier-ignore */\nexport type JsonSchemaObject = JsonSchemaCore & JsonSchemaRoot\nexport const isJsonSchemaObject = isIntersection\n\t.and(isJsonSchemaCore)\n\t.and(isJsonSchemaRoot)\n\nexport type JsonSchema = JsonSchemaObject | JsonSchemaRef | boolean\nexport function isJsonSchema(input: unknown): input is JsonSchema {\n\treturn couldBe(isJsonSchemaObject).or(isBoolean).or(isJsonSchemaRef)(input)\n}\n","import { pipe } from \"fp-ts/function\"\n\nexport type IntegerBrand = { readonly integer: unique symbol /* virtual */ }\nexport type integer = IntegerBrand & number\nexport const isInteger = (input: unknown): input is integer =>\n\tNumber.isInteger(input as number)\n\nexport const parseInteger = (input: unknown): integer => {\n\tif (isInteger(input)) return input\n\tthrow new IntegerParseError(input)\n}\n\nexport class Fraction extends Number {\n\tpublic readonly numerator: integer\n\tpublic readonly denominator: integer\n\n\tpublic constructor(n: integer | number, d: integer | number) {\n\t\tsuper(n / d)\n\t\tif (d === 0) {\n\t\t\tthrow new Error(`Denominator cannot be zero`)\n\t\t}\n\t\tthis.numerator = parseInteger(n)\n\t\tthis.denominator = parseInteger(d)\n\t}\n\tpublic readonly [Symbol.toPrimitive]: () => number = () =>\n\t\tthis.numerator / this.denominator\n}\n\nexport const Frac = (n: integer | number, d: integer | number): Fraction =>\n\tnew Fraction(n, d)\n\nexport const isFraction = (input: unknown): input is Fraction =>\n\tinput instanceof Fraction\n\nexport class IntegerParseError extends Error {\n\tpublic constructor(value: unknown) {\n\t\tsuper(`Could not parse integer from ${JSON.stringify(value)}`)\n\t}\n}\n\nexport type IntegerParseResult =\n\t| {\n\t\t\tvalue: integer\n\t\t\terror: null\n\t\t\tround: null\n\t\t\tupper: null\n\t\t\tlower: null\n\t\t\tratio: null\n\t }\n\t| {\n\t\t\tvalue: null\n\t\t\terror: IntegerParseError\n\t\t\tround: integer\n\t\t\tupper: integer\n\t\t\tlower: integer\n\t\t\tratio: Fraction | null\n\t }\n\nexport const Int = Object.assign((input: unknown) => parseInteger(input), {\n\tfrom: (input: unknown): IntegerParseResult =>\n\t\tpipe(input, String, parseFloat, (num) =>\n\t\t\tisInteger(num)\n\t\t\t\t? {\n\t\t\t\t\t\tvalue: num,\n\t\t\t\t\t\terror: null,\n\t\t\t\t\t\tround: null,\n\t\t\t\t\t\tupper: null,\n\t\t\t\t\t\tlower: null,\n\t\t\t\t\t\tratio: null,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tvalue: null,\n\t\t\t\t\t\terror: new IntegerParseError(input),\n\t\t\t\t\t\tround: Math.round(num) as integer,\n\t\t\t\t\t\tupper: Math.ceil(num) as integer,\n\t\t\t\t\t\tlower: Math.floor(num) as integer,\n\t\t\t\t\t\tratio: null,\n\t\t\t\t },\n\t\t),\n\n\tformula: <\n\t\tI extends Record<\n\t\t\tkeyof any,\n\t\t\tFraction | Fraction[] | integer | integer[] | number[] | number\n\t\t>,\n\t\tO extends Record<\n\t\t\tkeyof any,\n\t\t\tFraction | Fraction[] | integer | integer[] | number[] | number\n\t\t>,\n\t>(\n\t\tfm: (\n\t\t\tinput: {\n\t\t\t\t[K in keyof I]: I[K] extends (Fraction | integer)[] ? number[] : number\n\t\t\t},\n\t\t) => O,\n\t) => {\n\t\treturn (input: I): O => {\n\t\t\treturn fm(\n\t\t\t\tinput as {\n\t\t\t\t\t[K in keyof I]: I[K] extends (Fraction | integer)[] ? number[] : number\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\t},\n})\n\nexport function asNumber(input: Fraction | integer | number): number\nexport function asNumber(input: Fraction[] | integer[] | number[]): number[]\nexport function asNumber<\n\tR extends Record<\n\t\tkeyof any,\n\t\tFraction | Fraction[] | integer | integer[] | number[] | number\n\t>,\n>(input: R): {\n\t[K in keyof R]: R[K] extends Fraction | integer | number ? number : number[]\n}\nexport function asNumber(input: unknown): unknown {\n\treturn input as any\n}\n\nexport const a = asNumber(new Fraction(1, 2))\nexport const b = asNumber([new Fraction(1, 2)])\nexport const c = asNumber({ a: new Fraction(1, 2) })\n","import { isString } from \"fp-ts/string\"\n\nimport type { Substitute } from \"~/packages/anvl/src/tree/substitute\"\n\nimport { Int } from \"./integer\"\nimport type { JsonSchema } from \"./json-schema\"\nimport { isJsonSchema } from \"./json-schema\"\nimport { delve } from \"../object\"\nimport { doesExtend } from \"../object/refinement\"\n\nexport type JsonSchemaRef = {\n\t$ref: string\n}\nexport function isJsonSchemaRef(input: unknown): input is JsonSchemaRef {\n\treturn doesExtend({\n\t\t$ref: isString,\n\t})(input)\n}\n\nexport type ReffedJsonSchema = Substitute<\n\tJsonSchema,\n\tJsonSchema,\n\tJsonSchema | JsonSchemaRef\n>\n\nexport const colorPalette: ReffedJsonSchema = {\n\t$defs: {\n\t\tcolorChannel: {\n\t\t\ttype: `integer`,\n\t\t\tminimum: Int(0),\n\t\t\tmaximum: Int(255),\n\t\t},\n\t\tcolor: {\n\t\t\ttype: `object`,\n\t\t\tproperties: {\n\t\t\t\tred: { $ref: `#/$defs/colorChannel` },\n\t\t\t\tgreen: { $ref: `#/$defs/colorChannel` },\n\t\t\t\tblue: { $ref: `#/$defs/colorChannel` },\n\t\t\t},\n\t\t},\n\t},\n\ttype: `array`,\n\titems: {\n\t\t$ref: `#/$defs/color`,\n\t},\n} as const\n\ntype RetrieveRefOptions = {\n\trefNode: JsonSchemaRef\n\trefMap?: Record<string, JsonSchema>\n\troot: ReffedJsonSchema\n}\ntype RetrieveRefResult = {\n\tnode: JsonSchema\n\trefMap: Record<string, JsonSchema>\n}\n\nexport const retrieveRef = ({\n\trefNode: { $ref },\n\trefMap = {},\n\troot,\n}: RetrieveRefOptions): RetrieveRefResult => {\n\tif (typeof root === `boolean`) {\n\t\tthrow new TypeError(`The root is a boolean and cannot be indexed`)\n\t}\n\tif ($ref in refMap) return { node: refMap[$ref], refMap }\n\tconst [_, ...refPath] = $ref.split(`/`)\n\tconst discovery = delve(root, refPath)\n\tif (discovery instanceof Error) throw discovery\n\tlet node = discovery.found\n\twhile (isJsonSchemaRef(node)) {\n\t\tconst result = retrieveRef({ refNode: node, refMap, root })\n\t\tnode = result.node\n\t\trefMap = result.refMap\n\t}\n\tif (isJsonSchema(node)) {\n\t\treturn { node, refMap: { ...refMap, [$ref]: node } }\n\t}\n\tthrow new TypeError(`The refNode is not a JsonSchema`)\n}\n","// import net from \"net\"\n\nimport { isString } from \"fp-ts/string\"\n\nimport { attempt } from \"../function\"\n\nexport const JSON_SCHEMA_STRING_FORMATS = [\n\t`date-time`,\n\t`date`,\n\t`email`,\n\t`hostname`,\n\t`ipv4`,\n\t`ipv6`,\n\t`regex`,\n\t`time`,\n\t`uri-reference`,\n\t`uri-template`,\n\t`uri`,\n\t`uuid`,\n] as const\n\nexport type JsonSchemaStringFormat = typeof JSON_SCHEMA_STRING_FORMATS[number]\n\nexport type date_time = string & { readonly date_time: unique symbol }\nexport type date = string & { readonly date: unique symbol }\nexport type email = string & { readonly email: unique symbol }\nexport type hostname = string & { readonly hostname: unique symbol }\nexport type ipv4 = string & { readonly ipv4: unique symbol }\nexport type ipv6 = string & { readonly ipv6: unique symbol }\nexport type regex = string & { readonly regex: unique symbol }\nexport type time = string & { readonly time: unique symbol }\nexport type uri_reference = string & { readonly uri_reference: unique symbol }\nexport type uri_template = string & { readonly uri_template: unique symbol }\nexport type uri = string & { readonly uri: unique symbol }\nexport type uuid = string & { readonly uuid: unique symbol }\n\nexport const isDateTime = (input: unknown): input is date_time =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^([+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24:?00)([.,]\\d+(?!:))?)?(\\17[0-5]\\d([.,]\\d+)?)?([zZ]|([+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/,\n\t)?.length === 1\n\nexport const isDate = (input: unknown): input is date =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^([+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6]))))?$/,\n\t)?.length === 1\n\nexport const isEmail = (input: unknown): input is email =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n\t)?.length === 1\n\nexport const isHostname = (input: unknown): input is hostname =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^(?=.{1,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)/,\n\t)?.length === 1\n\nexport const isIpv4 = (input: unknown): input is ipv4 =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,\n\t)?.length === 1\n\nexport const isIpv6 = (input: unknown): input is ipv6 => isString(input) // && net.isIPv6(input)\n\nexport const isRegex = (input: unknown): input is regex =>\n\tisString(input) && attempt(() => new RegExp(input))\n\nexport const isTime = (input: unknown): input is time =>\n\tisString(input) &&\n\tinput.match(/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\\.\\d+)?$/)\n\t\t?.length === 1\n\nexport const isUriReference = (input: unknown): input is uri_reference =>\n\tisString(input) &&\n\tinput.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/)\n\t\t?.length === 1\n\nexport const isUriTemplate = (input: unknown): input is uri_template =>\n\tisString(input) &&\n\tinput.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/)\n\t\t?.length === 1\n\nexport const isUri = (input: unknown): input is uri =>\n\tisString(input) &&\n\tinput.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/)\n\t\t?.length === 1\n\nexport const isUuid = (input: unknown): input is uuid =>\n\tisString(input) &&\n\tinput.match(\n\t\t/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,\n\t)?.length === 1\n","export const expandPathForSchema = (\n\tpath: (keyof any)[],\n): (number | string)[] | Error => {\n\ttry {\n\t\treturn path.flatMap((key) => {\n\t\t\tswitch (typeof key) {\n\t\t\t\tcase `string`:\n\t\t\t\t\treturn [`properties`, key]\n\t\t\t\tcase `number`:\n\t\t\t\t\treturn [`items`, key]\n\t\t\t\tcase `symbol`:\n\t\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\t`The key ${String(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t)} is not a valid JSON key; expected string or number, got symbol`,\n\t\t\t\t\t)\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\t`The key ${key} is not a valid JSON key; expected string or number, got ${typeof key}`,\n\t\t\t\t\t)\n\t\t\t}\n\t\t})\n\t} catch (caught) {\n\t\tif (caught instanceof TypeError) return caught\n\t\tthrow caught\n\t}\n}\n","import { isJsonSchema } from \"./json-schema\"\nimport { expandPathForSchema } from \"./path-into\"\nimport { isJsonSchemaRef, retrieveRef } from \"./refs\"\nimport type { ReffedJsonSchema } from \"./refs\"\n\nexport const findSubSchema = (\n\tschema: ReffedJsonSchema,\n): ((\n\tpath: (number | string)[] | ReadonlyArray<number | string>,\n) => Error | ReffedJsonSchema) => {\n\tif (typeof schema === `boolean`) {\n\t\tthrow new Error(`The schema does not contain subSchemas`)\n\t}\n\treturn (path: string[]) => {\n\t\tconst pathIntoSchema = expandPathForSchema(path)\n\t\tif (pathIntoSchema instanceof Error) return pathIntoSchema\n\t\tif (typeof schema === `boolean`) {\n\t\t\treturn new TypeError(`The schema is not a JsonSchema`)\n\t\t}\n\t\tconst { node, refMap } = pathIntoSchema.reduce(\n\t\t\t({ node, refMap = undefined }, key) => (\n\t\t\t\tconsole.log({ node, key }),\n\t\t\t\tisJsonSchemaRef(node)\n\t\t\t\t\t? retrieveRef({ refNode: node, root: schema, refMap })\n\t\t\t\t\t: { node: node[key], refMap }\n\t\t\t),\n\t\t\t{ node: schema, refMap: undefined },\n\t\t)\n\t\tif (node instanceof Error) throw node\n\n\t\tlet subSchema = node\n\t\twhile (isJsonSchemaRef(subSchema)) {\n\t\t\tconsole.log({ subSchema })\n\t\t\tsubSchema = retrieveRef({ refNode: subSchema, root: schema, refMap }).node\n\t\t}\n\t\tconsole.log({ subSchema })\n\n\t\tif (isJsonSchema(subSchema)) {\n\t\t\treturn subSchema\n\t\t}\n\t\tthrow new TypeError(`The subSchema is not a JsonSchema`)\n\t}\n}\n","import type {\n\tJson,\n\tJsonArr,\n\tJsonObj,\n\tSerializable,\n} from \"~/packages/anvl/src/json\"\nimport { refineJsonType } from \"~/packages/anvl/src/json\"\n\nexport const stringToBoolean = (str: string): boolean => str === `true`\nexport const stringToNumber = (str: string): number => Number(str)\nexport const stringToArray = (str: string): string[] => str.split(`,`)\nexport const stringToObject = (str: string): JsonObj => {\n\ttry {\n\t\treturn JSON.parse(str)\n\t} catch (e) {\n\t\treturn { [str]: str }\n\t}\n}\n\nexport const objectToString = (obj: JsonObj): string => JSON.stringify(obj)\nexport const objectToBoolean = (obj: JsonObj): boolean => obj.true === true\nexport const objectToNumber = (obj: JsonObj): number =>\n\tNumber(obj.number ?? obj.size ?? obj.count ?? 0)\nexport const objectToArray = <T extends Serializable>(\n\tobj: JsonObj<string, T>,\n): [key: string, value: T][] => Object.entries(obj)\n\nexport const booleanToString = (bool: boolean): string => bool.toString()\nexport const booleanToNumber = (bool: boolean): number => +bool\nexport const booleanToObject = (bool: boolean): JsonObj => ({\n\t[bool.toString()]: bool,\n})\nexport const booleanToArray = (bool: boolean): boolean[] => [bool]\n\nexport const numberToString = (num: number): string => num.toString()\nexport const numberToBoolean = (num: number): boolean => num === 1\nexport const numberToObject = (num: number): JsonObj => ({\n\tnumber: num,\n})\nexport const numberToArray = (num: number): null[] => Array(num).fill(null)\n\nexport const arrayToString = (arr: JsonArr): string => arr.join(`,`)\nexport const arrayToNumber = (arr: JsonArr): number => arr.length\nexport const arrayToBoolean = (arr: JsonArr): boolean =>\n\ttypeof arr[0] === `boolean` ? arr[0] : arr.length > 0\nexport const arrayToObject = <T extends Serializable>(\n\tarr: JsonArr<T>,\n): JsonObj<`${number}`, T> =>\n\tarr.reduce((acc, cur, idx) => {\n\t\tacc[`${idx}`] = cur\n\t\treturn acc\n\t}, {} as JsonObj<`${number}`, T>)\n\nexport const nullToString = (): string => ``\nexport const nullToNumber = (): number => 0\nexport const nullToBoolean = (): boolean => false\nexport const nullToArray = (): JsonArr => []\nexport const nullToObject = (): JsonObj => ({})\n\nexport const cast = (\n\tinput: Json,\n): {\n\tto: {\n\t\tarray: () => JsonArr\n\t\tboolean: () => boolean\n\t\tnumber: () => number\n\t\tobject: () => JsonObj\n\t\tstring: () => string\n\t\tnull: () => null\n\t}\n} => {\n\tconst json = refineJsonType(input)\n\treturn {\n\t\tto: {\n\t\t\tarray: () => {\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase `array`:\n\t\t\t\t\t\treturn json.data\n\t\t\t\t\tcase `object`:\n\t\t\t\t\t\treturn objectToArray(json.data)\n\t\t\t\t\tcase `string`:\n\t\t\t\t\t\treturn stringToArray(json.data)\n\t\t\t\t\tcase `boolean`:\n\t\t\t\t\t\treturn booleanToArray(json.data)\n\t\t\t\t\tcase `number`:\n\t\t\t\t\t\treturn numberToArray(json.data)\n\t\t\t\t\tcase `null`:\n\t\t\t\t\t\treturn nullToArray()\n\t\t\t\t}\n\t\t\t},\n\t\t\tboolean: () => {\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase `array`:\n\t\t\t\t\t\treturn arrayToBoolean(json.data)\n\t\t\t\t\tcase `object`:\n\t\t\t\t\t\treturn objectToBoolean(json.data)\n\t\t\t\t\tcase `string`:\n\t\t\t\t\t\treturn stringToBoolean(json.data)\n\t\t\t\t\tcase `boolean`:\n\t\t\t\t\t\treturn json.data\n\t\t\t\t\tcase `number`:\n\t\t\t\t\t\treturn numberToBoolean(json.data)\n\t\t\t\t\tcase `null`:\n\t\t\t\t\t\treturn nullToBoolean()\n\t\t\t\t}\n\t\t\t},\n\t\t\tnumber: () => {\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase `array`:\n\t\t\t\t\t\treturn arrayToNumber(json.data)\n\t\t\t\t\tcase `object`:\n\t\t\t\t\t\treturn objectToNumber(json.data)\n\t\t\t\t\tcase `string`:\n\t\t\t\t\t\treturn stringToNumber(json.data)\n\t\t\t\t\tcase `boolean`:\n\t\t\t\t\t\treturn booleanToNumber(json.data)\n\t\t\t\t\tcase `number`:\n\t\t\t\t\t\treturn json.data\n\t\t\t\t\tcase `null`:\n\t\t\t\t\t\treturn nullToNumber()\n\t\t\t\t}\n\t\t\t},\n\t\t\tobject: () => {\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase `array`:\n\t\t\t\t\t\treturn arrayToObject(json.data)\n\t\t\t\t\tcase `object`:\n\t\t\t\t\t\treturn json.data\n\t\t\t\t\tcase `string`:\n\t\t\t\t\t\treturn stringToObject(json.data)\n\t\t\t\t\tcase `boolean`:\n\t\t\t\t\t\treturn booleanToObject(json.data)\n\t\t\t\t\tcase `number`:\n\t\t\t\t\t\treturn numberToObject(json.data)\n\t\t\t\t\tcase `null`:\n\t\t\t\t\t\treturn nullToObject()\n\t\t\t\t}\n\t\t\t},\n\t\t\tstring: () => {\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase `array`:\n\t\t\t\t\t\treturn arrayToString(json.data)\n\t\t\t\t\tcase `object`:\n\t\t\t\t\t\treturn objectToString(json.data)\n\t\t\t\t\tcase `string`:\n\t\t\t\t\t\treturn json.data\n\t\t\t\t\tcase `boolean`:\n\t\t\t\t\t\treturn booleanToString(json.data)\n\t\t\t\t\tcase `number`:\n\t\t\t\t\t\treturn numberToString(json.data)\n\t\t\t\t\tcase `null`:\n\t\t\t\t\t\treturn nullToString()\n\t\t\t\t}\n\t\t\t},\n\t\t\tnull: () => null,\n\t\t},\n\t}\n}\n","import type { MutableRefObject } from \"react\"\nimport type { SetterOrUpdater } from \"recoil\"\n\nimport { become } from \"~/packages/anvl/src/function\"\nimport { JSON_DEFAULTS } from \"~/packages/anvl/src/json\"\nimport type { Json, JsonObj, JsonTypeName } from \"~/packages/anvl/src/json\"\nimport { cast } from \"~/packages/anvl/src/json/cast\"\nimport { mapObject } from \"~/packages/anvl/src/object\"\n\nexport const makePropertySetters = <T extends JsonObj>(\n\tdata: T,\n\tset: SetterOrUpdater<T>,\n): { [K in keyof T]: SetterOrUpdater<T[K]> } =>\n\tmapObject<keyof T, any, SetterOrUpdater<any>>(\n\t\tdata,\n\t\t(value, key) => (newValue) =>\n\t\t\tset({ ...data, [key]: become(newValue)(value[key]) }),\n\t)\n\nexport const makePropertyRenamers = <T extends JsonObj>(\n\tdata: T,\n\tset: SetterOrUpdater<T>,\n\tstableKeyMapRef: MutableRefObject<{ [K in keyof T]: keyof T }>,\n): { [K in keyof T]: (newKey: string) => void } =>\n\tmapObject<keyof T, any, (newKey: string) => void>(\n\t\tdata,\n\t\t(value, key) => (newKey) =>\n\t\t\tObject.hasOwn(data, newKey)\n\t\t\t\t? null\n\t\t\t\t: set(() => {\n\t\t\t\t\t\tconst entries = Object.entries(data)\n\t\t\t\t\t\tconst index = entries.findIndex(([k]) => k === key)\n\t\t\t\t\t\tentries[index] = [newKey, value]\n\t\t\t\t\t\tconst stableKeyMap = stableKeyMapRef.current\n\t\t\t\t\t\tstableKeyMapRef.current = {\n\t\t\t\t\t\t\t...stableKeyMap,\n\t\t\t\t\t\t\t[newKey]: stableKeyMap[key],\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn Object.fromEntries(entries) as T\n\t\t\t\t }),\n\t)\n\nexport const makePropertyRemovers = <T extends JsonObj>(\n\tdata: T,\n\tset: SetterOrUpdater<T>,\n): { [K in keyof T]: () => void } =>\n\tmapObject<keyof T, any, () => void>(\n\t\tdata,\n\t\t(_, key) => () =>\n\t\t\tset(() => {\n\t\t\t\tconst { [key]: _, ...rest } = data\n\t\t\t\treturn rest as T\n\t\t\t}),\n\t)\n\nexport const makePropertyRecasters = <T extends JsonObj>(\n\tdata: T,\n\tset: SetterOrUpdater<T>,\n): { [K in keyof T]: (newType: JsonTypeName) => void } =>\n\tmapObject<keyof T, any, (newType: JsonTypeName) => void>(\n\t\tdata,\n\t\t(value, key) => (newType) =>\n\t\t\tset(() => ({\n\t\t\t\t...data,\n\t\t\t\t[key]: cast(value).to[newType](),\n\t\t\t})),\n\t)\n\nexport const makePropertyCreationInterface =\n\t<T extends JsonObj>(\n\t\tdata: T,\n\t\tset: SetterOrUpdater<T>,\n\t): ((key: string, type: JsonTypeName) => (value?: Json) => void) =>\n\t(key, type) =>\n\t(value) =>\n\t\tset({ ...data, [key]: value ?? JSON_DEFAULTS[type] })\n\nexport const makePropertySorter =\n\t<T extends JsonObj>(\n\t\tdata: T,\n\t\tset: SetterOrUpdater<T>,\n\t\tsortFn?: (a: string, b: string) => number,\n\t): (() => void) =>\n\t() => {\n\t\tconst sortedKeys = Object.keys(data).sort(sortFn)\n\t\tconst sortedObj = {} as Record<string, unknown>\n\t\tsortedKeys.forEach((key) => (sortedObj[key] = data[key]))\n\t\tset(sortedObj as T)\n\t}\n\n// export const sortPropertiesAlphabetically = <T extends JsonObj>(data: T): T =>\n// sortProperties(data, (a, b) => a.localeCompare(b))\n\nexport const deleteProperty =\n\t<T extends JsonObj>(\n\t\tdata: T,\n\t\tset: SetterOrUpdater<T>,\n\t): ((key: keyof T) => void) =>\n\t(key) => {\n\t\tconst { [key]: _, ...rest } = data\n\t\tset(rest as T)\n\t}\n\nexport const addProperty =\n\t<T extends JsonObj>(\n\t\tdata: T,\n\t\tset: SetterOrUpdater<T>,\n\t): ((key?: string, value?: Json) => void) =>\n\t(key, value) => {\n\t\tconst newKey = key ?? `newProperty`\n\t\tconst newValue = value ?? ``\n\t\tset({ ...data, [newKey]: newValue })\n\t}\n","import type { ReactElement } from \"react\"\n\nimport { NumberInput, TextInput } from \"../../react-elastic-input\"\nimport type { JsonEditorProps_INTERNAL } from \"../json-editor-internal\"\n\nexport const BooleanEditor = ({\n\tdata,\n\tset,\n\tComponents,\n}: JsonEditorProps_INTERNAL<boolean>): ReactElement => (\n\t<Components.BooleanWrapper>\n\t\t<input\n\t\t\ttype=\"checkbox\"\n\t\t\tchecked={data}\n\t\t\tonChange={(event) => set(event.target.checked)}\n\t\t/>\n\t</Components.BooleanWrapper>\n)\n\nexport const NullEditor = ({\n\tComponents,\n}: JsonEditorProps_INTERNAL<null>): ReactElement => (\n\t<Components.NullWrapper>\n\t\t<></>\n\t</Components.NullWrapper>\n)\n\nexport const NumberEditor = ({\n\tpath = [],\n\tisReadonly = () => false,\n\tdata,\n\tset,\n\tComponents,\n}: JsonEditorProps_INTERNAL<number>): ReactElement => (\n\t<Components.NumberWrapper>\n\t\t<NumberInput\n\t\t\tvalue={data}\n\t\t\tset={isReadonly(path) ? undefined : (newValue) => set(Number(newValue))}\n\t\t\tautoSize={true}\n\t\t/>\n\t</Components.NumberWrapper>\n)\n\nexport const StringEditor = ({\n\tpath = [],\n\tisReadonly = () => false,\n\tdata,\n\tset,\n\tComponents,\n}: JsonEditorProps_INTERNAL<string>): ReactElement => {\n\treturn (\n\t\t<Components.StringWrapper>\n\t\t\t<TextInput\n\t\t\t\tvalue={data}\n\t\t\t\tset={isReadonly(path) ? undefined : set}\n\t\t\t\tautoSize={true}\n\t\t\t/>\n\t\t</Components.StringWrapper>\n\t)\n}\n","import type { ErrorInfo, ReactNode, FC } from \"react\"\nimport { Component, useState } from \"react\"\n\nimport type { FallbackProps } from \"./DefaultFallback\"\nimport { DefaultFallback } from \"./DefaultFallback\"\n\nexport type ErrorBoundaryState = {\n\terror?: Error | string\n\terrorInfo?: ErrorInfo\n}\n\nexport type ErrorBoundaryProps = {\n\tchildren: ReactNode\n\tonError?: (error: Error | string, errorInfo: ErrorInfo) => void\n\tFallback?: FC<FallbackProps>\n\tuseResetErrorState?: () => () => void\n\tuseErrorState?: () => [\n\t\tErrorBoundaryState,\n\t\t(\n\t\t\tnewState:\n\t\t\t\t| ErrorBoundaryState\n\t\t\t\t| ((currState: ErrorBoundaryState) => ErrorBoundaryState),\n\t\t) => void,\n\t]\n}\n\nexport class ErrorBoundary extends Component<\n\tErrorBoundaryProps,\n\tErrorBoundaryState\n> {\n\tpublic constructor(props: ErrorBoundaryProps) {\n\t\tsuper(props)\n\t\tthis.state = { error: undefined, errorInfo: undefined }\n\t\t// We can filter or add information\n\t\t// to airbrake notifications here:\n\t}\n\n\tpublic override componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n\t\tthis.props.onError?.(error, errorInfo)\n\t\tthis.setState({\n\t\t\terror,\n\t\t\terrorInfo,\n\t\t})\n\t}\n\n\tpublic override render(): ReactNode {\n\t\tconst { error, errorInfo } = this.state\n\t\tconst { children, Fallback = DefaultFallback } = this.props\n\n\t\treturn errorInfo ? (\n\t\t\t<Fallback error={error} errorInfo={errorInfo} />\n\t\t) : (\n\t\t\t(children as ReactNode)\n\t\t)\n\t}\n}\n\nexport const RecoverableErrorBoundary: FC<ErrorBoundaryProps> = ({\n\tchildren,\n\tFallback = DefaultFallback,\n\tuseErrorState = () => useState<ErrorBoundaryState>({}),\n\tuseResetErrorState,\n}) => {\n\tconst [{ error }, setError] = useErrorState()\n\tconst resetError = useResetErrorState\n\t\t? useResetErrorState()\n\t\t: () => setError({})\n\tconst hasError = Boolean(error)\n\n\treturn hasError ? (\n\t\t<div>\n\t\t\t<button type=\"button\" onClick={resetError}>\n\t\t\t\tReset\n\t\t\t</button>\n\t\t\t<ErrorBoundary Fallback={Fallback}>{children}</ErrorBoundary>\n\t\t</div>\n\t) : (\n\t\t<ErrorBoundary\n\t\t\tFallback={Fallback}\n\t\t\tonError={(newError, newErrorInfo) =>\n\t\t\t\tsetError({ error: newError, errorInfo: newErrorInfo })\n\t\t\t}\n\t\t>\n\t\t\t{children}\n\t\t</ErrorBoundary>\n\t)\n}\n","import type { ErrorInfo, FC } from \"react\"\n\nexport type FallbackProps = {\n\terror?: Error | string\n\terrorInfo?: ErrorInfo\n}\n\nexport const DefaultFallback: FC<FallbackProps> = ({ error, errorInfo }) => {\n\tconst component = errorInfo?.componentStack.split(` `).filter(Boolean)[2]\n\tconst message =\n\t\terror?.toString() ?? errorInfo?.componentStack ?? `Unknown error`\n\treturn (\n\t\t<div\n\t\t\tdata-testid=\"error-boundary\"\n\t\t\tstyle={{\n\t\t\t\tflex: `1`,\n\t\t\t\tbackground: `black`,\n\t\t\t\tbackgroundImage: `url(./src/assets/kablooey.gif)`,\n\t\t\t\tbackgroundPosition: `center`,\n\t\t\t\t// backgroundRepeat: `no-repeat`,\n\t\t\t\tbackgroundSize: `overlay`,\n\t\t\t}}\n\t\t>\n\t\t\t{/* <img src=\"./src/assets/kablooey.gif\" alt=\"error\" /> */}\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tmargin: `50px`,\n\t\t\t\t\tmarginTop: `0`,\n\t\t\t\t\tpadding: `50px`,\n\t\t\t\t\tborder: `1px solid dashed`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbackground: `black`,\n\t\t\t\t\t\tcolor: `white`,\n\t\t\t\t\t\tpadding: 10,\n\t\t\t\t\t\tpaddingTop: 5,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{`⚠️ `}\n\t\t\t\t\t<span style={{ color: `#fc0`, fontWeight: 700 }}>{component}</span>\n\t\t\t\t\t{` ⚠️ `}\n\t\t\t\t\t{message}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n","import type { SerializedStyles } from \"@emotion/react\"\nimport type { FC, ReactNode } from \"react\"\n\nimport { ErrorBoundary } from \"../react-error-boundary\"\n\nexport type Dict<T> = Record<string, T>\n\nexport type WrapperComponent<T extends Dict<unknown> = Dict<unknown>> = FC<\n\tT & { children: ReactNode }\n>\n\nexport type WC<T extends Dict<unknown> = Dict<unknown>> = WrapperComponent<T>\n\nexport type JsonEditorComponents = {\n\tErrorBoundary: WC\n\n\tButton: WC<{ onClick: () => void; disabled: boolean }>\n\tDeleteIcon: FC\n\n\tEditorLayout: FC<{\n\t\tDeleteButton?: FC\n\t\tHeader?: FC\n\t\tKeyInput?: FC\n\t\tTypeSelect?: FC\n\t\tValueEditor: FC\n\t\tWrapper: WC\n\t}>\n\tEditorWrapper: WC<{ customCss?: SerializedStyles; className?: string }>\n\n\tArrayWrapper: WC\n\tObjectWrapper: WC\n\tStringWrapper: WC\n\tNumberWrapper: WC\n\tBooleanWrapper: WC\n\tNullWrapper: WC\n\n\tMiscastPropertyWrapper: WC\n\tMissingPropertyWrapper: WC\n\tOfficialPropertyWrapper: WC\n\tUnofficialPropertyWrapper: WC\n\tIllegalPropertyWrapper: WC\n\tKeyWrapper: WC\n}\n\nexport const DEFAULT_JSON_EDITOR_COMPONENTS: JsonEditorComponents = {\n\tErrorBoundary: ({ children }) => <ErrorBoundary>{children}</ErrorBoundary>,\n\tButton: ({ onClick, children, disabled }) => (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName=\"json_editor_button\"\n\t\t\tonClick={onClick}\n\t\t\tdisabled={disabled}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t),\n\tEditorWrapper: ({ children, customCss, className }) => (\n\t\t<div className={`json_editor` + ` ` + className ?? ``} css={customCss}>\n\t\t\t{children}\n\t\t</div>\n\t),\n\tEditorLayout: ({\n\t\tDeleteButton,\n\t\tHeader,\n\t\tKeyInput,\n\t\tTypeSelect,\n\t\tValueEditor,\n\t\tWrapper,\n\t}) => {\n\t\treturn (\n\t\t\t<Wrapper>\n\t\t\t\t{DeleteButton && <DeleteButton />}\n\t\t\t\t{Header && <Header />}\n\t\t\t\t{KeyInput && <KeyInput />}\n\t\t\t\t{TypeSelect && <TypeSelect />}\n\t\t\t\t<ValueEditor />\n\t\t\t</Wrapper>\n\t\t)\n\t},\n\tArrayWrapper: ({ children }) => (\n\t\t<div className=\"json_editor_array\">{children}</div>\n\t),\n\tObjectWrapper: ({ children }) => (\n\t\t<div className=\"json_editor_object\">{children}</div>\n\t),\n\tStringWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_string\">{children}</span>\n\t),\n\tNumberWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_number\">{children}</span>\n\t),\n\tBooleanWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_boolean\">{children}</span>\n\t),\n\tNullWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_null\">{children}</span>\n\t),\n\tMissingPropertyWrapper: ({ children }) => (\n\t\t<div className=\"json_editor_property json_editor_missing\">{children}</div>\n\t),\n\tMiscastPropertyWrapper: ({ children }) => (\n\t\t<div className=\"json_editor_property json_editor_miscast\">{children}</div>\n\t),\n\tIllegalPropertyWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_property json_editor_illegal\">{children}</span>\n\t),\n\tOfficialPropertyWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_property json_editor_official\">{children}</span>\n\t),\n\tUnofficialPropertyWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_property json_editor_unofficial\">\n\t\t\t{children}\n\t\t</span>\n\t),\n\tDeleteIcon: () => (\n\t\t<span className=\"json_editor_icon json_editor_delete\">x</span>\n\t),\n\tKeyWrapper: ({ children }) => (\n\t\t<span className=\"json_editor_key\">{children}</span>\n\t),\n}\n","import type { SerializedStyles } from \"@emotion/react\"\nimport Ajv from \"ajv\"\nimport type { FC, ReactElement, RefObject } from \"react\"\nimport { useMemo } from \"react\"\n\nimport type { Json, JsonTypes } from \"~/packages/anvl/src/json\"\nimport type { JsonSchema } from \"~/packages/anvl/src/json-schema/json-schema\"\n\nimport type { JsonEditorComponents } from \"./default-components\"\nimport { DEFAULT_JSON_EDITOR_COMPONENTS } from \"./default-components\"\nimport { ArrayEditor } from \"./editors-by-type/array-editor\"\nimport { ObjectEditor } from \"./editors-by-type/object-editor\"\nimport {\n\tBooleanEditor,\n\tNullEditor,\n\tNumberEditor,\n\tStringEditor,\n} from \"./editors-by-type/primitive-editors\"\nimport type { JsonEditorProps_INTERNAL } from \"./json-editor-internal\"\nimport { JsonEditor_INTERNAL } from \"./json-editor-internal\"\n\nexport const SubEditors: Record<\n\tkeyof JsonTypes,\n\tFC<JsonEditorProps_INTERNAL<any>>\n> = {\n\tarray: ArrayEditor,\n\tboolean: BooleanEditor,\n\tnull: NullEditor,\n\tnumber: NumberEditor,\n\tobject: ObjectEditor,\n\tstring: StringEditor,\n}\n\nexport type JsonEditorProps<T extends Json> = {\n\tdata: T\n\tset: (valOrUpdater: T | ((currVal: T) => T)) => void\n\tref?: RefObject<HTMLInputElement>\n\tname?: string\n\trename?: (newKey: string) => void\n\tremove?: () => void\n\tschema?: JsonSchema\n\tpath?: ReadonlyArray<number | string>\n\tisReadonly?: (path: ReadonlyArray<number | string>) => boolean\n\tisHidden?: (path: ReadonlyArray<number | string>) => boolean\n\tclassName?: string\n\tcustomCss?: SerializedStyles\n\tHeader?: FC<{ data: T; schema?: JsonSchema }>\n\tComponents?: Partial<JsonEditorComponents>\n}\n\nexport const JsonEditor = <T extends Json>({\n\tdata,\n\tset,\n\tschema = true,\n\tname,\n\trename,\n\tremove,\n\tisReadonly = () => false,\n\tisHidden = () => false,\n\t// isIllegal = () => false,\n\tclassName,\n\tcustomCss,\n\tHeader,\n\tComponents: CustomComponents = {},\n}: JsonEditorProps<T>): ReactElement => {\n\tconst Components = {\n\t\t...DEFAULT_JSON_EDITOR_COMPONENTS,\n\t\t...CustomComponents,\n\t}\n\n\tconst ajv = new Ajv({ allErrors: true, verbose: true })\n\tconst validate = useMemo(() => {\n\t\treturn ajv.compile(schema)\n\t}, [schema])\n\tconst validationResults = validate(data)\n\n\treturn (\n\t\t<JsonEditor_INTERNAL\n\t\t\tdata={data}\n\t\t\tset={set}\n\t\t\tname={name}\n\t\t\tschema={schema}\n\t\t\trename={rename}\n\t\t\tremove={remove}\n\t\t\tpath={[]}\n\t\t\tisReadonly={isReadonly}\n\t\t\tisHidden={isHidden}\n\t\t\tclassName={className}\n\t\t\tcustomCss={customCss}\n\t\t\tHeader={Header}\n\t\t\tComponents={Components}\n\t\t/>\n\t)\n}\n","import type { FC } from \"react\"\n\nimport type { JsonTypes } from \"~/packages/anvl/src/json\"\n\nimport { ArrayEditor } from \"./editors-by-type/array-editor\"\nimport { ObjectEditor } from \"./editors-by-type/object-editor\"\nimport {\n\tBooleanEditor,\n\tNullEditor,\n\tNumberEditor,\n\tStringEditor,\n} from \"./editors-by-type/primitive-editors\"\nimport type { JsonEditorProps_INTERNAL } from \"./json-editor-internal\"\n\nexport * from \"./default-components\"\nexport * from \"./developer-interface\"\n\nexport const SubEditors: Record<\n\tkeyof JsonTypes,\n\tFC<JsonEditorProps_INTERNAL<any>>\n> = {\n\tarray: ArrayEditor,\n\tboolean: BooleanEditor,\n\tnull: NullEditor,\n\tnumber: NumberEditor,\n\tobject: ObjectEditor,\n\tstring: StringEditor,\n}\n","import {\n\tundo,\n\ttype AtomToken,\n\ttype ReadonlySelectorToken,\n\ttype TimelineToken,\n\tredo,\n} from \"atom.io\"\nimport { useIO, useO } from \"atom.io/react\"\nimport { Fragment, type FC } from \"react\"\n\nimport { findTimelineState, findViewIsOpenState, timelineIndex } from \".\"\nimport { button } from \"./Button\"\nimport { article } from \"./Updates\"\nimport type { Timeline } from \"../internal\"\n\nexport const YouAreHere: FC = () => {\n\treturn <span className=\"you_are_here\">you are here</span>\n}\n\nexport const TimelineLog: FC<{\n\ttoken: TimelineToken\n\tisOpenState: AtomToken<boolean>\n\ttimelineState: ReadonlySelectorToken<Timeline>\n}> = ({ token, isOpenState, timelineState }) => {\n\tconst timeline = useO(timelineState)\n\tconst [isOpen, setIsOpen] = useIO(isOpenState)\n\n\treturn (\n\t\t<section className=\"node timeline_log\">\n\t\t\t<header>\n\t\t\t\t<button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />\n\t\t\t\t<label>\n\t\t\t\t\t<h2>{token.key}</h2>\n\t\t\t\t\t<span className=\"detail length\">\n\t\t\t\t\t\t({timeline.at}/{timeline.history.length})\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"gap\" />\n\t\t\t\t\t<nav>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={() => undo(token)}\n\t\t\t\t\t\t\tdisabled={timeline.at === 0}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tundo\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={() => redo(token)}\n\t\t\t\t\t\t\tdisabled={timeline.at === timeline.history.length}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tredo\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</nav>\n\t\t\t\t</label>\n\t\t\t</header>\n\t\t\t{isOpen ? (\n\t\t\t\t<main>\n\t\t\t\t\t{timeline.history.map((update, index) => (\n\t\t\t\t\t\t<Fragment key={update.key + index + timeline.at}>\n\t\t\t\t\t\t\t{index === timeline.at ? <YouAreHere /> : null}\n\t\t\t\t\t\t\t<article.TimelineUpdate timelineUpdate={update} />\n\t\t\t\t\t\t\t{index === timeline.history.length - 1 &&\n\t\t\t\t\t\t\ttimeline.at === timeline.history.length ? (\n\t\t\t\t\t\t\t\t<YouAreHere />\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t))}\n\t\t\t\t</main>\n\t\t\t) : null}\n\t\t</section>\n\t)\n}\n\nexport const TimelineIndex: FC = () => {\n\tconst tokenIds = useO(timelineIndex)\n\treturn (\n\t\t<article className=\"index timeline_index\">\n\t\t\t{tokenIds\n\t\t\t\t.filter((token) => !token.key.startsWith(`👁‍🗨`))\n\t\t\t\t.map((token) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TimelineLog\n\t\t\t\t\t\t\tkey={token.key}\n\t\t\t\t\t\t\ttoken={token}\n\t\t\t\t\t\t\tisOpenState={findViewIsOpenState(token.key)}\n\t\t\t\t\t\t\ttimelineState={findTimelineState(token.key)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t</article>\n\t)\n}\n","import type { ƒn } from \"~/packages/anvl/src/function\"\nimport { discoverType } from \"~/packages/anvl/src/refinement/refinery\"\n\nimport { prettyJson } from \".\"\nimport type { KeyedStateUpdate } from \"../subscribe\"\nimport type { TimelineUpdate } from \"../timeline\"\nimport type { TransactionUpdate } from \"../transaction\"\n\nconst AtomUpdateFC: React.FC<{\n\tserialNumber: number\n\tatomUpdate: KeyedStateUpdate<unknown>\n}> = ({ atomUpdate }) => {\n\treturn (\n\t\t<article\n\t\t\tkey={atomUpdate.key}\n\t\t\tclassName=\"node atom_update\"\n\t\t\tonClick={() => console.log(atomUpdate)}\n\t\t\tonKeyUp={() => console.log(atomUpdate)}\n\t\t>\n\t\t\t<span className=\"detail\">{atomUpdate.key}: </span>\n\t\t\t<span>\n\t\t\t\t<span className=\"summary\">\n\t\t\t\t\t{prettyJson.diff(atomUpdate.oldValue, atomUpdate.newValue).summary}\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</article>\n\t)\n}\n\nconst TransactionUpdateFC: React.FC<{\n\tserialNumber: number\n\ttransactionUpdate: TransactionUpdate<ƒn>\n}> = ({ serialNumber, transactionUpdate }) => {\n\treturn (\n\t\t<article className=\"node transaction_update\">\n\t\t\t<header>\n\t\t\t\t<h4>{serialNumber}</h4>\n\t\t\t</header>\n\t\t\t<main>\n\t\t\t\t<section className=\"transaction_params\">\n\t\t\t\t\t<span className=\"detail\">params: </span>\n\t\t\t\t\t{transactionUpdate.params.map((param, index) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<article\n\t\t\t\t\t\t\t\tkey={`param` + index}\n\t\t\t\t\t\t\t\tclassName=\"node transaction_param\"\n\t\t\t\t\t\t\t\tonClick={() => console.log(transactionUpdate)}\n\t\t\t\t\t\t\t\tonKeyUp={() => console.log(transactionUpdate)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span className=\"detail\">{discoverType(param)}: </span>\n\t\t\t\t\t\t\t\t<span className=\"summary\">\n\t\t\t\t\t\t\t\t\t{typeof param === `object` &&\n\t\t\t\t\t\t\t\t\t`type` in param &&\n\t\t\t\t\t\t\t\t\t`target` in param ? (\n\t\t\t\t\t\t\t\t\t\t<>{JSON.stringify(param.type)}</>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<>{JSON.stringify(param)}</>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</article>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</section>\n\t\t\t\t<section className=\"node transaction_output\">\n\t\t\t\t\t<span className=\"detail\">output: </span>\n\t\t\t\t\t<span className=\"detail\">\n\t\t\t\t\t\t{discoverType(transactionUpdate.output)}\n\t\t\t\t\t</span>\n\t\t\t\t\t{transactionUpdate.output ? (\n\t\t\t\t\t\t<span className=\"summary\">\n\t\t\t\t\t\t\t: {JSON.stringify(transactionUpdate.output)}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t</section>\n\t\t\t\t<section className=\"transaction_impact\">\n\t\t\t\t\t<span className=\"detail\">impact: </span>\n\t\t\t\t\t{transactionUpdate.atomUpdates\n\t\t\t\t\t\t.filter((token) => !token.key.startsWith(`👁‍🗨`))\n\t\t\t\t\t\t.map((atomUpdate, index) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<article.AtomUpdate\n\t\t\t\t\t\t\t\t\tkey={`${transactionUpdate.key}:${index}:${atomUpdate.key}`}\n\t\t\t\t\t\t\t\t\tserialNumber={index}\n\t\t\t\t\t\t\t\t\tatomUpdate={atomUpdate}\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</section>\n\t\t\t</main>\n\t\t</article>\n\t)\n}\n\nexport const TimelineUpdateFC: React.FC<{\n\ttimelineUpdate: TimelineUpdate\n}> = ({ timelineUpdate }) => {\n\treturn (\n\t\t<article className=\"node timeline_update\">\n\t\t\t<header>\n\t\t\t\t<h4>\n\t\t\t\t\t{timelineUpdate.timestamp}: {timelineUpdate.type} ({timelineUpdate.key}\n\t\t\t\t\t)\n\t\t\t\t</h4>\n\t\t\t</header>\n\t\t\t<main>\n\t\t\t\t{timelineUpdate.type === `transaction_update` ? (\n\t\t\t\t\ttimelineUpdate.atomUpdates\n\t\t\t\t\t\t.filter((token) => !token.key.startsWith(`👁‍🗨`))\n\t\t\t\t\t\t.map((atomUpdate, index) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<article.AtomUpdate\n\t\t\t\t\t\t\t\t\tkey={`${timelineUpdate.key}:${index}:${atomUpdate.key}`}\n\t\t\t\t\t\t\t\t\tserialNumber={index}\n\t\t\t\t\t\t\t\t\tatomUpdate={atomUpdate}\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) : timelineUpdate.type === `selector_update` ? (\n\t\t\t\t\ttimelineUpdate.atomUpdates\n\t\t\t\t\t\t.filter((token) => !token.key.startsWith(`👁‍🗨`))\n\t\t\t\t\t\t.map((atomUpdate, index) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<article.AtomUpdate\n\t\t\t\t\t\t\t\t\tkey={`${timelineUpdate.key}:${index}:${atomUpdate.key}`}\n\t\t\t\t\t\t\t\t\tserialNumber={index}\n\t\t\t\t\t\t\t\t\tatomUpdate={atomUpdate}\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) : timelineUpdate.type === `atom_update` ? (\n\t\t\t\t\t<article.AtomUpdate\n\t\t\t\t\t\tserialNumber={timelineUpdate.timestamp}\n\t\t\t\t\t\tatomUpdate={timelineUpdate}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t</main>\n\t\t</article>\n\t)\n}\n\nexport const article = {\n\tAtomUpdate: AtomUpdateFC,\n\tTransactionUpdate: TransactionUpdateFC,\n\tTimelineUpdate: TimelineUpdateFC,\n}\n","import type {\n\tAtomToken,\n\tReadonlySelectorToken,\n\tTransactionToken,\n\tTransactionUpdate,\n} from \"atom.io\"\nimport { useIO, useO } from \"atom.io/react\"\nimport type { FC } from \"react\"\n\nimport type { ƒn } from \"~/packages/anvl/src/function\"\n\nimport {\n\tfindTransactionLogState,\n\tfindViewIsOpenState,\n\ttransactionIndex,\n} from \".\"\nimport { button } from \"./Button\"\nimport { article } from \"./Updates\"\n\nexport const TransactionLog: FC<{\n\ttoken: TransactionToken<ƒn>\n\tisOpenState: AtomToken<boolean>\n\tlogState: ReadonlySelectorToken<TransactionUpdate<ƒn>[]>\n}> = ({ token, isOpenState, logState }) => {\n\tconst log = useO(logState)\n\tconst [isOpen, setIsOpen] = useIO(isOpenState)\n\n\treturn (\n\t\t<section className=\"node transaction_log\">\n\t\t\t<header>\n\t\t\t\t<button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />\n\t\t\t\t<label>\n\t\t\t\t\t<h2>{token.key}</h2>\n\t\t\t\t\t<span className=\"detail length\">({log.length})</span>\n\t\t\t\t</label>\n\t\t\t</header>\n\t\t\t{isOpen ? (\n\t\t\t\t<main>\n\t\t\t\t\t{log.map((update, index) => (\n\t\t\t\t\t\t<article.TransactionUpdate\n\t\t\t\t\t\t\tkey={update.key + index}\n\t\t\t\t\t\t\tserialNumber={index}\n\t\t\t\t\t\t\ttransactionUpdate={update}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</main>\n\t\t\t) : null}\n\t\t</section>\n\t)\n}\n\nexport const TransactionIndex: FC = () => {\n\tconst tokenIds = useO(transactionIndex)\n\treturn (\n\t\t<article className=\"index transaction_index\">\n\t\t\t{tokenIds\n\t\t\t\t.filter((token) => !token.key.startsWith(`👁‍🗨`))\n\t\t\t\t.map((token) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TransactionLog\n\t\t\t\t\t\t\tkey={token.key}\n\t\t\t\t\t\t\ttoken={token}\n\t\t\t\t\t\t\tisOpenState={findViewIsOpenState(token.key)}\n\t\t\t\t\t\t\tlogState={findTransactionLogState(token.key)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t</article>\n\t)\n}\n","import { isPlainObject } from \"~/packages/anvl/src/object\"\nimport { Refinery } from \"~/packages/anvl/src/refinement/refinery\"\nimport {\n\tdiffArray,\n\tdiffBoolean,\n\tdiffNumber,\n\tdiffObject,\n\tdiffString,\n\tDiffer,\n} from \"~/packages/anvl/src/tree/differ\"\n\nimport { atom, atomFamily } from \"..\"\nimport { attachIntrospectionStates } from \"../introspection\"\nimport { lazyLocalStorageEffect } from \"../web-effects\"\n\nexport * from \"./AtomIODevtools\"\n\nexport const {\n\tatomIndex,\n\tselectorIndex,\n\ttransactionIndex,\n\tfindTransactionLogState,\n\ttimelineIndex,\n\tfindTimelineState,\n} = attachIntrospectionStates()\n\nexport const devtoolsAreOpenState = atom<boolean>({\n\tkey: `👁‍🗨 Devtools Are Open`,\n\tdefault: true,\n\teffects: [lazyLocalStorageEffect(`👁‍🗨 Devtools Are Open`)],\n})\n\ntype DevtoolsView = `atoms` | `selectors` | `timelines` | `transactions`\n\nexport const devtoolsViewSelectionState = atom<DevtoolsView>({\n\tkey: `👁‍🗨 Devtools View Selection`,\n\tdefault: `atoms`,\n\teffects: [lazyLocalStorageEffect(`👁‍🗨 Devtools View`)],\n})\n\nexport const devtoolsViewOptionsState = atom<DevtoolsView[]>({\n\tkey: `👁‍🗨 Devtools View Options`,\n\tdefault: [`atoms`, `selectors`, `transactions`, `timelines`],\n\teffects: [lazyLocalStorageEffect(`👁‍🗨 Devtools View Options`)],\n})\n\nexport const findViewIsOpenState = atomFamily<boolean, string>({\n\tkey: `👁‍🗨 Devtools View Is Open`,\n\tdefault: false,\n\teffects: (key) => [lazyLocalStorageEffect(key + `:view-is-open`)],\n})\n\nexport const primitiveRefinery = new Refinery({\n\tnumber: (input: unknown): input is number => typeof input === `number`,\n\tstring: (input: unknown): input is string => typeof input === `string`,\n\tboolean: (input: unknown): input is boolean => typeof input === `boolean`,\n\tnull: (input: unknown): input is null => input === null,\n})\n\nexport const jsonTreeRefinery = new Refinery({\n\tobject: isPlainObject,\n\tarray: (input: unknown): input is unknown[] => Array.isArray(input),\n})\n\nexport const prettyJson = new Differ(primitiveRefinery, jsonTreeRefinery, {\n\tnumber: diffNumber,\n\tstring: diffString,\n\tboolean: diffBoolean,\n\tnull: () => ({ summary: `No Change` }),\n\tobject: diffObject,\n\tarray: diffArray,\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAAA,aAAY;;;ACArB,SAAS,QAAAC,aAAY;;;ACKd,IAAM,SAAS,CACrB,MAKA,OAAO,OAAO,CAAC,QAAW,IAAI,CAAY,GAAG;AAAA,EAC5C,IAAI,CAAC,QAAW,IAAI,CAAY;AACjC,CAAC;;;ACXK,IAAM,kBAAkB,CAC9B,QACmB,OAAO,QAAQ,GAAG;AAE/B,IAAM,kBAAkB,CAC9B,YACkB,OAAO,YAAY,OAAO;;;ACR7C,SAAS,YAAY;;;ACQd,IAAM,cAAyB,CAAC,UAAU,CAA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;AAAA,EACL,SAAS;AAAA,EACT,SAAS,CAAC,uBAAuB,wCAAqB,CAAC;AACxD,CAAC;AAEM,IAAM,2BAA2B,KAAqB;AAAA,EAC5D,KAAK;AAAA,EACL,SAAS,CAAC,SAAS,aAAa,gBAAgB,WAAW;AAAA,EAC3D,SAAS,CAAC,uBAAuB,gDAA6B,CAAC;AAChE,CAAC;AAEM,IAAM,sBAAsB,WAA4B;AAAA,EAC9D,KAAK;AAAA,EACL,SAAS;AAAA,EACT,SAAS,CAAC,QAAQ,CAAC,uBAAuB,MAAM,eAAe,CAAC;AACjE,CAAC;AAEM,IAAM,oBAAoB,IAAI,SAAS;AAAA,EAC7C,QAAQ,CAAC,UAAoC,OAAO,UAAU;AAAA,EAC9D,QAAQ,CAAC,UAAoC,OAAO,UAAU;AAAA,EAC9D,SAAS,CAAC,UAAqC,OAAO,UAAU;AAAA,EAChE,MAAM,CAAC,UAAkC,UAAU;AACpD,CAAC;AAEM,IAAM,mBAAmB,IAAI,SAAS;AAAA,EAC5C,QAAQ;AAAA,EACR,OAAO,CAAC,UAAuC,MAAM,QAAQ,KAAK;AACnE,CAAC;AAEM,IAAM,aAAa,IAAI,OAAO,mBAAmB,kBAAkB;AAAA,EACzE,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM,OAAO,EAAE,SAAS,YAAY;AAAA,EACpC,QAAQ;AAAA,EACR,OAAO;AACR,CAAC;","names":["pipe","pipe","a","a","pipe","path","node","result","e","a","b","_a","_a","_a","a","b","_a","a","b","join","pipe","pipe","isString","pipe","isString","map","_a","map","id","pipe","_a","_a","atom","timeline","_a","_a","pipe","isString","isString","_a","isJson","_a","_a","_b","state","atom","_a","atom","_a","__INTERNAL__","__INTERNAL__","__INTERNAL__","__INTERNAL__","__INTERNAL__","_a","__INTERNAL__","__INTERNAL__","__INTERNAL__","__INTERNAL__","useO","useIO","useRef","useO","useIO","isOpen","jsxDEV","_a","pipe","useState","useRef","jsxDEV","pipe","useState","useRef","_a","jsxDEV","jsxDEV","jsxDEV","jsxDEV","jsxDEV","useRef","isBoolean","isNumber","isString","pipe","pipe","isString","isString","isString","isString","isNumber","isBoolean","isString","isBoolean","node","refMap","_a","_a","_","Fragment","jsxDEV","_a","useRef","Fragment","jsxDEV","useState","jsxDEV","_a","jsxDEV","_a","jsxDEV","jsxDEV","jsxDEV","jsxDEV","Fragment","jsxDEV","_a","useIO","useO","useIO","useO","Fragment","Fragment","jsxDEV","jsxDEV","timeline","useO","useIO","Fragment","useIO","useO","jsxDEV","useO","useIO","Fragment","jsxDEV","useRef","useIO","useO"]}