@player-ui/context-plugin 0.16.0--canary.891.38194 → 0.16.0--canary.891.38216
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2502/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/dist/index.global.js","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/tapable-ts@0.2.4/node_modules/tapable-ts/src/utils.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/tapable-ts@0.2.4/node_modules/tapable-ts/src/index.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/utils.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/index.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/key.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/store.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/history.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/symbols.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/plugin.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/state-plugin.ts"],"names":["ContextPlugin","equalToOrIn","value","check","Array","isArray","includes","callTap","tap","args","ctx","context","callback","getContextPlugin","player","existing","findPlugin","ContextPluginSymbol","plugin","registerPlugin","__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","src_exports","StateContextPlugin","dataContextKey","defineContextKey","flowIdContextKey","flowStateContextKey","nameOfContextKey","playerStateContextKey","playerStatusContextKey","resolveContextKeySymbol","setDataActionKey","transitionActionKey","validationContextKey","viewContextKey","viewIdContextKey","InterceptionManager","interceptions","interceptionKeySet","Set","isUsed","length","intercept","int","push","keys","forEach","s","add","has","i","_a","_b","loop","error","err","Error","asError","result","r","done","Hook","taps","options","resolvedOptions","Symbol","before","insertionIndex","beforeSet","size","t","delete","splice","untap","filter","SyncHook","SyncWaterfallHook","rtn","rest","tapIndex","tapValue","KEY_NAMESPACE","description","symbol","for","k","keyFor","startsWith","slice","deepFreezeEntry","entry","freeze","tombstone","tombstoneFunctions","map","item","out","entries","v","ContextStore","Map","dependents","register","set","hasLiteral","literal","registerTransform","transform","previousSources","sources","src","stored","compute","Boolean","dependentsOf","sourceSymbol","targetSymbol","list","values","hasValue","hasTransform","meta","frozenEntries","computed","bySymbol","e","snapshot","flowId","endedAt","sym","reader","otherKey","ContextHistory","stack","clear","subscriptionCounter","_ContextPlugin","hooks","onSet","resolveValue","onRegister","onFlowFrozen","transforms","perKeySubs","globalSubs","tokenIndex","store","historyStack","apply","onStart","flow","currentFlowId","id","onEnd","Date","now","rotateStore","added","isFirstSighting","notify","dep","raw","resolved","subscribe","handler","token","nextToken","bucket","subscribeAll","unsubscribe","owner","history","setByName","ensureNamedKey","getByName","hasByName","subscribeByName","subscribeAllByName","validationController","publishValidation","byBinding","canTransition","getBindings","binding","getValidationForBinding","getAll","asString","severity","message","displayTarget","blocking","some","read","status","state","transition","view","data","model","validation","flowController","flowInstance","recordState","currentState","afterTransition","vc","viewController","initialView","onUpdate","dataController","setData","publish","serialize"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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gCAEA2B;4BACF;wBACF;oBACF;oBAEA7L,OAAOmJ,KAAA,CAAMwE,cAAA,CAAejO,GAAA,CAAI,IAAA,CAAKyB,IAAA,EAAM,SAACwM;wBAE1C,IAAMC,UAAyB,iBAAC3B,SAAS7M;4BACvCuO,eAAe1G,GAAA,CAAI;gCAAC;oCAACgF;oCAAS7M;iCAAM;6BAAC;wBACvC;wBACAQ,IAAIqH,GAAA,CAAIxE,kBAAkBmL;wBAE1B,IAAMC,UAAU;4BACdjO,IAAIqH,GAAA,CAAIhF,gBAAgB0L,eAAeG,SAAA;4BAEvCjC;wBACF;wBACA8B,eAAexE,KAAA,CAAMuE,QAAA,CAAShO,GAAA,CAAI,MAAKyB,IAAA,EAAM0M;wBAC7CA;oBACF;gBACF;;;;;IV8dA,OAAOhM,aAAaE;AACtB","sourcesContent":["\"use strict\";\nvar ContextPlugin = (() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/index.ts\n var src_exports = {};\n __export(src_exports, {\n ContextPlugin: () => ContextPlugin,\n ContextPluginSymbol: () => ContextPluginSymbol,\n StateContextPlugin: () => StateContextPlugin,\n dataContextKey: () => dataContextKey,\n defineContextKey: () => defineContextKey,\n flowIdContextKey: () => flowIdContextKey,\n flowStateContextKey: () => flowStateContextKey,\n getContextPlugin: () => getContextPlugin,\n nameOfContextKey: () => nameOfContextKey,\n playerStateContextKey: () => playerStateContextKey,\n playerStatusContextKey: () => playerStatusContextKey,\n resolveContextKeySymbol: () => resolveContextKeySymbol,\n setDataActionKey: () => setDataActionKey,\n transitionActionKey: () => transitionActionKey,\n validationContextKey: () => validationContextKey,\n viewContextKey: () => viewContextKey,\n viewIdContextKey: () => viewIdContextKey\n });\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/tapable-ts@0.2.4/node_modules/tapable-ts/dist/hooks.mjs\n function equalToOrIn(value, check) {\n if (Array.isArray(check)) {\n return check.includes(value);\n }\n return check === value;\n }\n function callTap(tap, args, ctx) {\n if (tap.context) {\n return tap.callback(ctx, ...args);\n }\n return tap.callback(...args);\n }\n var InterceptionManager = class {\n constructor() {\n this.interceptions = [];\n this.interceptionKeySet = /* @__PURE__ */ new Set();\n }\n isUsed() {\n return this.interceptions.length > 0;\n }\n intercept(int) {\n this.interceptions.push(int);\n Object.keys(int).forEach((s) => {\n this.interceptionKeySet.add(s);\n });\n }\n tap(tap) {\n if (this.interceptionKeySet.has(\"tap\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.tap) == null ? void 0 : _a.call(i, tap);\n });\n }\n }\n call(ctx, ...args) {\n if (this.interceptionKeySet.has(\"call\")) {\n this.interceptions.forEach((i) => {\n var _a, _b;\n if (i.context) {\n (_a = i.call) == null ? void 0 : _a.call(i, ctx, ...args);\n } else {\n (_b = i.call) == null ? void 0 : _b.call(i, ...args);\n }\n });\n }\n }\n loop(...args) {\n if (this.interceptionKeySet.has(\"loop\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.loop) == null ? void 0 : _a.call(i, ...args);\n });\n }\n }\n error(err) {\n if (this.interceptionKeySet.has(\"error\")) {\n if (err instanceof Error) {\n const asError = err;\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.error) == null ? void 0 : _a.call(i, asError);\n });\n }\n }\n }\n result(r) {\n if (this.interceptionKeySet.has(\"result\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.result) == null ? void 0 : _a.call(i, r);\n });\n }\n }\n done() {\n if (this.interceptionKeySet.has(\"done\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.done) == null ? void 0 : _a.call(i);\n });\n }\n }\n };\n var Hook = class {\n constructor() {\n this.taps = [];\n this.interceptions = new InterceptionManager();\n }\n tap(options, callback) {\n const resolvedOptions = typeof options === \"string\" ? {\n name: options,\n context: false\n } : {\n context: false,\n ...options\n };\n const key = Symbol(resolvedOptions.name);\n const tap = {\n key,\n ...resolvedOptions,\n callback\n };\n if (tap.before) {\n let insertionIndex = this.taps.length;\n const beforeSet = new Set(Array.isArray(tap.before) ? tap.before : [tap.before]);\n for (insertionIndex; insertionIndex > 0 && beforeSet.size > 0; insertionIndex--) {\n const t = this.taps[insertionIndex - 1];\n if (beforeSet.has(t.name)) {\n beforeSet.delete(t.name);\n }\n if (t.before && equalToOrIn(tap.name, t.before)) {\n break;\n }\n }\n this.taps.splice(insertionIndex, 0, tap);\n } else {\n this.taps.push(tap);\n }\n this.interceptions.tap(tap);\n return tap;\n }\n untap(tap) {\n this.taps = this.taps.filter((t) => t.key !== tap.key);\n }\n isUsed() {\n return this.taps.length > 0 || this.interceptions.isUsed();\n }\n intercept(int) {\n this.interceptions.intercept(int);\n }\n };\n var SyncHook = class extends Hook {\n call(...args) {\n if (!this.isUsed()) {\n return;\n }\n const ctx = {};\n this.interceptions.call(ctx, ...args);\n try {\n this.taps.forEach((t) => {\n callTap(t, args, ctx);\n });\n } catch (err) {\n this.interceptions.error(err);\n throw err;\n }\n this.interceptions.done();\n }\n };\n var SyncWaterfallHook = class extends Hook {\n call(...args) {\n const ctx = {};\n this.interceptions.call(ctx, ...args);\n let [rtn, ...rest] = args;\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const tapValue = callTap(this.taps[tapIndex], [rtn, ...rest], ctx);\n if (tapValue !== void 0) {\n rtn = tapValue;\n }\n }\n this.interceptions.result(rtn);\n return rtn;\n }\n };\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/key.ts\n var KEY_NAMESPACE = \"player-ui.context.\";\n var defineContextKey = (name, description) => ({\n symbol: Symbol.for(`${KEY_NAMESPACE}${name}`),\n description\n });\n var resolveContextKeySymbol = (name) => Symbol.for(`${KEY_NAMESPACE}${name}`);\n var nameOfContextKey = (key) => {\n const k = Symbol.keyFor(key.symbol);\n if (!k || !k.startsWith(KEY_NAMESPACE))\n return void 0;\n return k.slice(KEY_NAMESPACE.length);\n };\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/store.ts\n var deepFreezeEntry = (entry) => {\n Object.freeze(entry);\n return entry;\n };\n var tombstone = (description) => () => {\n throw new Error(\n `[ContextPlugin] Action \"${description}\" is no longer valid \\u2014 its flow has ended`\n );\n };\n var tombstoneFunctions = (value, description) => {\n if (typeof value === \"function\") {\n return tombstone(description);\n }\n if (Array.isArray(value)) {\n return value.map((item) => tombstoneFunctions(item, description));\n }\n if (value !== null && typeof value === \"object\") {\n const out = {};\n for (const [k, v] of Object.entries(value)) {\n out[k] = tombstoneFunctions(v, description);\n }\n return out;\n }\n return value;\n };\n var ContextStore = class {\n constructor() {\n this.entries = /* @__PURE__ */ new Map();\n /** source symbol -> set of target symbols (reverse index for invalidation). */\n this.dependents = /* @__PURE__ */ new Map();\n }\n register(key) {\n if (this.entries.has(key.symbol)) {\n return false;\n }\n this.entries.set(key.symbol, { key, hasLiteral: false });\n return true;\n }\n set(key, value) {\n const existing = this.entries.get(key.symbol);\n if (existing) {\n existing.hasLiteral = true;\n existing.literal = value;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: true,\n literal: value\n });\n }\n }\n registerTransform(key, transform) {\n const existing = this.entries.get(key.symbol);\n const previousSources = existing?.transform?.sources;\n if (previousSources) {\n for (const src of previousSources) {\n this.dependents.get(src.symbol)?.delete(key.symbol);\n }\n }\n const stored = {\n sources: transform.sources,\n compute: transform.compute\n };\n if (existing) {\n existing.transform = stored;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: false,\n transform: stored\n });\n }\n for (const src of transform.sources) {\n let set = this.dependents.get(src.symbol);\n if (!set) {\n set = /* @__PURE__ */ new Set();\n this.dependents.set(src.symbol, set);\n }\n set.add(key.symbol);\n }\n return { previousSources };\n }\n get(key) {\n return this.compute(key.symbol);\n }\n has(key) {\n const entry = this.entries.get(key.symbol);\n return Boolean(entry && (entry.hasLiteral || entry.transform));\n }\n /** Return the keys that depend on the given source key (direct dependents only). */\n dependentsOf(sourceSymbol) {\n const set = this.dependents.get(sourceSymbol);\n if (!set || set.size === 0) {\n return [];\n }\n const out = [];\n for (const targetSymbol of set) {\n const target = this.entries.get(targetSymbol);\n if (target) {\n out.push(target.key);\n }\n }\n return out;\n }\n list() {\n const out = [];\n for (const entry of this.entries.values()) {\n out.push({\n symbol: entry.key.symbol,\n description: entry.key.description,\n hasValue: entry.hasLiteral,\n hasTransform: Boolean(entry.transform)\n });\n }\n return out;\n }\n freeze(meta) {\n const frozenEntries = [];\n for (const entry of this.entries.values()) {\n if (!entry.hasLiteral && !entry.transform) {\n continue;\n }\n const computed = this.compute(entry.key.symbol);\n const value = tombstoneFunctions(computed, entry.key.description);\n frozenEntries.push(\n deepFreezeEntry({\n symbol: entry.key.symbol,\n name: nameOfContextKey(entry.key),\n description: entry.key.description,\n value\n })\n );\n }\n const bySymbol = new Map(frozenEntries.map((e) => [e.symbol, e.value]));\n const snapshot = {\n flowId: meta.flowId,\n endedAt: meta.endedAt,\n entries: Object.freeze(frozenEntries),\n get(key) {\n return bySymbol.get(key.symbol);\n }\n };\n return Object.freeze(snapshot);\n }\n compute(sym) {\n const entry = this.entries.get(sym);\n if (!entry)\n return void 0;\n if (entry.hasLiteral)\n return entry.literal;\n if (!entry.transform)\n return void 0;\n const reader = (otherKey) => this.compute(otherKey.symbol);\n return entry.transform.compute(reader);\n }\n };\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/history.ts\n var ContextHistory = class {\n constructor() {\n this.stack = [];\n }\n push(snapshot) {\n this.stack.push(snapshot);\n }\n entries() {\n return this.stack;\n }\n size() {\n return this.stack.length;\n }\n clear() {\n this.stack = [];\n }\n };\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/symbols.ts\n var ContextPluginSymbol = Symbol.for(\"ContextPlugin\");\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/plugin.ts\n var subscriptionCounter = 0;\n var _ContextPlugin = class _ContextPlugin {\n constructor() {\n this.name = \"context\";\n this.symbol = _ContextPlugin.Symbol;\n this.hooks = {\n onSet: new SyncHook(),\n resolveValue: new SyncWaterfallHook(),\n onRegister: new SyncHook(),\n onFlowFrozen: new SyncHook()\n };\n this.transforms = /* @__PURE__ */ new Map();\n this.perKeySubs = /* @__PURE__ */ new Map();\n this.globalSubs = /* @__PURE__ */ new Map();\n this.tokenIndex = /* @__PURE__ */ new Map();\n this.store = new ContextStore();\n this.historyStack = new ContextHistory();\n }\n apply(player) {\n const existing = player.findPlugin(ContextPluginSymbol);\n if (existing !== void 0 && existing !== this) {\n this.store = existing.store;\n this.historyStack = existing.historyStack;\n this.transforms = existing.transforms;\n this.perKeySubs = existing.perKeySubs;\n this.globalSubs = existing.globalSubs;\n this.tokenIndex = existing.tokenIndex;\n return;\n }\n player.hooks.onStart.tap(this.name, (flow) => {\n this.currentFlowId = flow?.id;\n });\n player.hooks.onEnd.tap(this.name, () => {\n const snapshot = this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now()\n });\n this.historyStack.push(snapshot);\n this.hooks.onFlowFrozen.call(snapshot);\n this.rotateStore();\n this.currentFlowId = void 0;\n });\n }\n register(key) {\n const added = this.store.register(key);\n if (added) {\n this.hooks.onRegister.call(key);\n }\n }\n set(key, value) {\n const isFirstSighting = !this.store.has(key);\n this.store.set(key, value);\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n this.notify(key, value);\n const dependents = this.store.dependentsOf(key.symbol);\n for (const dep of dependents) {\n const computed = this.store.get(dep);\n this.notify(dep, computed);\n }\n }\n get(key) {\n const raw = this.store.get(key);\n const resolved = this.hooks.resolveValue.call(raw, key);\n return resolved;\n }\n has(key) {\n return this.store.has(key);\n }\n registerTransform(key, transform) {\n const isFirstSighting = !this.store.has(key);\n this.store.registerTransform(key, transform);\n this.transforms.set(key.symbol, {\n key,\n transform: {\n sources: transform.sources,\n compute: transform.compute\n }\n });\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n }\n subscribe(key, handler) {\n const token = this.nextToken();\n let bucket = this.perKeySubs.get(key.symbol);\n if (!bucket) {\n bucket = /* @__PURE__ */ new Map();\n this.perKeySubs.set(key.symbol, bucket);\n }\n bucket.set(token, handler);\n this.tokenIndex.set(token, key.symbol);\n return token;\n }\n subscribeAll(handler) {\n const token = this.nextToken();\n this.globalSubs.set(token, handler);\n this.tokenIndex.set(token, void 0);\n return token;\n }\n unsubscribe(token) {\n const owner = this.tokenIndex.get(token);\n if (owner === void 0) {\n this.globalSubs.delete(token);\n } else {\n this.perKeySubs.get(owner)?.delete(token);\n }\n this.tokenIndex.delete(token);\n }\n list() {\n return this.store.list();\n }\n history() {\n return this.historyStack.entries();\n }\n snapshot() {\n return this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now()\n });\n }\n /**\n * Bridge-friendly: set a value by string name. Used by native wrappers that\n * cannot construct a `ContextKey` object directly.\n */\n setByName(name, description, value) {\n this.set(this.ensureNamedKey(name, description), value);\n }\n /** Bridge-friendly: get a value by string name. */\n getByName(name) {\n return this.get(this.ensureNamedKey(name));\n }\n /** Bridge-friendly: check presence by string name. */\n hasByName(name) {\n return this.has(this.ensureNamedKey(name));\n }\n /** Bridge-friendly: subscribe by string name. */\n subscribeByName(name, description, handler) {\n return this.subscribe(\n this.ensureNamedKey(name, description),\n (value) => handler(value, name)\n );\n }\n /**\n * Bridge-friendly: subscribe to all updates. The handler receives the\n * key's resolved name (or undefined for non-namespaced keys).\n */\n subscribeAllByName(handler) {\n return this.subscribeAll(\n (value, key) => handler(value, nameOfContextKey(key), key.description)\n );\n }\n ensureNamedKey(name, description) {\n return defineContextKey(name, description ?? name);\n }\n notify(key, value) {\n this.hooks.onSet.call(key, value);\n const bucket = this.perKeySubs.get(key.symbol);\n if (bucket) {\n for (const handler of bucket.values()) {\n handler(value, key);\n }\n }\n for (const handler of this.globalSubs.values()) {\n handler(value, key);\n }\n }\n rotateStore() {\n this.store = new ContextStore();\n for (const { key, transform } of this.transforms.values()) {\n this.store.registerTransform(key, transform);\n }\n }\n nextToken() {\n subscriptionCounter += 1;\n return `ctx_${subscriptionCounter}`;\n }\n };\n _ContextPlugin.Symbol = ContextPluginSymbol;\n var ContextPlugin = _ContextPlugin;\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/utils.ts\n function getContextPlugin(player) {\n const existing = player.findPlugin(ContextPluginSymbol);\n const plugin = existing ?? new ContextPlugin();\n if (!existing) {\n player.registerPlugin(plugin);\n }\n return plugin;\n }\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/state-plugin.ts\n var flowIdContextKey = defineContextKey(\n \"player.flow.id\",\n \"Identifier of the running flow\"\n );\n var flowStateContextKey = defineContextKey(\n \"player.flow.state\",\n \"Name of the current FSM state in the running flow\"\n );\n var viewIdContextKey = defineContextKey(\n \"player.view.id\",\n \"Identifier of the currently-resolved view\"\n );\n var viewContextKey = defineContextKey(\n \"player.view\",\n \"Full resolved view object for the current FSM state\"\n );\n var dataContextKey = defineContextKey(\n \"player.data\",\n \"Full data model tree for the running flow\"\n );\n var playerStatusContextKey = defineContextKey(\n \"player.status\",\n \"Player flow status: not-started, in-progress, completed, or error\"\n );\n var validationContextKey = defineContextKey(\n \"player.validation\",\n \"Validation state for the running view, keyed by binding\"\n );\n var setDataActionKey = defineContextKey(\n \"player.data.set\",\n \"Set a value in the Player data model at the given binding\"\n );\n var transitionActionKey = defineContextKey(\n \"player.flow.transition\",\n \"Transition the current flow using the given transition value\"\n );\n var playerStateContextKey = defineContextKey(\n \"player.state\",\n \"Aggregated snapshot of every Player runtime context entry\"\n );\n var StateContextPlugin = class {\n constructor() {\n this.name = \"state-context\";\n }\n apply(player) {\n const ctx = getContextPlugin(player);\n let validationController;\n const publishValidation = () => {\n if (!validationController)\n return;\n const byBinding = {};\n let canTransition = true;\n validationController.getBindings().forEach((binding) => {\n const all = validationController.getValidationForBinding(binding)?.getAll() ?? [];\n if (all.length === 0)\n return;\n byBinding[binding.asString()] = all.map((v) => ({\n severity: v.severity,\n message: v.message,\n displayTarget: v.displayTarget,\n blocking: v.blocking\n }));\n if (all.some((v) => v.blocking)) {\n canTransition = false;\n }\n });\n ctx.set(validationContextKey, { canTransition, byBinding });\n };\n ctx.register(flowIdContextKey);\n ctx.register(flowStateContextKey);\n ctx.register(viewIdContextKey);\n ctx.register(viewContextKey);\n ctx.register(dataContextKey);\n ctx.register(playerStatusContextKey);\n ctx.register(validationContextKey);\n ctx.register(setDataActionKey);\n ctx.register(transitionActionKey);\n ctx.registerTransform(playerStateContextKey, {\n sources: [\n flowIdContextKey,\n flowStateContextKey,\n viewIdContextKey,\n viewContextKey,\n dataContextKey,\n playerStatusContextKey,\n validationContextKey,\n setDataActionKey,\n transitionActionKey\n ],\n compute: (read) => ({\n status: read(playerStatusContextKey),\n flow: {\n id: read(flowIdContextKey),\n state: read(flowStateContextKey),\n transition: read(transitionActionKey)\n },\n view: {\n id: read(viewIdContextKey),\n resolved: read(viewContextKey)\n },\n data: {\n model: read(dataContextKey),\n set: read(setDataActionKey)\n },\n validation: read(validationContextKey) ?? {\n canTransition: true,\n byBinding: {}\n }\n })\n });\n player.hooks.onStart.tap(this.name, (flow) => {\n if (flow?.id) {\n ctx.set(flowIdContextKey, flow.id);\n }\n });\n player.hooks.state.tap(this.name, (state) => {\n ctx.set(playerStatusContextKey, state.status);\n });\n player.hooks.flowController.tap(this.name, (flowController) => {\n const transition = (value) => flowController.transition(value);\n ctx.set(transitionActionKey, transition);\n flowController.hooks.flow.tap(this.name, (flowInstance) => {\n const recordState = () => {\n const name = flowInstance.currentState?.name;\n if (name) {\n ctx.set(flowStateContextKey, name);\n }\n };\n recordState();\n flowInstance.hooks.afterTransition.tap(this.name, recordState);\n });\n });\n player.hooks.validationController.tap(this.name, (vc) => {\n validationController = vc;\n publishValidation();\n });\n player.hooks.viewController.tap(this.name, (viewController) => {\n viewController.hooks.view.tap(this.name, (view) => {\n const id = view.initialView?.id;\n if (id) {\n ctx.set(viewIdContextKey, id);\n }\n view.hooks.onUpdate.tap(this.name, (resolved) => {\n ctx.set(viewContextKey, resolved);\n if (resolved?.id) {\n ctx.set(viewIdContextKey, resolved.id);\n }\n publishValidation();\n });\n });\n });\n player.hooks.dataController.tap(this.name, (dataController) => {\n const setData = (binding, value) => {\n dataController.set([[binding, value]]);\n };\n ctx.set(setDataActionKey, setData);\n const publish = () => {\n ctx.set(dataContextKey, dataController.serialize());\n publishValidation();\n };\n dataController.hooks.onUpdate.tap(this.name, publish);\n publish();\n });\n }\n };\n return __toCommonJS(src_exports);\n})();\n","/**\n * Checks if `value` is equal to `check` if `check` is a string or in `check` if check is an Array\n *\n * @param value - the value being searched for\n * @param check - the values to check against\n * @returns `boolean`\n */\nexport function equalToOrIn(value: string, check: string | Array<string>) {\n if (Array.isArray(check)) {\n return check.includes(value);\n }\n\n return check === value;\n}\n","import { equalToOrIn } from \"./utils\";\n\nexport type Interceptor<Args extends any[], ReturnType, ContextType> = {\n /** An optional name for the interceptor */\n name?: string;\n /** Callback for each loop when used by the hook */\n loop?: (...args: Args) => void;\n /** Callback when an error occurs during the hook's call */\n error?: (err: Error) => void;\n /** Callback when a result is found for a hook's invocation */\n result?: (\n r: ReturnType extends Promise<infer AwaitedValue>\n ? AwaitedValue\n : ReturnType\n ) => void;\n /** Callback when a hook's call is complete */\n done?: () => void;\n /** Callback when a hook is tapped */\n tap?: (tap: Tap<Args, ReturnType, ContextType>) => void;\n} & (\n | {\n /** If context should be omitted from the 'call'. This is the default */\n context?: false;\n /** Callback when the hook is tapped without context */\n call?: (...args: Args) => void;\n }\n | {\n /** If context should be included in the 'call' */\n context: true;\n /** Callback when the hook is tapped with context */\n call?: (context: ContextType, ...args: Args) => void;\n }\n);\n\nexport type Tap<Args extends any[], ReturnType, ContextType = unknown> = {\n key: symbol;\n name: string;\n before?: string | Array<string>;\n} & (\n | {\n context: false;\n callback: (...args: Args) => ReturnType;\n }\n | {\n context: true;\n callback: (context: ContextType, ...args: Args) => ReturnType;\n }\n);\n\ntype BasicTap<Args extends any[], ReturnType, ContextType> = (\n name: string,\n callback: (...args: Args) => ReturnType,\n before?: string | Array<string>\n) => Tap<Args, ReturnType, ContextType>;\n\ntype TapWithContext<Args extends any[], ReturnType, ContextType> =\n | ((\n options: {\n name: string;\n context?: false;\n before?: string | Array<string>;\n },\n callback: (...args: Args) => ReturnType\n ) => Tap<Args, ReturnType>)\n | ((\n options: {\n name: string;\n context: true;\n before?: string | Array<string>;\n },\n callback: (context: ContextType, ...args: Args) => ReturnType\n ) => Tap<Args, ReturnType>);\n\ninterface SyncBaseHookType<Args extends any[], ReturnType, ContextType> {\n tap:\n | BasicTap<Args, ReturnType, ContextType>\n | TapWithContext<Args, ReturnType, ContextType>;\n call(...args: Args): void;\n untap(key: Tap<Args, ReturnType>): void;\n isUsed(): boolean;\n intercept(int: Interceptor<Args, ReturnType, ContextType>): void;\n}\n\nfunction callTap<Args extends any[], ReturnType, ContextType>(\n tap: Tap<Args, ReturnType, ContextType>,\n args: Args,\n ctx: ContextType\n) {\n if (tap.context) {\n return tap.callback(ctx, ...args);\n }\n\n return tap.callback(...args);\n}\n\n/** A manager for all intercepts inside of a tap */\nclass InterceptionManager<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> {\n protected interceptions: Array<Interceptor<Args, ReturnType, ContextType>>;\n private interceptionKeySet: Set<\n keyof Interceptor<Args, ReturnType, ContextType>\n >;\n\n constructor() {\n this.interceptions = [];\n this.interceptionKeySet = new Set();\n }\n\n isUsed() {\n return this.interceptions.length > 0;\n }\n\n intercept(int: Interceptor<Args, ReturnType, ContextType>): void {\n this.interceptions.push(int);\n Object.keys(int).forEach((s) => {\n this.interceptionKeySet.add(s as any);\n });\n }\n\n tap(tap: Tap<Args, ReturnType, ContextType>): void {\n if (this.interceptionKeySet.has(\"tap\")) {\n this.interceptions.forEach((i) => {\n i.tap?.(tap);\n });\n }\n }\n\n call(ctx: ContextType, ...args: Args): void {\n if (this.interceptionKeySet.has(\"call\")) {\n this.interceptions.forEach((i) => {\n if (i.context) {\n i.call?.(ctx, ...args);\n } else {\n i.call?.(...args);\n }\n });\n }\n }\n\n loop(...args: Args): void {\n if (this.interceptionKeySet.has(\"loop\")) {\n this.interceptions.forEach((i) => {\n i.loop?.(...args);\n });\n }\n }\n\n error(err: unknown): void {\n if (this.interceptionKeySet.has(\"error\")) {\n if (err instanceof Error) {\n const asError: Error = err;\n this.interceptions.forEach((i) => {\n i.error?.(asError);\n });\n }\n }\n }\n\n result(\n r: ReturnType extends Promise<infer AwaitedValue>\n ? AwaitedValue\n : ReturnType\n ): void {\n if (this.interceptionKeySet.has(\"result\")) {\n this.interceptions.forEach((i) => {\n i.result?.(r);\n });\n }\n }\n\n done(): void {\n if (this.interceptionKeySet.has(\"done\")) {\n this.interceptions.forEach((i) => {\n i.done?.();\n });\n }\n }\n}\n\nabstract class Hook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> implements SyncBaseHookType<Args, ReturnType, ContextType>\n{\n protected taps: Array<Tap<Args, ReturnType, ContextType>>;\n protected interceptions: InterceptionManager<Args, ReturnType, ContextType>;\n\n constructor() {\n this.taps = [];\n this.interceptions = new InterceptionManager<\n Args,\n ReturnType,\n ContextType\n >();\n }\n\n public tap(\n options: { name: string; context?: false; before?: string | Array<string> },\n callback: (...args: Args) => ReturnType\n ): Tap<Args, ReturnType, ContextType>;\n\n public tap(\n options: { name: string; context: true; before?: string | Array<string> },\n callback: (ctx: ContextType, ...args: Args) => ReturnType\n ): Tap<Args, ReturnType, ContextType>;\n\n public tap(\n name: string,\n callback: (...args: Args) => ReturnType\n ): Tap<Args, ReturnType, ContextType>;\n\n public tap(options: any, callback: any): Tap<Args, ReturnType, ContextType> {\n const resolvedOptions =\n typeof options === \"string\"\n ? {\n name: options,\n context: false,\n }\n : {\n context: false,\n ...options,\n };\n\n const key = Symbol(resolvedOptions.name);\n const tap: Tap<Args, ReturnType, ContextType> = {\n key,\n ...resolvedOptions,\n callback,\n };\n\n if (tap.before) {\n let insertionIndex = this.taps.length;\n const beforeSet = new Set(\n Array.isArray(tap.before) ? tap.before : [tap.before]\n );\n for (\n insertionIndex;\n insertionIndex > 0 && beforeSet.size > 0;\n insertionIndex--\n ) {\n const t = this.taps[insertionIndex - 1];\n if (beforeSet.has(t.name)) {\n beforeSet.delete(t.name);\n }\n\n if (t.before && equalToOrIn(tap.name, t.before)) {\n break;\n }\n }\n\n this.taps.splice(insertionIndex, 0, tap);\n } else {\n this.taps.push(tap);\n }\n\n this.interceptions.tap(tap);\n\n return tap;\n }\n\n abstract call(...args: Args): ReturnType;\n\n public untap(tap: Tap<Args, ReturnType, ContextType>) {\n this.taps = this.taps.filter((t) => t.key !== tap.key);\n }\n\n public isUsed() {\n return this.taps.length > 0 || this.interceptions.isUsed();\n }\n\n public intercept(int: Interceptor<Args, ReturnType, ContextType>): void {\n this.interceptions.intercept(int);\n }\n}\n\nexport class SyncHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, void, ContextType> {\n public call(...args: Args) {\n if (!this.isUsed()) {\n return;\n }\n\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n this.taps.forEach((t) => {\n callTap(t, args, ctx);\n });\n } catch (err: unknown) {\n this.interceptions.error(err);\n\n throw err;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class SyncBailHook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> extends Hook<Args, ReturnType | undefined | null, ContextType> {\n public call(...args: Args): ReturnType | undefined | null {\n if (!this.isUsed()) {\n return;\n }\n\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = callTap(this.taps[tapIndex], args, ctx);\n if (rtn !== undefined) {\n this.interceptions.result(rtn as any);\n return rtn;\n }\n }\n\n this.interceptions.done();\n }\n}\n\nexport class SyncWaterfallHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Args[0], ContextType> {\n public call(...args: Args): Args[0] {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n // eslint-disable-next-line prefer-const\n let [rtn, ...rest] = args;\n\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const tapValue = callTap(this.taps[tapIndex], [rtn, ...rest] as any, ctx);\n if (tapValue !== undefined) {\n rtn = tapValue;\n }\n }\n\n this.interceptions.result(rtn);\n\n return rtn;\n }\n}\n\nexport class SyncLoopHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, void, ContextType> {\n public call(...args: Args) {\n let finished = false;\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n while (finished !== true) {\n finished = true;\n this.interceptions.loop(...args);\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = callTap(this.taps[tapIndex], args, ctx);\n\n if (rtn !== undefined) {\n finished = false;\n break;\n }\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class AsyncParallelHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<void>, ContextType> {\n public async call(...args: Args): Promise<void> {\n const ctx: ContextType = {} as any;\n this.interceptions.call(ctx, ...args);\n\n await Promise.allSettled(this.taps.map((tap) => callTap(tap, args, ctx)));\n this.interceptions.done();\n }\n}\n\nexport class AsyncParallelBailHook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<ReturnType>, ContextType> {\n public async call(...args: Args): Promise<ReturnType> {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n const rtn = await Promise.race(\n this.taps.map((tap) => callTap(tap, args, ctx))\n );\n\n this.interceptions.result(rtn as any);\n return rtn;\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n }\n}\n\nexport class AsyncSeriesHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<void>, ContextType> {\n public async call(...args: Args): Promise<void> {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n await callTap(this.taps[tapIndex], args, ctx);\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class AsyncSeriesBailHook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<ReturnType | undefined | null>, ContextType> {\n public async call(...args: Args): Promise<ReturnType | undefined | null> {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = await callTap(this.taps[tapIndex], args, ctx);\n if (rtn !== undefined) {\n this.interceptions.result(rtn);\n return rtn;\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class AsyncSeriesWaterfallHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<Args[0]>, ContextType> {\n public async call(...args: Args): Promise<Args[0]> {\n // eslint-disable-next-line prefer-const\n let [rtn, ...rest] = args;\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const tapValue = await callTap(\n this.taps[tapIndex],\n [rtn, ...rest] as any,\n ctx\n );\n if (tapValue !== undefined) {\n rtn = tapValue;\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.result(rtn);\n\n return rtn;\n }\n}\n\nexport class AsyncSeriesLoopHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<void>, ContextType> {\n public async call(...args: Args): Promise<void> {\n let finished = false;\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n while (finished !== true) {\n finished = true;\n this.interceptions.loop(...args);\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = await callTap(this.taps[tapIndex], args, ctx);\n\n if (rtn !== undefined) {\n finished = false;\n break;\n }\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n","import type { Player } from \"@player-ui/player\";\nimport { ContextPlugin } from \"./plugin\";\nimport { ContextPluginSymbol } from \"./symbols\";\n\n/**\n * Returns the existing ContextPlugin or creates and registers a new one.\n */\nexport function getContextPlugin(player: Player): ContextPlugin {\n const existing = player.findPlugin<ContextPlugin>(ContextPluginSymbol);\n const plugin = existing ?? new ContextPlugin();\n\n if (!existing) {\n player.registerPlugin(plugin);\n }\n\n return plugin;\n}\n","export * from \"./plugin\";\nexport * from \"./symbols\";\nexport * from \"./types\";\nexport * from \"./key\";\nexport * from \"./utils\";\nexport * from \"./state-plugin\";\n","import type { ContextKey } from \"./types\";\n\nconst KEY_NAMESPACE = \"player-ui.context.\";\n\n/**\n * Create a typed, globally-identifiable context key.\n *\n * Identity is backed by `Symbol.for`, so two keys created with the same `name`\n * in different bundles refer to the same store entry. The `description` is the\n * human-readable label used by introspection consumers.\n */\nexport const defineContextKey = <Value>(\n name: string,\n description: string,\n): ContextKey<Value> => ({\n symbol: Symbol.for(`${KEY_NAMESPACE}${name}`),\n description,\n});\n\n/**\n * Resolve the global symbol for a context key name. Used by native wrappers\n * that cross the JS bridge with string names instead of JS symbols.\n */\nexport const resolveContextKeySymbol = (name: string): symbol =>\n Symbol.for(`${KEY_NAMESPACE}${name}`);\n\n/**\n * Reverse-derive the name from a key created via `defineContextKey`. Returns\n * `undefined` if the key's symbol was not created in the context namespace.\n */\nexport const nameOfContextKey = (key: ContextKey): string | undefined => {\n const k = Symbol.keyFor(key.symbol);\n if (!k || !k.startsWith(KEY_NAMESPACE)) return undefined;\n return k.slice(KEY_NAMESPACE.length);\n};\n","import type {\n ContextEntryDescriptor,\n ContextKey,\n ContextTransform,\n FrozenContextEntry,\n FrozenContextSnapshot,\n} from \"./types\";\nimport { nameOfContextKey } from \"./key\";\n\ntype Entry = {\n key: ContextKey;\n hasLiteral: boolean;\n literal?: unknown;\n transform?: ContextTransform<unknown>;\n};\n\nconst deepFreezeEntry = (entry: FrozenContextEntry): FrozenContextEntry => {\n Object.freeze(entry);\n return entry;\n};\n\n/**\n * A poisoned stand-in for a function captured into a history snapshot. The\n * key and description survive in the snapshot — the capability *existed* —\n * but the callable is dead: invoking it throws because the flow it was bound\n * to has ended. This preserves the distinction between \"context that never\n * held this action\" and \"an action that is no longer valid\".\n */\nconst tombstone = (description: string) => (): never => {\n throw new Error(\n `[ContextPlugin] Action \"${description}\" is no longer valid — its flow has ended`,\n );\n};\n\n/**\n * Recursively replace every function in [value] (top-level or nested) with a\n * {@link tombstone}, so a frozen history snapshot carries no live callables.\n */\nconst tombstoneFunctions = (value: unknown, description: string): unknown => {\n if (typeof value === \"function\") {\n return tombstone(description);\n }\n if (Array.isArray(value)) {\n return value.map((item) => tombstoneFunctions(item, description));\n }\n if (value !== null && typeof value === \"object\") {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(value)) {\n out[k] = tombstoneFunctions(v, description);\n }\n return out;\n }\n return value;\n};\n\n/**\n * Mutable per-flow context store. Owned by a single flow lifecycle; the plugin\n * rotates the store on flow end and freezes the prior one into a snapshot.\n */\nexport class ContextStore {\n private entries = new Map<symbol, Entry>();\n /** source symbol -> set of target symbols (reverse index for invalidation). */\n private dependents = new Map<symbol, Set<symbol>>();\n\n register(key: ContextKey): boolean {\n if (this.entries.has(key.symbol)) {\n return false;\n }\n this.entries.set(key.symbol, { key, hasLiteral: false });\n return true;\n }\n\n set<Value>(key: ContextKey<Value>, value: Value): void {\n const existing = this.entries.get(key.symbol);\n if (existing) {\n existing.hasLiteral = true;\n existing.literal = value;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: true,\n literal: value,\n });\n }\n }\n\n registerTransform<Value>(\n key: ContextKey<Value>,\n transform: ContextTransform<Value>,\n ): { previousSources?: ReadonlyArray<ContextKey> } {\n const existing = this.entries.get(key.symbol);\n const previousSources = existing?.transform?.sources;\n\n if (previousSources) {\n for (const src of previousSources) {\n this.dependents.get(src.symbol)?.delete(key.symbol);\n }\n }\n\n const stored: ContextTransform<unknown> = {\n sources: transform.sources,\n compute: transform.compute as ContextTransform<unknown>[\"compute\"],\n };\n\n if (existing) {\n existing.transform = stored;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: false,\n transform: stored,\n });\n }\n\n for (const src of transform.sources) {\n let set = this.dependents.get(src.symbol);\n if (!set) {\n set = new Set();\n this.dependents.set(src.symbol, set);\n }\n set.add(key.symbol);\n }\n\n return { previousSources };\n }\n\n get<Value>(key: ContextKey<Value>): Value | undefined {\n return this.compute(key.symbol) as Value | undefined;\n }\n\n has(key: ContextKey): boolean {\n const entry = this.entries.get(key.symbol);\n return Boolean(entry && (entry.hasLiteral || entry.transform));\n }\n\n /** Return the keys that depend on the given source key (direct dependents only). */\n dependentsOf(sourceSymbol: symbol): ReadonlyArray<ContextKey> {\n const set = this.dependents.get(sourceSymbol);\n if (!set || set.size === 0) {\n return [];\n }\n const out: ContextKey[] = [];\n for (const targetSymbol of set) {\n const target = this.entries.get(targetSymbol);\n if (target) {\n out.push(target.key);\n }\n }\n return out;\n }\n\n list(): ReadonlyArray<ContextEntryDescriptor> {\n const out: ContextEntryDescriptor[] = [];\n for (const entry of this.entries.values()) {\n out.push({\n symbol: entry.key.symbol,\n description: entry.key.description,\n hasValue: entry.hasLiteral,\n hasTransform: Boolean(entry.transform),\n });\n }\n return out;\n }\n\n freeze(meta: { flowId?: string; endedAt: number }): FrozenContextSnapshot {\n const frozenEntries: FrozenContextEntry[] = [];\n for (const entry of this.entries.values()) {\n if (!entry.hasLiteral && !entry.transform) {\n continue;\n }\n const computed = this.compute(entry.key.symbol);\n const value = tombstoneFunctions(computed, entry.key.description);\n frozenEntries.push(\n deepFreezeEntry({\n symbol: entry.key.symbol,\n name: nameOfContextKey(entry.key),\n description: entry.key.description,\n value,\n }),\n );\n }\n const bySymbol = new Map(frozenEntries.map((e) => [e.symbol, e.value]));\n const snapshot: FrozenContextSnapshot = {\n flowId: meta.flowId,\n endedAt: meta.endedAt,\n entries: Object.freeze(frozenEntries),\n get<Value>(key: ContextKey<Value>): Value | undefined {\n return bySymbol.get(key.symbol) as Value | undefined;\n },\n };\n return Object.freeze(snapshot);\n }\n\n private compute(sym: symbol): unknown {\n const entry = this.entries.get(sym);\n if (!entry) return undefined;\n if (entry.hasLiteral) return entry.literal;\n if (!entry.transform) return undefined;\n const reader = <V>(otherKey: { symbol: symbol }): V | undefined =>\n this.compute(otherKey.symbol) as V | undefined;\n return entry.transform.compute(reader);\n }\n}\n","import type { FrozenContextSnapshot } from \"./types\";\n\n/**\n * Append-only stack of frozen per-flow snapshots. The plugin pushes one\n * snapshot on each flow end; consumers read via `entries()`.\n */\nexport class ContextHistory {\n private stack: FrozenContextSnapshot[] = [];\n\n push(snapshot: FrozenContextSnapshot): void {\n this.stack.push(snapshot);\n }\n\n entries(): ReadonlyArray<FrozenContextSnapshot> {\n return this.stack;\n }\n\n size(): number {\n return this.stack.length;\n }\n\n clear(): void {\n this.stack = [];\n }\n}\n","export const ContextPluginSymbol = Symbol.for(\"ContextPlugin\");\n","import type { Player, PlayerPlugin, Flow } from \"@player-ui/player\";\nimport { SyncHook, SyncWaterfallHook } from \"tapable-ts\";\nimport { ContextStore } from \"./store\";\nimport { ContextHistory } from \"./history\";\nimport { ContextPluginSymbol } from \"./symbols\";\nimport { defineContextKey, nameOfContextKey } from \"./key\";\nimport type {\n ContextEntryDescriptor,\n ContextGlobalSubscriber,\n ContextKey,\n ContextSubscriber,\n ContextTransform,\n FrozenContextSnapshot,\n SubscriptionToken,\n} from \"./types\";\n\ntype TransformRegistration = {\n key: ContextKey;\n transform: ContextTransform<unknown>;\n};\n\nlet subscriptionCounter = 0;\n\n/**\n * Maintains a per-flow store of context entries keyed by symbol, with\n * registered transforms for derived values and a subscription API for\n * external consumers. On flow end the active store is frozen into a snapshot\n * and pushed onto a history stack; a fresh store is created for the next flow,\n * with transforms re-applied. Subscribers persist across flow rotations.\n */\nexport class ContextPlugin implements PlayerPlugin {\n name = \"context\";\n\n static Symbol: symbol = ContextPluginSymbol;\n public readonly symbol: symbol = ContextPlugin.Symbol;\n\n public readonly hooks = {\n onSet: new SyncHook<[ContextKey, unknown]>(),\n resolveValue: new SyncWaterfallHook<[unknown, ContextKey]>(),\n onRegister: new SyncHook<[ContextKey]>(),\n onFlowFrozen: new SyncHook<[FrozenContextSnapshot]>(),\n };\n\n protected store: ContextStore;\n protected historyStack: ContextHistory;\n private transforms = new Map<symbol, TransformRegistration>();\n private perKeySubs = new Map<\n symbol,\n Map<SubscriptionToken, ContextSubscriber<unknown>>\n >();\n private globalSubs = new Map<SubscriptionToken, ContextGlobalSubscriber>();\n private tokenIndex = new Map<SubscriptionToken, symbol | undefined>();\n private currentFlowId: string | undefined;\n\n constructor() {\n this.store = new ContextStore();\n this.historyStack = new ContextHistory();\n }\n\n apply(player: Player) {\n const existing = player.findPlugin<ContextPlugin>(ContextPluginSymbol);\n if (existing !== undefined && existing !== this) {\n this.store = existing.store;\n this.historyStack = existing.historyStack;\n this.transforms = existing.transforms;\n this.perKeySubs = existing.perKeySubs;\n this.globalSubs = existing.globalSubs;\n this.tokenIndex = existing.tokenIndex;\n return;\n }\n\n player.hooks.onStart.tap(this.name, (flow: Flow) => {\n this.currentFlowId = flow?.id;\n });\n\n player.hooks.onEnd.tap(this.name, () => {\n const snapshot = this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now(),\n });\n this.historyStack.push(snapshot);\n this.hooks.onFlowFrozen.call(snapshot);\n this.rotateStore();\n this.currentFlowId = undefined;\n });\n }\n\n register<Value>(key: ContextKey<Value>): void {\n const added = this.store.register(key);\n if (added) {\n this.hooks.onRegister.call(key);\n }\n }\n\n set<Value>(key: ContextKey<Value>, value: Value): void {\n const isFirstSighting = !this.store.has(key);\n this.store.set(key, value);\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n this.notify(key, value);\n\n const dependents = this.store.dependentsOf(key.symbol);\n for (const dep of dependents) {\n const computed = this.store.get(dep);\n this.notify(dep, computed);\n }\n }\n\n get<Value>(key: ContextKey<Value>): Value | undefined {\n const raw = this.store.get(key);\n const resolved = this.hooks.resolveValue.call(raw, key);\n return resolved as Value | undefined;\n }\n\n has(key: ContextKey): boolean {\n return this.store.has(key);\n }\n\n registerTransform<Value>(\n key: ContextKey<Value>,\n transform: ContextTransform<Value>,\n ): void {\n const isFirstSighting = !this.store.has(key);\n this.store.registerTransform(key, transform);\n this.transforms.set(key.symbol, {\n key,\n transform: {\n sources: transform.sources,\n compute: transform.compute as ContextTransform<unknown>[\"compute\"],\n },\n });\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n }\n\n subscribe<Value>(\n key: ContextKey<Value>,\n handler: ContextSubscriber<Value>,\n ): SubscriptionToken {\n const token = this.nextToken();\n let bucket = this.perKeySubs.get(key.symbol);\n if (!bucket) {\n bucket = new Map();\n this.perKeySubs.set(key.symbol, bucket);\n }\n bucket.set(token, handler as ContextSubscriber<unknown>);\n this.tokenIndex.set(token, key.symbol);\n return token;\n }\n\n subscribeAll(handler: ContextGlobalSubscriber): SubscriptionToken {\n const token = this.nextToken();\n this.globalSubs.set(token, handler);\n this.tokenIndex.set(token, undefined);\n return token;\n }\n\n unsubscribe(token: SubscriptionToken): void {\n const owner = this.tokenIndex.get(token);\n if (owner === undefined) {\n this.globalSubs.delete(token);\n } else {\n this.perKeySubs.get(owner)?.delete(token);\n }\n this.tokenIndex.delete(token);\n }\n\n list(): ReadonlyArray<ContextEntryDescriptor> {\n return this.store.list();\n }\n\n history(): ReadonlyArray<FrozenContextSnapshot> {\n return this.historyStack.entries();\n }\n\n snapshot(): FrozenContextSnapshot {\n return this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now(),\n });\n }\n\n /**\n * Bridge-friendly: set a value by string name. Used by native wrappers that\n * cannot construct a `ContextKey` object directly.\n */\n setByName(name: string, description: string, value: unknown): void {\n this.set(this.ensureNamedKey(name, description), value);\n }\n\n /** Bridge-friendly: get a value by string name. */\n getByName(name: string): unknown {\n return this.get(this.ensureNamedKey(name));\n }\n\n /** Bridge-friendly: check presence by string name. */\n hasByName(name: string): boolean {\n return this.has(this.ensureNamedKey(name));\n }\n\n /** Bridge-friendly: subscribe by string name. */\n subscribeByName(\n name: string,\n description: string,\n handler: (value: unknown, name: string) => void,\n ): SubscriptionToken {\n return this.subscribe(this.ensureNamedKey(name, description), (value) =>\n handler(value, name),\n );\n }\n\n /**\n * Bridge-friendly: subscribe to all updates. The handler receives the\n * key's resolved name (or undefined for non-namespaced keys).\n */\n subscribeAllByName(\n handler: (\n value: unknown,\n name: string | undefined,\n description: string,\n ) => void,\n ): SubscriptionToken {\n return this.subscribeAll((value, key) =>\n handler(value, nameOfContextKey(key), key.description),\n );\n }\n\n private ensureNamedKey(\n name: string,\n description?: string,\n ): ContextKey<unknown> {\n return defineContextKey<unknown>(name, description ?? name);\n }\n\n private notify<Value>(key: ContextKey<Value>, value: Value | undefined) {\n this.hooks.onSet.call(key, value);\n const bucket = this.perKeySubs.get(key.symbol);\n if (bucket) {\n for (const handler of bucket.values()) {\n (handler as ContextSubscriber<Value>)(value, key);\n }\n }\n for (const handler of this.globalSubs.values()) {\n handler(value, key);\n }\n }\n\n private rotateStore() {\n this.store = new ContextStore();\n for (const { key, transform } of this.transforms.values()) {\n this.store.registerTransform(key, transform);\n }\n }\n\n private nextToken(): SubscriptionToken {\n subscriptionCounter += 1;\n return `ctx_${subscriptionCounter}`;\n }\n}\n","import type { Player, PlayerPlugin } from \"@player-ui/player\";\nimport { defineContextKey } from \"./key\";\nimport { getContextPlugin } from \"./utils\";\nimport type { ContextKey } from \"./types\";\n\n/** Set a single binding in the Player data model. */\nexport type SetDataAction = (binding: string, value: unknown) => void;\n\n/** Transition the running flow using the given transition value. */\nexport type TransitionAction = (transition: string) => void;\n\n/** A single validation, projected to its serializable fields. */\nexport type ContextValidation = {\n severity: \"error\" | \"warning\";\n message: string;\n displayTarget?: \"page\" | \"section\" | \"field\";\n blocking?: boolean | \"once\";\n};\n\n/** Validation state for the running view, keyed by binding. */\nexport type ValidationContext = {\n /** Whether the view has no blocking validations (derived, no side effects). */\n canTransition: boolean;\n /** Active validations per binding string. */\n byBinding: Record<string, ReadonlyArray<ContextValidation>>;\n};\n\n/** Identifier of the currently-running flow. */\nexport const flowIdContextKey: ContextKey<string> = defineContextKey<string>(\n \"player.flow.id\",\n \"Identifier of the running flow\",\n);\n\n/** Name of the current FSM state within the running flow. */\nexport const flowStateContextKey: ContextKey<string> = defineContextKey<string>(\n \"player.flow.state\",\n \"Name of the current FSM state in the running flow\",\n);\n\n/** Identifier of the view currently resolved by the ViewController. */\nexport const viewIdContextKey: ContextKey<string> = defineContextKey<string>(\n \"player.view.id\",\n \"Identifier of the currently-resolved view\",\n);\n\n/** Full resolved view object for the current FSM state. */\nexport const viewContextKey: ContextKey<unknown> = defineContextKey<unknown>(\n \"player.view\",\n \"Full resolved view object for the current FSM state\",\n);\n\n/** Full data model tree for the running flow. */\nexport const dataContextKey: ContextKey<unknown> = defineContextKey<unknown>(\n \"player.data\",\n \"Full data model tree for the running flow\",\n);\n\n/** Player flow status: not-started, in-progress, completed, or error. */\nexport const playerStatusContextKey: ContextKey<string> =\n defineContextKey<string>(\n \"player.status\",\n \"Player flow status: not-started, in-progress, completed, or error\",\n );\n\n/** Validation state for the running view, keyed by binding. */\nexport const validationContextKey: ContextKey<ValidationContext> =\n defineContextKey<ValidationContext>(\n \"player.validation\",\n \"Validation state for the running view, keyed by binding\",\n );\n\n/**\n * Action entry whose value is a callable that sets a binding in the data\n * model. Read via `ctx.get(setDataActionKey)`; absent until a flow is running.\n */\nexport const setDataActionKey: ContextKey<SetDataAction> =\n defineContextKey<SetDataAction>(\n \"player.data.set\",\n \"Set a value in the Player data model at the given binding\",\n );\n\n/**\n * Action entry whose value is a callable that transitions the running flow.\n * Read via `ctx.get(transitionActionKey)`; absent until a flow is running.\n */\nexport const transitionActionKey: ContextKey<TransitionAction> =\n defineContextKey<TransitionAction>(\n \"player.flow.transition\",\n \"Transition the current flow using the given transition value\",\n );\n\n/**\n * Aggregated snapshot composed from every other StateContextPlugin key.\n *\n * Actions are scoped to the construct they operate on — `transition` lives\n * under `flow`, `set` under `data` — rather than in a flat actions bag. Each\n * is bound to the live controller and is absent until a flow is in-progress.\n */\nexport type PlayerStateContext = {\n status?: string;\n flow: {\n id?: string;\n state?: string;\n /** Transition the running flow (e.g. 'Next'). */\n transition?: TransitionAction;\n };\n view: {\n id?: string;\n resolved?: unknown;\n };\n data: {\n /** Full data model tree for the running flow. */\n model?: unknown;\n /** Set a value in the data model at the given binding. */\n set?: SetDataAction;\n };\n /** Validation state for the running view, keyed by binding. */\n validation: ValidationContext;\n};\n\n/**\n * Single roll-up key that aggregates every other [[StateContextPlugin]] entry\n * into one object. Backed by a transform — reading recomputes from the latest\n * source values, and subscribers fire whenever any source updates.\n */\nexport const playerStateContextKey: ContextKey<PlayerStateContext> =\n defineContextKey<PlayerStateContext>(\n \"player.state\",\n \"Aggregated snapshot of every Player runtime context entry\",\n );\n\n/**\n * A consumer plugin that mirrors Player runtime state into the ContextPlugin\n * store. Registers a small, opinionated set of context entries (flow id,\n * current FSM state, view id, full view, data model, status) so external\n * automation/devtools can observe the running Player without tapping every\n * controller hook themselves.\n *\n * Auto-registers a [[ContextPlugin]] if one isn't already on the player.\n */\nexport class StateContextPlugin implements PlayerPlugin {\n name = \"state-context\";\n\n apply(player: Player) {\n const ctx = getContextPlugin(player);\n\n // The validation controller for the running flow, captured so data/view\n // updates can re-publish a passive (side-effect-free) validation snapshot.\n type ValidationControllerLike = Parameters<\n Parameters<typeof player.hooks.validationController.tap>[1]\n >[0];\n let validationController: ValidationControllerLike | undefined;\n\n const publishValidation = () => {\n if (!validationController) return;\n const byBinding: Record<string, ReadonlyArray<ContextValidation>> = {};\n let canTransition = true;\n validationController.getBindings().forEach((binding) => {\n const all = (validationController!\n .getValidationForBinding(binding)\n ?.getAll() ?? []) as ReadonlyArray<ContextValidation>;\n if (all.length === 0) return;\n byBinding[binding.asString()] = all.map((v) => ({\n severity: v.severity,\n message: v.message,\n displayTarget: v.displayTarget,\n blocking: v.blocking,\n }));\n if (all.some((v) => v.blocking)) {\n canTransition = false;\n }\n });\n ctx.set(validationContextKey, { canTransition, byBinding });\n };\n\n ctx.register(flowIdContextKey);\n ctx.register(flowStateContextKey);\n ctx.register(viewIdContextKey);\n ctx.register(viewContextKey);\n ctx.register(dataContextKey);\n ctx.register(playerStatusContextKey);\n ctx.register(validationContextKey);\n ctx.register(setDataActionKey);\n ctx.register(transitionActionKey);\n\n ctx.registerTransform(playerStateContextKey, {\n sources: [\n flowIdContextKey,\n flowStateContextKey,\n viewIdContextKey,\n viewContextKey,\n dataContextKey,\n playerStatusContextKey,\n validationContextKey,\n setDataActionKey,\n transitionActionKey,\n ],\n compute: (read) => ({\n status: read(playerStatusContextKey),\n flow: {\n id: read(flowIdContextKey),\n state: read(flowStateContextKey),\n transition: read(transitionActionKey),\n },\n view: {\n id: read(viewIdContextKey),\n resolved: read(viewContextKey),\n },\n data: {\n model: read(dataContextKey),\n set: read(setDataActionKey),\n },\n validation: read(validationContextKey) ?? {\n canTransition: true,\n byBinding: {},\n },\n }),\n });\n\n player.hooks.onStart.tap(this.name, (flow) => {\n if (flow?.id) {\n ctx.set(flowIdContextKey, flow.id);\n }\n });\n\n player.hooks.state.tap(this.name, (state) => {\n ctx.set(playerStatusContextKey, state.status);\n });\n\n player.hooks.flowController.tap(this.name, (flowController) => {\n // Bind to the concrete controller instance for the running flow.\n const transition: TransitionAction = (value) =>\n flowController.transition(value);\n ctx.set(transitionActionKey, transition);\n\n flowController.hooks.flow.tap(this.name, (flowInstance) => {\n const recordState = () => {\n const name = flowInstance.currentState?.name;\n if (name) {\n ctx.set(flowStateContextKey, name);\n }\n };\n recordState();\n flowInstance.hooks.afterTransition.tap(this.name, recordState);\n });\n });\n\n player.hooks.validationController.tap(this.name, (vc) => {\n validationController = vc;\n publishValidation();\n });\n\n player.hooks.viewController.tap(this.name, (viewController) => {\n viewController.hooks.view.tap(this.name, (view) => {\n const id = view.initialView?.id;\n if (id) {\n ctx.set(viewIdContextKey, id);\n }\n view.hooks.onUpdate.tap(this.name, (resolved) => {\n ctx.set(viewContextKey, resolved);\n if (resolved?.id) {\n ctx.set(viewIdContextKey, resolved.id);\n }\n // Validation resets per view; re-publish for the resolved view.\n publishValidation();\n });\n });\n });\n\n player.hooks.dataController.tap(this.name, (dataController) => {\n // Bind the set-data action to this concrete controller instance.\n const setData: SetDataAction = (binding, value) => {\n dataController.set([[binding, value]]);\n };\n ctx.set(setDataActionKey, setData);\n\n const publish = () => {\n ctx.set(dataContextKey, dataController.serialize());\n // Validation re-evaluates on data change.\n publishValidation();\n };\n dataController.hooks.onUpdate.tap(this.name, publish);\n publish();\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2568/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/dist/index.global.js","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/tapable-ts@0.2.4/node_modules/tapable-ts/src/utils.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/tapable-ts@0.2.4/node_modules/tapable-ts/src/index.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/utils.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/index.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/key.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/store.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/history.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/symbols.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/plugin.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/state-plugin.ts"],"names":["ContextPlugin","equalToOrIn","value","check","Array","isArray","includes","callTap","tap","args","ctx","context","callback","getContextPlugin","player","existing","findPlugin","ContextPluginSymbol","plugin","registerPlugin","__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","src_exports","StateContextPlugin","dataContextKey","defineContextKey","flowIdContextKey","flowStateContextKey","nameOfContextKey","playerStateContextKey","playerStatusContextKey","resolveContextKeySymbol","setDataActionKey","transitionActionKey","validationContextKey","viewContextKey","viewIdContextKey","InterceptionManager","interceptions","interceptionKeySet","Set","isUsed","length","intercept","int","push","keys","forEach","s","add","has","i","_a","_b","loop","error","err","Error","asError","result","r","done","Hook","taps","options","resolvedOptions","Symbol","before","insertionIndex","beforeSet","size","t","delete","splice","untap","filter","SyncHook","SyncWaterfallHook","rtn","rest","tapIndex","tapValue","KEY_NAMESPACE","description","symbol","for","k","keyFor","startsWith","slice","deepFreezeEntry","entry","freeze","tombstone","tombstoneFunctions","map","item","out","entries","v","ContextStore","Map","dependents","register","set","hasLiteral","literal","registerTransform","transform","previousSources","sources","src","stored","compute","Boolean","dependentsOf","sourceSymbol","targetSymbol","list","values","hasValue","hasTransform","meta","frozenEntries","computed","bySymbol","e","snapshot","flowId","endedAt","sym","reader","otherKey","ContextHistory","stack","clear","subscriptionCounter","_ContextPlugin","hooks","onSet","resolveValue","onRegister","onFlowFrozen","transforms","perKeySubs","globalSubs","tokenIndex","store","historyStack","apply","onStart","flow","currentFlowId","id","onEnd","Date","now","rotateStore","added","isFirstSighting","notify","dep","raw","resolved","subscribe","handler","token","nextToken","bucket","subscribeAll","unsubscribe","owner","history","setByName","ensureNamedKey","getByName","hasByName","subscribeByName","subscribeAllByName","validationController","publishValidation","byBinding","canTransition","getBindings","binding","getValidationForBinding","getAll","asString","severity","message","displayTarget","blocking","some","read","status","state","transition","view","data","model","validation","flowController","flowInstance","recordState","currentState","afterTransition","vc","viewController","initialView","onUpdate","dataController","setData","publish","serialize"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAKyB,IAAA,EAAM,SAACwM;wBAE1C,IAAMC,UAAyB,iBAAC3B,SAAS7M;4BACvCuO,eAAe1G,GAAA,CAAI;gCAAC;oCAACgF;oCAAS7M;iCAAM;6BAAC;wBACvC;wBACAQ,IAAIqH,GAAA,CAAIxE,kBAAkBmL;wBAE1B,IAAMC,UAAU;4BACdjO,IAAIqH,GAAA,CAAIhF,gBAAgB0L,eAAeG,SAAA;4BAEvCjC;wBACF;wBACA8B,eAAexE,KAAA,CAAMuE,QAAA,CAAShO,GAAA,CAAI,MAAKyB,IAAA,EAAM0M;wBAC7CA;oBACF;gBACF;;;;;IV8dA,OAAOhM,aAAaE;AACtB","sourcesContent":["\"use strict\";\nvar ContextPlugin = (() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/index.ts\n var src_exports = {};\n __export(src_exports, {\n ContextPlugin: () => ContextPlugin,\n ContextPluginSymbol: () => ContextPluginSymbol,\n StateContextPlugin: () => StateContextPlugin,\n dataContextKey: () => dataContextKey,\n defineContextKey: () => defineContextKey,\n flowIdContextKey: () => flowIdContextKey,\n flowStateContextKey: () => flowStateContextKey,\n getContextPlugin: () => getContextPlugin,\n nameOfContextKey: () => nameOfContextKey,\n playerStateContextKey: () => playerStateContextKey,\n playerStatusContextKey: () => playerStatusContextKey,\n resolveContextKeySymbol: () => resolveContextKeySymbol,\n setDataActionKey: () => setDataActionKey,\n transitionActionKey: () => transitionActionKey,\n validationContextKey: () => validationContextKey,\n viewContextKey: () => viewContextKey,\n viewIdContextKey: () => viewIdContextKey\n });\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/tapable-ts@0.2.4/node_modules/tapable-ts/dist/hooks.mjs\n function equalToOrIn(value, check) {\n if (Array.isArray(check)) {\n return check.includes(value);\n }\n return check === value;\n }\n function callTap(tap, args, ctx) {\n if (tap.context) {\n return tap.callback(ctx, ...args);\n }\n return tap.callback(...args);\n }\n var InterceptionManager = class {\n constructor() {\n this.interceptions = [];\n this.interceptionKeySet = /* @__PURE__ */ new Set();\n }\n isUsed() {\n return this.interceptions.length > 0;\n }\n intercept(int) {\n this.interceptions.push(int);\n Object.keys(int).forEach((s) => {\n this.interceptionKeySet.add(s);\n });\n }\n tap(tap) {\n if (this.interceptionKeySet.has(\"tap\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.tap) == null ? void 0 : _a.call(i, tap);\n });\n }\n }\n call(ctx, ...args) {\n if (this.interceptionKeySet.has(\"call\")) {\n this.interceptions.forEach((i) => {\n var _a, _b;\n if (i.context) {\n (_a = i.call) == null ? void 0 : _a.call(i, ctx, ...args);\n } else {\n (_b = i.call) == null ? void 0 : _b.call(i, ...args);\n }\n });\n }\n }\n loop(...args) {\n if (this.interceptionKeySet.has(\"loop\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.loop) == null ? void 0 : _a.call(i, ...args);\n });\n }\n }\n error(err) {\n if (this.interceptionKeySet.has(\"error\")) {\n if (err instanceof Error) {\n const asError = err;\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.error) == null ? void 0 : _a.call(i, asError);\n });\n }\n }\n }\n result(r) {\n if (this.interceptionKeySet.has(\"result\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.result) == null ? void 0 : _a.call(i, r);\n });\n }\n }\n done() {\n if (this.interceptionKeySet.has(\"done\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.done) == null ? void 0 : _a.call(i);\n });\n }\n }\n };\n var Hook = class {\n constructor() {\n this.taps = [];\n this.interceptions = new InterceptionManager();\n }\n tap(options, callback) {\n const resolvedOptions = typeof options === \"string\" ? {\n name: options,\n context: false\n } : {\n context: false,\n ...options\n };\n const key = Symbol(resolvedOptions.name);\n const tap = {\n key,\n ...resolvedOptions,\n callback\n };\n if (tap.before) {\n let insertionIndex = this.taps.length;\n const beforeSet = new Set(Array.isArray(tap.before) ? tap.before : [tap.before]);\n for (insertionIndex; insertionIndex > 0 && beforeSet.size > 0; insertionIndex--) {\n const t = this.taps[insertionIndex - 1];\n if (beforeSet.has(t.name)) {\n beforeSet.delete(t.name);\n }\n if (t.before && equalToOrIn(tap.name, t.before)) {\n break;\n }\n }\n this.taps.splice(insertionIndex, 0, tap);\n } else {\n this.taps.push(tap);\n }\n this.interceptions.tap(tap);\n return tap;\n }\n untap(tap) {\n this.taps = this.taps.filter((t) => t.key !== tap.key);\n }\n isUsed() {\n return this.taps.length > 0 || this.interceptions.isUsed();\n }\n intercept(int) {\n this.interceptions.intercept(int);\n }\n };\n var SyncHook = class extends Hook {\n call(...args) {\n if (!this.isUsed()) {\n return;\n }\n const ctx = {};\n this.interceptions.call(ctx, ...args);\n try {\n this.taps.forEach((t) => {\n callTap(t, args, ctx);\n });\n } catch (err) {\n this.interceptions.error(err);\n throw err;\n }\n this.interceptions.done();\n }\n };\n var SyncWaterfallHook = class extends Hook {\n call(...args) {\n const ctx = {};\n this.interceptions.call(ctx, ...args);\n let [rtn, ...rest] = args;\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const tapValue = callTap(this.taps[tapIndex], [rtn, ...rest], ctx);\n if (tapValue !== void 0) {\n rtn = tapValue;\n }\n }\n this.interceptions.result(rtn);\n return rtn;\n }\n };\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/key.ts\n var KEY_NAMESPACE = \"player-ui.context.\";\n var defineContextKey = (name, description) => ({\n symbol: Symbol.for(`${KEY_NAMESPACE}${name}`),\n description\n });\n var resolveContextKeySymbol = (name) => Symbol.for(`${KEY_NAMESPACE}${name}`);\n var nameOfContextKey = (key) => {\n const k = Symbol.keyFor(key.symbol);\n if (!k || !k.startsWith(KEY_NAMESPACE))\n return void 0;\n return k.slice(KEY_NAMESPACE.length);\n };\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/store.ts\n var deepFreezeEntry = (entry) => {\n Object.freeze(entry);\n return entry;\n };\n var tombstone = (description) => () => {\n throw new Error(\n `[ContextPlugin] Action \"${description}\" is no longer valid \\u2014 its flow has ended`\n );\n };\n var tombstoneFunctions = (value, description) => {\n if (typeof value === \"function\") {\n return tombstone(description);\n }\n if (Array.isArray(value)) {\n return value.map((item) => tombstoneFunctions(item, description));\n }\n if (value !== null && typeof value === \"object\") {\n const out = {};\n for (const [k, v] of Object.entries(value)) {\n out[k] = tombstoneFunctions(v, description);\n }\n return out;\n }\n return value;\n };\n var ContextStore = class {\n constructor() {\n this.entries = /* @__PURE__ */ new Map();\n /** source symbol -> set of target symbols (reverse index for invalidation). */\n this.dependents = /* @__PURE__ */ new Map();\n }\n register(key) {\n if (this.entries.has(key.symbol)) {\n return false;\n }\n this.entries.set(key.symbol, { key, hasLiteral: false });\n return true;\n }\n set(key, value) {\n const existing = this.entries.get(key.symbol);\n if (existing) {\n existing.hasLiteral = true;\n existing.literal = value;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: true,\n literal: value\n });\n }\n }\n registerTransform(key, transform) {\n const existing = this.entries.get(key.symbol);\n const previousSources = existing?.transform?.sources;\n if (previousSources) {\n for (const src of previousSources) {\n this.dependents.get(src.symbol)?.delete(key.symbol);\n }\n }\n const stored = {\n sources: transform.sources,\n compute: transform.compute\n };\n if (existing) {\n existing.transform = stored;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: false,\n transform: stored\n });\n }\n for (const src of transform.sources) {\n let set = this.dependents.get(src.symbol);\n if (!set) {\n set = /* @__PURE__ */ new Set();\n this.dependents.set(src.symbol, set);\n }\n set.add(key.symbol);\n }\n return { previousSources };\n }\n get(key) {\n return this.compute(key.symbol);\n }\n has(key) {\n const entry = this.entries.get(key.symbol);\n return Boolean(entry && (entry.hasLiteral || entry.transform));\n }\n /** Return the keys that depend on the given source key (direct dependents only). */\n dependentsOf(sourceSymbol) {\n const set = this.dependents.get(sourceSymbol);\n if (!set || set.size === 0) {\n return [];\n }\n const out = [];\n for (const targetSymbol of set) {\n const target = this.entries.get(targetSymbol);\n if (target) {\n out.push(target.key);\n }\n }\n return out;\n }\n list() {\n const out = [];\n for (const entry of this.entries.values()) {\n out.push({\n symbol: entry.key.symbol,\n description: entry.key.description,\n hasValue: entry.hasLiteral,\n hasTransform: Boolean(entry.transform)\n });\n }\n return out;\n }\n freeze(meta) {\n const frozenEntries = [];\n for (const entry of this.entries.values()) {\n if (!entry.hasLiteral && !entry.transform) {\n continue;\n }\n const computed = this.compute(entry.key.symbol);\n const value = tombstoneFunctions(computed, entry.key.description);\n frozenEntries.push(\n deepFreezeEntry({\n symbol: entry.key.symbol,\n name: nameOfContextKey(entry.key),\n description: entry.key.description,\n value\n })\n );\n }\n const bySymbol = new Map(frozenEntries.map((e) => [e.symbol, e.value]));\n const snapshot = {\n flowId: meta.flowId,\n endedAt: meta.endedAt,\n entries: Object.freeze(frozenEntries),\n get(key) {\n return bySymbol.get(key.symbol);\n }\n };\n return Object.freeze(snapshot);\n }\n compute(sym) {\n const entry = this.entries.get(sym);\n if (!entry)\n return void 0;\n if (entry.hasLiteral)\n return entry.literal;\n if (!entry.transform)\n return void 0;\n const reader = (otherKey) => this.compute(otherKey.symbol);\n return entry.transform.compute(reader);\n }\n };\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/history.ts\n var ContextHistory = class {\n constructor() {\n this.stack = [];\n }\n push(snapshot) {\n this.stack.push(snapshot);\n }\n entries() {\n return this.stack;\n }\n size() {\n return this.stack.length;\n }\n clear() {\n this.stack = [];\n }\n };\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/symbols.ts\n var ContextPluginSymbol = Symbol.for(\"ContextPlugin\");\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/plugin.ts\n var subscriptionCounter = 0;\n var _ContextPlugin = class _ContextPlugin {\n constructor() {\n this.name = \"context\";\n this.symbol = _ContextPlugin.Symbol;\n this.hooks = {\n onSet: new SyncHook(),\n resolveValue: new SyncWaterfallHook(),\n onRegister: new SyncHook(),\n onFlowFrozen: new SyncHook()\n };\n this.transforms = /* @__PURE__ */ new Map();\n this.perKeySubs = /* @__PURE__ */ new Map();\n this.globalSubs = /* @__PURE__ */ new Map();\n this.tokenIndex = /* @__PURE__ */ new Map();\n this.store = new ContextStore();\n this.historyStack = new ContextHistory();\n }\n apply(player) {\n const existing = player.findPlugin(ContextPluginSymbol);\n if (existing !== void 0 && existing !== this) {\n this.store = existing.store;\n this.historyStack = existing.historyStack;\n this.transforms = existing.transforms;\n this.perKeySubs = existing.perKeySubs;\n this.globalSubs = existing.globalSubs;\n this.tokenIndex = existing.tokenIndex;\n return;\n }\n player.hooks.onStart.tap(this.name, (flow) => {\n this.currentFlowId = flow?.id;\n });\n player.hooks.onEnd.tap(this.name, () => {\n const snapshot = this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now()\n });\n this.historyStack.push(snapshot);\n this.hooks.onFlowFrozen.call(snapshot);\n this.rotateStore();\n this.currentFlowId = void 0;\n });\n }\n register(key) {\n const added = this.store.register(key);\n if (added) {\n this.hooks.onRegister.call(key);\n }\n }\n set(key, value) {\n const isFirstSighting = !this.store.has(key);\n this.store.set(key, value);\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n this.notify(key, value);\n const dependents = this.store.dependentsOf(key.symbol);\n for (const dep of dependents) {\n const computed = this.store.get(dep);\n this.notify(dep, computed);\n }\n }\n get(key) {\n const raw = this.store.get(key);\n const resolved = this.hooks.resolveValue.call(raw, key);\n return resolved;\n }\n has(key) {\n return this.store.has(key);\n }\n registerTransform(key, transform) {\n const isFirstSighting = !this.store.has(key);\n this.store.registerTransform(key, transform);\n this.transforms.set(key.symbol, {\n key,\n transform: {\n sources: transform.sources,\n compute: transform.compute\n }\n });\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n }\n subscribe(key, handler) {\n const token = this.nextToken();\n let bucket = this.perKeySubs.get(key.symbol);\n if (!bucket) {\n bucket = /* @__PURE__ */ new Map();\n this.perKeySubs.set(key.symbol, bucket);\n }\n bucket.set(token, handler);\n this.tokenIndex.set(token, key.symbol);\n return token;\n }\n subscribeAll(handler) {\n const token = this.nextToken();\n this.globalSubs.set(token, handler);\n this.tokenIndex.set(token, void 0);\n return token;\n }\n unsubscribe(token) {\n const owner = this.tokenIndex.get(token);\n if (owner === void 0) {\n this.globalSubs.delete(token);\n } else {\n this.perKeySubs.get(owner)?.delete(token);\n }\n this.tokenIndex.delete(token);\n }\n list() {\n return this.store.list();\n }\n history() {\n return this.historyStack.entries();\n }\n snapshot() {\n return this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now()\n });\n }\n /**\n * Bridge-friendly: set a value by string name. Used by native wrappers that\n * cannot construct a `ContextKey` object directly.\n */\n setByName(name, description, value) {\n this.set(this.ensureNamedKey(name, description), value);\n }\n /** Bridge-friendly: get a value by string name. */\n getByName(name) {\n return this.get(this.ensureNamedKey(name));\n }\n /** Bridge-friendly: check presence by string name. */\n hasByName(name) {\n return this.has(this.ensureNamedKey(name));\n }\n /** Bridge-friendly: subscribe by string name. */\n subscribeByName(name, description, handler) {\n return this.subscribe(\n this.ensureNamedKey(name, description),\n (value) => handler(value, name)\n );\n }\n /**\n * Bridge-friendly: subscribe to all updates. The handler receives the\n * key's resolved name (or undefined for non-namespaced keys).\n */\n subscribeAllByName(handler) {\n return this.subscribeAll(\n (value, key) => handler(value, nameOfContextKey(key), key.description)\n );\n }\n ensureNamedKey(name, description) {\n return defineContextKey(name, description ?? name);\n }\n notify(key, value) {\n this.hooks.onSet.call(key, value);\n const bucket = this.perKeySubs.get(key.symbol);\n if (bucket) {\n for (const handler of bucket.values()) {\n handler(value, key);\n }\n }\n for (const handler of this.globalSubs.values()) {\n handler(value, key);\n }\n }\n rotateStore() {\n this.store = new ContextStore();\n for (const { key, transform } of this.transforms.values()) {\n this.store.registerTransform(key, transform);\n }\n }\n nextToken() {\n subscriptionCounter += 1;\n return `ctx_${subscriptionCounter}`;\n }\n };\n _ContextPlugin.Symbol = ContextPluginSymbol;\n var ContextPlugin = _ContextPlugin;\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/utils.ts\n function getContextPlugin(player) {\n const existing = player.findPlugin(ContextPluginSymbol);\n const plugin = existing ?? new ContextPlugin();\n if (!existing) {\n player.registerPlugin(plugin);\n }\n return plugin;\n }\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/state-plugin.ts\n var flowIdContextKey = defineContextKey(\n \"player.flow.id\",\n \"Identifier of the running flow\"\n );\n var flowStateContextKey = defineContextKey(\n \"player.flow.state\",\n \"Name of the current FSM state in the running flow\"\n );\n var viewIdContextKey = defineContextKey(\n \"player.view.id\",\n \"Identifier of the currently-resolved view\"\n );\n var viewContextKey = defineContextKey(\n \"player.view\",\n \"Full resolved view object for the current FSM state\"\n );\n var dataContextKey = defineContextKey(\n \"player.data\",\n \"Full data model tree for the running flow\"\n );\n var playerStatusContextKey = defineContextKey(\n \"player.status\",\n \"Player flow status: not-started, in-progress, completed, or error\"\n );\n var validationContextKey = defineContextKey(\n \"player.validation\",\n \"Validation state for the running view, keyed by binding\"\n );\n var setDataActionKey = defineContextKey(\n \"player.data.set\",\n \"Set a value in the Player data model at the given binding\"\n );\n var transitionActionKey = defineContextKey(\n \"player.flow.transition\",\n \"Transition the current flow using the given transition value\"\n );\n var playerStateContextKey = defineContextKey(\n \"player.state\",\n \"Aggregated snapshot of every Player runtime context entry\"\n );\n var StateContextPlugin = class {\n constructor() {\n this.name = \"state-context\";\n }\n apply(player) {\n const ctx = getContextPlugin(player);\n let validationController;\n const publishValidation = () => {\n if (!validationController)\n return;\n const byBinding = {};\n let canTransition = true;\n validationController.getBindings().forEach((binding) => {\n const all = validationController.getValidationForBinding(binding)?.getAll() ?? [];\n if (all.length === 0)\n return;\n byBinding[binding.asString()] = all.map((v) => ({\n severity: v.severity,\n message: v.message,\n displayTarget: v.displayTarget,\n blocking: v.blocking\n }));\n if (all.some((v) => v.blocking)) {\n canTransition = false;\n }\n });\n ctx.set(validationContextKey, { canTransition, byBinding });\n };\n ctx.register(flowIdContextKey);\n ctx.register(flowStateContextKey);\n ctx.register(viewIdContextKey);\n ctx.register(viewContextKey);\n ctx.register(dataContextKey);\n ctx.register(playerStatusContextKey);\n ctx.register(validationContextKey);\n ctx.register(setDataActionKey);\n ctx.register(transitionActionKey);\n ctx.registerTransform(playerStateContextKey, {\n sources: [\n flowIdContextKey,\n flowStateContextKey,\n viewIdContextKey,\n viewContextKey,\n dataContextKey,\n playerStatusContextKey,\n validationContextKey,\n setDataActionKey,\n transitionActionKey\n ],\n compute: (read) => ({\n status: read(playerStatusContextKey),\n flow: {\n id: read(flowIdContextKey),\n state: read(flowStateContextKey),\n transition: read(transitionActionKey)\n },\n view: {\n id: read(viewIdContextKey),\n resolved: read(viewContextKey)\n },\n data: {\n model: read(dataContextKey),\n set: read(setDataActionKey)\n },\n validation: read(validationContextKey) ?? {\n canTransition: true,\n byBinding: {}\n }\n })\n });\n player.hooks.onStart.tap(this.name, (flow) => {\n if (flow?.id) {\n ctx.set(flowIdContextKey, flow.id);\n }\n });\n player.hooks.state.tap(this.name, (state) => {\n ctx.set(playerStatusContextKey, state.status);\n });\n player.hooks.flowController.tap(this.name, (flowController) => {\n const transition = (value) => flowController.transition(value);\n ctx.set(transitionActionKey, transition);\n flowController.hooks.flow.tap(this.name, (flowInstance) => {\n const recordState = () => {\n const name = flowInstance.currentState?.name;\n if (name) {\n ctx.set(flowStateContextKey, name);\n }\n };\n recordState();\n flowInstance.hooks.afterTransition.tap(this.name, recordState);\n });\n });\n player.hooks.validationController.tap(this.name, (vc) => {\n validationController = vc;\n publishValidation();\n });\n player.hooks.viewController.tap(this.name, (viewController) => {\n viewController.hooks.view.tap(this.name, (view) => {\n const id = view.initialView?.id;\n if (id) {\n ctx.set(viewIdContextKey, id);\n }\n view.hooks.onUpdate.tap(this.name, (resolved) => {\n ctx.set(viewContextKey, resolved);\n if (resolved?.id) {\n ctx.set(viewIdContextKey, resolved.id);\n }\n publishValidation();\n });\n });\n });\n player.hooks.dataController.tap(this.name, (dataController) => {\n const setData = (binding, value) => {\n dataController.set([[binding, value]]);\n };\n ctx.set(setDataActionKey, setData);\n const publish = () => {\n ctx.set(dataContextKey, dataController.serialize());\n publishValidation();\n };\n dataController.hooks.onUpdate.tap(this.name, publish);\n publish();\n });\n }\n };\n return __toCommonJS(src_exports);\n})();\n","/**\n * Checks if `value` is equal to `check` if `check` is a string or in `check` if check is an Array\n *\n * @param value - the value being searched for\n * @param check - the values to check against\n * @returns `boolean`\n */\nexport function equalToOrIn(value: string, check: string | Array<string>) {\n if (Array.isArray(check)) {\n return check.includes(value);\n }\n\n return check === value;\n}\n","import { equalToOrIn } from \"./utils\";\n\nexport type Interceptor<Args extends any[], ReturnType, ContextType> = {\n /** An optional name for the interceptor */\n name?: string;\n /** Callback for each loop when used by the hook */\n loop?: (...args: Args) => void;\n /** Callback when an error occurs during the hook's call */\n error?: (err: Error) => void;\n /** Callback when a result is found for a hook's invocation */\n result?: (\n r: ReturnType extends Promise<infer AwaitedValue>\n ? AwaitedValue\n : ReturnType\n ) => void;\n /** Callback when a hook's call is complete */\n done?: () => void;\n /** Callback when a hook is tapped */\n tap?: (tap: Tap<Args, ReturnType, ContextType>) => void;\n} & (\n | {\n /** If context should be omitted from the 'call'. This is the default */\n context?: false;\n /** Callback when the hook is tapped without context */\n call?: (...args: Args) => void;\n }\n | {\n /** If context should be included in the 'call' */\n context: true;\n /** Callback when the hook is tapped with context */\n call?: (context: ContextType, ...args: Args) => void;\n }\n);\n\nexport type Tap<Args extends any[], ReturnType, ContextType = unknown> = {\n key: symbol;\n name: string;\n before?: string | Array<string>;\n} & (\n | {\n context: false;\n callback: (...args: Args) => ReturnType;\n }\n | {\n context: true;\n callback: (context: ContextType, ...args: Args) => ReturnType;\n }\n);\n\ntype BasicTap<Args extends any[], ReturnType, ContextType> = (\n name: string,\n callback: (...args: Args) => ReturnType,\n before?: string | Array<string>\n) => Tap<Args, ReturnType, ContextType>;\n\ntype TapWithContext<Args extends any[], ReturnType, ContextType> =\n | ((\n options: {\n name: string;\n context?: false;\n before?: string | Array<string>;\n },\n callback: (...args: Args) => ReturnType\n ) => Tap<Args, ReturnType>)\n | ((\n options: {\n name: string;\n context: true;\n before?: string | Array<string>;\n },\n callback: (context: ContextType, ...args: Args) => ReturnType\n ) => Tap<Args, ReturnType>);\n\ninterface SyncBaseHookType<Args extends any[], ReturnType, ContextType> {\n tap:\n | BasicTap<Args, ReturnType, ContextType>\n | TapWithContext<Args, ReturnType, ContextType>;\n call(...args: Args): void;\n untap(key: Tap<Args, ReturnType>): void;\n isUsed(): boolean;\n intercept(int: Interceptor<Args, ReturnType, ContextType>): void;\n}\n\nfunction callTap<Args extends any[], ReturnType, ContextType>(\n tap: Tap<Args, ReturnType, ContextType>,\n args: Args,\n ctx: ContextType\n) {\n if (tap.context) {\n return tap.callback(ctx, ...args);\n }\n\n return tap.callback(...args);\n}\n\n/** A manager for all intercepts inside of a tap */\nclass InterceptionManager<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> {\n protected interceptions: Array<Interceptor<Args, ReturnType, ContextType>>;\n private interceptionKeySet: Set<\n keyof Interceptor<Args, ReturnType, ContextType>\n >;\n\n constructor() {\n this.interceptions = [];\n this.interceptionKeySet = new Set();\n }\n\n isUsed() {\n return this.interceptions.length > 0;\n }\n\n intercept(int: Interceptor<Args, ReturnType, ContextType>): void {\n this.interceptions.push(int);\n Object.keys(int).forEach((s) => {\n this.interceptionKeySet.add(s as any);\n });\n }\n\n tap(tap: Tap<Args, ReturnType, ContextType>): void {\n if (this.interceptionKeySet.has(\"tap\")) {\n this.interceptions.forEach((i) => {\n i.tap?.(tap);\n });\n }\n }\n\n call(ctx: ContextType, ...args: Args): void {\n if (this.interceptionKeySet.has(\"call\")) {\n this.interceptions.forEach((i) => {\n if (i.context) {\n i.call?.(ctx, ...args);\n } else {\n i.call?.(...args);\n }\n });\n }\n }\n\n loop(...args: Args): void {\n if (this.interceptionKeySet.has(\"loop\")) {\n this.interceptions.forEach((i) => {\n i.loop?.(...args);\n });\n }\n }\n\n error(err: unknown): void {\n if (this.interceptionKeySet.has(\"error\")) {\n if (err instanceof Error) {\n const asError: Error = err;\n this.interceptions.forEach((i) => {\n i.error?.(asError);\n });\n }\n }\n }\n\n result(\n r: ReturnType extends Promise<infer AwaitedValue>\n ? AwaitedValue\n : ReturnType\n ): void {\n if (this.interceptionKeySet.has(\"result\")) {\n this.interceptions.forEach((i) => {\n i.result?.(r);\n });\n }\n }\n\n done(): void {\n if (this.interceptionKeySet.has(\"done\")) {\n this.interceptions.forEach((i) => {\n i.done?.();\n });\n }\n }\n}\n\nabstract class Hook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> implements SyncBaseHookType<Args, ReturnType, ContextType>\n{\n protected taps: Array<Tap<Args, ReturnType, ContextType>>;\n protected interceptions: InterceptionManager<Args, ReturnType, ContextType>;\n\n constructor() {\n this.taps = [];\n this.interceptions = new InterceptionManager<\n Args,\n ReturnType,\n ContextType\n >();\n }\n\n public tap(\n options: { name: string; context?: false; before?: string | Array<string> },\n callback: (...args: Args) => ReturnType\n ): Tap<Args, ReturnType, ContextType>;\n\n public tap(\n options: { name: string; context: true; before?: string | Array<string> },\n callback: (ctx: ContextType, ...args: Args) => ReturnType\n ): Tap<Args, ReturnType, ContextType>;\n\n public tap(\n name: string,\n callback: (...args: Args) => ReturnType\n ): Tap<Args, ReturnType, ContextType>;\n\n public tap(options: any, callback: any): Tap<Args, ReturnType, ContextType> {\n const resolvedOptions =\n typeof options === \"string\"\n ? {\n name: options,\n context: false,\n }\n : {\n context: false,\n ...options,\n };\n\n const key = Symbol(resolvedOptions.name);\n const tap: Tap<Args, ReturnType, ContextType> = {\n key,\n ...resolvedOptions,\n callback,\n };\n\n if (tap.before) {\n let insertionIndex = this.taps.length;\n const beforeSet = new Set(\n Array.isArray(tap.before) ? tap.before : [tap.before]\n );\n for (\n insertionIndex;\n insertionIndex > 0 && beforeSet.size > 0;\n insertionIndex--\n ) {\n const t = this.taps[insertionIndex - 1];\n if (beforeSet.has(t.name)) {\n beforeSet.delete(t.name);\n }\n\n if (t.before && equalToOrIn(tap.name, t.before)) {\n break;\n }\n }\n\n this.taps.splice(insertionIndex, 0, tap);\n } else {\n this.taps.push(tap);\n }\n\n this.interceptions.tap(tap);\n\n return tap;\n }\n\n abstract call(...args: Args): ReturnType;\n\n public untap(tap: Tap<Args, ReturnType, ContextType>) {\n this.taps = this.taps.filter((t) => t.key !== tap.key);\n }\n\n public isUsed() {\n return this.taps.length > 0 || this.interceptions.isUsed();\n }\n\n public intercept(int: Interceptor<Args, ReturnType, ContextType>): void {\n this.interceptions.intercept(int);\n }\n}\n\nexport class SyncHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, void, ContextType> {\n public call(...args: Args) {\n if (!this.isUsed()) {\n return;\n }\n\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n this.taps.forEach((t) => {\n callTap(t, args, ctx);\n });\n } catch (err: unknown) {\n this.interceptions.error(err);\n\n throw err;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class SyncBailHook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> extends Hook<Args, ReturnType | undefined | null, ContextType> {\n public call(...args: Args): ReturnType | undefined | null {\n if (!this.isUsed()) {\n return;\n }\n\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = callTap(this.taps[tapIndex], args, ctx);\n if (rtn !== undefined) {\n this.interceptions.result(rtn as any);\n return rtn;\n }\n }\n\n this.interceptions.done();\n }\n}\n\nexport class SyncWaterfallHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Args[0], ContextType> {\n public call(...args: Args): Args[0] {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n // eslint-disable-next-line prefer-const\n let [rtn, ...rest] = args;\n\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const tapValue = callTap(this.taps[tapIndex], [rtn, ...rest] as any, ctx);\n if (tapValue !== undefined) {\n rtn = tapValue;\n }\n }\n\n this.interceptions.result(rtn);\n\n return rtn;\n }\n}\n\nexport class SyncLoopHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, void, ContextType> {\n public call(...args: Args) {\n let finished = false;\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n while (finished !== true) {\n finished = true;\n this.interceptions.loop(...args);\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = callTap(this.taps[tapIndex], args, ctx);\n\n if (rtn !== undefined) {\n finished = false;\n break;\n }\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class AsyncParallelHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<void>, ContextType> {\n public async call(...args: Args): Promise<void> {\n const ctx: ContextType = {} as any;\n this.interceptions.call(ctx, ...args);\n\n await Promise.allSettled(this.taps.map((tap) => callTap(tap, args, ctx)));\n this.interceptions.done();\n }\n}\n\nexport class AsyncParallelBailHook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<ReturnType>, ContextType> {\n public async call(...args: Args): Promise<ReturnType> {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n const rtn = await Promise.race(\n this.taps.map((tap) => callTap(tap, args, ctx))\n );\n\n this.interceptions.result(rtn as any);\n return rtn;\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n }\n}\n\nexport class AsyncSeriesHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<void>, ContextType> {\n public async call(...args: Args): Promise<void> {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n await callTap(this.taps[tapIndex], args, ctx);\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class AsyncSeriesBailHook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<ReturnType | undefined | null>, ContextType> {\n public async call(...args: Args): Promise<ReturnType | undefined | null> {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = await callTap(this.taps[tapIndex], args, ctx);\n if (rtn !== undefined) {\n this.interceptions.result(rtn);\n return rtn;\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class AsyncSeriesWaterfallHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<Args[0]>, ContextType> {\n public async call(...args: Args): Promise<Args[0]> {\n // eslint-disable-next-line prefer-const\n let [rtn, ...rest] = args;\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const tapValue = await callTap(\n this.taps[tapIndex],\n [rtn, ...rest] as any,\n ctx\n );\n if (tapValue !== undefined) {\n rtn = tapValue;\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.result(rtn);\n\n return rtn;\n }\n}\n\nexport class AsyncSeriesLoopHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<void>, ContextType> {\n public async call(...args: Args): Promise<void> {\n let finished = false;\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n while (finished !== true) {\n finished = true;\n this.interceptions.loop(...args);\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = await callTap(this.taps[tapIndex], args, ctx);\n\n if (rtn !== undefined) {\n finished = false;\n break;\n }\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n","import type { Player } from \"@player-ui/player\";\nimport { ContextPlugin } from \"./plugin\";\nimport { ContextPluginSymbol } from \"./symbols\";\n\n/**\n * Returns the existing ContextPlugin or creates and registers a new one.\n */\nexport function getContextPlugin(player: Player): ContextPlugin {\n const existing = player.findPlugin<ContextPlugin>(ContextPluginSymbol);\n const plugin = existing ?? new ContextPlugin();\n\n if (!existing) {\n player.registerPlugin(plugin);\n }\n\n return plugin;\n}\n","export * from \"./plugin\";\nexport * from \"./symbols\";\nexport * from \"./types\";\nexport * from \"./key\";\nexport * from \"./utils\";\nexport * from \"./state-plugin\";\n","import type { ContextKey } from \"./types\";\n\nconst KEY_NAMESPACE = \"player-ui.context.\";\n\n/**\n * Create a typed, globally-identifiable context key.\n *\n * Identity is backed by `Symbol.for`, so two keys created with the same `name`\n * in different bundles refer to the same store entry. The `description` is the\n * human-readable label used by introspection consumers.\n */\nexport const defineContextKey = <Value>(\n name: string,\n description: string,\n): ContextKey<Value> => ({\n symbol: Symbol.for(`${KEY_NAMESPACE}${name}`),\n description,\n});\n\n/**\n * Resolve the global symbol for a context key name. Used by native wrappers\n * that cross the JS bridge with string names instead of JS symbols.\n */\nexport const resolveContextKeySymbol = (name: string): symbol =>\n Symbol.for(`${KEY_NAMESPACE}${name}`);\n\n/**\n * Reverse-derive the name from a key created via `defineContextKey`. Returns\n * `undefined` if the key's symbol was not created in the context namespace.\n */\nexport const nameOfContextKey = (key: ContextKey): string | undefined => {\n const k = Symbol.keyFor(key.symbol);\n if (!k || !k.startsWith(KEY_NAMESPACE)) return undefined;\n return k.slice(KEY_NAMESPACE.length);\n};\n","import type {\n ContextEntryDescriptor,\n ContextKey,\n ContextTransform,\n FrozenContextEntry,\n FrozenContextSnapshot,\n} from \"./types\";\nimport { nameOfContextKey } from \"./key\";\n\ntype Entry = {\n key: ContextKey;\n hasLiteral: boolean;\n literal?: unknown;\n transform?: ContextTransform<unknown>;\n};\n\nconst deepFreezeEntry = (entry: FrozenContextEntry): FrozenContextEntry => {\n Object.freeze(entry);\n return entry;\n};\n\n/**\n * A poisoned stand-in for a function captured into a history snapshot. The\n * key and description survive in the snapshot — the capability *existed* —\n * but the callable is dead: invoking it throws because the flow it was bound\n * to has ended. This preserves the distinction between \"context that never\n * held this action\" and \"an action that is no longer valid\".\n */\nconst tombstone = (description: string) => (): never => {\n throw new Error(\n `[ContextPlugin] Action \"${description}\" is no longer valid — its flow has ended`,\n );\n};\n\n/**\n * Recursively replace every function in [value] (top-level or nested) with a\n * {@link tombstone}, so a frozen history snapshot carries no live callables.\n */\nconst tombstoneFunctions = (value: unknown, description: string): unknown => {\n if (typeof value === \"function\") {\n return tombstone(description);\n }\n if (Array.isArray(value)) {\n return value.map((item) => tombstoneFunctions(item, description));\n }\n if (value !== null && typeof value === \"object\") {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(value)) {\n out[k] = tombstoneFunctions(v, description);\n }\n return out;\n }\n return value;\n};\n\n/**\n * Mutable per-flow context store. Owned by a single flow lifecycle; the plugin\n * rotates the store on flow end and freezes the prior one into a snapshot.\n */\nexport class ContextStore {\n private entries = new Map<symbol, Entry>();\n /** source symbol -> set of target symbols (reverse index for invalidation). */\n private dependents = new Map<symbol, Set<symbol>>();\n\n register(key: ContextKey): boolean {\n if (this.entries.has(key.symbol)) {\n return false;\n }\n this.entries.set(key.symbol, { key, hasLiteral: false });\n return true;\n }\n\n set<Value>(key: ContextKey<Value>, value: Value): void {\n const existing = this.entries.get(key.symbol);\n if (existing) {\n existing.hasLiteral = true;\n existing.literal = value;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: true,\n literal: value,\n });\n }\n }\n\n registerTransform<Value>(\n key: ContextKey<Value>,\n transform: ContextTransform<Value>,\n ): { previousSources?: ReadonlyArray<ContextKey> } {\n const existing = this.entries.get(key.symbol);\n const previousSources = existing?.transform?.sources;\n\n if (previousSources) {\n for (const src of previousSources) {\n this.dependents.get(src.symbol)?.delete(key.symbol);\n }\n }\n\n const stored: ContextTransform<unknown> = {\n sources: transform.sources,\n compute: transform.compute as ContextTransform<unknown>[\"compute\"],\n };\n\n if (existing) {\n existing.transform = stored;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: false,\n transform: stored,\n });\n }\n\n for (const src of transform.sources) {\n let set = this.dependents.get(src.symbol);\n if (!set) {\n set = new Set();\n this.dependents.set(src.symbol, set);\n }\n set.add(key.symbol);\n }\n\n return { previousSources };\n }\n\n get<Value>(key: ContextKey<Value>): Value | undefined {\n return this.compute(key.symbol) as Value | undefined;\n }\n\n has(key: ContextKey): boolean {\n const entry = this.entries.get(key.symbol);\n return Boolean(entry && (entry.hasLiteral || entry.transform));\n }\n\n /** Return the keys that depend on the given source key (direct dependents only). */\n dependentsOf(sourceSymbol: symbol): ReadonlyArray<ContextKey> {\n const set = this.dependents.get(sourceSymbol);\n if (!set || set.size === 0) {\n return [];\n }\n const out: ContextKey[] = [];\n for (const targetSymbol of set) {\n const target = this.entries.get(targetSymbol);\n if (target) {\n out.push(target.key);\n }\n }\n return out;\n }\n\n list(): ReadonlyArray<ContextEntryDescriptor> {\n const out: ContextEntryDescriptor[] = [];\n for (const entry of this.entries.values()) {\n out.push({\n symbol: entry.key.symbol,\n description: entry.key.description,\n hasValue: entry.hasLiteral,\n hasTransform: Boolean(entry.transform),\n });\n }\n return out;\n }\n\n freeze(meta: { flowId?: string; endedAt: number }): FrozenContextSnapshot {\n const frozenEntries: FrozenContextEntry[] = [];\n for (const entry of this.entries.values()) {\n if (!entry.hasLiteral && !entry.transform) {\n continue;\n }\n const computed = this.compute(entry.key.symbol);\n const value = tombstoneFunctions(computed, entry.key.description);\n frozenEntries.push(\n deepFreezeEntry({\n symbol: entry.key.symbol,\n name: nameOfContextKey(entry.key),\n description: entry.key.description,\n value,\n }),\n );\n }\n const bySymbol = new Map(frozenEntries.map((e) => [e.symbol, e.value]));\n const snapshot: FrozenContextSnapshot = {\n flowId: meta.flowId,\n endedAt: meta.endedAt,\n entries: Object.freeze(frozenEntries),\n get<Value>(key: ContextKey<Value>): Value | undefined {\n return bySymbol.get(key.symbol) as Value | undefined;\n },\n };\n return Object.freeze(snapshot);\n }\n\n private compute(sym: symbol): unknown {\n const entry = this.entries.get(sym);\n if (!entry) return undefined;\n if (entry.hasLiteral) return entry.literal;\n if (!entry.transform) return undefined;\n const reader = <V>(otherKey: { symbol: symbol }): V | undefined =>\n this.compute(otherKey.symbol) as V | undefined;\n return entry.transform.compute(reader);\n }\n}\n","import type { FrozenContextSnapshot } from \"./types\";\n\n/**\n * Append-only stack of frozen per-flow snapshots. The plugin pushes one\n * snapshot on each flow end; consumers read via `entries()`.\n */\nexport class ContextHistory {\n private stack: FrozenContextSnapshot[] = [];\n\n push(snapshot: FrozenContextSnapshot): void {\n this.stack.push(snapshot);\n }\n\n entries(): ReadonlyArray<FrozenContextSnapshot> {\n return this.stack;\n }\n\n size(): number {\n return this.stack.length;\n }\n\n clear(): void {\n this.stack = [];\n }\n}\n","export const ContextPluginSymbol = Symbol.for(\"ContextPlugin\");\n","import type { Player, PlayerPlugin, Flow } from \"@player-ui/player\";\nimport { SyncHook, SyncWaterfallHook } from \"tapable-ts\";\nimport { ContextStore } from \"./store\";\nimport { ContextHistory } from \"./history\";\nimport { ContextPluginSymbol } from \"./symbols\";\nimport { defineContextKey, nameOfContextKey } from \"./key\";\nimport type {\n ContextEntryDescriptor,\n ContextGlobalSubscriber,\n ContextKey,\n ContextSubscriber,\n ContextTransform,\n FrozenContextSnapshot,\n SubscriptionToken,\n} from \"./types\";\n\ntype TransformRegistration = {\n key: ContextKey;\n transform: ContextTransform<unknown>;\n};\n\nlet subscriptionCounter = 0;\n\n/**\n * Maintains a per-flow store of context entries keyed by symbol, with\n * registered transforms for derived values and a subscription API for\n * external consumers. On flow end the active store is frozen into a snapshot\n * and pushed onto a history stack; a fresh store is created for the next flow,\n * with transforms re-applied. Subscribers persist across flow rotations.\n */\nexport class ContextPlugin implements PlayerPlugin {\n name = \"context\";\n\n static Symbol: symbol = ContextPluginSymbol;\n public readonly symbol: symbol = ContextPlugin.Symbol;\n\n public readonly hooks = {\n onSet: new SyncHook<[ContextKey, unknown]>(),\n resolveValue: new SyncWaterfallHook<[unknown, ContextKey]>(),\n onRegister: new SyncHook<[ContextKey]>(),\n onFlowFrozen: new SyncHook<[FrozenContextSnapshot]>(),\n };\n\n protected store: ContextStore;\n protected historyStack: ContextHistory;\n private transforms = new Map<symbol, TransformRegistration>();\n private perKeySubs = new Map<\n symbol,\n Map<SubscriptionToken, ContextSubscriber<unknown>>\n >();\n private globalSubs = new Map<SubscriptionToken, ContextGlobalSubscriber>();\n private tokenIndex = new Map<SubscriptionToken, symbol | undefined>();\n private currentFlowId: string | undefined;\n\n constructor() {\n this.store = new ContextStore();\n this.historyStack = new ContextHistory();\n }\n\n apply(player: Player) {\n const existing = player.findPlugin<ContextPlugin>(ContextPluginSymbol);\n if (existing !== undefined && existing !== this) {\n this.store = existing.store;\n this.historyStack = existing.historyStack;\n this.transforms = existing.transforms;\n this.perKeySubs = existing.perKeySubs;\n this.globalSubs = existing.globalSubs;\n this.tokenIndex = existing.tokenIndex;\n return;\n }\n\n player.hooks.onStart.tap(this.name, (flow: Flow) => {\n this.currentFlowId = flow?.id;\n });\n\n player.hooks.onEnd.tap(this.name, () => {\n const snapshot = this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now(),\n });\n this.historyStack.push(snapshot);\n this.hooks.onFlowFrozen.call(snapshot);\n this.rotateStore();\n this.currentFlowId = undefined;\n });\n }\n\n register<Value>(key: ContextKey<Value>): void {\n const added = this.store.register(key);\n if (added) {\n this.hooks.onRegister.call(key);\n }\n }\n\n set<Value>(key: ContextKey<Value>, value: Value): void {\n const isFirstSighting = !this.store.has(key);\n this.store.set(key, value);\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n this.notify(key, value);\n\n const dependents = this.store.dependentsOf(key.symbol);\n for (const dep of dependents) {\n const computed = this.store.get(dep);\n this.notify(dep, computed);\n }\n }\n\n get<Value>(key: ContextKey<Value>): Value | undefined {\n const raw = this.store.get(key);\n const resolved = this.hooks.resolveValue.call(raw, key);\n return resolved as Value | undefined;\n }\n\n has(key: ContextKey): boolean {\n return this.store.has(key);\n }\n\n registerTransform<Value>(\n key: ContextKey<Value>,\n transform: ContextTransform<Value>,\n ): void {\n const isFirstSighting = !this.store.has(key);\n this.store.registerTransform(key, transform);\n this.transforms.set(key.symbol, {\n key,\n transform: {\n sources: transform.sources,\n compute: transform.compute as ContextTransform<unknown>[\"compute\"],\n },\n });\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n }\n\n subscribe<Value>(\n key: ContextKey<Value>,\n handler: ContextSubscriber<Value>,\n ): SubscriptionToken {\n const token = this.nextToken();\n let bucket = this.perKeySubs.get(key.symbol);\n if (!bucket) {\n bucket = new Map();\n this.perKeySubs.set(key.symbol, bucket);\n }\n bucket.set(token, handler as ContextSubscriber<unknown>);\n this.tokenIndex.set(token, key.symbol);\n return token;\n }\n\n subscribeAll(handler: ContextGlobalSubscriber): SubscriptionToken {\n const token = this.nextToken();\n this.globalSubs.set(token, handler);\n this.tokenIndex.set(token, undefined);\n return token;\n }\n\n unsubscribe(token: SubscriptionToken): void {\n const owner = this.tokenIndex.get(token);\n if (owner === undefined) {\n this.globalSubs.delete(token);\n } else {\n this.perKeySubs.get(owner)?.delete(token);\n }\n this.tokenIndex.delete(token);\n }\n\n list(): ReadonlyArray<ContextEntryDescriptor> {\n return this.store.list();\n }\n\n history(): ReadonlyArray<FrozenContextSnapshot> {\n return this.historyStack.entries();\n }\n\n snapshot(): FrozenContextSnapshot {\n return this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now(),\n });\n }\n\n /**\n * Bridge-friendly: set a value by string name. Used by native wrappers that\n * cannot construct a `ContextKey` object directly.\n */\n setByName(name: string, description: string, value: unknown): void {\n this.set(this.ensureNamedKey(name, description), value);\n }\n\n /** Bridge-friendly: get a value by string name. */\n getByName(name: string): unknown {\n return this.get(this.ensureNamedKey(name));\n }\n\n /** Bridge-friendly: check presence by string name. */\n hasByName(name: string): boolean {\n return this.has(this.ensureNamedKey(name));\n }\n\n /** Bridge-friendly: subscribe by string name. */\n subscribeByName(\n name: string,\n description: string,\n handler: (value: unknown, name: string) => void,\n ): SubscriptionToken {\n return this.subscribe(this.ensureNamedKey(name, description), (value) =>\n handler(value, name),\n );\n }\n\n /**\n * Bridge-friendly: subscribe to all updates. The handler receives the\n * key's resolved name (or undefined for non-namespaced keys).\n */\n subscribeAllByName(\n handler: (\n value: unknown,\n name: string | undefined,\n description: string,\n ) => void,\n ): SubscriptionToken {\n return this.subscribeAll((value, key) =>\n handler(value, nameOfContextKey(key), key.description),\n );\n }\n\n private ensureNamedKey(\n name: string,\n description?: string,\n ): ContextKey<unknown> {\n return defineContextKey<unknown>(name, description ?? name);\n }\n\n private notify<Value>(key: ContextKey<Value>, value: Value | undefined) {\n this.hooks.onSet.call(key, value);\n const bucket = this.perKeySubs.get(key.symbol);\n if (bucket) {\n for (const handler of bucket.values()) {\n (handler as ContextSubscriber<Value>)(value, key);\n }\n }\n for (const handler of this.globalSubs.values()) {\n handler(value, key);\n }\n }\n\n private rotateStore() {\n this.store = new ContextStore();\n for (const { key, transform } of this.transforms.values()) {\n this.store.registerTransform(key, transform);\n }\n }\n\n private nextToken(): SubscriptionToken {\n subscriptionCounter += 1;\n return `ctx_${subscriptionCounter}`;\n }\n}\n","import type { Player, PlayerPlugin } from \"@player-ui/player\";\nimport { defineContextKey } from \"./key\";\nimport { getContextPlugin } from \"./utils\";\nimport type { ContextKey } from \"./types\";\n\n/** Set a single binding in the Player data model. */\nexport type SetDataAction = (binding: string, value: unknown) => void;\n\n/** Transition the running flow using the given transition value. */\nexport type TransitionAction = (transition: string) => void;\n\n/** A single validation, projected to its serializable fields. */\nexport type ContextValidation = {\n severity: \"error\" | \"warning\";\n message: string;\n displayTarget?: \"page\" | \"section\" | \"field\";\n blocking?: boolean | \"once\";\n};\n\n/** Validation state for the running view, keyed by binding. */\nexport type ValidationContext = {\n /** Whether the view has no blocking validations (derived, no side effects). */\n canTransition: boolean;\n /** Active validations per binding string. */\n byBinding: Record<string, ReadonlyArray<ContextValidation>>;\n};\n\n/** Identifier of the currently-running flow. */\nexport const flowIdContextKey: ContextKey<string> = defineContextKey<string>(\n \"player.flow.id\",\n \"Identifier of the running flow\",\n);\n\n/** Name of the current FSM state within the running flow. */\nexport const flowStateContextKey: ContextKey<string> = defineContextKey<string>(\n \"player.flow.state\",\n \"Name of the current FSM state in the running flow\",\n);\n\n/** Identifier of the view currently resolved by the ViewController. */\nexport const viewIdContextKey: ContextKey<string> = defineContextKey<string>(\n \"player.view.id\",\n \"Identifier of the currently-resolved view\",\n);\n\n/** Full resolved view object for the current FSM state. */\nexport const viewContextKey: ContextKey<unknown> = defineContextKey<unknown>(\n \"player.view\",\n \"Full resolved view object for the current FSM state\",\n);\n\n/** Full data model tree for the running flow. */\nexport const dataContextKey: ContextKey<unknown> = defineContextKey<unknown>(\n \"player.data\",\n \"Full data model tree for the running flow\",\n);\n\n/** Player flow status: not-started, in-progress, completed, or error. */\nexport const playerStatusContextKey: ContextKey<string> =\n defineContextKey<string>(\n \"player.status\",\n \"Player flow status: not-started, in-progress, completed, or error\",\n );\n\n/** Validation state for the running view, keyed by binding. */\nexport const validationContextKey: ContextKey<ValidationContext> =\n defineContextKey<ValidationContext>(\n \"player.validation\",\n \"Validation state for the running view, keyed by binding\",\n );\n\n/**\n * Action entry whose value is a callable that sets a binding in the data\n * model. Read via `ctx.get(setDataActionKey)`; absent until a flow is running.\n */\nexport const setDataActionKey: ContextKey<SetDataAction> =\n defineContextKey<SetDataAction>(\n \"player.data.set\",\n \"Set a value in the Player data model at the given binding\",\n );\n\n/**\n * Action entry whose value is a callable that transitions the running flow.\n * Read via `ctx.get(transitionActionKey)`; absent until a flow is running.\n */\nexport const transitionActionKey: ContextKey<TransitionAction> =\n defineContextKey<TransitionAction>(\n \"player.flow.transition\",\n \"Transition the current flow using the given transition value\",\n );\n\n/**\n * Aggregated snapshot composed from every other StateContextPlugin key.\n *\n * Actions are scoped to the construct they operate on — `transition` lives\n * under `flow`, `set` under `data` — rather than in a flat actions bag. Each\n * is bound to the live controller and is absent until a flow is in-progress.\n */\nexport type PlayerStateContext = {\n status?: string;\n flow: {\n id?: string;\n state?: string;\n /** Transition the running flow (e.g. 'Next'). */\n transition?: TransitionAction;\n };\n view: {\n id?: string;\n resolved?: unknown;\n };\n data: {\n /** Full data model tree for the running flow. */\n model?: unknown;\n /** Set a value in the data model at the given binding. */\n set?: SetDataAction;\n };\n /** Validation state for the running view, keyed by binding. */\n validation: ValidationContext;\n};\n\n/**\n * Single roll-up key that aggregates every other [[StateContextPlugin]] entry\n * into one object. Backed by a transform — reading recomputes from the latest\n * source values, and subscribers fire whenever any source updates.\n */\nexport const playerStateContextKey: ContextKey<PlayerStateContext> =\n defineContextKey<PlayerStateContext>(\n \"player.state\",\n \"Aggregated snapshot of every Player runtime context entry\",\n );\n\n/**\n * A consumer plugin that mirrors Player runtime state into the ContextPlugin\n * store. Registers a small, opinionated set of context entries (flow id,\n * current FSM state, view id, full view, data model, status) so external\n * automation/devtools can observe the running Player without tapping every\n * controller hook themselves.\n *\n * Auto-registers a [[ContextPlugin]] if one isn't already on the player.\n */\nexport class StateContextPlugin implements PlayerPlugin {\n name = \"state-context\";\n\n apply(player: Player) {\n const ctx = getContextPlugin(player);\n\n // The validation controller for the running flow, captured so data/view\n // updates can re-publish a passive (side-effect-free) validation snapshot.\n type ValidationControllerLike = Parameters<\n Parameters<typeof player.hooks.validationController.tap>[1]\n >[0];\n let validationController: ValidationControllerLike | undefined;\n\n const publishValidation = () => {\n if (!validationController) return;\n const byBinding: Record<string, ReadonlyArray<ContextValidation>> = {};\n let canTransition = true;\n validationController.getBindings().forEach((binding) => {\n const all = (validationController!\n .getValidationForBinding(binding)\n ?.getAll() ?? []) as ReadonlyArray<ContextValidation>;\n if (all.length === 0) return;\n byBinding[binding.asString()] = all.map((v) => ({\n severity: v.severity,\n message: v.message,\n displayTarget: v.displayTarget,\n blocking: v.blocking,\n }));\n if (all.some((v) => v.blocking)) {\n canTransition = false;\n }\n });\n ctx.set(validationContextKey, { canTransition, byBinding });\n };\n\n ctx.register(flowIdContextKey);\n ctx.register(flowStateContextKey);\n ctx.register(viewIdContextKey);\n ctx.register(viewContextKey);\n ctx.register(dataContextKey);\n ctx.register(playerStatusContextKey);\n ctx.register(validationContextKey);\n ctx.register(setDataActionKey);\n ctx.register(transitionActionKey);\n\n ctx.registerTransform(playerStateContextKey, {\n sources: [\n flowIdContextKey,\n flowStateContextKey,\n viewIdContextKey,\n viewContextKey,\n dataContextKey,\n playerStatusContextKey,\n validationContextKey,\n setDataActionKey,\n transitionActionKey,\n ],\n compute: (read) => ({\n status: read(playerStatusContextKey),\n flow: {\n id: read(flowIdContextKey),\n state: read(flowStateContextKey),\n transition: read(transitionActionKey),\n },\n view: {\n id: read(viewIdContextKey),\n resolved: read(viewContextKey),\n },\n data: {\n model: read(dataContextKey),\n set: read(setDataActionKey),\n },\n validation: read(validationContextKey) ?? {\n canTransition: true,\n byBinding: {},\n },\n }),\n });\n\n player.hooks.onStart.tap(this.name, (flow) => {\n if (flow?.id) {\n ctx.set(flowIdContextKey, flow.id);\n }\n });\n\n player.hooks.state.tap(this.name, (state) => {\n ctx.set(playerStatusContextKey, state.status);\n });\n\n player.hooks.flowController.tap(this.name, (flowController) => {\n // Bind to the concrete controller instance for the running flow.\n const transition: TransitionAction = (value) =>\n flowController.transition(value);\n ctx.set(transitionActionKey, transition);\n\n flowController.hooks.flow.tap(this.name, (flowInstance) => {\n const recordState = () => {\n const name = flowInstance.currentState?.name;\n if (name) {\n ctx.set(flowStateContextKey, name);\n }\n };\n recordState();\n flowInstance.hooks.afterTransition.tap(this.name, recordState);\n });\n });\n\n player.hooks.validationController.tap(this.name, (vc) => {\n validationController = vc;\n publishValidation();\n });\n\n player.hooks.viewController.tap(this.name, (viewController) => {\n viewController.hooks.view.tap(this.name, (view) => {\n const id = view.initialView?.id;\n if (id) {\n ctx.set(viewIdContextKey, id);\n }\n view.hooks.onUpdate.tap(this.name, (resolved) => {\n ctx.set(viewContextKey, resolved);\n if (resolved?.id) {\n ctx.set(viewIdContextKey, resolved.id);\n }\n // Validation resets per view; re-publish for the resolved view.\n publishValidation();\n });\n });\n });\n\n player.hooks.dataController.tap(this.name, (dataController) => {\n // Bind the set-data action to this concrete controller instance.\n const setData: SetDataAction = (binding, value) => {\n dataController.set([[binding, value]]);\n };\n ctx.set(setDataActionKey, setData);\n\n const publish = () => {\n ctx.set(dataContextKey, dataController.serialize());\n // Validation re-evaluates on data change.\n publishValidation();\n };\n dataController.hooks.onUpdate.tap(this.name, publish);\n publish();\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
"types"
|
|
7
7
|
],
|
|
8
8
|
"name": "@player-ui/context-plugin",
|
|
9
|
-
"version": "0.16.0--canary.891.
|
|
9
|
+
"version": "0.16.0--canary.891.38216",
|
|
10
10
|
"main": "dist/cjs/index.cjs",
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@player-ui/player": "0.16.0--canary.891.
|
|
12
|
+
"@player-ui/player": "0.16.0--canary.891.38216"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@player-ui/common-types-plugin": "workspace:^",
|