@getuserfeedback/sdk 0.19.5 → 0.20.0

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.
@@ -12,14 +12,14 @@
12
12
  "import * as checks from \"./checks.js\";\nimport * as core from \"./core.js\";\nimport { Doc } from \"./doc.js\";\nimport { parse, parseAsync, safeParse, safeParseAsync } from \"./parse.js\";\nimport * as regexes from \"./regexes.js\";\nimport * as util from \"./util.js\";\nimport { version } from \"./versions.js\";\nexport const $ZodType = /*@__PURE__*/ core.$constructor(\"$ZodType\", (inst, def) => {\n var _a;\n inst ?? (inst = {});\n inst._zod.def = def; // set _def property\n inst._zod.bag = inst._zod.bag || {}; // initialize _bag object\n inst._zod.version = version;\n const checks = [...(inst._zod.def.checks ?? [])];\n // if inst is itself a checks.$ZodCheck, run it as a check\n if (inst._zod.traits.has(\"$ZodCheck\")) {\n checks.unshift(inst);\n }\n for (const ch of checks) {\n for (const fn of ch._zod.onattach) {\n fn(inst);\n }\n }\n if (checks.length === 0) {\n // deferred initializer\n // inst._zod.parse is not yet defined\n (_a = inst._zod).deferred ?? (_a.deferred = []);\n inst._zod.deferred?.push(() => {\n inst._zod.run = inst._zod.parse;\n });\n }\n else {\n const runChecks = (payload, checks, ctx) => {\n let isAborted = util.aborted(payload);\n let asyncResult;\n for (const ch of checks) {\n if (ch._zod.def.when) {\n if (util.explicitlyAborted(payload))\n continue;\n const shouldRun = ch._zod.def.when(payload);\n if (!shouldRun)\n continue;\n }\n else if (isAborted) {\n continue;\n }\n const currLen = payload.issues.length;\n const _ = ch._zod.check(payload);\n if (_ instanceof Promise && ctx?.async === false) {\n throw new core.$ZodAsyncError();\n }\n if (asyncResult || _ instanceof Promise) {\n asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {\n await _;\n const nextLen = payload.issues.length;\n if (nextLen === currLen)\n return;\n if (!isAborted)\n isAborted = util.aborted(payload, currLen);\n });\n }\n else {\n const nextLen = payload.issues.length;\n if (nextLen === currLen)\n continue;\n if (!isAborted)\n isAborted = util.aborted(payload, currLen);\n }\n }\n if (asyncResult) {\n return asyncResult.then(() => {\n return payload;\n });\n }\n return payload;\n };\n const handleCanaryResult = (canary, payload, ctx) => {\n // abort if the canary is aborted\n if (util.aborted(canary)) {\n canary.aborted = true;\n return canary;\n }\n // run checks first, then\n const checkResult = runChecks(payload, checks, ctx);\n if (checkResult instanceof Promise) {\n if (ctx.async === false)\n throw new core.$ZodAsyncError();\n return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));\n }\n return inst._zod.parse(checkResult, ctx);\n };\n inst._zod.run = (payload, ctx) => {\n if (ctx.skipChecks) {\n return inst._zod.parse(payload, ctx);\n }\n if (ctx.direction === \"backward\") {\n // run canary\n // initial pass (no checks)\n const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });\n if (canary instanceof Promise) {\n return canary.then((canary) => {\n return handleCanaryResult(canary, payload, ctx);\n });\n }\n return handleCanaryResult(canary, payload, ctx);\n }\n // forward\n const result = inst._zod.parse(payload, ctx);\n if (result instanceof Promise) {\n if (ctx.async === false)\n throw new core.$ZodAsyncError();\n return result.then((result) => runChecks(result, checks, ctx));\n }\n return runChecks(result, checks, ctx);\n };\n }\n // Lazy initialize ~standard to avoid creating objects for every schema\n util.defineLazy(inst, \"~standard\", () => ({\n validate: (value) => {\n try {\n const r = safeParse(inst, value);\n return r.success ? { value: r.data } : { issues: r.error?.issues };\n }\n catch (_) {\n return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));\n }\n },\n vendor: \"zod\",\n version: 1,\n }));\n});\nexport { clone } from \"./util.js\";\nexport const $ZodString = /*@__PURE__*/ core.$constructor(\"$ZodString\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);\n inst._zod.parse = (payload, _) => {\n if (def.coerce)\n try {\n payload.value = String(payload.value);\n }\n catch (_) { }\n if (typeof payload.value === \"string\")\n return payload;\n payload.issues.push({\n expected: \"string\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodStringFormat = /*@__PURE__*/ core.$constructor(\"$ZodStringFormat\", (inst, def) => {\n // check initialization must come first\n checks.$ZodCheckStringFormat.init(inst, def);\n $ZodString.init(inst, def);\n});\nexport const $ZodGUID = /*@__PURE__*/ core.$constructor(\"$ZodGUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.guid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodUUID = /*@__PURE__*/ core.$constructor(\"$ZodUUID\", (inst, def) => {\n if (def.version) {\n const versionMap = {\n v1: 1,\n v2: 2,\n v3: 3,\n v4: 4,\n v5: 5,\n v6: 6,\n v7: 7,\n v8: 8,\n };\n const v = versionMap[def.version];\n if (v === undefined)\n throw new Error(`Invalid UUID version: \"${def.version}\"`);\n def.pattern ?? (def.pattern = regexes.uuid(v));\n }\n else\n def.pattern ?? (def.pattern = regexes.uuid());\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodEmail = /*@__PURE__*/ core.$constructor(\"$ZodEmail\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.email);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodURL = /*@__PURE__*/ core.$constructor(\"$ZodURL\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n try {\n // Trim whitespace from input\n const trimmed = payload.value.trim();\n // When normalize is off, require :// for http/https URLs\n // This prevents strings like \"http:example.com\" or \"https:/path\" from being silently accepted\n if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source) {\n if (!/^https?:\\/\\//i.test(trimmed)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid URL format\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n return;\n }\n }\n // @ts-ignore\n const url = new URL(trimmed);\n if (def.hostname) {\n def.hostname.lastIndex = 0;\n if (!def.hostname.test(url.hostname)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid hostname\",\n pattern: def.hostname.source,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n }\n if (def.protocol) {\n def.protocol.lastIndex = 0;\n if (!def.protocol.test(url.protocol.endsWith(\":\") ? url.protocol.slice(0, -1) : url.protocol)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid protocol\",\n pattern: def.protocol.source,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n }\n // Set the output value based on normalize flag\n if (def.normalize) {\n // Use normalized URL\n payload.value = url.href;\n }\n else {\n // Preserve the original input (trimmed)\n payload.value = trimmed;\n }\n return;\n }\n catch (_) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodEmoji = /*@__PURE__*/ core.$constructor(\"$ZodEmoji\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.emoji());\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodNanoID = /*@__PURE__*/ core.$constructor(\"$ZodNanoID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.nanoid);\n $ZodStringFormat.init(inst, def);\n});\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link $ZodCUID2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport const $ZodCUID = /*@__PURE__*/ core.$constructor(\"$ZodCUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cuid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodCUID2 = /*@__PURE__*/ core.$constructor(\"$ZodCUID2\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cuid2);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodULID = /*@__PURE__*/ core.$constructor(\"$ZodULID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ulid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodXID = /*@__PURE__*/ core.$constructor(\"$ZodXID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.xid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodKSUID = /*@__PURE__*/ core.$constructor(\"$ZodKSUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ksuid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODateTime = /*@__PURE__*/ core.$constructor(\"$ZodISODateTime\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.datetime(def));\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODate = /*@__PURE__*/ core.$constructor(\"$ZodISODate\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.date);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISOTime = /*@__PURE__*/ core.$constructor(\"$ZodISOTime\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.time(def));\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODuration = /*@__PURE__*/ core.$constructor(\"$ZodISODuration\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.duration);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodIPv4 = /*@__PURE__*/ core.$constructor(\"$ZodIPv4\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ipv4);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.format = `ipv4`;\n});\nexport const $ZodIPv6 = /*@__PURE__*/ core.$constructor(\"$ZodIPv6\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ipv6);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.format = `ipv6`;\n inst._zod.check = (payload) => {\n try {\n // @ts-ignore\n new URL(`http://[${payload.value}]`);\n // return;\n }\n catch {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"ipv6\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodMAC = /*@__PURE__*/ core.$constructor(\"$ZodMAC\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.mac(def.delimiter));\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.format = `mac`;\n});\nexport const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor(\"$ZodCIDRv4\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cidrv4);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodCIDRv6 = /*@__PURE__*/ core.$constructor(\"$ZodCIDRv6\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n const parts = payload.value.split(\"/\");\n try {\n if (parts.length !== 2)\n throw new Error();\n const [address, prefix] = parts;\n if (!prefix)\n throw new Error();\n const prefixNum = Number(prefix);\n if (`${prefixNum}` !== prefix)\n throw new Error();\n if (prefixNum < 0 || prefixNum > 128)\n throw new Error();\n // @ts-ignore\n new URL(`http://[${address}]`);\n }\n catch {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"cidrv6\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\n////////////////////////////// ZodBase64 //////////////////////////////\nexport function isValidBase64(data) {\n if (data === \"\")\n return true;\n // atob ignores whitespace, so reject it up front.\n if (/\\s/.test(data))\n return false;\n if (data.length % 4 !== 0)\n return false;\n try {\n // @ts-ignore\n atob(data);\n return true;\n }\n catch {\n return false;\n }\n}\nexport const $ZodBase64 = /*@__PURE__*/ core.$constructor(\"$ZodBase64\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.base64);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.contentEncoding = \"base64\";\n inst._zod.check = (payload) => {\n if (isValidBase64(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"base64\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\n////////////////////////////// ZodBase64 //////////////////////////////\nexport function isValidBase64URL(data) {\n if (!regexes.base64url.test(data))\n return false;\n const base64 = data.replace(/[-_]/g, (c) => (c === \"-\" ? \"+\" : \"/\"));\n const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, \"=\");\n return isValidBase64(padded);\n}\nexport const $ZodBase64URL = /*@__PURE__*/ core.$constructor(\"$ZodBase64URL\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.base64url);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.contentEncoding = \"base64url\";\n inst._zod.check = (payload) => {\n if (isValidBase64URL(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"base64url\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodE164 = /*@__PURE__*/ core.$constructor(\"$ZodE164\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.e164);\n $ZodStringFormat.init(inst, def);\n});\n////////////////////////////// ZodJWT //////////////////////////////\nexport function isValidJWT(token, algorithm = null) {\n try {\n const tokensParts = token.split(\".\");\n if (tokensParts.length !== 3)\n return false;\n const [header] = tokensParts;\n if (!header)\n return false;\n // @ts-ignore\n const parsedHeader = JSON.parse(atob(header));\n if (\"typ\" in parsedHeader && parsedHeader?.typ !== \"JWT\")\n return false;\n if (!parsedHeader.alg)\n return false;\n if (algorithm && (!(\"alg\" in parsedHeader) || parsedHeader.alg !== algorithm))\n return false;\n return true;\n }\n catch {\n return false;\n }\n}\nexport const $ZodJWT = /*@__PURE__*/ core.$constructor(\"$ZodJWT\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (isValidJWT(payload.value, def.alg))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"jwt\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCustomStringFormat = /*@__PURE__*/ core.$constructor(\"$ZodCustomStringFormat\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (def.fn(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: def.format,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodNumber = /*@__PURE__*/ core.$constructor(\"$ZodNumber\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = Number(payload.value);\n }\n catch (_) { }\n const input = payload.value;\n if (typeof input === \"number\" && !Number.isNaN(input) && Number.isFinite(input)) {\n return payload;\n }\n const received = typeof input === \"number\"\n ? Number.isNaN(input)\n ? \"NaN\"\n : !Number.isFinite(input)\n ? \"Infinity\"\n : undefined\n : undefined;\n payload.issues.push({\n expected: \"number\",\n code: \"invalid_type\",\n input,\n inst,\n ...(received ? { received } : {}),\n });\n return payload;\n };\n});\nexport const $ZodNumberFormat = /*@__PURE__*/ core.$constructor(\"$ZodNumberFormat\", (inst, def) => {\n checks.$ZodCheckNumberFormat.init(inst, def);\n $ZodNumber.init(inst, def); // no format checks\n});\nexport const $ZodBoolean = /*@__PURE__*/ core.$constructor(\"$ZodBoolean\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.boolean;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = Boolean(payload.value);\n }\n catch (_) { }\n const input = payload.value;\n if (typeof input === \"boolean\")\n return payload;\n payload.issues.push({\n expected: \"boolean\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodBigInt = /*@__PURE__*/ core.$constructor(\"$ZodBigInt\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.bigint;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = BigInt(payload.value);\n }\n catch (_) { }\n if (typeof payload.value === \"bigint\")\n return payload;\n payload.issues.push({\n expected: \"bigint\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodBigIntFormat = /*@__PURE__*/ core.$constructor(\"$ZodBigIntFormat\", (inst, def) => {\n checks.$ZodCheckBigIntFormat.init(inst, def);\n $ZodBigInt.init(inst, def); // no format checks\n});\nexport const $ZodSymbol = /*@__PURE__*/ core.$constructor(\"$ZodSymbol\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"symbol\")\n return payload;\n payload.issues.push({\n expected: \"symbol\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodUndefined = /*@__PURE__*/ core.$constructor(\"$ZodUndefined\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.undefined;\n inst._zod.values = new Set([undefined]);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"undefined\")\n return payload;\n payload.issues.push({\n expected: \"undefined\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodNull = /*@__PURE__*/ core.$constructor(\"$ZodNull\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.null;\n inst._zod.values = new Set([null]);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (input === null)\n return payload;\n payload.issues.push({\n expected: \"null\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodAny = /*@__PURE__*/ core.$constructor(\"$ZodAny\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload) => payload;\n});\nexport const $ZodUnknown = /*@__PURE__*/ core.$constructor(\"$ZodUnknown\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload) => payload;\n});\nexport const $ZodNever = /*@__PURE__*/ core.$constructor(\"$ZodNever\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n payload.issues.push({\n expected: \"never\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodVoid = /*@__PURE__*/ core.$constructor(\"$ZodVoid\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"undefined\")\n return payload;\n payload.issues.push({\n expected: \"void\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodDate = /*@__PURE__*/ core.$constructor(\"$ZodDate\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce) {\n try {\n payload.value = new Date(payload.value);\n }\n catch (_err) { }\n }\n const input = payload.value;\n const isDate = input instanceof Date;\n const isValidDate = isDate && !Number.isNaN(input.getTime());\n if (isValidDate)\n return payload;\n payload.issues.push({\n expected: \"date\",\n code: \"invalid_type\",\n input,\n ...(isDate ? { received: \"Invalid Date\" } : {}),\n inst,\n });\n return payload;\n };\n});\nfunction handleArrayResult(result, final, index) {\n if (result.issues.length) {\n final.issues.push(...util.prefixIssues(index, result.issues));\n }\n final.value[index] = result.value;\n}\nexport const $ZodArray = /*@__PURE__*/ core.$constructor(\"$ZodArray\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!Array.isArray(input)) {\n payload.issues.push({\n expected: \"array\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n payload.value = Array(input.length);\n const proms = [];\n for (let i = 0; i < input.length; i++) {\n const item = input[i];\n const result = def.element._zod.run({\n value: item,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => handleArrayResult(result, payload, i)));\n }\n else {\n handleArrayResult(result, payload, i);\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => payload);\n }\n return payload; //handleArrayResultsAsync(parseResults, final);\n };\n});\nfunction handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {\n const isPresent = key in input;\n if (result.issues.length) {\n // For optional-in/out schemas, ignore errors on absent keys.\n if (isOptionalIn && isOptionalOut && !isPresent) {\n return;\n }\n final.issues.push(...util.prefixIssues(key, result.issues));\n }\n if (!isPresent && !isOptionalIn) {\n if (!result.issues.length) {\n final.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: undefined,\n path: [key],\n });\n }\n return;\n }\n if (result.value === undefined) {\n if (isPresent) {\n final.value[key] = undefined;\n }\n }\n else {\n final.value[key] = result.value;\n }\n}\nfunction normalizeDef(def) {\n const keys = Object.keys(def.shape);\n for (const k of keys) {\n if (!def.shape?.[k]?._zod?.traits?.has(\"$ZodType\")) {\n throw new Error(`Invalid element at key \"${k}\": expected a Zod schema`);\n }\n }\n const okeys = util.optionalKeys(def.shape);\n return {\n ...def,\n keys,\n keySet: new Set(keys),\n numKeys: keys.length,\n optionalKeys: new Set(okeys),\n };\n}\nfunction handleCatchall(proms, input, payload, ctx, def, inst) {\n const unrecognized = [];\n const keySet = def.keySet;\n const _catchall = def.catchall._zod;\n const t = _catchall.def.type;\n const isOptionalIn = _catchall.optin === \"optional\";\n const isOptionalOut = _catchall.optout === \"optional\";\n for (const key in input) {\n // skip __proto__ so it can't replace the result prototype via the\n // assignment setter on the plain {} we build into\n if (key === \"__proto__\")\n continue;\n if (keySet.has(key))\n continue;\n if (t === \"never\") {\n unrecognized.push(key);\n continue;\n }\n const r = _catchall.run({ value: input[key], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));\n }\n else {\n handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);\n }\n }\n if (unrecognized.length) {\n payload.issues.push({\n code: \"unrecognized_keys\",\n keys: unrecognized,\n input,\n inst,\n });\n }\n if (!proms.length)\n return payload;\n return Promise.all(proms).then(() => {\n return payload;\n });\n}\nexport const $ZodObject = /*@__PURE__*/ core.$constructor(\"$ZodObject\", (inst, def) => {\n // requires cast because technically $ZodObject doesn't extend\n $ZodType.init(inst, def);\n // const sh = def.shape;\n const desc = Object.getOwnPropertyDescriptor(def, \"shape\");\n if (!desc?.get) {\n const sh = def.shape;\n Object.defineProperty(def, \"shape\", {\n get: () => {\n const newSh = { ...sh };\n Object.defineProperty(def, \"shape\", {\n value: newSh,\n });\n return newSh;\n },\n });\n }\n const _normalized = util.cached(() => normalizeDef(def));\n util.defineLazy(inst._zod, \"propValues\", () => {\n const shape = def.shape;\n const propValues = {};\n for (const key in shape) {\n const field = shape[key]._zod;\n if (field.values) {\n propValues[key] ?? (propValues[key] = new Set());\n for (const v of field.values)\n propValues[key].add(v);\n }\n }\n return propValues;\n });\n const isObject = util.isObject;\n const catchall = def.catchall;\n let value;\n inst._zod.parse = (payload, ctx) => {\n value ?? (value = _normalized.value);\n const input = payload.value;\n if (!isObject(input)) {\n payload.issues.push({\n expected: \"object\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n payload.value = {};\n const proms = [];\n const shape = value.shape;\n for (const key of value.keys) {\n const el = shape[key];\n const isOptionalIn = el._zod.optin === \"optional\";\n const isOptionalOut = el._zod.optout === \"optional\";\n const r = el._zod.run({ value: input[key], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));\n }\n else {\n handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);\n }\n }\n if (!catchall) {\n return proms.length ? Promise.all(proms).then(() => payload) : payload;\n }\n return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);\n };\n});\nexport const $ZodObjectJIT = /*@__PURE__*/ core.$constructor(\"$ZodObjectJIT\", (inst, def) => {\n // requires cast because technically $ZodObject doesn't extend\n $ZodObject.init(inst, def);\n const superParse = inst._zod.parse;\n const _normalized = util.cached(() => normalizeDef(def));\n const generateFastpass = (shape) => {\n const doc = new Doc([\"shape\", \"payload\", \"ctx\"]);\n const normalized = _normalized.value;\n const parseStr = (key) => {\n const k = util.esc(key);\n return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;\n };\n doc.write(`const input = payload.value;`);\n const ids = Object.create(null);\n let counter = 0;\n for (const key of normalized.keys) {\n ids[key] = `key_${counter++}`;\n }\n // A: preserve key order {\n doc.write(`const newResult = {};`);\n for (const key of normalized.keys) {\n const id = ids[key];\n const k = util.esc(key);\n const schema = shape[key];\n const isOptionalIn = schema?._zod?.optin === \"optional\";\n const isOptionalOut = schema?._zod?.optout === \"optional\";\n doc.write(`const ${id} = ${parseStr(key)};`);\n if (isOptionalIn && isOptionalOut) {\n // For optional-in/out schemas, ignore errors on absent keys\n doc.write(`\n if (${id}.issues.length) {\n if (${k} in input) {\n payload.issues = payload.issues.concat(${id}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n }\n \n if (${id}.value === undefined) {\n if (${k} in input) {\n newResult[${k}] = undefined;\n }\n } else {\n newResult[${k}] = ${id}.value;\n }\n \n `);\n }\n else if (!isOptionalIn) {\n doc.write(`\n const ${id}_present = ${k} in input;\n if (${id}.issues.length) {\n payload.issues = payload.issues.concat(${id}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n if (!${id}_present && !${id}.issues.length) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: undefined,\n path: [${k}]\n });\n }\n\n if (${id}_present) {\n if (${id}.value === undefined) {\n newResult[${k}] = undefined;\n } else {\n newResult[${k}] = ${id}.value;\n }\n }\n\n `);\n }\n else {\n doc.write(`\n if (${id}.issues.length) {\n payload.issues = payload.issues.concat(${id}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n \n if (${id}.value === undefined) {\n if (${k} in input) {\n newResult[${k}] = undefined;\n }\n } else {\n newResult[${k}] = ${id}.value;\n }\n \n `);\n }\n }\n doc.write(`payload.value = newResult;`);\n doc.write(`return payload;`);\n const fn = doc.compile();\n return (payload, ctx) => fn(shape, payload, ctx);\n };\n let fastpass;\n const isObject = util.isObject;\n const jit = !core.globalConfig.jitless;\n const allowsEval = util.allowsEval;\n const fastEnabled = jit && allowsEval.value; // && !def.catchall;\n const catchall = def.catchall;\n let value;\n inst._zod.parse = (payload, ctx) => {\n value ?? (value = _normalized.value);\n const input = payload.value;\n if (!isObject(input)) {\n payload.issues.push({\n expected: \"object\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {\n // always synchronous\n if (!fastpass)\n fastpass = generateFastpass(def.shape);\n payload = fastpass(payload, ctx);\n if (!catchall)\n return payload;\n return handleCatchall([], input, payload, ctx, value, inst);\n }\n return superParse(payload, ctx);\n };\n});\nfunction handleUnionResults(results, final, inst, ctx) {\n for (const result of results) {\n if (result.issues.length === 0) {\n final.value = result.value;\n return final;\n }\n }\n const nonaborted = results.filter((r) => !util.aborted(r));\n if (nonaborted.length === 1) {\n final.value = nonaborted[0].value;\n return nonaborted[0];\n }\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),\n });\n return final;\n}\nexport const $ZodUnion = /*@__PURE__*/ core.$constructor(\"$ZodUnion\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"optin\", () => def.options.some((o) => o._zod.optin === \"optional\") ? \"optional\" : undefined);\n util.defineLazy(inst._zod, \"optout\", () => def.options.some((o) => o._zod.optout === \"optional\") ? \"optional\" : undefined);\n util.defineLazy(inst._zod, \"values\", () => {\n if (def.options.every((o) => o._zod.values)) {\n return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));\n }\n return undefined;\n });\n util.defineLazy(inst._zod, \"pattern\", () => {\n if (def.options.every((o) => o._zod.pattern)) {\n const patterns = def.options.map((o) => o._zod.pattern);\n return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join(\"|\")})$`);\n }\n return undefined;\n });\n const first = def.options.length === 1 ? def.options[0]._zod.run : null;\n inst._zod.parse = (payload, ctx) => {\n if (first) {\n return first(payload, ctx);\n }\n let async = false;\n const results = [];\n for (const option of def.options) {\n const result = option._zod.run({\n value: payload.value,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n results.push(result);\n async = true;\n }\n else {\n if (result.issues.length === 0)\n return result;\n results.push(result);\n }\n }\n if (!async)\n return handleUnionResults(results, payload, inst, ctx);\n return Promise.all(results).then((results) => {\n return handleUnionResults(results, payload, inst, ctx);\n });\n };\n});\nfunction handleExclusiveUnionResults(results, final, inst, ctx) {\n const successes = results.filter((r) => r.issues.length === 0);\n if (successes.length === 1) {\n final.value = successes[0].value;\n return final;\n }\n if (successes.length === 0) {\n // No matches - same as regular union\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),\n });\n }\n else {\n // Multiple matches - exclusive union failure\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: [],\n inclusive: false,\n });\n }\n return final;\n}\nexport const $ZodXor = /*@__PURE__*/ core.$constructor(\"$ZodXor\", (inst, def) => {\n $ZodUnion.init(inst, def);\n def.inclusive = false;\n const first = def.options.length === 1 ? def.options[0]._zod.run : null;\n inst._zod.parse = (payload, ctx) => {\n if (first) {\n return first(payload, ctx);\n }\n let async = false;\n const results = [];\n for (const option of def.options) {\n const result = option._zod.run({\n value: payload.value,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n results.push(result);\n async = true;\n }\n else {\n results.push(result);\n }\n }\n if (!async)\n return handleExclusiveUnionResults(results, payload, inst, ctx);\n return Promise.all(results).then((results) => {\n return handleExclusiveUnionResults(results, payload, inst, ctx);\n });\n };\n});\nexport const $ZodDiscriminatedUnion = \n/*@__PURE__*/\ncore.$constructor(\"$ZodDiscriminatedUnion\", (inst, def) => {\n def.inclusive = false;\n $ZodUnion.init(inst, def);\n const _super = inst._zod.parse;\n util.defineLazy(inst._zod, \"propValues\", () => {\n const propValues = {};\n for (const option of def.options) {\n const pv = option._zod.propValues;\n if (!pv || Object.keys(pv).length === 0)\n throw new Error(`Invalid discriminated union option at index \"${def.options.indexOf(option)}\"`);\n for (const [k, v] of Object.entries(pv)) {\n if (!propValues[k])\n propValues[k] = new Set();\n for (const val of v) {\n propValues[k].add(val);\n }\n }\n }\n return propValues;\n });\n const disc = util.cached(() => {\n const opts = def.options;\n const map = new Map();\n for (const o of opts) {\n const values = o._zod.propValues?.[def.discriminator];\n if (!values || values.size === 0)\n throw new Error(`Invalid discriminated union option at index \"${def.options.indexOf(o)}\"`);\n for (const v of values) {\n if (map.has(v)) {\n throw new Error(`Duplicate discriminator value \"${String(v)}\"`);\n }\n map.set(v, o);\n }\n }\n return map;\n });\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!util.isObject(input)) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"object\",\n input,\n inst,\n });\n return payload;\n }\n const opt = disc.value.get(input?.[def.discriminator]);\n if (opt) {\n return opt._zod.run(payload, ctx);\n }\n // Fall back to union matching when the fast discriminator path fails:\n // - explicitly enabled via unionFallback, or\n // - during backward direction (encode), since codec-based discriminators\n // have different values in forward vs backward directions\n if (def.unionFallback || ctx.direction === \"backward\") {\n return _super(payload, ctx);\n }\n // no matching discriminator\n payload.issues.push({\n code: \"invalid_union\",\n errors: [],\n note: \"No matching discriminator\",\n discriminator: def.discriminator,\n options: Array.from(disc.value.keys()),\n input,\n path: [def.discriminator],\n inst,\n });\n return payload;\n };\n});\nexport const $ZodIntersection = /*@__PURE__*/ core.$constructor(\"$ZodIntersection\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n const left = def.left._zod.run({ value: input, issues: [] }, ctx);\n const right = def.right._zod.run({ value: input, issues: [] }, ctx);\n const async = left instanceof Promise || right instanceof Promise;\n if (async) {\n return Promise.all([left, right]).then(([left, right]) => {\n return handleIntersectionResults(payload, left, right);\n });\n }\n return handleIntersectionResults(payload, left, right);\n };\n});\nfunction mergeValues(a, b) {\n // const aType = parse.t(a);\n // const bType = parse.t(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n if (a instanceof Date && b instanceof Date && +a === +b) {\n return { valid: true, data: a };\n }\n if (util.isPlainObject(a) && util.isPlainObject(b)) {\n const bKeys = Object.keys(b);\n const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return {\n valid: false,\n mergeErrorPath: [key, ...sharedValue.mergeErrorPath],\n };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) {\n return { valid: false, mergeErrorPath: [] };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return {\n valid: false,\n mergeErrorPath: [index, ...sharedValue.mergeErrorPath],\n };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n return { valid: false, mergeErrorPath: [] };\n}\nfunction handleIntersectionResults(result, left, right) {\n // Track which side(s) report each key as unrecognized\n const unrecKeys = new Map();\n let unrecIssue;\n for (const iss of left.issues) {\n if (iss.code === \"unrecognized_keys\") {\n unrecIssue ?? (unrecIssue = iss);\n for (const k of iss.keys) {\n if (!unrecKeys.has(k))\n unrecKeys.set(k, {});\n unrecKeys.get(k).l = true;\n }\n }\n else {\n result.issues.push(iss);\n }\n }\n for (const iss of right.issues) {\n if (iss.code === \"unrecognized_keys\") {\n for (const k of iss.keys) {\n if (!unrecKeys.has(k))\n unrecKeys.set(k, {});\n unrecKeys.get(k).r = true;\n }\n }\n else {\n result.issues.push(iss);\n }\n }\n // Report only keys unrecognized by BOTH sides\n const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);\n if (bothKeys.length && unrecIssue) {\n result.issues.push({ ...unrecIssue, keys: bothKeys });\n }\n if (util.aborted(result))\n return result;\n const merged = mergeValues(left.value, right.value);\n if (!merged.valid) {\n throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);\n }\n result.value = merged.data;\n return result;\n}\nexport const $ZodTuple = /*@__PURE__*/ core.$constructor(\"$ZodTuple\", (inst, def) => {\n $ZodType.init(inst, def);\n const items = def.items;\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!Array.isArray(input)) {\n payload.issues.push({\n input,\n inst,\n expected: \"tuple\",\n code: \"invalid_type\",\n });\n return payload;\n }\n payload.value = [];\n const proms = [];\n const optinStart = getTupleOptStart(items, \"optin\");\n const optoutStart = getTupleOptStart(items, \"optout\");\n if (!def.rest) {\n if (input.length < optinStart) {\n payload.issues.push({\n code: \"too_small\",\n minimum: optinStart,\n inclusive: true,\n input,\n inst,\n origin: \"array\",\n });\n return payload;\n }\n if (input.length > items.length) {\n payload.issues.push({\n code: \"too_big\",\n maximum: items.length,\n inclusive: true,\n input,\n inst,\n origin: \"array\",\n });\n }\n }\n // Run every item in parallel, collecting results into an indexed\n // array. The post-processing in `handleTupleResults` walks them in\n // order so it can decide whether an absent optional-output error can\n // truncate the tail or must be reported to preserve required output.\n const itemResults = new Array(items.length);\n for (let i = 0; i < items.length; i++) {\n const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((rr) => {\n itemResults[i] = rr;\n }));\n }\n else {\n itemResults[i] = r;\n }\n }\n if (def.rest) {\n let i = items.length - 1;\n const rest = input.slice(items.length);\n for (const el of rest) {\n i++;\n const result = def.rest._zod.run({ value: el, issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((r) => handleTupleResult(r, payload, i)));\n }\n else {\n handleTupleResult(result, payload, i);\n }\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));\n }\n return handleTupleResults(itemResults, payload, items, input, optoutStart);\n };\n});\nfunction getTupleOptStart(items, key) {\n for (let i = items.length - 1; i >= 0; i--) {\n if (items[i]._zod[key] !== \"optional\")\n return i + 1;\n }\n return 0;\n}\nfunction handleTupleResult(result, final, index) {\n if (result.issues.length) {\n final.issues.push(...util.prefixIssues(index, result.issues));\n }\n final.value[index] = result.value;\n}\nfunction handleTupleResults(itemResults, final, items, input, optoutStart) {\n // Walk results in order. Mirror $ZodObject's swallow-on-absent-optional\n // rule, but only after `optoutStart`: the first index where the output\n // tuple tail can be absent.\n for (let i = 0; i < items.length; i++) {\n const r = itemResults[i];\n const isPresent = i < input.length;\n if (r.issues.length) {\n if (!isPresent && i >= optoutStart) {\n final.value.length = i;\n break;\n }\n final.issues.push(...util.prefixIssues(i, r.issues));\n }\n final.value[i] = r.value;\n }\n // Drop trailing slots that produced `undefined` for absent input\n // (the array analog of an absent optional key on an object). The\n // `i >= input.length` floor is critical: an explicit `undefined`\n // *inside* the input must be preserved even when the schema is\n // optional-out (e.g. `z.string().or(z.undefined())` accepting an\n // explicit undefined value).\n for (let i = final.value.length - 1; i >= input.length; i--) {\n if (items[i]._zod.optout === \"optional\" && final.value[i] === undefined) {\n final.value.length = i;\n }\n else {\n break;\n }\n }\n return final;\n}\nexport const $ZodRecord = /*@__PURE__*/ core.$constructor(\"$ZodRecord\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!util.isPlainObject(input)) {\n payload.issues.push({\n expected: \"record\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n const proms = [];\n const values = def.keyType._zod.values;\n if (values) {\n payload.value = {};\n const recordKeys = new Set();\n for (const key of values) {\n if (typeof key === \"string\" || typeof key === \"number\" || typeof key === \"symbol\") {\n recordKeys.add(typeof key === \"number\" ? key.toString() : key);\n const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n if (keyResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n if (keyResult.issues.length) {\n payload.issues.push({\n code: \"invalid_key\",\n origin: \"record\",\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n input: key,\n path: [key],\n inst,\n });\n continue;\n }\n const outKey = keyResult.value;\n const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[outKey] = result.value;\n }));\n }\n else {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[outKey] = result.value;\n }\n }\n }\n let unrecognized;\n for (const key in input) {\n if (!recordKeys.has(key)) {\n unrecognized = unrecognized ?? [];\n unrecognized.push(key);\n }\n }\n if (unrecognized && unrecognized.length > 0) {\n payload.issues.push({\n code: \"unrecognized_keys\",\n input,\n inst,\n keys: unrecognized,\n });\n }\n }\n else {\n payload.value = {};\n // Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()\n for (const key of Reflect.ownKeys(input)) {\n if (key === \"__proto__\")\n continue;\n if (!Object.prototype.propertyIsEnumerable.call(input, key))\n continue;\n let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n if (keyResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n // Numeric string fallback: if key is a numeric string and failed, retry with Number(key)\n // This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals\n const checkNumericKey = typeof key === \"string\" && regexes.number.test(key) && keyResult.issues.length;\n if (checkNumericKey) {\n const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);\n if (retryResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n if (retryResult.issues.length === 0) {\n keyResult = retryResult;\n }\n }\n if (keyResult.issues.length) {\n if (def.mode === \"loose\") {\n // Pass through unchanged\n payload.value[key] = input[key];\n }\n else {\n // Default \"strict\" behavior: error on invalid key\n payload.issues.push({\n code: \"invalid_key\",\n origin: \"record\",\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n input: key,\n path: [key],\n inst,\n });\n }\n continue;\n }\n const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[keyResult.value] = result.value;\n }));\n }\n else {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[keyResult.value] = result.value;\n }\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => payload);\n }\n return payload;\n };\n});\nexport const $ZodMap = /*@__PURE__*/ core.$constructor(\"$ZodMap\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!(input instanceof Map)) {\n payload.issues.push({\n expected: \"map\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n const proms = [];\n payload.value = new Map();\n for (const [key, value] of input) {\n const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);\n if (keyResult instanceof Promise || valueResult instanceof Promise) {\n proms.push(Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {\n handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);\n }));\n }\n else {\n handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);\n }\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n});\nfunction handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {\n if (keyResult.issues.length) {\n if (util.propertyKeyTypes.has(typeof key)) {\n final.issues.push(...util.prefixIssues(key, keyResult.issues));\n }\n else {\n final.issues.push({\n code: \"invalid_key\",\n origin: \"map\",\n input,\n inst,\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n });\n }\n }\n if (valueResult.issues.length) {\n if (util.propertyKeyTypes.has(typeof key)) {\n final.issues.push(...util.prefixIssues(key, valueResult.issues));\n }\n else {\n final.issues.push({\n origin: \"map\",\n code: \"invalid_element\",\n input,\n inst,\n key: key,\n issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n });\n }\n }\n final.value.set(keyResult.value, valueResult.value);\n}\nexport const $ZodSet = /*@__PURE__*/ core.$constructor(\"$ZodSet\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!(input instanceof Set)) {\n payload.issues.push({\n input,\n inst,\n expected: \"set\",\n code: \"invalid_type\",\n });\n return payload;\n }\n const proms = [];\n payload.value = new Set();\n for (const item of input) {\n const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => handleSetResult(result, payload)));\n }\n else\n handleSetResult(result, payload);\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n});\nfunction handleSetResult(result, final) {\n if (result.issues.length) {\n final.issues.push(...result.issues);\n }\n final.value.add(result.value);\n}\nexport const $ZodEnum = /*@__PURE__*/ core.$constructor(\"$ZodEnum\", (inst, def) => {\n $ZodType.init(inst, def);\n const values = util.getEnumValues(def.entries);\n const valuesSet = new Set(values);\n inst._zod.values = valuesSet;\n inst._zod.pattern = new RegExp(`^(${values\n .filter((k) => util.propertyKeyTypes.has(typeof k))\n .map((o) => (typeof o === \"string\" ? util.escapeRegex(o) : o.toString()))\n .join(\"|\")})$`);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (valuesSet.has(input)) {\n return payload;\n }\n payload.issues.push({\n code: \"invalid_value\",\n values,\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodLiteral = /*@__PURE__*/ core.$constructor(\"$ZodLiteral\", (inst, def) => {\n $ZodType.init(inst, def);\n if (def.values.length === 0) {\n throw new Error(\"Cannot create literal schema with no valid values\");\n }\n const values = new Set(def.values);\n inst._zod.values = values;\n inst._zod.pattern = new RegExp(`^(${def.values\n .map((o) => (typeof o === \"string\" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))\n .join(\"|\")})$`);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (values.has(input)) {\n return payload;\n }\n payload.issues.push({\n code: \"invalid_value\",\n values: def.values,\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodFile = /*@__PURE__*/ core.$constructor(\"$ZodFile\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n // @ts-ignore\n if (input instanceof File)\n return payload;\n payload.issues.push({\n expected: \"file\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodTransform = /*@__PURE__*/ core.$constructor(\"$ZodTransform\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n throw new core.$ZodEncodeError(inst.constructor.name);\n }\n const _out = def.transform(payload.value, payload);\n if (ctx.async) {\n const output = _out instanceof Promise ? _out : Promise.resolve(_out);\n return output.then((output) => {\n payload.value = output;\n payload.fallback = true;\n return payload;\n });\n }\n if (_out instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n payload.value = _out;\n payload.fallback = true;\n return payload;\n };\n});\nfunction handleOptionalResult(result, input) {\n if (input === undefined && (result.issues.length || result.fallback)) {\n return { issues: [], value: undefined };\n }\n return result;\n}\nexport const $ZodOptional = /*@__PURE__*/ core.$constructor(\"$ZodOptional\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n inst._zod.optout = \"optional\";\n util.defineLazy(inst._zod, \"values\", () => {\n return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;\n });\n util.defineLazy(inst._zod, \"pattern\", () => {\n const pattern = def.innerType._zod.pattern;\n return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n if (def.innerType._zod.optin === \"optional\") {\n const input = payload.value;\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise)\n return result.then((r) => handleOptionalResult(r, input));\n return handleOptionalResult(result, input);\n }\n if (payload.value === undefined) {\n return payload;\n }\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodExactOptional = /*@__PURE__*/ core.$constructor(\"$ZodExactOptional\", (inst, def) => {\n // Call parent init - inherits optin/optout = \"optional\"\n $ZodOptional.init(inst, def);\n // Override values/pattern to NOT add undefined\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n util.defineLazy(inst._zod, \"pattern\", () => def.innerType._zod.pattern);\n // Override parse to just delegate (no undefined handling)\n inst._zod.parse = (payload, ctx) => {\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodNullable = /*@__PURE__*/ core.$constructor(\"$ZodNullable\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"optin\", () => def.innerType._zod.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.innerType._zod.optout);\n util.defineLazy(inst._zod, \"pattern\", () => {\n const pattern = def.innerType._zod.pattern;\n return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;\n });\n util.defineLazy(inst._zod, \"values\", () => {\n return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n // Forward direction (decode): allow null to pass through\n if (payload.value === null)\n return payload;\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodDefault = /*@__PURE__*/ core.$constructor(\"$ZodDefault\", (inst, def) => {\n $ZodType.init(inst, def);\n // inst._zod.qin = \"true\";\n inst._zod.optin = \"optional\";\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply defaults for undefined input\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n /**\n * $ZodDefault returns the default value immediately in forward direction.\n * It doesn't pass the default value into the validator (\"prefault\"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a \"prefault\" for the pipe. */\n return payload;\n }\n // Forward direction: continue with default handling\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => handleDefaultResult(result, def));\n }\n return handleDefaultResult(result, def);\n };\n});\nfunction handleDefaultResult(payload, def) {\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n }\n return payload;\n}\nexport const $ZodPrefault = /*@__PURE__*/ core.$constructor(\"$ZodPrefault\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply prefault for undefined input\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n }\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodNonOptional = /*@__PURE__*/ core.$constructor(\"$ZodNonOptional\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"values\", () => {\n const v = def.innerType._zod.values;\n return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => handleNonOptionalResult(result, inst));\n }\n return handleNonOptionalResult(result, inst);\n };\n});\nfunction handleNonOptionalResult(payload, inst) {\n if (!payload.issues.length && payload.value === undefined) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: payload.value,\n inst,\n });\n }\n return payload;\n}\nexport const $ZodSuccess = /*@__PURE__*/ core.$constructor(\"$ZodSuccess\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n throw new core.$ZodEncodeError(\"ZodSuccess\");\n }\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => {\n payload.value = result.issues.length === 0;\n return payload;\n });\n }\n payload.value = result.issues.length === 0;\n return payload;\n };\n});\nexport const $ZodCatch = /*@__PURE__*/ core.$constructor(\"$ZodCatch\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n util.defineLazy(inst._zod, \"optout\", () => def.innerType._zod.optout);\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply catch logic\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => {\n payload.value = result.value;\n if (result.issues.length) {\n payload.value = def.catchValue({\n ...payload,\n error: {\n issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n },\n input: payload.value,\n });\n payload.issues = [];\n payload.fallback = true;\n }\n return payload;\n });\n }\n payload.value = result.value;\n if (result.issues.length) {\n payload.value = def.catchValue({\n ...payload,\n error: {\n issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n },\n input: payload.value,\n });\n payload.issues = [];\n payload.fallback = true;\n }\n return payload;\n };\n});\nexport const $ZodNaN = /*@__PURE__*/ core.$constructor(\"$ZodNaN\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"number\" || !Number.isNaN(payload.value)) {\n payload.issues.push({\n input: payload.value,\n inst,\n expected: \"nan\",\n code: \"invalid_type\",\n });\n return payload;\n }\n return payload;\n };\n});\nexport const $ZodPipe = /*@__PURE__*/ core.$constructor(\"$ZodPipe\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"values\", () => def.in._zod.values);\n util.defineLazy(inst._zod, \"optin\", () => def.in._zod.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.out._zod.optout);\n util.defineLazy(inst._zod, \"propValues\", () => def.in._zod.propValues);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n const right = def.out._zod.run(payload, ctx);\n if (right instanceof Promise) {\n return right.then((right) => handlePipeResult(right, def.in, ctx));\n }\n return handlePipeResult(right, def.in, ctx);\n }\n const left = def.in._zod.run(payload, ctx);\n if (left instanceof Promise) {\n return left.then((left) => handlePipeResult(left, def.out, ctx));\n }\n return handlePipeResult(left, def.out, ctx);\n };\n});\nfunction handlePipeResult(left, next, ctx) {\n if (left.issues.length) {\n // prevent further checks\n left.aborted = true;\n return left;\n }\n return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);\n}\nexport const $ZodCodec = /*@__PURE__*/ core.$constructor(\"$ZodCodec\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"values\", () => def.in._zod.values);\n util.defineLazy(inst._zod, \"optin\", () => def.in._zod.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.out._zod.optout);\n util.defineLazy(inst._zod, \"propValues\", () => def.in._zod.propValues);\n inst._zod.parse = (payload, ctx) => {\n const direction = ctx.direction || \"forward\";\n if (direction === \"forward\") {\n const left = def.in._zod.run(payload, ctx);\n if (left instanceof Promise) {\n return left.then((left) => handleCodecAResult(left, def, ctx));\n }\n return handleCodecAResult(left, def, ctx);\n }\n else {\n const right = def.out._zod.run(payload, ctx);\n if (right instanceof Promise) {\n return right.then((right) => handleCodecAResult(right, def, ctx));\n }\n return handleCodecAResult(right, def, ctx);\n }\n };\n});\nfunction handleCodecAResult(result, def, ctx) {\n if (result.issues.length) {\n // prevent further checks\n result.aborted = true;\n return result;\n }\n const direction = ctx.direction || \"forward\";\n if (direction === \"forward\") {\n const transformed = def.transform(result.value, result);\n if (transformed instanceof Promise) {\n return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));\n }\n return handleCodecTxResult(result, transformed, def.out, ctx);\n }\n else {\n const transformed = def.reverseTransform(result.value, result);\n if (transformed instanceof Promise) {\n return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));\n }\n return handleCodecTxResult(result, transformed, def.in, ctx);\n }\n}\nfunction handleCodecTxResult(left, value, nextSchema, ctx) {\n // Check if transform added any issues\n if (left.issues.length) {\n left.aborted = true;\n return left;\n }\n return nextSchema._zod.run({ value, issues: left.issues }, ctx);\n}\nexport const $ZodPreprocess = /*@__PURE__*/ core.$constructor(\"$ZodPreprocess\", (inst, def) => {\n $ZodPipe.init(inst, def);\n});\nexport const $ZodReadonly = /*@__PURE__*/ core.$constructor(\"$ZodReadonly\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"propValues\", () => def.innerType._zod.propValues);\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n util.defineLazy(inst._zod, \"optin\", () => def.innerType?._zod?.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.innerType?._zod?.optout);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then(handleReadonlyResult);\n }\n return handleReadonlyResult(result);\n };\n});\nfunction handleReadonlyResult(payload) {\n payload.value = Object.freeze(payload.value);\n return payload;\n}\nexport const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor(\"$ZodTemplateLiteral\", (inst, def) => {\n $ZodType.init(inst, def);\n const regexParts = [];\n for (const part of def.parts) {\n if (typeof part === \"object\" && part !== null) {\n // is Zod schema\n if (!part._zod.pattern) {\n // if (!source)\n throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);\n }\n const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;\n if (!source)\n throw new Error(`Invalid template literal part: ${part._zod.traits}`);\n const start = source.startsWith(\"^\") ? 1 : 0;\n const end = source.endsWith(\"$\") ? source.length - 1 : source.length;\n regexParts.push(source.slice(start, end));\n }\n else if (part === null || util.primitiveTypes.has(typeof part)) {\n regexParts.push(util.escapeRegex(`${part}`));\n }\n else {\n throw new Error(`Invalid template literal part: ${part}`);\n }\n }\n inst._zod.pattern = new RegExp(`^${regexParts.join(\"\")}$`);\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"string\") {\n payload.issues.push({\n input: payload.value,\n inst,\n expected: \"string\",\n code: \"invalid_type\",\n });\n return payload;\n }\n inst._zod.pattern.lastIndex = 0;\n if (!inst._zod.pattern.test(payload.value)) {\n payload.issues.push({\n input: payload.value,\n inst,\n code: \"invalid_format\",\n format: def.format ?? \"template_literal\",\n pattern: inst._zod.pattern.source,\n });\n return payload;\n }\n return payload;\n };\n});\nexport const $ZodFunction = /*@__PURE__*/ core.$constructor(\"$ZodFunction\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._def = def;\n inst._zod.def = def;\n inst.implement = (func) => {\n if (typeof func !== \"function\") {\n throw new Error(\"implement() must be called with a function\");\n }\n return function (...args) {\n const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;\n const result = Reflect.apply(func, this, parsedArgs);\n if (inst._def.output) {\n return parse(inst._def.output, result);\n }\n return result;\n };\n };\n inst.implementAsync = (func) => {\n if (typeof func !== \"function\") {\n throw new Error(\"implementAsync() must be called with a function\");\n }\n return async function (...args) {\n const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;\n const result = await Reflect.apply(func, this, parsedArgs);\n if (inst._def.output) {\n return await parseAsync(inst._def.output, result);\n }\n return result;\n };\n };\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"function\") {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"function\",\n input: payload.value,\n inst,\n });\n return payload;\n }\n // Check if output is a promise type to determine if we should use async implementation\n const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === \"promise\";\n if (hasPromiseOutput) {\n payload.value = inst.implementAsync(payload.value);\n }\n else {\n payload.value = inst.implement(payload.value);\n }\n return payload;\n };\n inst.input = (...args) => {\n const F = inst.constructor;\n if (Array.isArray(args[0])) {\n return new F({\n type: \"function\",\n input: new $ZodTuple({\n type: \"tuple\",\n items: args[0],\n rest: args[1],\n }),\n output: inst._def.output,\n });\n }\n return new F({\n type: \"function\",\n input: args[0],\n output: inst._def.output,\n });\n };\n inst.output = (output) => {\n const F = inst.constructor;\n return new F({\n type: \"function\",\n input: inst._def.input,\n output,\n });\n };\n return inst;\n});\nexport const $ZodPromise = /*@__PURE__*/ core.$constructor(\"$ZodPromise\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));\n };\n});\nexport const $ZodLazy = /*@__PURE__*/ core.$constructor(\"$ZodLazy\", (inst, def) => {\n $ZodType.init(inst, def);\n // Cache the resolved inner type on the shared `def` so all clones of this\n // lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,\n // preserving identity for cycle detection on recursive schemas.\n util.defineLazy(inst._zod, \"innerType\", () => {\n const d = def;\n if (!d._cachedInner)\n d._cachedInner = def.getter();\n return d._cachedInner;\n });\n util.defineLazy(inst._zod, \"pattern\", () => inst._zod.innerType?._zod?.pattern);\n util.defineLazy(inst._zod, \"propValues\", () => inst._zod.innerType?._zod?.propValues);\n util.defineLazy(inst._zod, \"optin\", () => inst._zod.innerType?._zod?.optin ?? undefined);\n util.defineLazy(inst._zod, \"optout\", () => inst._zod.innerType?._zod?.optout ?? undefined);\n inst._zod.parse = (payload, ctx) => {\n const inner = inst._zod.innerType;\n return inner._zod.run(payload, ctx);\n };\n});\nexport const $ZodCustom = /*@__PURE__*/ core.$constructor(\"$ZodCustom\", (inst, def) => {\n checks.$ZodCheck.init(inst, def);\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _) => {\n return payload;\n };\n inst._zod.check = (payload) => {\n const input = payload.value;\n const r = def.fn(input);\n if (r instanceof Promise) {\n return r.then((r) => handleRefineResult(r, payload, input, inst));\n }\n handleRefineResult(r, payload, input, inst);\n return;\n };\n});\nfunction handleRefineResult(result, payload, input, inst) {\n if (!result) {\n const _iss = {\n code: \"custom\",\n input,\n inst, // incorporates params.error into issue reporting\n path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting\n continue: !inst._zod.def.abort,\n // params: inst._zod.def.params,\n };\n if (inst._zod.def.params)\n _iss.params = inst._zod.def.params;\n payload.issues.push(util.issue(_iss));\n }\n}\n",
13
13
  "import * as checks from \"./checks.js\";\nimport * as registries from \"./registries.js\";\nimport * as schemas from \"./schemas.js\";\nimport * as util from \"./util.js\";\n// @__NO_SIDE_EFFECTS__\nexport function _string(Class, params) {\n return new Class({\n type: \"string\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedString(Class, params) {\n return new Class({\n type: \"string\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _email(Class, params) {\n return new Class({\n type: \"string\",\n format: \"email\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _guid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"guid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuidv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v4\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuidv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v6\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuidv7(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v7\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _url(Class, params) {\n return new Class({\n type: \"string\",\n format: \"url\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _emoji(Class, params) {\n return new Class({\n type: \"string\",\n format: \"emoji\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nanoid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"nanoid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link _cuid2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\n// @__NO_SIDE_EFFECTS__\nexport function _cuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _cuid2(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cuid2\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ulid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ulid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _xid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"xid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ksuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ksuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ipv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ipv4\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ipv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ipv6\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _mac(Class, params) {\n return new Class({\n type: \"string\",\n format: \"mac\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _cidrv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cidrv4\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _cidrv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cidrv6\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _base64(Class, params) {\n return new Class({\n type: \"string\",\n format: \"base64\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _base64url(Class, params) {\n return new Class({\n type: \"string\",\n format: \"base64url\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _e164(Class, params) {\n return new Class({\n type: \"string\",\n format: \"e164\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _jwt(Class, params) {\n return new Class({\n type: \"string\",\n format: \"jwt\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport const TimePrecision = {\n Any: null,\n Minute: -1,\n Second: 0,\n Millisecond: 3,\n Microsecond: 6,\n};\n// @__NO_SIDE_EFFECTS__\nexport function _isoDateTime(Class, params) {\n return new Class({\n type: \"string\",\n format: \"datetime\",\n check: \"string_format\",\n offset: false,\n local: false,\n precision: null,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _isoDate(Class, params) {\n return new Class({\n type: \"string\",\n format: \"date\",\n check: \"string_format\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _isoTime(Class, params) {\n return new Class({\n type: \"string\",\n format: \"time\",\n check: \"string_format\",\n precision: null,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _isoDuration(Class, params) {\n return new Class({\n type: \"string\",\n format: \"duration\",\n check: \"string_format\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _number(Class, params) {\n return new Class({\n type: \"number\",\n checks: [],\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedNumber(Class, params) {\n return new Class({\n type: \"number\",\n coerce: true,\n checks: [],\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _int(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"safeint\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _float32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"float32\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _float64(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"float64\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _int32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"int32\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uint32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"uint32\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _boolean(Class, params) {\n return new Class({\n type: \"boolean\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedBoolean(Class, params) {\n return new Class({\n type: \"boolean\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _bigint(Class, params) {\n return new Class({\n type: \"bigint\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedBigint(Class, params) {\n return new Class({\n type: \"bigint\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _int64(Class, params) {\n return new Class({\n type: \"bigint\",\n check: \"bigint_format\",\n abort: false,\n format: \"int64\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uint64(Class, params) {\n return new Class({\n type: \"bigint\",\n check: \"bigint_format\",\n abort: false,\n format: \"uint64\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _symbol(Class, params) {\n return new Class({\n type: \"symbol\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _undefined(Class, params) {\n return new Class({\n type: \"undefined\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _null(Class, params) {\n return new Class({\n type: \"null\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _any(Class) {\n return new Class({\n type: \"any\",\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _unknown(Class) {\n return new Class({\n type: \"unknown\",\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _never(Class, params) {\n return new Class({\n type: \"never\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _void(Class, params) {\n return new Class({\n type: \"void\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _date(Class, params) {\n return new Class({\n type: \"date\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedDate(Class, params) {\n return new Class({\n type: \"date\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nan(Class, params) {\n return new Class({\n type: \"nan\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lt(value, params) {\n return new checks.$ZodCheckLessThan({\n check: \"less_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: false,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lte(value, params) {\n return new checks.$ZodCheckLessThan({\n check: \"less_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: true,\n });\n}\nexport { \n/** @deprecated Use `z.lte()` instead. */\n_lte as _max, };\n// @__NO_SIDE_EFFECTS__\nexport function _gt(value, params) {\n return new checks.$ZodCheckGreaterThan({\n check: \"greater_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: false,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _gte(value, params) {\n return new checks.$ZodCheckGreaterThan({\n check: \"greater_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: true,\n });\n}\nexport { \n/** @deprecated Use `z.gte()` instead. */\n_gte as _min, };\n// @__NO_SIDE_EFFECTS__\nexport function _positive(params) {\n return _gt(0, params);\n}\n// negative\n// @__NO_SIDE_EFFECTS__\nexport function _negative(params) {\n return _lt(0, params);\n}\n// nonpositive\n// @__NO_SIDE_EFFECTS__\nexport function _nonpositive(params) {\n return _lte(0, params);\n}\n// nonnegative\n// @__NO_SIDE_EFFECTS__\nexport function _nonnegative(params) {\n return _gte(0, params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function _multipleOf(value, params) {\n return new checks.$ZodCheckMultipleOf({\n check: \"multiple_of\",\n ...util.normalizeParams(params),\n value,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _maxSize(maximum, params) {\n return new checks.$ZodCheckMaxSize({\n check: \"max_size\",\n ...util.normalizeParams(params),\n maximum,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _minSize(minimum, params) {\n return new checks.$ZodCheckMinSize({\n check: \"min_size\",\n ...util.normalizeParams(params),\n minimum,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _size(size, params) {\n return new checks.$ZodCheckSizeEquals({\n check: \"size_equals\",\n ...util.normalizeParams(params),\n size,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _maxLength(maximum, params) {\n const ch = new checks.$ZodCheckMaxLength({\n check: \"max_length\",\n ...util.normalizeParams(params),\n maximum,\n });\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _minLength(minimum, params) {\n return new checks.$ZodCheckMinLength({\n check: \"min_length\",\n ...util.normalizeParams(params),\n minimum,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _length(length, params) {\n return new checks.$ZodCheckLengthEquals({\n check: \"length_equals\",\n ...util.normalizeParams(params),\n length,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _regex(pattern, params) {\n return new checks.$ZodCheckRegex({\n check: \"string_format\",\n format: \"regex\",\n ...util.normalizeParams(params),\n pattern,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lowercase(params) {\n return new checks.$ZodCheckLowerCase({\n check: \"string_format\",\n format: \"lowercase\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uppercase(params) {\n return new checks.$ZodCheckUpperCase({\n check: \"string_format\",\n format: \"uppercase\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _includes(includes, params) {\n return new checks.$ZodCheckIncludes({\n check: \"string_format\",\n format: \"includes\",\n ...util.normalizeParams(params),\n includes,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _startsWith(prefix, params) {\n return new checks.$ZodCheckStartsWith({\n check: \"string_format\",\n format: \"starts_with\",\n ...util.normalizeParams(params),\n prefix,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _endsWith(suffix, params) {\n return new checks.$ZodCheckEndsWith({\n check: \"string_format\",\n format: \"ends_with\",\n ...util.normalizeParams(params),\n suffix,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _property(property, schema, params) {\n return new checks.$ZodCheckProperty({\n check: \"property\",\n property,\n schema,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _mime(types, params) {\n return new checks.$ZodCheckMimeType({\n check: \"mime_type\",\n mime: types,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _overwrite(tx) {\n return new checks.$ZodCheckOverwrite({\n check: \"overwrite\",\n tx,\n });\n}\n// normalize\n// @__NO_SIDE_EFFECTS__\nexport function _normalize(form) {\n return _overwrite((input) => input.normalize(form));\n}\n// trim\n// @__NO_SIDE_EFFECTS__\nexport function _trim() {\n return _overwrite((input) => input.trim());\n}\n// toLowerCase\n// @__NO_SIDE_EFFECTS__\nexport function _toLowerCase() {\n return _overwrite((input) => input.toLowerCase());\n}\n// toUpperCase\n// @__NO_SIDE_EFFECTS__\nexport function _toUpperCase() {\n return _overwrite((input) => input.toUpperCase());\n}\n// slugify\n// @__NO_SIDE_EFFECTS__\nexport function _slugify() {\n return _overwrite((input) => util.slugify(input));\n}\n// @__NO_SIDE_EFFECTS__\nexport function _array(Class, element, params) {\n return new Class({\n type: \"array\",\n element,\n // get element() {\n // return element;\n // },\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _union(Class, options, params) {\n return new Class({\n type: \"union\",\n options,\n ...util.normalizeParams(params),\n });\n}\nexport function _xor(Class, options, params) {\n return new Class({\n type: \"union\",\n options,\n inclusive: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _discriminatedUnion(Class, discriminator, options, params) {\n return new Class({\n type: \"union\",\n options,\n discriminator,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _intersection(Class, left, right) {\n return new Class({\n type: \"intersection\",\n left,\n right,\n });\n}\n// export function _tuple(\n// Class: util.SchemaClass<schemas.$ZodTuple>,\n// items: [],\n// params?: string | $ZodTupleParams\n// ): schemas.$ZodTuple<[], null>;\n// @__NO_SIDE_EFFECTS__\nexport function _tuple(Class, items, _paramsOrRest, _params) {\n const hasRest = _paramsOrRest instanceof schemas.$ZodType;\n const params = hasRest ? _params : _paramsOrRest;\n const rest = hasRest ? _paramsOrRest : null;\n return new Class({\n type: \"tuple\",\n items,\n rest,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _record(Class, keyType, valueType, params) {\n return new Class({\n type: \"record\",\n keyType,\n valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _map(Class, keyType, valueType, params) {\n return new Class({\n type: \"map\",\n keyType,\n valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _set(Class, valueType, params) {\n return new Class({\n type: \"set\",\n valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _enum(Class, values, params) {\n const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;\n // if (Array.isArray(values)) {\n // for (const value of values) {\n // entries[value] = value;\n // }\n // } else {\n // Object.assign(entries, values);\n // }\n // const entries: util.EnumLike = {};\n // for (const val of values) {\n // entries[val] = val;\n // }\n return new Class({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\n/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.\n *\n * ```ts\n * enum Colors { red, green, blue }\n * z.enum(Colors);\n * ```\n */\nexport function _nativeEnum(Class, entries, params) {\n return new Class({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _literal(Class, value, params) {\n return new Class({\n type: \"literal\",\n values: Array.isArray(value) ? value : [value],\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _file(Class, params) {\n return new Class({\n type: \"file\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _transform(Class, fn) {\n return new Class({\n type: \"transform\",\n transform: fn,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _optional(Class, innerType) {\n return new Class({\n type: \"optional\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nullable(Class, innerType) {\n return new Class({\n type: \"nullable\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _default(Class, innerType, defaultValue) {\n return new Class({\n type: \"default\",\n innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nonoptional(Class, innerType, params) {\n return new Class({\n type: \"nonoptional\",\n innerType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _success(Class, innerType) {\n return new Class({\n type: \"success\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _catch(Class, innerType, catchValue) {\n return new Class({\n type: \"catch\",\n innerType,\n catchValue: (typeof catchValue === \"function\" ? catchValue : () => catchValue),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _pipe(Class, in_, out) {\n return new Class({\n type: \"pipe\",\n in: in_,\n out,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _readonly(Class, innerType) {\n return new Class({\n type: \"readonly\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _templateLiteral(Class, parts, params) {\n return new Class({\n type: \"template_literal\",\n parts,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lazy(Class, getter) {\n return new Class({\n type: \"lazy\",\n getter,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _promise(Class, innerType) {\n return new Class({\n type: \"promise\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _custom(Class, fn, _params) {\n const norm = util.normalizeParams(_params);\n norm.abort ?? (norm.abort = true); // default to abort:false\n const schema = new Class({\n type: \"custom\",\n check: \"custom\",\n fn: fn,\n ...norm,\n });\n return schema;\n}\n// same as _custom but defaults to abort:false\n// @__NO_SIDE_EFFECTS__\nexport function _refine(Class, fn, _params) {\n const schema = new Class({\n type: \"custom\",\n check: \"custom\",\n fn: fn,\n ...util.normalizeParams(_params),\n });\n return schema;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _superRefine(fn, params) {\n const ch = _check((payload) => {\n payload.addIssue = (issue) => {\n if (typeof issue === \"string\") {\n payload.issues.push(util.issue(issue, payload.value, ch._zod.def));\n }\n else {\n // for Zod 3 backwards compatibility\n const _issue = issue;\n if (_issue.fatal)\n _issue.continue = false;\n _issue.code ?? (_issue.code = \"custom\");\n _issue.input ?? (_issue.input = payload.value);\n _issue.inst ?? (_issue.inst = ch);\n _issue.continue ?? (_issue.continue = !ch._zod.def.abort); // abort is always undefined, so this is always true...\n payload.issues.push(util.issue(_issue));\n }\n };\n return fn(payload.value, payload);\n }, params);\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _check(fn, params) {\n const ch = new checks.$ZodCheck({\n check: \"custom\",\n ...util.normalizeParams(params),\n });\n ch._zod.check = fn;\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function describe(description) {\n const ch = new checks.$ZodCheck({ check: \"describe\" });\n ch._zod.onattach = [\n (inst) => {\n const existing = registries.globalRegistry.get(inst) ?? {};\n registries.globalRegistry.add(inst, { ...existing, description });\n },\n ];\n ch._zod.check = () => { }; // no-op check\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function meta(metadata) {\n const ch = new checks.$ZodCheck({ check: \"meta\" });\n ch._zod.onattach = [\n (inst) => {\n const existing = registries.globalRegistry.get(inst) ?? {};\n registries.globalRegistry.add(inst, { ...existing, ...metadata });\n },\n ];\n ch._zod.check = () => { }; // no-op check\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _stringbool(Classes, _params) {\n const params = util.normalizeParams(_params);\n let truthyArray = params.truthy ?? [\"true\", \"1\", \"yes\", \"on\", \"y\", \"enabled\"];\n let falsyArray = params.falsy ?? [\"false\", \"0\", \"no\", \"off\", \"n\", \"disabled\"];\n if (params.case !== \"sensitive\") {\n truthyArray = truthyArray.map((v) => (typeof v === \"string\" ? v.toLowerCase() : v));\n falsyArray = falsyArray.map((v) => (typeof v === \"string\" ? v.toLowerCase() : v));\n }\n const truthySet = new Set(truthyArray);\n const falsySet = new Set(falsyArray);\n const _Codec = Classes.Codec ?? schemas.$ZodCodec;\n const _Boolean = Classes.Boolean ?? schemas.$ZodBoolean;\n const _String = Classes.String ?? schemas.$ZodString;\n const stringSchema = new _String({ type: \"string\", error: params.error });\n const booleanSchema = new _Boolean({ type: \"boolean\", error: params.error });\n const codec = new _Codec({\n type: \"pipe\",\n in: stringSchema,\n out: booleanSchema,\n transform: ((input, payload) => {\n let data = input;\n if (params.case !== \"sensitive\")\n data = data.toLowerCase();\n if (truthySet.has(data)) {\n return true;\n }\n else if (falsySet.has(data)) {\n return false;\n }\n else {\n payload.issues.push({\n code: \"invalid_value\",\n expected: \"stringbool\",\n values: [...truthySet, ...falsySet],\n input: payload.value,\n inst: codec,\n continue: false,\n });\n return {};\n }\n }),\n reverseTransform: ((input, _payload) => {\n if (input === true) {\n return truthyArray[0] || \"true\";\n }\n else {\n return falsyArray[0] || \"false\";\n }\n }),\n error: params.error,\n });\n return codec;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _stringFormat(Class, format, fnOrRegex, _params = {}) {\n const params = util.normalizeParams(_params);\n const def = {\n ...util.normalizeParams(_params),\n check: \"string_format\",\n type: \"string\",\n format,\n fn: typeof fnOrRegex === \"function\" ? fnOrRegex : (val) => fnOrRegex.test(val),\n ...params,\n };\n if (fnOrRegex instanceof RegExp) {\n def.pattern = fnOrRegex;\n }\n const inst = new Class(def);\n return inst;\n}\n",
14
14
  "import * as core from \"../core/index.js\";\nimport * as util from \"../core/util.js\";\nimport * as parse from \"./parse.js\";\nexport const ZodMiniType = /*@__PURE__*/ core.$constructor(\"ZodMiniType\", (inst, def) => {\n if (!inst._zod)\n throw new Error(\"Uninitialized schema in ZodMiniType.\");\n core.$ZodType.init(inst, def);\n inst.def = def;\n inst.type = def.type;\n inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });\n inst.safeParse = (data, params) => parse.safeParse(inst, data, params);\n inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });\n inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);\n inst.check = (...checks) => {\n return inst.clone({\n ...def,\n checks: [\n ...(def.checks ?? []),\n ...checks.map((ch) => typeof ch === \"function\"\n ? {\n _zod: { check: ch, def: { check: \"custom\" }, onattach: [] },\n }\n : ch),\n ],\n }, { parent: true });\n };\n inst.with = inst.check;\n inst.clone = (_def, params) => core.clone(inst, _def, params);\n inst.brand = () => inst;\n inst.register = ((reg, meta) => {\n reg.add(inst, meta);\n return inst;\n });\n inst.apply = (fn) => fn(inst);\n});\nexport const ZodMiniString = /*@__PURE__*/ core.$constructor(\"ZodMiniString\", (inst, def) => {\n core.$ZodString.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function string(params) {\n return core._string(ZodMiniString, params);\n}\nexport const ZodMiniStringFormat = /*@__PURE__*/ core.$constructor(\"ZodMiniStringFormat\", (inst, def) => {\n core.$ZodStringFormat.init(inst, def);\n ZodMiniString.init(inst, def);\n});\nexport const ZodMiniEmail = /*@__PURE__*/ core.$constructor(\"ZodMiniEmail\", (inst, def) => {\n core.$ZodEmail.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function email(params) {\n return core._email(ZodMiniEmail, params);\n}\nexport const ZodMiniGUID = /*@__PURE__*/ core.$constructor(\"ZodMiniGUID\", (inst, def) => {\n core.$ZodGUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function guid(params) {\n return core._guid(ZodMiniGUID, params);\n}\nexport const ZodMiniUUID = /*@__PURE__*/ core.$constructor(\"ZodMiniUUID\", (inst, def) => {\n core.$ZodUUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function uuid(params) {\n return core._uuid(ZodMiniUUID, params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function uuidv4(params) {\n return core._uuidv4(ZodMiniUUID, params);\n}\n// ZodMiniUUIDv6\n// @__NO_SIDE_EFFECTS__\nexport function uuidv6(params) {\n return core._uuidv6(ZodMiniUUID, params);\n}\n// ZodMiniUUIDv7\n// @__NO_SIDE_EFFECTS__\nexport function uuidv7(params) {\n return core._uuidv7(ZodMiniUUID, params);\n}\nexport const ZodMiniURL = /*@__PURE__*/ core.$constructor(\"ZodMiniURL\", (inst, def) => {\n core.$ZodURL.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function url(params) {\n return core._url(ZodMiniURL, params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function httpUrl(params) {\n return core._url(ZodMiniURL, {\n protocol: core.regexes.httpProtocol,\n hostname: core.regexes.domain,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniEmoji = /*@__PURE__*/ core.$constructor(\"ZodMiniEmoji\", (inst, def) => {\n core.$ZodEmoji.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function emoji(params) {\n return core._emoji(ZodMiniEmoji, params);\n}\nexport const ZodMiniNanoID = /*@__PURE__*/ core.$constructor(\"ZodMiniNanoID\", (inst, def) => {\n core.$ZodNanoID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function nanoid(params) {\n return core._nanoid(ZodMiniNanoID, params);\n}\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport const ZodMiniCUID = /*@__PURE__*/ core.$constructor(\"ZodMiniCUID\", (inst, def) => {\n core.$ZodCUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n/**\n * Validates a CUID v1 string.\n *\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.\n * See https://github.com/paralleldrive/cuid.\n */\n// @__NO_SIDE_EFFECTS__\nexport function cuid(params) {\n return core._cuid(ZodMiniCUID, params);\n}\nexport const ZodMiniCUID2 = /*@__PURE__*/ core.$constructor(\"ZodMiniCUID2\", (inst, def) => {\n core.$ZodCUID2.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function cuid2(params) {\n return core._cuid2(ZodMiniCUID2, params);\n}\nexport const ZodMiniULID = /*@__PURE__*/ core.$constructor(\"ZodMiniULID\", (inst, def) => {\n core.$ZodULID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function ulid(params) {\n return core._ulid(ZodMiniULID, params);\n}\nexport const ZodMiniXID = /*@__PURE__*/ core.$constructor(\"ZodMiniXID\", (inst, def) => {\n core.$ZodXID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function xid(params) {\n return core._xid(ZodMiniXID, params);\n}\nexport const ZodMiniKSUID = /*@__PURE__*/ core.$constructor(\"ZodMiniKSUID\", (inst, def) => {\n core.$ZodKSUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function ksuid(params) {\n return core._ksuid(ZodMiniKSUID, params);\n}\nexport const ZodMiniIPv4 = /*@__PURE__*/ core.$constructor(\"ZodMiniIPv4\", (inst, def) => {\n core.$ZodIPv4.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function ipv4(params) {\n return core._ipv4(ZodMiniIPv4, params);\n}\nexport const ZodMiniIPv6 = /*@__PURE__*/ core.$constructor(\"ZodMiniIPv6\", (inst, def) => {\n core.$ZodIPv6.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function ipv6(params) {\n return core._ipv6(ZodMiniIPv6, params);\n}\nexport const ZodMiniCIDRv4 = /*@__PURE__*/ core.$constructor(\"ZodMiniCIDRv4\", (inst, def) => {\n core.$ZodCIDRv4.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function cidrv4(params) {\n return core._cidrv4(ZodMiniCIDRv4, params);\n}\nexport const ZodMiniCIDRv6 = /*@__PURE__*/ core.$constructor(\"ZodMiniCIDRv6\", (inst, def) => {\n core.$ZodCIDRv6.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function cidrv6(params) {\n return core._cidrv6(ZodMiniCIDRv6, params);\n}\nexport const ZodMiniMAC = /*@__PURE__*/ core.$constructor(\"ZodMiniMAC\", (inst, def) => {\n core.$ZodMAC.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function mac(params) {\n return core._mac(ZodMiniMAC, params);\n}\nexport const ZodMiniBase64 = /*@__PURE__*/ core.$constructor(\"ZodMiniBase64\", (inst, def) => {\n core.$ZodBase64.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function base64(params) {\n return core._base64(ZodMiniBase64, params);\n}\nexport const ZodMiniBase64URL = /*@__PURE__*/ core.$constructor(\"ZodMiniBase64URL\", (inst, def) => {\n core.$ZodBase64URL.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function base64url(params) {\n return core._base64url(ZodMiniBase64URL, params);\n}\nexport const ZodMiniE164 = /*@__PURE__*/ core.$constructor(\"ZodMiniE164\", (inst, def) => {\n core.$ZodE164.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function e164(params) {\n return core._e164(ZodMiniE164, params);\n}\nexport const ZodMiniJWT = /*@__PURE__*/ core.$constructor(\"ZodMiniJWT\", (inst, def) => {\n core.$ZodJWT.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function jwt(params) {\n return core._jwt(ZodMiniJWT, params);\n}\nexport const ZodMiniCustomStringFormat = /*@__PURE__*/ core.$constructor(\"ZodMiniCustomStringFormat\", (inst, def) => {\n core.$ZodCustomStringFormat.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function stringFormat(format, fnOrRegex, _params = {}) {\n return core._stringFormat(ZodMiniCustomStringFormat, format, fnOrRegex, _params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function hostname(_params) {\n return core._stringFormat(ZodMiniCustomStringFormat, \"hostname\", core.regexes.hostname, _params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function hex(_params) {\n return core._stringFormat(ZodMiniCustomStringFormat, \"hex\", core.regexes.hex, _params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function hash(alg, params) {\n const enc = params?.enc ?? \"hex\";\n const format = `${alg}_${enc}`;\n const regex = core.regexes[format];\n // check for unrecognized format\n if (!regex)\n throw new Error(`Unrecognized hash format: ${format}`);\n return core._stringFormat(ZodMiniCustomStringFormat, format, regex, params);\n}\nexport const ZodMiniNumber = /*@__PURE__*/ core.$constructor(\"ZodMiniNumber\", (inst, def) => {\n core.$ZodNumber.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function number(params) {\n return core._number(ZodMiniNumber, params);\n}\nexport const ZodMiniNumberFormat = /*@__PURE__*/ core.$constructor(\"ZodMiniNumberFormat\", (inst, def) => {\n core.$ZodNumberFormat.init(inst, def);\n ZodMiniNumber.init(inst, def);\n});\n// int\n// @__NO_SIDE_EFFECTS__\nexport function int(params) {\n return core._int(ZodMiniNumberFormat, params);\n}\n// float32\n// @__NO_SIDE_EFFECTS__\nexport function float32(params) {\n return core._float32(ZodMiniNumberFormat, params);\n}\n// float64\n// @__NO_SIDE_EFFECTS__\nexport function float64(params) {\n return core._float64(ZodMiniNumberFormat, params);\n}\n// int32\n// @__NO_SIDE_EFFECTS__\nexport function int32(params) {\n return core._int32(ZodMiniNumberFormat, params);\n}\n// uint32\n// @__NO_SIDE_EFFECTS__\nexport function uint32(params) {\n return core._uint32(ZodMiniNumberFormat, params);\n}\nexport const ZodMiniBoolean = /*@__PURE__*/ core.$constructor(\"ZodMiniBoolean\", (inst, def) => {\n core.$ZodBoolean.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function boolean(params) {\n return core._boolean(ZodMiniBoolean, params);\n}\nexport const ZodMiniBigInt = /*@__PURE__*/ core.$constructor(\"ZodMiniBigInt\", (inst, def) => {\n core.$ZodBigInt.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function bigint(params) {\n return core._bigint(ZodMiniBigInt, params);\n}\nexport const ZodMiniBigIntFormat = /*@__PURE__*/ core.$constructor(\"ZodMiniBigIntFormat\", (inst, def) => {\n core.$ZodBigIntFormat.init(inst, def);\n ZodMiniBigInt.init(inst, def);\n});\n// int64\n// @__NO_SIDE_EFFECTS__\nexport function int64(params) {\n return core._int64(ZodMiniBigIntFormat, params);\n}\n// uint64\n// @__NO_SIDE_EFFECTS__\nexport function uint64(params) {\n return core._uint64(ZodMiniBigIntFormat, params);\n}\nexport const ZodMiniSymbol = /*@__PURE__*/ core.$constructor(\"ZodMiniSymbol\", (inst, def) => {\n core.$ZodSymbol.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function symbol(params) {\n return core._symbol(ZodMiniSymbol, params);\n}\nexport const ZodMiniUndefined = /*@__PURE__*/ core.$constructor(\"ZodMiniUndefined\", (inst, def) => {\n core.$ZodUndefined.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nfunction _undefined(params) {\n return core._undefined(ZodMiniUndefined, params);\n}\nexport { _undefined as undefined };\nexport const ZodMiniNull = /*@__PURE__*/ core.$constructor(\"ZodMiniNull\", (inst, def) => {\n core.$ZodNull.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nfunction _null(params) {\n return core._null(ZodMiniNull, params);\n}\nexport { _null as null };\nexport const ZodMiniAny = /*@__PURE__*/ core.$constructor(\"ZodMiniAny\", (inst, def) => {\n core.$ZodAny.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function any() {\n return core._any(ZodMiniAny);\n}\nexport const ZodMiniUnknown = /*@__PURE__*/ core.$constructor(\"ZodMiniUnknown\", (inst, def) => {\n core.$ZodUnknown.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function unknown() {\n return core._unknown(ZodMiniUnknown);\n}\nexport const ZodMiniNever = /*@__PURE__*/ core.$constructor(\"ZodMiniNever\", (inst, def) => {\n core.$ZodNever.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function never(params) {\n return core._never(ZodMiniNever, params);\n}\nexport const ZodMiniVoid = /*@__PURE__*/ core.$constructor(\"ZodMiniVoid\", (inst, def) => {\n core.$ZodVoid.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nfunction _void(params) {\n return core._void(ZodMiniVoid, params);\n}\nexport { _void as void };\nexport const ZodMiniDate = /*@__PURE__*/ core.$constructor(\"ZodMiniDate\", (inst, def) => {\n core.$ZodDate.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function date(params) {\n return core._date(ZodMiniDate, params);\n}\nexport const ZodMiniArray = /*@__PURE__*/ core.$constructor(\"ZodMiniArray\", (inst, def) => {\n core.$ZodArray.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function array(element, params) {\n return new ZodMiniArray({\n type: \"array\",\n element: element,\n ...util.normalizeParams(params),\n });\n}\n// .keyof\n// @__NO_SIDE_EFFECTS__\nexport function keyof(schema) {\n const shape = schema._zod.def.shape;\n return _enum(Object.keys(shape));\n}\nexport const ZodMiniObject = /*@__PURE__*/ core.$constructor(\"ZodMiniObject\", (inst, def) => {\n core.$ZodObject.init(inst, def);\n ZodMiniType.init(inst, def);\n util.defineLazy(inst, \"shape\", () => def.shape);\n});\n// @__NO_SIDE_EFFECTS__\nexport function object(shape, params) {\n const def = {\n type: \"object\",\n shape: shape ?? {},\n ...util.normalizeParams(params),\n };\n return new ZodMiniObject(def);\n}\n// strictObject\n// @__NO_SIDE_EFFECTS__\nexport function strictObject(shape, params) {\n return new ZodMiniObject({\n type: \"object\",\n shape,\n catchall: never(),\n ...util.normalizeParams(params),\n });\n}\n// looseObject\n// @__NO_SIDE_EFFECTS__\nexport function looseObject(shape, params) {\n return new ZodMiniObject({\n type: \"object\",\n shape,\n catchall: unknown(),\n ...util.normalizeParams(params),\n });\n}\n// object methods\n// @__NO_SIDE_EFFECTS__\nexport function extend(schema, shape) {\n return util.extend(schema, shape);\n}\n// @__NO_SIDE_EFFECTS__\nexport function safeExtend(schema, shape) {\n return util.safeExtend(schema, shape);\n}\n// @__NO_SIDE_EFFECTS__\nexport function merge(schema, shape) {\n return util.extend(schema, shape);\n}\n// @__NO_SIDE_EFFECTS__\nexport function pick(schema, mask) {\n return util.pick(schema, mask);\n}\n// .omit\n// @__NO_SIDE_EFFECTS__\nexport function omit(schema, mask) {\n return util.omit(schema, mask);\n}\n// @__NO_SIDE_EFFECTS__\nexport function partial(schema, mask) {\n return util.partial(ZodMiniOptional, schema, mask);\n}\n// @__NO_SIDE_EFFECTS__\nexport function required(schema, mask) {\n return util.required(ZodMiniNonOptional, schema, mask);\n}\n// @__NO_SIDE_EFFECTS__\nexport function catchall(inst, catchall) {\n return inst.clone({ ...inst._zod.def, catchall: catchall });\n}\nexport const ZodMiniUnion = /*@__PURE__*/ core.$constructor(\"ZodMiniUnion\", (inst, def) => {\n core.$ZodUnion.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function union(options, params) {\n return new ZodMiniUnion({\n type: \"union\",\n options: options,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniXor = /*@__PURE__*/ core.$constructor(\"ZodMiniXor\", (inst, def) => {\n ZodMiniUnion.init(inst, def);\n core.$ZodXor.init(inst, def);\n});\n/** Creates an exclusive union (XOR) where exactly one option must match.\n * Unlike regular unions that succeed when any option matches, xor fails if\n * zero or more than one option matches the input. */\nexport function xor(options, params) {\n return new ZodMiniXor({\n type: \"union\",\n options: options,\n inclusive: false,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniDiscriminatedUnion = /*@__PURE__*/ core.$constructor(\"ZodMiniDiscriminatedUnion\", (inst, def) => {\n core.$ZodDiscriminatedUnion.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function discriminatedUnion(discriminator, options, params) {\n return new ZodMiniDiscriminatedUnion({\n type: \"union\",\n options,\n discriminator,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniIntersection = /*@__PURE__*/ core.$constructor(\"ZodMiniIntersection\", (inst, def) => {\n core.$ZodIntersection.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function intersection(left, right) {\n return new ZodMiniIntersection({\n type: \"intersection\",\n left: left,\n right: right,\n });\n}\nexport const ZodMiniTuple = /*@__PURE__*/ core.$constructor(\"ZodMiniTuple\", (inst, def) => {\n core.$ZodTuple.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function tuple(items, _paramsOrRest, _params) {\n const hasRest = _paramsOrRest instanceof core.$ZodType;\n const params = hasRest ? _params : _paramsOrRest;\n const rest = hasRest ? _paramsOrRest : null;\n return new ZodMiniTuple({\n type: \"tuple\",\n items: items,\n rest,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniRecord = /*@__PURE__*/ core.$constructor(\"ZodMiniRecord\", (inst, def) => {\n core.$ZodRecord.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function record(keyType, valueType, params) {\n // v3-compat: z.record(valueType, params?) — defaults keyType to z.string()\n if (!valueType || !valueType._zod) {\n return new ZodMiniRecord({\n type: \"record\",\n keyType: string(),\n valueType: keyType,\n ...util.normalizeParams(valueType),\n });\n }\n return new ZodMiniRecord({\n type: \"record\",\n keyType,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function partialRecord(keyType, valueType, params) {\n const k = core.clone(keyType);\n k._zod.values = undefined;\n return new ZodMiniRecord({\n type: \"record\",\n keyType: k,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport function looseRecord(keyType, valueType, params) {\n return new ZodMiniRecord({\n type: \"record\",\n keyType,\n valueType: valueType,\n mode: \"loose\",\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniMap = /*@__PURE__*/ core.$constructor(\"ZodMiniMap\", (inst, def) => {\n core.$ZodMap.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function map(keyType, valueType, params) {\n return new ZodMiniMap({\n type: \"map\",\n keyType: keyType,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniSet = /*@__PURE__*/ core.$constructor(\"ZodMiniSet\", (inst, def) => {\n core.$ZodSet.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function set(valueType, params) {\n return new ZodMiniSet({\n type: \"set\",\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniEnum = /*@__PURE__*/ core.$constructor(\"ZodMiniEnum\", (inst, def) => {\n core.$ZodEnum.init(inst, def);\n ZodMiniType.init(inst, def);\n inst.options = Object.values(def.entries);\n});\n// @__NO_SIDE_EFFECTS__\nfunction _enum(values, params) {\n const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;\n return new ZodMiniEnum({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\nexport { _enum as enum };\n// @__NO_SIDE_EFFECTS__\n/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.\n *\n * ```ts\n * enum Colors { red, green, blue }\n * z.enum(Colors);\n * ```\n */\nexport function nativeEnum(entries, params) {\n return new ZodMiniEnum({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniLiteral = /*@__PURE__*/ core.$constructor(\"ZodMiniLiteral\", (inst, def) => {\n core.$ZodLiteral.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function literal(value, params) {\n return new ZodMiniLiteral({\n type: \"literal\",\n values: Array.isArray(value) ? value : [value],\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniFile = /*@__PURE__*/ core.$constructor(\"ZodMiniFile\", (inst, def) => {\n core.$ZodFile.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function file(params) {\n return core._file(ZodMiniFile, params);\n}\nexport const ZodMiniTransform = /*@__PURE__*/ core.$constructor(\"ZodMiniTransform\", (inst, def) => {\n core.$ZodTransform.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function transform(fn) {\n return new ZodMiniTransform({\n type: \"transform\",\n transform: fn,\n });\n}\nexport const ZodMiniOptional = /*@__PURE__*/ core.$constructor(\"ZodMiniOptional\", (inst, def) => {\n core.$ZodOptional.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function optional(innerType) {\n return new ZodMiniOptional({\n type: \"optional\",\n innerType: innerType,\n });\n}\nexport const ZodMiniExactOptional = /*@__PURE__*/ core.$constructor(\"ZodMiniExactOptional\", (inst, def) => {\n core.$ZodExactOptional.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function exactOptional(innerType) {\n return new ZodMiniExactOptional({\n type: \"optional\",\n innerType: innerType,\n });\n}\nexport const ZodMiniNullable = /*@__PURE__*/ core.$constructor(\"ZodMiniNullable\", (inst, def) => {\n core.$ZodNullable.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function nullable(innerType) {\n return new ZodMiniNullable({\n type: \"nullable\",\n innerType: innerType,\n });\n}\n// nullish\n// @__NO_SIDE_EFFECTS__\nexport function nullish(innerType) {\n return optional(nullable(innerType));\n}\nexport const ZodMiniDefault = /*@__PURE__*/ core.$constructor(\"ZodMiniDefault\", (inst, def) => {\n core.$ZodDefault.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function _default(innerType, defaultValue) {\n return new ZodMiniDefault({\n type: \"default\",\n innerType: innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\nexport const ZodMiniPrefault = /*@__PURE__*/ core.$constructor(\"ZodMiniPrefault\", (inst, def) => {\n core.$ZodPrefault.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function prefault(innerType, defaultValue) {\n return new ZodMiniPrefault({\n type: \"prefault\",\n innerType: innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\nexport const ZodMiniNonOptional = /*@__PURE__*/ core.$constructor(\"ZodMiniNonOptional\", (inst, def) => {\n core.$ZodNonOptional.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function nonoptional(innerType, params) {\n return new ZodMiniNonOptional({\n type: \"nonoptional\",\n innerType: innerType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniSuccess = /*@__PURE__*/ core.$constructor(\"ZodMiniSuccess\", (inst, def) => {\n core.$ZodSuccess.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function success(innerType) {\n return new ZodMiniSuccess({\n type: \"success\",\n innerType: innerType,\n });\n}\nexport const ZodMiniCatch = /*@__PURE__*/ core.$constructor(\"ZodMiniCatch\", (inst, def) => {\n core.$ZodCatch.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nfunction _catch(innerType, catchValue) {\n return new ZodMiniCatch({\n type: \"catch\",\n innerType: innerType,\n catchValue: (typeof catchValue === \"function\" ? catchValue : () => catchValue),\n });\n}\nexport { _catch as catch };\nexport const ZodMiniNaN = /*@__PURE__*/ core.$constructor(\"ZodMiniNaN\", (inst, def) => {\n core.$ZodNaN.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function nan(params) {\n return core._nan(ZodMiniNaN, params);\n}\nexport const ZodMiniPipe = /*@__PURE__*/ core.$constructor(\"ZodMiniPipe\", (inst, def) => {\n core.$ZodPipe.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function pipe(in_, out) {\n return new ZodMiniPipe({\n type: \"pipe\",\n in: in_,\n out: out,\n });\n}\nexport const ZodMiniCodec = /*@__PURE__*/ core.$constructor(\"ZodMiniCodec\", (inst, def) => {\n ZodMiniPipe.init(inst, def);\n core.$ZodCodec.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function codec(in_, out, params) {\n return new ZodMiniCodec({\n type: \"pipe\",\n in: in_,\n out: out,\n transform: params.decode,\n reverseTransform: params.encode,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function invertCodec(codec) {\n const def = codec._zod.def;\n return new ZodMiniCodec({\n type: \"pipe\",\n in: def.out,\n out: def.in,\n transform: def.reverseTransform,\n reverseTransform: def.transform,\n });\n}\nexport const ZodMiniReadonly = /*@__PURE__*/ core.$constructor(\"ZodMiniReadonly\", (inst, def) => {\n core.$ZodReadonly.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function readonly(innerType) {\n return new ZodMiniReadonly({\n type: \"readonly\",\n innerType: innerType,\n });\n}\nexport const ZodMiniTemplateLiteral = /*@__PURE__*/ core.$constructor(\"ZodMiniTemplateLiteral\", (inst, def) => {\n core.$ZodTemplateLiteral.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function templateLiteral(parts, params) {\n return new ZodMiniTemplateLiteral({\n type: \"template_literal\",\n parts,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniLazy = /*@__PURE__*/ core.$constructor(\"ZodMiniLazy\", (inst, def) => {\n core.$ZodLazy.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// export function lazy<T extends object>(getter: () => T): T {\n// return util.createTransparentProxy<T>(getter);\n// }\n// @__NO_SIDE_EFFECTS__\nfunction _lazy(getter) {\n return new ZodMiniLazy({\n type: \"lazy\",\n getter: getter,\n });\n}\nexport { _lazy as lazy };\nexport const ZodMiniPromise = /*@__PURE__*/ core.$constructor(\"ZodMiniPromise\", (inst, def) => {\n core.$ZodPromise.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function promise(innerType) {\n return new ZodMiniPromise({\n type: \"promise\",\n innerType: innerType,\n });\n}\nexport const ZodMiniCustom = /*@__PURE__*/ core.$constructor(\"ZodMiniCustom\", (inst, def) => {\n core.$ZodCustom.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// custom checks\n// @__NO_SIDE_EFFECTS__\nexport function check(fn, params) {\n const ch = new core.$ZodCheck({\n check: \"custom\",\n ...util.normalizeParams(params),\n });\n ch._zod.check = fn;\n return ch;\n}\n// ZodCustom\n// custom schema\n// @__NO_SIDE_EFFECTS__\nexport function custom(fn, _params) {\n return core._custom(ZodMiniCustom, fn ?? (() => true), _params);\n}\n// refine\n// @__NO_SIDE_EFFECTS__\nexport function refine(fn, _params = {}) {\n return core._refine(ZodMiniCustom, fn, _params);\n}\n// superRefine\n// @__NO_SIDE_EFFECTS__\nexport function superRefine(fn, params) {\n return core._superRefine(fn, params);\n}\n// Re-export describe and meta from core\nexport const describe = core.describe;\nexport const meta = core.meta;\n// instanceof\nclass Class {\n constructor(..._args) { }\n}\n// @__NO_SIDE_EFFECTS__\nfunction _instanceof(cls, params = {}) {\n const inst = custom((data) => data instanceof cls, params);\n inst._zod.bag.Class = cls;\n // Override check to emit invalid_type instead of custom\n inst._zod.check = (payload) => {\n if (!(payload.value instanceof cls)) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: cls.name,\n input: payload.value,\n inst,\n path: [...(inst._zod.def.path ?? [])],\n });\n }\n };\n return inst;\n}\nexport { _instanceof as instanceof };\n// stringbool\nexport const stringbool = (...args) => core._stringbool({\n Codec: ZodMiniCodec,\n Boolean: ZodMiniBoolean,\n String: ZodMiniString,\n}, ...args);\n// @__NO_SIDE_EFFECTS__\nexport function json() {\n const jsonSchema = _lazy(() => {\n return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);\n });\n return jsonSchema;\n}\nexport const ZodMiniFunction = /*@__PURE__*/ core.$constructor(\"ZodMiniFunction\", (inst, def) => {\n core.$ZodFunction.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function _function(params) {\n return new ZodMiniFunction({\n type: \"function\",\n input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),\n output: params?.output ?? unknown(),\n });\n}\nexport { _function as function };\n",
15
- "import * as z from \"zod/mini\";\n/** Persisted identity cannot be claimed by a client-supplied definition. */\nexport const INLINE_FLOW_PERSISTED_IDENTITY_FIELDS = [\n \"id\",\n \"organizationId\",\n \"versionId\",\n \"versionNumber\",\n];\n/** @internal */\nexport const inlineFlowThemeSchema = z.strictObject({\n css: z.optional(z.string()),\n themeRuntimeArtifactId: z.optional(z.string().check(z.trim(), z.minLength(1))),\n themeVersionId: z.optional(z.string().check(z.trim(), z.minLength(1))),\n});\n/** @internal */\nexport const inlineFlowSchema = z.strictObject({\n definition: z.unknown().check(z.check((ctx) => {\n if (ctx.value !== undefined) {\n return;\n }\n ctx.issues.push({\n code: \"custom\",\n input: ctx.value,\n message: \"Inline flow definition is required.\",\n continue: false,\n });\n })),\n theme: z.optional(inlineFlowThemeSchema),\n});\n",
16
- "import type { InlineFlow } from \"@getuserfeedback/protocol/internal/inline-flow\";\nimport type { InlineFlowRun } from \"./inline-flow\";\n\n/** @internal Versioned package bridge shared by the SDK root and internal entry. */\nexport type InlineFlowClientBridge = {\n\tcreateInlineFlowRun: (flow: InlineFlow) => InlineFlowRun;\n};\n\n// This bridge is package compatibility, not caller authorization. Same-window\n// host code already owns the realm in which the SDK and Loader execute.\nconst INLINE_FLOW_CLIENT_BRIDGE_SYMBOL = Symbol.for(\n\t\"@getuserfeedback/sdk/internal/inline-flow-client-bridge/1\",\n);\n\nexport const attachInlineFlowClientBridge = (\n\tclient: object,\n\tbridge: InlineFlowClientBridge,\n): void => {\n\tObject.defineProperty(client, INLINE_FLOW_CLIENT_BRIDGE_SYMBOL, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: bridge,\n\t\twritable: false,\n\t});\n};\n\nexport const getInlineFlowClientBridge = (\n\tclient: object,\n): InlineFlowClientBridge => {\n\tconst bridge = Reflect.get(client, INLINE_FLOW_CLIENT_BRIDGE_SYMBOL);\n\tif (\n\t\ttypeof bridge !== \"object\" ||\n\t\tbridge === null ||\n\t\t!(\"createInlineFlowRun\" in bridge) ||\n\t\ttypeof Reflect.get(bridge, \"createInlineFlowRun\") !== \"function\"\n\t) {\n\t\tthrow new Error(\n\t\t\t\"Inline flows require a compatible client created by @getuserfeedback/sdk.\",\n\t\t);\n\t}\n\treturn bridge as InlineFlowClientBridge;\n};\n",
15
+ "import * as z from \"zod/mini\";\n/** Persisted identity cannot be claimed by a client-supplied definition. */\nexport const INLINE_FLOW_PERSISTED_IDENTITY_FIELDS = [\n \"id\",\n \"organizationId\",\n \"versionId\",\n \"versionNumber\",\n];\n/** @internal */\nexport const inlineFlowThemeSchema = z\n .strictObject({\n css: z.optional(z.string()),\n // Core admits the envelope; View owns exact renderer-contract admission.\n themePayload: z.optional(z.unknown()),\n themeRuntimeArtifactId: z.optional(z.string().check(z.trim(), z.minLength(1))),\n themeVersionId: z.optional(z.string().check(z.trim(), z.minLength(1))),\n})\n .check(z.check((ctx) => {\n if (\"themePayload\" in ctx.value && ctx.value.css !== undefined) {\n ctx.issues.push({\n code: \"custom\",\n input: ctx.value,\n message: \"Inline themes cannot mix CSS and a complete payload.\",\n continue: false,\n });\n }\n}));\n/** @internal */\nexport const inlineFlowSchema = z.strictObject({\n definition: z.unknown().check(z.check((ctx) => {\n if (ctx.value !== undefined) {\n return;\n }\n ctx.issues.push({\n code: \"custom\",\n input: ctx.value,\n message: \"Inline flow definition is required.\",\n continue: false,\n });\n })),\n theme: z.optional(inlineFlowThemeSchema),\n});\n",
16
+ "import type { InlineFlow } from \"@getuserfeedback/protocol/internal/inline-flow\";\nimport type { Client } from \"../client\";\nimport type { InlineFlowRun } from \"./inline-flow\";\n\n/** @internal Versioned package bridge shared by the SDK root and internal entry. */\nexport type InlineFlowClientBridge = {\n\tcreateInlineFlowRun: (flow: InlineFlow) => InlineFlowRun;\n};\n\n// This bridge is package compatibility, not caller authorization. Same-window\n// host code already owns the realm in which the SDK and Loader execute.\nconst INLINE_FLOW_CLIENT_BRIDGE_SYMBOL = Symbol.for(\n\t\"@getuserfeedback/sdk/internal/inline-flow-client-bridge/1\",\n);\n\nconst isInlineFlowClientBridge = (\n\tvalue: unknown,\n): value is InlineFlowClientBridge =>\n\ttypeof value === \"object\" &&\n\tvalue !== null &&\n\t\"createInlineFlowRun\" in value &&\n\ttypeof value.createInlineFlowRun === \"function\";\n\nexport const attachInlineFlowClientBridge = (\n\tclient: Client,\n\tbridge: InlineFlowClientBridge,\n): void => {\n\tObject.defineProperty(client, INLINE_FLOW_CLIENT_BRIDGE_SYMBOL, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: bridge,\n\t\twritable: false,\n\t});\n};\n\nexport const getInlineFlowClientBridge = (\n\tclient: Client,\n): InlineFlowClientBridge => {\n\tconst bridge =\n\t\tINLINE_FLOW_CLIENT_BRIDGE_SYMBOL in client\n\t\t\t? client[INLINE_FLOW_CLIENT_BRIDGE_SYMBOL]\n\t\t\t: undefined;\n\tif (!isInlineFlowClientBridge(bridge)) {\n\t\tthrow new Error(\n\t\t\t\"Inline flows require a compatible client created by @getuserfeedback/sdk.\",\n\t\t);\n\t}\n\treturn bridge;\n};\n",
17
17
  "type TransportAdmissionResult<TResult> =\n\t| { status: \"superseded\" }\n\t| { status: \"settled\"; result: TResult };\n\ntype TransportHandoff<TResult> = {\n\tsettlement: Promise<TResult>;\n};\n\ntype TransportOperationScope = {\n\tattemptHandoff<TResult>(options: {\n\t\tprepare: () => void | Promise<void>;\n\t\thandOff: () => TransportHandoff<TResult>;\n\t}): Promise<TResult>;\n};\n\ntype BarrierGate = {\n\tstate: \"pending\" | \"resolved\" | \"rejected\";\n\tfallback: BarrierGate | null;\n\tpromise: Promise<void>;\n\tresolve: () => void;\n\treject: (error: unknown) => void;\n};\n\ntype OrderGate = {\n\tstate: \"pending\" | \"resolved\";\n\tpromise: Promise<void>;\n\tresolve: () => void;\n};\n\ntype OperationState =\n\t| \"registered\"\n\t| \"preparing\"\n\t| \"handing-off\"\n\t| \"handed-off\"\n\t| \"settlement-failed\"\n\t| \"handoff-failed\"\n\t| \"attempt-settled\"\n\t| \"settled\";\n\ntype PendingOperation = {\n\tgeneration: number;\n\tbarrierGate: BarrierGate;\n\tstate: OperationState;\n\tactiveAttempt: boolean;\n\tattemptCount: number;\n\teverHandedOff: boolean;\n\thasLastSettlementError: boolean;\n\tlastSettlementError?: unknown;\n\tsuperseded: boolean;\n\touterSettled: boolean;\n\tsettleAfterBarrier: () => void;\n};\n\nconst OPERATION_SUPERSEDED = Symbol(\"operation-superseded\");\n\nconst createBarrierGate = (fallback: BarrierGate): BarrierGate => {\n\tlet resolvePromise: (() => void) | undefined;\n\tlet rejectPromise: ((error: unknown) => void) | undefined;\n\tconst promise = new Promise<void>((resolve, reject) => {\n\t\tresolvePromise = resolve;\n\t\trejectPromise = reject;\n\t});\n\tlet settled = false;\n\tconst gate: BarrierGate = {\n\t\tstate: \"pending\",\n\t\tfallback,\n\t\tpromise,\n\t\tresolve: () => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tgate.state = \"resolved\";\n\t\t\tresolvePromise?.();\n\t\t},\n\t\treject: (error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tgate.state = \"rejected\";\n\t\t\trejectPromise?.(error);\n\t\t},\n\t};\n\treturn gate;\n};\n\nconst RESOLVED_BARRIER_GATE: BarrierGate = {\n\tstate: \"resolved\",\n\tfallback: null,\n\tpromise: Promise.resolve(),\n\tresolve: () => {},\n\treject: () => {},\n};\n\nconst createOrderGate = (resolved = false): OrderGate => {\n\tlet resolvePromise: (() => void) | undefined;\n\tconst promise = new Promise<void>((resolve) => {\n\t\tresolvePromise = resolve;\n\t});\n\tconst gate: OrderGate = {\n\t\tstate: resolved ? \"resolved\" : \"pending\",\n\t\tpromise: resolved ? Promise.resolve() : promise,\n\t\tresolve: () => {\n\t\t\tif (gate.state === \"resolved\") return;\n\t\t\tgate.state = \"resolved\";\n\t\t\tresolvePromise?.();\n\t\t},\n\t};\n\treturn gate;\n};\n\nconst isPromiseLike = (value: unknown): value is PromiseLike<void> =>\n\ttypeof value === \"object\" &&\n\tvalue !== null &&\n\t\"then\" in value &&\n\ttypeof value.then === \"function\";\n\n/**\n * Owns caller-generation admission before the SDK hands a command to its host.\n * Handle FIFO, stale classification, and settlement publication remain with the\n * Flow command controller.\n *\n * @see docs/specs/2026-08-02-flow-interaction-model.md\n */\nexport const createClientTransportAdmission = () => {\n\tlet generation = 0;\n\tlet latestBarrierGate = RESOLVED_BARRIER_GATE;\n\tlet barrierOrderTail = createOrderGate(true);\n\tconst pendingOperations = new Set<PendingOperation>();\n\n\tconst runOperation = <TResult>(\n\t\texecute: (scope: TransportOperationScope) => Promise<TResult>,\n\t): Promise<TransportAdmissionResult<TResult>> => {\n\t\tlet resolveBarrierOutcome:\n\t\t\t| ((result: TransportAdmissionResult<TResult>) => void)\n\t\t\t| undefined;\n\t\tlet rejectBarrierOutcome: ((error: unknown) => void) | undefined;\n\t\tconst barrierOutcome = new Promise<TransportAdmissionResult<TResult>>(\n\t\t\t(resolve, reject) => {\n\t\t\t\tresolveBarrierOutcome = resolve;\n\t\t\t\trejectBarrierOutcome = reject;\n\t\t\t},\n\t\t);\n\t\tconst operation: PendingOperation = {\n\t\t\tgeneration,\n\t\t\tbarrierGate: latestBarrierGate,\n\t\t\tstate: \"registered\",\n\t\t\tactiveAttempt: false,\n\t\t\tattemptCount: 0,\n\t\t\teverHandedOff: false,\n\t\t\thasLastSettlementError: false,\n\t\t\tsuperseded: false,\n\t\t\touterSettled: false,\n\t\t\tsettleAfterBarrier: () => {\n\t\t\t\tif (operation.everHandedOff && operation.hasLastSettlementError) {\n\t\t\t\t\trejectBarrierOutcome?.(operation.lastSettlementError);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tresolveBarrierOutcome?.({ status: \"superseded\" });\n\t\t\t},\n\t\t};\n\t\tpendingOperations.add(operation);\n\n\t\tconst throwSuperseded = (): never => {\n\t\t\tif (operation.everHandedOff && operation.hasLastSettlementError) {\n\t\t\t\tthrow operation.lastSettlementError;\n\t\t\t}\n\t\t\tthrow OPERATION_SUPERSEDED;\n\t\t};\n\t\tconst assertCurrent = (): void => {\n\t\t\tif (operation.outerSettled) {\n\t\t\t\tthrow new Error(\"Transport operation has already settled\");\n\t\t\t}\n\t\t\tif (operation.superseded || operation.generation !== generation) {\n\t\t\t\tthrowSuperseded();\n\t\t\t}\n\t\t};\n\n\t\tconst attemptHandoff: TransportOperationScope[\"attemptHandoff\"] = async <\n\t\t\tTHandoffResult,\n\t\t>({\n\t\t\tprepare,\n\t\t\thandOff,\n\t\t}: {\n\t\t\tprepare: () => void | Promise<void>;\n\t\t\thandOff: () => TransportHandoff<THandoffResult>;\n\t\t}): Promise<THandoffResult> => {\n\t\t\tassertCurrent();\n\t\t\tif (operation.activeAttempt) {\n\t\t\t\tthrow new Error(\"A transport handoff attempt is already active\");\n\t\t\t}\n\t\t\tif (\n\t\t\t\toperation.attemptCount > 0 &&\n\t\t\t\toperation.state !== \"settlement-failed\"\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"A transport handoff may retry only after a failed settlement\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (operation.attemptCount >= 2) {\n\t\t\t\tthrow new Error(\"A transport operation may retry at most once\");\n\t\t\t}\n\n\t\t\toperation.activeAttempt = true;\n\t\t\toperation.attemptCount += 1;\n\t\t\toperation.state = \"preparing\";\n\t\t\ttry {\n\t\t\t\tif (operation.barrierGate.state !== \"resolved\") {\n\t\t\t\t\tawait operation.barrierGate.promise;\n\t\t\t\t}\n\t\t\t\tassertCurrent();\n\t\t\t\tconst preparation = prepare();\n\t\t\t\tif (isPromiseLike(preparation)) {\n\t\t\t\t\tawait preparation;\n\t\t\t\t}\n\t\t\t\tassertCurrent();\n\t\t\t\toperation.state = \"handing-off\";\n\t\t\t\tlet settlement: Promise<THandoffResult>;\n\t\t\t\ttry {\n\t\t\t\t\tsettlement = handOff().settlement;\n\t\t\t\t} catch (error) {\n\t\t\t\t\toperation.activeAttempt = false;\n\t\t\t\t\toperation.state = \"handoff-failed\";\n\t\t\t\t\tif (operation.superseded || operation.generation !== generation) {\n\t\t\t\t\t\toperation.settleAfterBarrier();\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\n\t\t\t\toperation.everHandedOff = true;\n\t\t\t\toperation.state = \"handed-off\";\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await settlement;\n\t\t\t\t\toperation.activeAttempt = false;\n\t\t\t\t\toperation.hasLastSettlementError = false;\n\t\t\t\t\toperation.lastSettlementError = undefined;\n\t\t\t\t\toperation.state = \"attempt-settled\";\n\t\t\t\t\treturn result;\n\t\t\t\t} catch (error) {\n\t\t\t\t\toperation.activeAttempt = false;\n\t\t\t\t\toperation.hasLastSettlementError = true;\n\t\t\t\t\toperation.lastSettlementError = error;\n\t\t\t\t\toperation.state = \"settlement-failed\";\n\t\t\t\t\tif (operation.superseded || operation.generation !== generation) {\n\t\t\t\t\t\toperation.settleAfterBarrier();\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (operation.activeAttempt) {\n\t\t\t\t\toperation.activeAttempt = false;\n\t\t\t\t\toperation.state = \"handoff-failed\";\n\t\t\t\t}\n\t\t\t\tif (operation.superseded || operation.generation !== generation) {\n\t\t\t\t\toperation.settleAfterBarrier();\n\t\t\t\t\tthrowSuperseded();\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t};\n\n\t\tlet internalRun: Promise<TResult>;\n\t\ttry {\n\t\t\tinternalRun = Promise.resolve(execute({ attemptHandoff }));\n\t\t} catch (error) {\n\t\t\tinternalRun = Promise.reject(error);\n\t\t}\n\t\tconst observedRun: Promise<TransportAdmissionResult<TResult>> =\n\t\t\tinternalRun.then(\n\t\t\t\t(result) => {\n\t\t\t\t\toperation.outerSettled = true;\n\t\t\t\t\toperation.state = \"settled\";\n\t\t\t\t\tpendingOperations.delete(operation);\n\t\t\t\t\treturn { status: \"settled\" as const, result };\n\t\t\t\t},\n\t\t\t\t(error) => {\n\t\t\t\t\toperation.outerSettled = true;\n\t\t\t\t\toperation.state = \"settled\";\n\t\t\t\t\tpendingOperations.delete(operation);\n\t\t\t\t\tif (error === OPERATION_SUPERSEDED && !operation.everHandedOff) {\n\t\t\t\t\t\treturn { status: \"superseded\" as const };\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t},\n\t\t\t);\n\n\t\treturn Promise.race([observedRun, barrierOutcome]);\n\t};\n\n\tconst runBarrier = <TResult>({\n\t\tonGenerationAdvanced,\n\t\tprepare,\n\t\thandOff,\n\t}: {\n\t\tonGenerationAdvanced: () => void;\n\t\tprepare: () => void | Promise<void>;\n\t\thandOff: () => TransportHandoff<TResult>;\n\t}): Promise<TResult> => {\n\t\tgeneration += 1;\n\t\tconst previousOrderTail = barrierOrderTail;\n\t\tconst previousAdmissionGate = latestBarrierGate;\n\t\tconst currentOrderTail = createOrderGate();\n\t\tbarrierOrderTail = currentOrderTail;\n\t\tconst currentGate = createBarrierGate(previousAdmissionGate);\n\t\tlatestBarrierGate = currentGate;\n\t\tvoid currentGate.promise.catch(() => {});\n\n\t\tfor (const operation of pendingOperations) {\n\t\t\tif (operation.generation >= generation) continue;\n\t\t\toperation.superseded = true;\n\t\t\tif (\n\t\t\t\toperation.state !== \"handing-off\" &&\n\t\t\t\toperation.state !== \"handed-off\" &&\n\t\t\t\toperation.state !== \"attempt-settled\"\n\t\t\t) {\n\t\t\t\toperation.settleAfterBarrier();\n\t\t\t}\n\t\t}\n\n\t\tconst rejectAdmissionGate = (error: unknown): void => {\n\t\t\tcurrentGate.reject(error);\n\t\t\tif (latestBarrierGate === currentGate) {\n\t\t\t\tlet fallback = previousAdmissionGate;\n\t\t\t\twhile (fallback.state === \"rejected\" && fallback.fallback) {\n\t\t\t\t\tfallback = fallback.fallback;\n\t\t\t\t}\n\t\t\t\tlatestBarrierGate = fallback;\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\tonGenerationAdvanced();\n\t\t} catch (error) {\n\t\t\trejectAdmissionGate(error);\n\t\t\tif (previousOrderTail.state === \"resolved\") {\n\t\t\t\tcurrentOrderTail.resolve();\n\t\t\t} else {\n\t\t\t\tvoid previousOrderTail.promise.then(currentOrderTail.resolve);\n\t\t\t}\n\t\t\treturn Promise.reject(error);\n\t\t}\n\n\t\tconst performHandoff = (): Promise<TResult> => {\n\t\t\tlet settlement: Promise<TResult>;\n\t\t\ttry {\n\t\t\t\tsettlement = handOff().settlement;\n\t\t\t} catch (error) {\n\t\t\t\trejectAdmissionGate(error);\n\t\t\t\tcurrentOrderTail.resolve();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tcurrentGate.fallback = null;\n\t\t\tcurrentGate.resolve();\n\t\t\tcurrentOrderTail.resolve();\n\t\t\treturn settlement;\n\t\t};\n\t\tconst prepareAndHandOff = (): Promise<TResult> => {\n\t\t\ttry {\n\t\t\t\tconst preparation = prepare();\n\t\t\t\tif (isPromiseLike(preparation)) {\n\t\t\t\t\treturn Promise.resolve(preparation).then(performHandoff, (error) => {\n\t\t\t\t\t\trejectAdmissionGate(error);\n\t\t\t\t\t\tcurrentOrderTail.resolve();\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn performHandoff();\n\t\t\t} catch (error) {\n\t\t\t\trejectAdmissionGate(error);\n\t\t\t\tcurrentOrderTail.resolve();\n\t\t\t\treturn Promise.reject(error);\n\t\t\t}\n\t\t};\n\n\t\treturn previousOrderTail.state === \"resolved\"\n\t\t\t? prepareAndHandOff()\n\t\t\t: previousOrderTail.promise.then(prepareAndHandOff);\n\t};\n\n\treturn { runOperation, runBarrier };\n};\n",
18
18
  "declare const __GX_SDK_VERSION__: string | undefined;\n\nconst sdkVersion =\n\ttypeof __GX_SDK_VERSION__ === \"string\" ? __GX_SDK_VERSION__.trim() : \"\";\n\n// Build scripts inject __GX_SDK_VERSION__ for published artifacts.\n// Source-linked workspace usage may not inject defines, so keep a safe fallback.\nexport const SDK_VERSION = sdkVersion.length > 0 ? sdkVersion : \"0.0.0-local\";\n",
19
- "import type {\n\tCaptureInstanceFeedbackRequest,\n\tCaptureInstanceFeedbackResponse,\n\tListInstanceFeedbackMineRequest,\n\tListInstanceFeedbackMineResponse,\n} from \"@getuserfeedback/protocol\";\nimport {\n\ttype AppEventCapability,\n\ttype AppEventFlag,\n\tassertNoSegmentExternalIdsInValueArgument,\n\ttype CapabilitiesInput,\n\ttype ClientMeta,\n\ttype ClientOptions,\n\ttype Command,\n\ttype CommandEnvelope,\n\tCommandSettlementError,\n\tCommandSettlementTimeoutError,\n\ttype ConfigureOptions,\n\ttype ContainerPolicy,\n\tcreateCommandEnvelope,\n\tcreateCommandRequestId,\n\tcreateCommandSettlementDispatch,\n\tcreateFlowCommandHandleController,\n\ttype FlagsInput,\n\tgetFeedbackReadFromSettlementDetail,\n\tgetFeedbackSubmissionFromSettlementDetail,\n\tgetFlowHandleFromSettlementDetail,\n\ttype FlowRenderState as HostFlowRenderState,\n\ttype IdentifyOptions,\n\ttype InitOptions,\n\ttype LinkRouter,\n\tLOADER_RUNTIME_GLOBAL_KEY,\n\tLOADER_RUNTIME_PROTOCOL_VERSION,\n\tOPEN_URL_ACTION_CAPABILITY,\n\tOPEN_URL_ACTION_V1_CAPABILITY,\n\tOPEN_URL_ACTION_VERSION,\n\ttype ResponseMetadataInput,\n\tSDK_PROTOCOL_CAPABILITIES,\n\ttype WidgetLayoutTransitionPolicy,\n\twaitForCommandSettlement,\n} from \"@getuserfeedback/protocol/host\";\nimport { UNIFIED_FLOW_RUNTIME_V1_CAPABILITY } from \"@getuserfeedback/protocol/internal/core-host-command-settlement\";\nimport { suppliedOnlyLocalInitOptionsSchema } from \"@getuserfeedback/protocol/internal/core-init-options\";\nimport type { InternalHostCommandEnvelope } from \"@getuserfeedback/protocol/internal/host-command-envelope\";\nimport type {\n\tInternalHostInlineFlowCommandPayload,\n\tInternalHostSuppliedOnlyLocalInitCommandPayload,\n} from \"@getuserfeedback/protocol/internal/host-command-payload\";\nimport type { InlineFlow } from \"@getuserfeedback/protocol/internal/inline-flow\";\nimport { parseCustomerOccurrenceName } from \"@getuserfeedback/protocol/internal/sdk-event-options\";\nimport { createClientTransportAdmission } from \"./internal/client-transport-admission\";\nimport {\n\tbuildCustomerOccurrenceCommand,\n\ttype EventOptions,\n\ttype EventProperties,\n} from \"./internal/customer-occurrence-command\";\nimport { createFlowOpenRequestController } from \"./internal/flow-open-request-controller\";\nimport type { InlineFlowRun } from \"./internal/inline-flow\";\nimport { attachInlineFlowClientBridge } from \"./internal/inline-flow-client-bridge\";\nimport { invokeLinkRouter, resolveLinkRouter } from \"./internal/link-router\";\nimport { SDK_VERSION } from \"./version\";\n\nexport type {\n\tEventOptions,\n\tEventProperties,\n} from \"./internal/customer-occurrence-command\";\nexport type { ClientOptions };\n\n/** Feedback captured as an evaluation of the current app or a specific target. */\nexport type FeedbackInput = CaptureInstanceFeedbackRequest;\n\n/** Receipt returned after feedback has been accepted. */\nexport type SubmitFeedbackResult = CaptureInstanceFeedbackResponse;\n\n/** Selectors used to read the current authenticated user's feedback. */\nexport type FetchFeedbackInput = ListInstanceFeedbackMineRequest;\n\n/** Feedback matching each requested selector, in selector order. */\nexport type FetchFeedbackResult = ListInstanceFeedbackMineResponse;\n\n/** Operations for submitting and reading feedback through the current SDK client. */\nexport type FeedbackOperations = {\n\t/**\n\t * Read feedback matching each selector for the JWT-authenticated user.\n\t * Requires `auth.jwt` configuration; `identify()` alone does not authorize readback.\n\t */\n\tfetch: (input: FetchFeedbackInput) => Promise<FetchFeedbackResult>;\n\tsubmit: (input: FeedbackInput) => Promise<SubmitFeedbackResult>;\n};\n\n/** One endpoint in a directed relationship observation. */\nexport type GraphRelationshipRef = {\n\tcollection: string;\n\tid: string;\n};\n\n/** A directed relationship observation recorded through the analytics pipeline. */\nexport type GraphRelationship = {\n\tfrom: GraphRelationshipRef;\n\tto: GraphRelationshipRef;\n};\n\n/** Operations for recording relationship observations as product events. */\nexport type GraphOperations = {\n\tconnect: (relationship: GraphRelationship) => Promise<void>;\n\tdisconnect: (relationship: GraphRelationship) => Promise<void>;\n};\n\nimport { type ActionRegistry, createActionRegistry } from \"./action-registry\";\nimport { createClientHostEventHub } from \"./client-host-event-hub\";\nimport { createOpenRequestBridge } from \"./open-request-bridge\";\nimport type { OpenRequestedEvent as OpenRequestDispatcherEvent } from \"./open-request-dispatcher\";\nimport { resolveStartupRuntimeUrls } from \"./runtime-url-defaults\";\n\n/** @internal */\ndeclare global {\n\tinterface Window {\n\t\t__getuserfeedback_queue?: Array<\n\t\t\tCommandEnvelope | InternalHostCommandEnvelope\n\t\t>;\n\t\t[LOADER_RUNTIME_GLOBAL_KEY]?: {\n\t\t\talive?: boolean;\n\t\t\tprotocolVersion?: string;\n\t\t\tfeatures?: readonly string[];\n\t\t};\n\t}\n}\n\ntype FlowHandleId = string;\n\ntype FlowRunTarget = { flowId: string } | { flow: InlineFlow };\n\n/** Durable state of a flow run (open/loading + dimensions when known). */\nexport interface FlowState extends HostFlowRenderState {\n\t/**\n\t * @deprecated Stop reading this field. SDK state snapshots and subscriptions\n\t * never populate it, and there is no replacement SDK state field.\n\t */\n\ttransitionPolicy?: WidgetLayoutTransitionPolicy;\n}\n\n/** Callback invoked when flow state changes. */\nexport type FlowStateCallback = (state: FlowState) => void;\ntype IdentifyTraits = Record<string, unknown>;\nexport type OpenRequestedEvent = OpenRequestDispatcherEvent;\nexport type OpenRequestedCallback = (event: OpenRequestedEvent) => void;\ntype StableJsonObject = { [key: string]: StableJsonValue };\ntype StableJsonValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| StableJsonValue[]\n\t| StableJsonObject;\n\n/** Options for opening a flow run. */\nexport type OpenFlowOptions = {\n\t/** Host container used for this open request. Omit to use default floating mounting; pass null to wait for a custom container. */\n\tcontainer?: HTMLElement | null;\n\t/**\n\t * Optional response metadata to preserve with the eventual submission.\n\t * These tags are attached when the flow is opened and do not affect prerendering.\n\t */\n\tmetadata?: ResponseMetadataInput;\n\t/**\n\t * When `true`, the flow view does not show a close button.\n\t * Useful for mobile or embedded contexts where the host handles dismissal (e.g. via a drawer or back gesture).\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for prerendering a flow run. */\nexport type PrerenderFlowOptions = {\n\t/**\n\t * When `true`, the prerendered view does not show a close button.\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for subscribing to flow state updates. */\nexport type SubscribeFlowStateOptions = {\n\t/** Emit the current snapshot immediately. Default `true`. */\n\temitInitial?: boolean;\n\t/** Auto-unsubscribe when the signal is aborted. */\n\tsignal?: AbortSignal;\n};\n\nconst DEFAULT_FLOW_STATE: FlowState = {\n\tisOpen: false,\n\tisLoading: false,\n\twidth: undefined,\n\theight: undefined,\n};\nconst STALE_HANDLE_ERROR_CODE = \"STALE_HANDLE\" as const;\n\nconst isStaleHandleError = (error: unknown): boolean => {\n\tif (error instanceof CommandSettlementError) {\n\t\treturn error.code === STALE_HANDLE_ERROR_CODE;\n\t}\n\tif (!(error instanceof Error)) {\n\t\treturn false;\n\t}\n\treturn error.message.includes(\"flowHandleId is stale\");\n};\n\n/** Instance for a specific flow: open, prefetch, prerender, close, and subscribe to flow state. */\nexport type FlowRun = {\n\t/** The flow/survey ID this instance refers to. */\n\tflowId: string;\n\t/** Open the flow (show the survey). */\n\topen: (options?: OpenFlowOptions) => Promise<void>;\n\t/** Prefetch the flow so it opens faster when you call `open()`. */\n\tprefetch: () => Promise<void>;\n\t/** Prerender the flow into a container (e.g. for a custom dialog). */\n\tprerender: (options?: PrerenderFlowOptions) => Promise<void>;\n\t/** Attach or detach this flow to a specific host container. */\n\tsetContainer: (element: HTMLElement | null) => void;\n\t/** Close this flow. */\n\tclose: () => Promise<void>;\n\t/** Return the latest known flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to open/loading/dimensions; returns an unsubscribe function. */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n};\n\n/**\n * getuserfeedback client for loading the widget, opening flows, configuring\n * consent/auth, identifying users, and tracking events.\n *\n * @see https://getuserfeedback.com/docs/reference/javascript-sdk-reference\n */\nexport type Client = {\n\t/** Load the widget script. Call when you created the client with `disableAutoLoad: true`. */\n\tload: () => void;\n\t/** Set how this instance should choose default containers for flows. */\n\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => void;\n\t/** Return the latest known instance-level flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to instance-level flow state updates (eg targeting-triggered opens). */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n\t/** Return a flow instance; call .open(), .prefetch(), .prerender(), .close() on it. */\n\tflow: (flowId: string) => FlowRun;\n\t/** Close all open flows. */\n\tclose: () => Promise<void>;\n\t/** Close all open flows, clear JWT authentication, and reset user identity. */\n\treset: () => Promise<void>;\n\t/**\n\t * Update color scheme, consent, or auth. Pass a fresh JWT here after login\n\t * and whenever your auth provider refreshes the session token. Await the\n\t * returned promise or handle its rejection when applying runtime updates.\n\t *\n\t * When using `disableAutoLoad`, call `load()` first. Calls made before `load()`\n\t * resolve without applying the update. Provide the initial color scheme,\n\t * default consent, and capabilities to `createClient()`; configure auth after\n\t * `load()`.\n\t *\n\t * @see https://getuserfeedback.com/docs/security-and-privacy/jwt-auth\n\t */\n\tconfigure: (updates: ConfigureOptions) => Promise<void>;\n\t/**\n\t * Associate the current user with a user ID, traits, and optional external IDs.\n\t *\n\t * Use `options.externalIds` for Segment-compatible identifiers from another\n\t * system. Without a user ID, pass options as `client.identify(traits, options)`,\n\t * or use `client.identify(traits, undefined, options)` when your call site needs\n\t * the explicit three-argument form. Do not put Segment-shaped `externalIds` in\n\t * traits. Some invalid arguments throw synchronously; other validation or\n\t * command-processing failures reject the returned promise.\n\t *\n\t * @see https://getuserfeedback.com/docs/guides/identity-resolution\n\t */\n\tidentify: {\n\t\t(\n\t\t\tuserId: string,\n\t\t\ttraits?: IdentifyTraits,\n\t\t\toptions?: IdentifyOptions,\n\t\t): Promise<void>;\n\t\t(\n\t\t\ttraits: IdentifyTraits,\n\t\t\tplaceholder: undefined,\n\t\t\toptions?: IdentifyOptions,\n\t\t): Promise<void>;\n\t\t(traits: IdentifyTraits, options?: IdentifyOptions): Promise<void>;\n\t};\n\t/**\n\t * Track a product event from the browser.\n\t *\n\t * Use `options.externalIds` when the event carries a Segment-compatible\n\t * identifier from another system. Do not put Segment-shaped `externalIds` in\n\t * properties. Some invalid arguments throw synchronously; other validation or\n\t * command-processing failures reject the returned promise.\n\t *\n\t * @see https://getuserfeedback.com/docs/reference/events\n\t */\n\ttrack: (\n\t\teventName: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t) => Promise<void>;\n\t/**\n\t * Record the current browser page or a named page location. Some invalid\n\t * arguments throw synchronously; other validation or command-processing\n\t * failures reject the returned promise.\n\t */\n\tpage: (\n\t\tname?: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t) => Promise<void>;\n\t/** Record directed relationship observations through the analytics pipeline. */\n\tgraph: GraphOperations;\n\t/** Submit feedback or read the authenticated user's matching feedback. */\n\tfeedback: FeedbackOperations;\n\t/** Subscribe to explicit SDK and client-side targeting open requests, or suppress them — for example if you know the user should not be interrupted.\n\t * For example, when the user is filling out a form, or is in the middle of a multi-step flow.\n\t * Prevention applies only to that presentation attempt; it does not create a\n\t * public retry schedule.\n\t *\n\t * @example — suppress open flow requests if the user is busy\n\t * ```ts\n\t * client.onOpenRequested((event) => {\n\t * if (userIsBusy()) {\n\t * event.preventDefault();\n\t * }\n\t * });\n\t * ```\n\t */\n\tonOpenRequested: (callback: OpenRequestedCallback) => () => void;\n};\n\ntype ClientRegistryEntry = {\n\tclient: Client;\n\tupdateOptions: (\n\t\toptions: ClientOptions,\n\t\tactionRegistry: ActionRegistry,\n\t\tlinkRouter: LinkRouter | undefined,\n\t) => void;\n};\n\nconst openRequestBridgeByClient = new WeakMap<\n\tClient,\n\tReturnType<typeof createOpenRequestBridge>\n>();\n\nconst clientRegistry = new Map<object, Map<string, ClientRegistryEntry>>();\n\nexport const getOpenRequestBridge = (\n\tclient: Client,\n): ReturnType<typeof createOpenRequestBridge> => {\n\tconst bridge = openRequestBridgeByClient.get(client);\n\tif (!bridge) {\n\t\tthrow new Error(\"Open request bridge not found for client instance.\");\n\t}\n\treturn bridge;\n};\n\nconst createClientInstanceId = (): string => {\n\tif (\n\t\ttypeof globalThis.crypto !== \"undefined\" &&\n\t\ttypeof globalThis.crypto.randomUUID === \"function\"\n\t) {\n\t\treturn globalThis.crypto.randomUUID();\n\t}\n\treturn `sdk-${Date.now()}-${Math.random().toString(16).slice(2)}`;\n};\n\nconst toIdentifyCommandPayload = (\n\tidentifyInput: string | IdentifyTraits,\n\ttraitsOrOptions?: IdentifyTraits | IdentifyOptions,\n\toptions?: IdentifyOptions,\n): Extract<Command, { kind: \"identify\" }> => {\n\tif (typeof identifyInput === \"string\") {\n\t\tassertNoSegmentExternalIdsInValueArgument({\n\t\t\targument: traitsOrOptions,\n\t\t\tcommandName: \"identify\",\n\t\t\tvalueArgumentName: \"traits\",\n\t\t\tcallShape: \"identify(userId, traits, { externalIds })\",\n\t\t});\n\t\treturn {\n\t\t\tkind: \"identify\",\n\t\t\tuserId: identifyInput,\n\t\t\ttraits: traitsOrOptions,\n\t\t\toptions,\n\t\t};\n\t}\n\tassertNoSegmentExternalIdsInValueArgument({\n\t\targument: identifyInput,\n\t\tcommandName: \"identify\",\n\t\tvalueArgumentName: \"traits\",\n\t\tcallShape: \"identify(traits, { externalIds })\",\n\t});\n\treturn {\n\t\tkind: \"identify\",\n\t\ttraits: identifyInput,\n\t\toptions: options ?? traitsOrOptions,\n\t};\n};\n\nconst toFlags = (input: FlagsInput | undefined): AppEventFlag[] | undefined => {\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\tif (Array.isArray(input)) {\n\t\treturn input.map((flag) => ({ ...flag }));\n\t}\n\treturn Object.entries(input)\n\t\t.sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey))\n\t\t.map(([key, value]) => ({ key, value }));\n};\n\nconst toCapabilities = (\n\tinput: CapabilitiesInput | undefined,\n): AppEventCapability[] | undefined => {\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\treturn input.map((capability) =>\n\t\ttypeof capability === \"string\" ? { key: capability } : { ...capability },\n\t);\n};\n\nconst CIRCULAR_TARGETING_CONTEXT_ERROR =\n\t\"Targeting context cannot contain circular values\";\n\nconst toStableJsonValue = (\n\tvalue: unknown,\n\tancestors: WeakSet<object> = new WeakSet(),\n): StableJsonValue => {\n\tif (\n\t\tvalue === null ||\n\t\ttypeof value === \"string\" ||\n\t\ttypeof value === \"number\" ||\n\t\ttypeof value === \"boolean\"\n\t) {\n\t\treturn value;\n\t}\n\tif (Array.isArray(value)) {\n\t\tif (ancestors.has(value)) {\n\t\t\tthrow new Error(CIRCULAR_TARGETING_CONTEXT_ERROR);\n\t\t}\n\t\tancestors.add(value);\n\t\ttry {\n\t\t\treturn value.map((entryValue) =>\n\t\t\t\ttoStableJsonValue(entryValue, ancestors),\n\t\t\t);\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t}\n\tif (typeof value === \"object\") {\n\t\tif (ancestors.has(value)) {\n\t\t\tthrow new Error(CIRCULAR_TARGETING_CONTEXT_ERROR);\n\t\t}\n\t\tancestors.add(value);\n\t\tconst objectValue: StableJsonObject = {};\n\t\ttry {\n\t\t\tfor (const [key, entryValue] of Object.entries(value).sort(\n\t\t\t\t([leftKey], [rightKey]) => leftKey.localeCompare(rightKey),\n\t\t\t)) {\n\t\t\t\tif (entryValue !== undefined) {\n\t\t\t\t\tobjectValue[key] = toStableJsonValue(entryValue, ancestors);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn objectValue;\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t}\n\treturn null;\n};\n\nconst toCanonicalTargetingValues = (\n\tvalues: unknown[] | undefined,\n): StableJsonValue[] | null => {\n\tif (values === undefined || values.length === 0) {\n\t\treturn null;\n\t}\n\treturn values\n\t\t.map((value) => {\n\t\t\tconst stableValue = toStableJsonValue(value);\n\t\t\treturn { key: JSON.stringify(stableValue), value: stableValue };\n\t\t})\n\t\t.sort(({ key: leftKey }, { key: rightKey }) =>\n\t\t\tleftKey.localeCompare(rightKey),\n\t\t)\n\t\t.map(({ value }) => value);\n};\n\nconst resolveTargetingContextRegistryKey = (options: ClientOptions): string =>\n\tJSON.stringify({\n\t\tflags: toCanonicalTargetingValues(toFlags(options.flags)),\n\t\tcapabilities: toCanonicalTargetingValues(\n\t\t\ttoCapabilities(options.capabilities),\n\t\t),\n\t});\n\nconst LOADER_RUNTIME_PROBE_TIMEOUT_MS = 120;\n// Once Loader registration has been enqueued, it is ordinary command settlement\n// rather than a short ownership probe. Keep supplied-flow handoff behind that\n// settlement so Core capability negotiation can complete before admission.\nconst LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS = 30_000;\nconst INVALID_COMMAND_ERROR_CODE = \"INVALID_COMMAND\";\nconst SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL = Symbol.for(\n\t\"@getuserfeedback/sdk/internal/supplied-only-local-client-options/1\",\n);\nconst BUNDLED_DOCS_LOCAL_API_KEY = \"@getuserfeedback/internal/bundled-docs\";\n\ntype MarkedSuppliedOnlyLocalClientOptions = ClientOptions & {\n\t[SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL]: true;\n};\ntype MaybeMarkedSuppliedOnlyLocalClientOptions = ClientOptions & {\n\t[SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL]?: true;\n};\n\n/** Private runtime inputs for the deployment-owned bundled-docs client. */\nexport type BundledDocsClientOptions = {\n\tloaderUrl: string;\n\tcoreUrl: string;\n\tcolorScheme?: ClientOptions[\"colorScheme\"];\n\tdisableAutoLoad?: boolean;\n};\n\n/**\n * Build options that the public React provider can pass through to the SDK root\n * without exposing local registration in the public options type.\n * Pass the returned object intact; cloning or serializing it deliberately fails\n * closed instead of falling back to persisted registration.\n * See docs/specs/2026-08-02-flow-interaction-model.md.\n */\nexport const createBundledDocsClientOptions = (\n\toptions: BundledDocsClientOptions,\n): ClientOptions => {\n\tconst clientOptions: ClientOptions = {\n\t\tapiKey: BUNDLED_DOCS_LOCAL_API_KEY,\n\t\t_loaderUrl: options.loaderUrl,\n\t\t_coreUrl: options.coreUrl,\n\t\t...(options.colorScheme === undefined\n\t\t\t? {}\n\t\t\t: { colorScheme: options.colorScheme }),\n\t\t...(options.disableAutoLoad === undefined\n\t\t\t? {}\n\t\t\t: { disableAutoLoad: options.disableAutoLoad }),\n\t};\n\tObject.defineProperty(\n\t\tclientOptions,\n\t\tSUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL,\n\t\t{\n\t\t\tconfigurable: false,\n\t\t\tenumerable: false,\n\t\t\tvalue: true,\n\t\t\twritable: false,\n\t\t},\n\t);\n\treturn clientOptions;\n};\n\nconst isSuppliedOnlyLocalClientOptions = (\n\toptions: MaybeMarkedSuppliedOnlyLocalClientOptions,\n): options is MarkedSuppliedOnlyLocalClientOptions =>\n\toptions[SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL] === true;\n\nconst resolveRegistryKey = (\n\toptions: ClientOptions,\n\tregistrationKind: \"persisted\" | \"supplied-only-local\",\n): string =>\n\t`${registrationKind}:${options.apiKey}:${resolveTargetingContextRegistryKey(options)}`;\n\nconst haveSameActionDefinitions = (left: string[], right: string[]): boolean =>\n\tJSON.stringify(left) === JSON.stringify(right);\n\nconst rejectAmbiguousLinkOwnership = (\n\tlinkRouter: LinkRouter | undefined,\n\tactionRegistry: ActionRegistry,\n): void => {\n\tif (linkRouter !== undefined && actionRegistry.getOpenUrlHandler()) {\n\t\tthrow new TypeError(\n\t\t\t\"links.router cannot be configured with actions open-url; choose one link owner\",\n\t\t);\n\t}\n};\n\nconst resolveRegistryScope = (): object =>\n\ttypeof window === \"undefined\" ? globalThis : window;\n\nconst getRegistryForScope = (): Map<string, ClientRegistryEntry> => {\n\tconst scope = resolveRegistryScope();\n\tconst existing = clientRegistry.get(scope);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst created = new Map<string, ClientRegistryEntry>();\n\tclientRegistry.set(scope, created);\n\treturn created;\n};\n\n/**\n * Create a getuserfeedback client. Reuses an existing logical client for the\n * same `apiKey` and targeting context. Host-action definitions may change\n * before loading starts; afterward, changing their canonical identities throws\n * while equivalent definitions refresh their handlers.\n */\nexport const createClient = (options: ClientOptions): Client => {\n\tconst suppliedOnlyLocal = isSuppliedOnlyLocalClientOptions(options);\n\tif (!suppliedOnlyLocal && options.apiKey === BUNDLED_DOCS_LOCAL_API_KEY) {\n\t\tthrow new Error(\n\t\t\t\"Bundled docs client options must be passed intact without cloning or serialization.\",\n\t\t);\n\t}\n\tconst {\n\t\tapiKey,\n\t\t_loaderUrl,\n\t\t_coreUrl,\n\t\t_apiUrl,\n\t\t_realtimeUrl,\n\t\tdisableAutoLoad = false,\n\t\tcolorScheme,\n\t\tdisableTelemetry = false,\n\t\tenableDebug = false,\n\t\tdefaultConsent,\n\t\tflags,\n\t\tcapabilities,\n\t\tactions,\n\t\tlinks,\n\t} = options;\n\tconst initialActionRegistry = createActionRegistry(actions);\n\tconst initialLinkRouter = resolveLinkRouter(links);\n\trejectAmbiguousLinkOwnership(initialLinkRouter, initialActionRegistry);\n\tconst registryKey = resolveRegistryKey(\n\t\t{\n\t\t\tapiKey,\n\t\t\t_loaderUrl,\n\t\t\t_coreUrl,\n\t\t\t_apiUrl,\n\t\t\t_realtimeUrl,\n\t\t\tdisableAutoLoad,\n\t\t\tcolorScheme,\n\t\t\tdisableTelemetry,\n\t\t\tenableDebug,\n\t\t\tdefaultConsent,\n\t\t\tflags,\n\t\t\tcapabilities,\n\t\t\tactions,\n\t\t},\n\t\tsuppliedOnlyLocal ? \"supplied-only-local\" : \"persisted\",\n\t);\n\tconst registry = getRegistryForScope();\n\tconst existing = registry.get(registryKey);\n\tif (existing) {\n\t\texisting.updateOptions(\n\t\t\t{\n\t\t\t\tapiKey,\n\t\t\t\t_loaderUrl,\n\t\t\t\t_coreUrl,\n\t\t\t\t_apiUrl,\n\t\t\t\t_realtimeUrl,\n\t\t\t\tdisableAutoLoad,\n\t\t\t\tcolorScheme,\n\t\t\t\tdisableTelemetry,\n\t\t\t\tenableDebug,\n\t\t\t\tdefaultConsent,\n\t\t\t\tflags,\n\t\t\t\tcapabilities,\n\t\t\t\tactions,\n\t\t\t},\n\t\t\tinitialActionRegistry,\n\t\t\tinitialLinkRouter,\n\t\t);\n\t\tif (!disableAutoLoad) {\n\t\t\texisting.client.load();\n\t\t}\n\t\treturn existing.client;\n\t}\n\n\tlet loaderUrlConfig = _loaderUrl;\n\tlet coreUrlConfig = _coreUrl;\n\tlet apiUrlConfig = _apiUrl;\n\tlet realtimeUrlConfig = _realtimeUrl;\n\n\tconst notifyError = (_error: unknown): void => {\n\t\t// No-op: track/use hooks removed from public API.\n\t};\n\tconst hostWindow =\n\t\ttypeof window !== \"undefined\" &&\n\t\ttypeof window.addEventListener === \"function\" &&\n\t\ttypeof window.removeEventListener === \"function\"\n\t\t\t? window\n\t\t\t: null;\n\tconst hostDocument =\n\t\ttypeof document !== \"undefined\" &&\n\t\ttypeof document.createElement === \"function\" &&\n\t\tdocument.head !== null\n\t\t\t? document\n\t\t\t: null;\n\n\tconst sdkVersion = SDK_VERSION;\n\tconst clientInstanceId = createClientInstanceId();\n\tconst openRequestBridge = createOpenRequestBridge();\n\tconst clientMeta: ClientMeta = {\n\t\tloader: \"sdk\",\n\t\tclientName: \"@getuserfeedback/sdk\",\n\t\tclientVersion: sdkVersion,\n\t\ttransport: \"snippet\",\n\t};\n\n\tlet defaultConsentConfig = defaultConsent;\n\tlet colorSchemeConfig = colorScheme;\n\tlet flagsConfig = toFlags(flags);\n\tlet capabilitiesConfig = toCapabilities(capabilities);\n\tlet actionRegistry = initialActionRegistry;\n\tlet linkRouterConfig = initialLinkRouter;\n\n\tconst buildRuntimeEndpoints = (): InitOptions[\"runtimeEndpoints\"] => {\n\t\tif (!(coreUrlConfig || apiUrlConfig || realtimeUrlConfig)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn {\n\t\t\t...(coreUrlConfig !== undefined ? { coreUrl: coreUrlConfig } : {}),\n\t\t\t...(apiUrlConfig !== undefined ? { apiUrl: apiUrlConfig } : {}),\n\t\t\t...(realtimeUrlConfig !== undefined\n\t\t\t\t? { realtimeUrl: realtimeUrlConfig }\n\t\t\t\t: {}),\n\t\t};\n\t};\n\n\tconst buildInitOpts = (includeHostActions = true): InitOptions => {\n\t\tconst runtimeEndpoints = buildRuntimeEndpoints();\n\t\tconst hostActionDefinitions = includeHostActions\n\t\t\t? actionRegistry.listDefinitions()\n\t\t\t: [];\n\t\tconst protocolCapabilities = [\n\t\t\t...SDK_PROTOCOL_CAPABILITIES,\n\t\t\t...(linkRouterConfig !== undefined || actionRegistry.getOpenUrlHandler()\n\t\t\t\t? [OPEN_URL_ACTION_CAPABILITY, OPEN_URL_ACTION_V1_CAPABILITY]\n\t\t\t\t: []),\n\t\t];\n\t\treturn {\n\t\t\tapiKey,\n\t\t\tclientMeta,\n\t\t\tcapabilities: [...protocolCapabilities],\n\t\t\t...(flagsConfig !== undefined && {\n\t\t\t\tflags: flagsConfig.map((flag) => ({ ...flag })),\n\t\t\t}),\n\t\t\t...(capabilitiesConfig !== undefined && {\n\t\t\t\thostCapabilities: capabilitiesConfig.map((capability) => ({\n\t\t\t\t\t...capability,\n\t\t\t\t})),\n\t\t\t}),\n\t\t\t...(hostActionDefinitions.length > 0 && {\n\t\t\t\thostActions: hostActionDefinitions,\n\t\t\t}),\n\t\t\t...(runtimeEndpoints !== undefined ? { runtimeEndpoints } : {}),\n\t\t\t...(colorSchemeConfig !== undefined && {\n\t\t\t\tcolorScheme: colorSchemeConfig,\n\t\t\t}),\n\t\t\t...(disableTelemetry !== undefined && { disableTelemetry }),\n\t\t\t...(enableDebug !== undefined && { enableDebug }),\n\t\t\t...(defaultConsentConfig !== undefined && {\n\t\t\t\tdefaultConsent: defaultConsentConfig,\n\t\t\t}),\n\t\t};\n\t};\n\n\tlet loaderRequested = false;\n\tlet pendingLoad: Promise<void> | null = null;\n\tlet pendingRegistrationProbe: Promise<void> | null = null;\n\tlet disableAutoLoadConfig = disableAutoLoad;\n\tconst flowStateByHandle = new Map<FlowHandleId, FlowState>();\n\tconst claimedFlowStateHandles = new Set<FlowHandleId>();\n\tconst pendingFlowStateHandles = new Set<FlowHandleId>();\n\tlet isFlowHandleAllocationActive = false;\n\tlet isFlowHandleAllocationLocked = false;\n\tconst flowHandleAllocationWaiters: Array<(release: () => void) => void> = [];\n\tlet instanceFlowState: FlowState = DEFAULT_FLOW_STATE;\n\tconst hostEventHub = createClientHostEventHub({\n\t\tinstanceId: clientInstanceId,\n\t\tonNavigationRequested: (detail) => {\n\t\t\tconst target =\n\t\t\t\tdetail.version === 1 && detail.target === \"_blank\"\n\t\t\t\t\t? undefined\n\t\t\t\t\t: detail.version === OPEN_URL_ACTION_VERSION &&\n\t\t\t\t\t\t\t(detail.target === undefined ||\n\t\t\t\t\t\t\t\tdetail.target === \"self\" ||\n\t\t\t\t\t\t\t\tdetail.target === \"blank\")\n\t\t\t\t\t\t? detail.target\n\t\t\t\t\t\t: null;\n\t\t\tif (target === null) {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tif (linkRouterConfig !== undefined) {\n\t\t\t\tinvokeLinkRouter(linkRouterConfig, {\n\t\t\t\t\turl: detail.url,\n\t\t\t\t\t...(target === undefined ? {} : { target }),\n\t\t\t\t});\n\t\t\t\treturn \"succeeded\";\n\t\t\t}\n\t\t\tconst handler = actionRegistry.getOpenUrlHandler();\n\t\t\tif (!handler) {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tconst outcome = handler({\n\t\t\t\turl: detail.url,\n\t\t\t\t...(target === undefined ? {} : { target }),\n\t\t\t});\n\t\t\tif (outcome === \"handled\") {\n\t\t\t\treturn \"succeeded\";\n\t\t\t}\n\t\t\tif (outcome === \"unhandled\") {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tthrow new TypeError(\n\t\t\t\t'Registered open-url action must return \"handled\" or \"unhandled\" synchronously.',\n\t\t\t);\n\t\t},\n\t\twindowRef: hostWindow,\n\t});\n\n\tconst resolveRequiredRuntimeUrls = (): {\n\t\tloaderUrl: string;\n\t\tcoreUrl: string;\n\t\tapiUrl: string;\n\t\trealtimeUrl?: string;\n\t} => {\n\t\tconst runtimeUrls = resolveStartupRuntimeUrls({\n\t\t\tapiKey,\n\t\t\t_loaderUrl: loaderUrlConfig,\n\t\t\t_coreUrl: coreUrlConfig,\n\t\t\t_apiUrl: apiUrlConfig,\n\t\t\t_realtimeUrl: realtimeUrlConfig,\n\t\t});\n\t\tloaderUrlConfig = runtimeUrls.loaderUrl;\n\t\tcoreUrlConfig = runtimeUrls.coreUrl;\n\t\tapiUrlConfig = runtimeUrls.apiUrl;\n\t\trealtimeUrlConfig = runtimeUrls.realtimeUrl;\n\t\treturn runtimeUrls;\n\t};\n\n\tconst cloneFlowState = (state: FlowState): FlowState => ({\n\t\tisOpen: state.isOpen,\n\t\tisLoading: state.isLoading,\n\t\twidth: state.width,\n\t\theight: state.height,\n\t});\n\n\tconst getFlowStateForHandle = (flowHandleId: FlowHandleId): FlowState => {\n\t\tconst existing = flowStateByHandle.get(flowHandleId);\n\t\tif (!existing) {\n\t\t\treturn cloneFlowState(DEFAULT_FLOW_STATE);\n\t\t}\n\t\treturn cloneFlowState(existing);\n\t};\n\n\tconst setFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tstate: FlowState,\n\t): void => {\n\t\tflowStateByHandle.set(flowHandleId, cloneFlowState(state));\n\t};\n\n\t// Core can publish state for a newly allocated supplied Flow before the\n\t// command settlement tells its FlowRun which handle was allocated. Keep the\n\t// client-owned snapshot current so binding that handle can replay the state\n\t// instead of losing the first open transition.\n\thostEventHub.subscribeFlowState((detail): void => {\n\t\tconst isClaimedHandle = claimedFlowStateHandles.has(detail.flowHandleId);\n\t\tif (!isClaimedHandle && !isFlowHandleAllocationActive) {\n\t\t\treturn;\n\t\t}\n\t\tsetFlowStateForHandle(detail.flowHandleId, {\n\t\t\tisOpen: detail.isOpen,\n\t\t\tisLoading: detail.isLoading,\n\t\t\twidth: detail.width,\n\t\t\theight: detail.height,\n\t\t});\n\t\tif (!isClaimedHandle) {\n\t\t\tpendingFlowStateHandles.add(detail.flowHandleId);\n\t\t}\n\t});\n\tconst beginFlowHandleAllocation = (): void => {\n\t\tisFlowHandleAllocationActive = true;\n\t};\n\tconst clearPendingFlowHandleState = (): void => {\n\t\tfor (const flowHandleId of pendingFlowStateHandles) {\n\t\t\tflowStateByHandle.delete(flowHandleId);\n\t\t}\n\t\tpendingFlowStateHandles.clear();\n\t};\n\tconst endFlowHandleAllocation = (): void => {\n\t\tisFlowHandleAllocationActive = false;\n\t\tclearPendingFlowHandleState();\n\t};\n\t/**\n\t * Flow-state events do not carry the allocating command requestId. Serialize\n\t * only handle-free handoffs so a pre-settlement snapshot has one possible\n\t * owner. Other commands remain concurrent. If allocation concurrency becomes\n\t * a product requirement, add explicit event correlation instead of a ledger.\n\t */\n\tconst createFlowHandleAllocationRelease = (): (() => void) => {\n\t\tlet released = false;\n\t\treturn () => {\n\t\t\tif (released) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treleased = true;\n\t\t\tconst next = flowHandleAllocationWaiters.shift();\n\t\t\tif (next) {\n\t\t\t\tnext(createFlowHandleAllocationRelease());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tisFlowHandleAllocationLocked = false;\n\t\t};\n\t};\n\tconst acquireFlowHandleAllocation = ():\n\t\t| (() => void)\n\t\t| Promise<() => void> => {\n\t\tif (!isFlowHandleAllocationLocked) {\n\t\t\tisFlowHandleAllocationLocked = true;\n\t\t\treturn createFlowHandleAllocationRelease();\n\t\t}\n\t\treturn new Promise<() => void>((resolve) => {\n\t\t\tflowHandleAllocationWaiters.push(resolve);\n\t\t});\n\t};\n\n\tconst getInstanceFlowState = (): FlowState =>\n\t\tcloneFlowState(instanceFlowState);\n\n\tconst setInstanceFlowState = (state: FlowState): void => {\n\t\tinstanceFlowState = cloneFlowState(state);\n\t};\n\n\thostEventHub.subscribeInstanceFlowState((detail): void => {\n\t\tsetInstanceFlowState({\n\t\t\tisOpen: detail.isOpen,\n\t\t\tisLoading: detail.isLoading,\n\t\t\twidth: detail.width,\n\t\t\theight: detail.height,\n\t\t});\n\t});\n\n\tconst ensureFlowStateForHandle = (flowHandleId: FlowHandleId): void => {\n\t\tif (!flowStateByHandle.has(flowHandleId)) {\n\t\t\tsetFlowStateForHandle(flowHandleId, DEFAULT_FLOW_STATE);\n\t\t}\n\t};\n\n\tconst subscribeFlowHandleInvalidation = (\n\t\tsubscriber: (flowHandleId: FlowHandleId) => void,\n\t): (() => void) => hostEventHub.subscribeFlowHandleInvalidation(subscriber);\n\n\tconst subscribeFlowStateCacheForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t): (() => void) =>\n\t\thostEventHub.subscribeFlowStateForHandle(flowHandleId, (detail): void => {\n\t\t\tconst nextState: FlowState = {\n\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\twidth: detail.width,\n\t\t\t\theight: detail.height,\n\t\t\t};\n\t\t\tsetFlowStateForHandle(flowHandleId, nextState);\n\t\t});\n\n\tconst isLoaderRequested = (): boolean => loaderRequested;\n\n\tconst enqueue = (\n\t\tenvelope: CommandEnvelope | InternalHostCommandEnvelope,\n\t): void => {\n\t\tif (!hostWindow) {\n\t\t\treturn;\n\t\t}\n\t\tif (!hostWindow.__getuserfeedback_queue) {\n\t\t\thostWindow.__getuserfeedback_queue = [];\n\t\t}\n\t\t// Stamp instanceId and clientMeta so the loader can route commands.\n\t\tconst stamped: CommandEnvelope | InternalHostCommandEnvelope = {\n\t\t\t...envelope,\n\t\t\tinstanceId: envelope.instanceId ?? clientInstanceId,\n\t\t\tclientMeta: envelope.clientMeta ?? clientMeta,\n\t\t};\n\t\thostWindow.__getuserfeedback_queue.push(stamped);\n\t};\n\n\tconst enqueueInstanceRegistration = (\n\t\trequestId?: string,\n\t\tincludeHostActions = true,\n\t): string => {\n\t\tif (suppliedOnlyLocal) {\n\t\t\tif (!coreUrlConfig) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"_coreUrl is not resolved for bundled docs registration\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst localRequestId = requestId ?? createCommandRequestId();\n\t\t\tconst command: InternalHostSuppliedOnlyLocalInitCommandPayload = {\n\t\t\t\tkind: \"init\",\n\t\t\t\topts: suppliedOnlyLocalInitOptionsSchema.parse({\n\t\t\t\t\tregistration: {\n\t\t\t\t\t\tkind: \"supplied-only-local\",\n\t\t\t\t\t\tprofile: \"bundled-docs\",\n\t\t\t\t\t},\n\t\t\t\t\t...(colorSchemeConfig === undefined\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: { colorScheme: colorSchemeConfig }),\n\t\t\t\t}),\n\t\t\t\truntimeEndpoints: { coreUrl: coreUrlConfig },\n\t\t\t};\n\t\t\tenqueue({\n\t\t\t\tversion: \"1\",\n\t\t\t\trequestId: localRequestId,\n\t\t\t\tidempotencyKey: localRequestId,\n\t\t\t\tcommand,\n\t\t\t});\n\t\t\treturn localRequestId;\n\t\t}\n\t\tconst envelope = createCommandEnvelope({\n\t\t\tinstanceId: clientInstanceId,\n\t\t\trequestId,\n\t\t\tcommand: { kind: \"init\", opts: buildInitOpts(includeHostActions) },\n\t\t});\n\t\tenqueue(envelope);\n\t\treturn envelope.requestId;\n\t};\n\n\tconst runAfterRegistrationProbe = (run: () => void): void => {\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (!registrationProbe) {\n\t\t\trun();\n\t\t\treturn;\n\t\t}\n\t\tvoid registrationProbe.then(run);\n\t};\n\n\tconst enqueueSetDefaultContainerPolicy = (policy: ContainerPolicy): void => {\n\t\trunAfterRegistrationProbe(() => {\n\t\t\tenqueue(\n\t\t\t\tcreateCommandEnvelope({\n\t\t\t\t\tcommand: { kind: \"setDefaultContainerPolicy\", policy },\n\t\t\t\t}),\n\t\t\t);\n\t\t});\n\t};\n\n\tconst enqueueSetContainer = (\n\t\tflowHandleId: FlowHandleId,\n\t\telement: HTMLElement | null,\n\t): void => {\n\t\tenqueue(\n\t\t\tcreateCommandEnvelope({\n\t\t\t\tcommand: { kind: \"setContainer\", flowHandleId, container: element },\n\t\t\t}),\n\t\t);\n\t};\n\n\tconst reportAsyncError = <T>(promise: Promise<T>): Promise<T> => {\n\t\treturn promise.catch((error) => {\n\t\t\tnotifyError(error);\n\t\t\tthrow error;\n\t\t});\n\t};\n\n\tconst ensureCommandsCanRun = (): void => {\n\t\tif (!hostWindow) {\n\t\t\treturn;\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\tif (disableAutoLoadConfig) {\n\t\t\t\tthrow new Error(\"Widget not loaded. Call client.load() first.\");\n\t\t\t}\n\t\t\tload();\n\t\t}\n\t};\n\n\tconst assertInlineFlowRuntimeSupport = (): void => {\n\t\tconst runtimeMarker = hostWindow?.[LOADER_RUNTIME_GLOBAL_KEY];\n\t\tif (!runtimeMarker?.alive) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Inline flows require an active compatible Loader runtime.\",\n\t\t\t);\n\t\t}\n\t\tif (runtimeMarker.protocolVersion !== LOADER_RUNTIME_PROTOCOL_VERSION) {\n\t\t\tthrow new Error(\n\t\t\t\t`Incompatible loader runtime protocol: expected ${LOADER_RUNTIME_PROTOCOL_VERSION}, received ${runtimeMarker.protocolVersion ?? \"unknown\"}`,\n\t\t\t);\n\t\t}\n\t\tif (!runtimeMarker.features?.includes(UNIFIED_FLOW_RUNTIME_V1_CAPABILITY)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Inline flows require Loader feature ${UNIFIED_FLOW_RUNTIME_V1_CAPABILITY}.`,\n\t\t\t);\n\t\t}\n\t};\n\n\t/** Enqueue a command and await its settlement.\n\t * The loader resolves instanceId from the instance registry. */\n\tconst rawSettlementDispatch = createCommandSettlementDispatch((cmd) =>\n\t\tenqueue(cmd),\n\t);\n\t// createCommandSettlementDispatch inserts the envelope synchronously before\n\t// returning its settlement promise, which makes invocation the handoff edge.\n\tconst handOffCommand = (input: Command) => rawSettlementDispatch(input);\n\tconst handOffInlineFlowCommand = (\n\t\tinput: InternalHostInlineFlowCommandPayload,\n\t) => {\n\t\tconst requestId = createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: requestId,\n\t\t\tcommand: input,\n\t\t});\n\t\treturn waitForCommandSettlement({\n\t\t\trequestId,\n\t\t\twindowRef: hostWindow ?? undefined,\n\t\t});\n\t};\n\tconst transportAdmission = createClientTransportAdmission();\n\tconst prepareCommandHandoff = (): void | Promise<void> => {\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\treturn registrationProbe;\n\t\t}\n\t};\n\tconst prepareInlineFlowCommandHandoff = (): void | Promise<void> => {\n\t\tensureCommandsCanRun();\n\t\tconst startup = pendingLoad ?? pendingRegistrationProbe;\n\t\tif (startup) {\n\t\t\treturn startup.then(assertInlineFlowRuntimeSupport);\n\t\t}\n\t\tassertInlineFlowRuntimeSupport();\n\t};\n\tconst dispatch = async (input: Command): Promise<void> => {\n\t\tconst preparation = prepareCommandHandoff();\n\t\tif (preparation) {\n\t\t\tawait preparation;\n\t\t}\n\t\tawait rawSettlementDispatch(input);\n\t};\n\n\tconst enqueueConfigUpdate = (opts: ConfigureOptions): void => {\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn;\n\t\t}\n\t\trunAfterRegistrationProbe(() => {\n\t\t\tenqueue(\n\t\t\t\tcreateCommandEnvelope({\n\t\t\t\t\tcommand: { kind: \"configure\", opts },\n\t\t\t\t}),\n\t\t\t);\n\t\t});\n\t};\n\n\tconst toConfigureCommandOptions = (\n\t\tupdates: ConfigureOptions,\n\t): ConfigureOptions => {\n\t\tconst nextCapabilities = toCapabilities(updates.capabilities);\n\t\treturn {\n\t\t\t...(updates.colorScheme !== undefined && {\n\t\t\t\tcolorScheme: updates.colorScheme,\n\t\t\t}),\n\t\t\t...(updates.consent !== undefined && { consent: updates.consent }),\n\t\t\t...(updates.auth !== undefined && { auth: updates.auth }),\n\t\t\t...(nextCapabilities !== undefined && {\n\t\t\t\tcapabilities: nextCapabilities,\n\t\t\t}),\n\t\t};\n\t};\n\n\tconst updateOptions = (\n\t\tnext: ClientOptions,\n\t\tnextActionRegistry: ActionRegistry,\n\t\tnextLinkRouter: LinkRouter | undefined,\n\t): void => {\n\t\tconst linkRouterOwnershipChanged =\n\t\t\t(linkRouterConfig === undefined) !== (nextLinkRouter === undefined);\n\t\tif (\n\t\t\tlinkRouterOwnershipChanged &&\n\t\t\t(isLoaderRequested() || pendingLoad !== null)\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t\"links.router cannot be added or removed after widget init; keeping original router\",\n\t\t\t);\n\t\t}\n\t\tconst definitionsChanged = !haveSameActionDefinitions(\n\t\t\tactionRegistry.listRegistrationIdentities(),\n\t\t\tnextActionRegistry.listRegistrationIdentities(),\n\t\t);\n\t\tif (definitionsChanged && (isLoaderRequested() || pendingLoad !== null)) {\n\t\t\tconst error = new Error(\n\t\t\t\t\"actions definitions cannot be changed after widget init; keeping original registrations\",\n\t\t\t);\n\t\t\tnotifyError(error);\n\t\t\tthrow error;\n\t\t}\n\t\tactionRegistry = nextActionRegistry;\n\t\tlinkRouterConfig = nextLinkRouter;\n\t\tdisableAutoLoadConfig = next.disableAutoLoad ?? disableAutoLoadConfig;\n\t\tdefaultConsentConfig = next.defaultConsent ?? defaultConsentConfig;\n\t\tif (!isLoaderRequested() && pendingLoad === null) {\n\t\t\tif (next.colorScheme !== undefined) {\n\t\t\t\tcolorSchemeConfig = next.colorScheme;\n\t\t\t}\n\t\t\tif (next.flags !== undefined) {\n\t\t\t\tflagsConfig = toFlags(next.flags);\n\t\t\t}\n\t\t\tif (next.capabilities !== undefined) {\n\t\t\t\tcapabilitiesConfig = toCapabilities(next.capabilities);\n\t\t\t}\n\t\t}\n\n\t\tif (next._loaderUrl !== undefined && next._loaderUrl !== loaderUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_loaderUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tloaderUrlConfig = next._loaderUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (next._coreUrl !== undefined && next._coreUrl !== coreUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_coreUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tcoreUrlConfig = next._coreUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (next._apiUrl !== undefined && next._apiUrl !== apiUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_apiUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tapiUrlConfig = next._apiUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tnext._realtimeUrl !== undefined &&\n\t\t\tnext._realtimeUrl !== realtimeUrlConfig\n\t\t) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_realtimeUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\trealtimeUrlConfig = next._realtimeUrl;\n\t\t\t}\n\t\t}\n\n\t\tapplyStartupConfig(next);\n\n\t\tif (!disableAutoLoadConfig && !isLoaderRequested()) {\n\t\t\tload();\n\t\t}\n\t};\n\n\tconst applyStartupConfig = (next: ClientOptions): void => {\n\t\t// Send configure payload from next (colorScheme only from ClientOptions).\n\t\tif (!isLoaderRequested()) return;\n\t\tconst opts: ConfigureOptions = {};\n\t\tif (next.colorScheme !== undefined) opts.colorScheme = next.colorScheme;\n\t\tif (next.capabilities !== undefined) {\n\t\t\tcapabilitiesConfig = toCapabilities(next.capabilities);\n\t\t\topts.capabilities = capabilitiesConfig;\n\t\t}\n\t\tenqueueConfigUpdate(opts);\n\t};\n\n\tconst load = (): void => {\n\t\tif (!hostWindow || !hostDocument) {\n\t\t\treturn;\n\t\t}\n\t\tif (isLoaderRequested() || pendingLoad) {\n\t\t\treturn;\n\t\t}\n\t\tconst runtimeUrls = resolveRequiredRuntimeUrls();\n\n\t\tconst appendLoaderScript = (): void => {\n\t\t\tconst scriptUrl = runtimeUrls.loaderUrl;\n\t\t\tif (\n\t\t\t\t!hostDocument.querySelector(`link[href=\"${scriptUrl}\"][rel=\"preload\"]`)\n\t\t\t) {\n\t\t\t\tconst preload = hostDocument.createElement(\"link\");\n\t\t\t\tpreload.rel = \"preload\";\n\t\t\t\tpreload.as = \"script\";\n\t\t\t\tpreload.href = scriptUrl;\n\t\t\t\thostDocument.head.appendChild(preload);\n\t\t\t}\n\n\t\t\tconst script = hostDocument.createElement(\"script\");\n\t\t\tscript.src = scriptUrl;\n\t\t\tscript.async = true;\n\t\t\tif (script.dataset) {\n\t\t\t\tscript.dataset.disableAutoRegister = \"true\";\n\t\t\t} else if (typeof script.setAttribute === \"function\") {\n\t\t\t\tscript.setAttribute(\"data-disable-auto-register\", \"true\");\n\t\t\t}\n\t\t\thostDocument.head.appendChild(script);\n\t\t};\n\n\t\tconst runtimeMarker = hostWindow[LOADER_RUNTIME_GLOBAL_KEY];\n\t\tif (runtimeMarker?.alive) {\n\t\t\tconst protocolVersion = runtimeMarker.protocolVersion;\n\t\t\tif (protocolVersion !== LOADER_RUNTIME_PROTOCOL_VERSION) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Incompatible loader runtime protocol: expected ${LOADER_RUNTIME_PROTOCOL_VERSION}, received ${protocolVersion ?? \"unknown\"}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst requestId = enqueueInstanceRegistration();\n\t\t\tloaderRequested = true;\n\t\t\tif (\n\t\t\t\t!runtimeMarker.features?.includes(UNIFIED_FLOW_RUNTIME_V1_CAPABILITY)\n\t\t\t) {\n\t\t\t\tlet trackedPending: Promise<void>;\n\t\t\t\tconst pending = waitForCommandSettlement({\n\t\t\t\t\trequestId,\n\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t})\n\t\t\t\t\t.then(() => {})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tnotifyError(error);\n\t\t\t\t\t});\n\t\t\t\ttrackedPending = pending.finally(() => {\n\t\t\t\t\tif (pendingRegistrationProbe === trackedPending) {\n\t\t\t\t\t\tpendingRegistrationProbe = null;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tpendingRegistrationProbe = trackedPending;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst hasCommandQueue = Array.isArray(hostWindow.__getuserfeedback_queue);\n\t\tif (!hasCommandQueue) {\n\t\t\tconst requestId = enqueueInstanceRegistration();\n\t\t\tappendLoaderScript();\n\t\t\tloaderRequested = true;\n\t\t\tlet trackedPending: Promise<void>;\n\t\t\tconst pending = waitForCommandSettlement({\n\t\t\t\trequestId,\n\t\t\t\twindowRef: hostWindow,\n\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t})\n\t\t\t\t.then(() => {})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tnotifyError(error);\n\t\t\t\t});\n\t\t\ttrackedPending = pending.finally(() => {\n\t\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\t\tpendingLoad = null;\n\t\t\t\t}\n\t\t\t});\n\t\t\tpendingLoad = trackedPending;\n\t\t\treturn;\n\t\t}\n\n\t\tloaderRequested = true;\n\n\t\tlet trackedPending: Promise<void>;\n\t\tconst pending = (async () => {\n\t\t\tconst requestId = createCommandRequestId();\n\t\t\tenqueueInstanceRegistration(requestId);\n\t\t\ttry {\n\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\trequestId,\n\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_PROBE_TIMEOUT_MS,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof CommandSettlementTimeoutError) {\n\t\t\t\t\tappendLoaderScript();\n\t\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\terror instanceof CommandSettlementError &&\n\t\t\t\t\terror.code === INVALID_COMMAND_ERROR_CODE &&\n\t\t\t\t\tactionRegistry.listDefinitions().length > 0\n\t\t\t\t) {\n\t\t\t\t\tconst fallbackRequestId = createCommandRequestId();\n\t\t\t\t\tenqueueInstanceRegistration(fallbackRequestId, false);\n\t\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\t\trequestId: fallbackRequestId,\n\t\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})().catch((error) => {\n\t\t\tnotifyError(error);\n\t\t});\n\t\ttrackedPending = pending.finally(() => {\n\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\tpendingLoad = null;\n\t\t\t}\n\t\t\tif (pendingRegistrationProbe === trackedPending) {\n\t\t\t\tpendingRegistrationProbe = null;\n\t\t\t}\n\t\t});\n\t\tpendingLoad = trackedPending;\n\t\tif (actionRegistry.listDefinitions().length > 0) {\n\t\t\tpendingRegistrationProbe = trackedPending;\n\t\t}\n\t};\n\n\tconst subscribeFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getFlowStateForHandle(flowHandleId));\n\t\t}\n\t\treturn hostEventHub.subscribeFlowStateForHandle(\n\t\t\tflowHandleId,\n\t\t\t(detail): void => {\n\t\t\t\tconst nextState: FlowState = {\n\t\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\t\twidth: detail.width,\n\t\t\t\t\theight: detail.height,\n\t\t\t\t};\n\t\t\t\tsetFlowStateForHandle(flowHandleId, nextState);\n\t\t\t\tcallback(cloneFlowState(nextState));\n\t\t\t},\n\t\t\t{ signal: options?.signal },\n\t\t);\n\t};\n\n\tconst subscribeFlowStateForInstance = (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getInstanceFlowState());\n\t\t}\n\t\treturn hostEventHub.subscribeInstanceFlowState(\n\t\t\t(detail): void => {\n\t\t\t\tconst nextState: FlowState = {\n\t\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\t\twidth: detail.width,\n\t\t\t\t\theight: detail.height,\n\t\t\t\t};\n\t\t\t\tcallback(cloneFlowState(nextState));\n\t\t\t},\n\t\t\t{ signal: options?.signal },\n\t\t);\n\t};\n\n\tconst resetFlowRunsForClientBarrier = new Set<() => void>();\n\tlet deferredFlowRunNotifications: Array<() => void> | null = null;\n\n\tfunction createFlowRun(target: { flowId: string }): FlowRun;\n\tfunction createFlowRun(target: { flow: InlineFlow }): InlineFlowRun;\n\tfunction createFlowRun(target: FlowRunTarget): FlowRun | InlineFlowRun {\n\t\tconst openRequestController = createFlowOpenRequestController();\n\t\tlet latestContainer: HTMLElement | null | undefined;\n\t\tlet unsubscribeFlowStateCache: (() => void) | null = null;\n\t\ttype SubscriberEntry = {\n\t\t\tcallback: FlowStateCallback;\n\t\t\toptions?: SubscribeFlowStateOptions;\n\t\t\tunsubscribe: (() => void) | null;\n\t\t};\n\t\tconst activeSubscribers = new Set<SubscriberEntry>();\n\t\tconst handleClient = createFlowCommandHandleController<\n\t\t\tFlowHandleId,\n\t\t\t{\n\t\t\t\tok: boolean;\n\t\t\t\tkind: string;\n\t\t\t\tresult?: unknown;\n\t\t\t}\n\t\t>({\n\t\t\tgetHandleIdFromSettlement: (settlement) => {\n\t\t\t\tconst handle = getFlowHandleFromSettlementDetail(settlement);\n\t\t\t\treturn handle?.flowHandleId;\n\t\t\t},\n\t\t\tisStaleHandleError,\n\t\t\tonClearResolvedHandle: (previousFlowHandleId) => {\n\t\t\t\tclaimedFlowStateHandles.delete(previousFlowHandleId);\n\t\t\t\tpendingFlowStateHandles.delete(previousFlowHandleId);\n\t\t\t\tif (unsubscribeFlowStateCache) {\n\t\t\t\t\tunsubscribeFlowStateCache();\n\t\t\t\t\tunsubscribeFlowStateCache = null;\n\t\t\t\t}\n\t\t\t\tsetFlowStateForHandle(previousFlowHandleId, DEFAULT_FLOW_STATE);\n\t\t\t\trebindSubscribersToCurrentHandle();\n\t\t\t\tconst subscribersAtReset = [...activeSubscribers];\n\t\t\t\tconst notify = (): void =>\n\t\t\t\t\tnotifySubscribersWithDefaultState(subscribersAtReset);\n\t\t\t\tif (deferredFlowRunNotifications) {\n\t\t\t\t\tdeferredFlowRunNotifications.push(notify);\n\t\t\t\t} else {\n\t\t\t\t\tnotify();\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tconst bindSubscriberToCurrentHandle = (\n\t\t\tsubscriber: SubscriberEntry,\n\t\t\temitCurrent = false,\n\t\t): void => {\n\t\t\tif (subscriber.unsubscribe) {\n\t\t\t\tsubscriber.unsubscribe();\n\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t}\n\t\t\tif (subscriber.options?.signal?.aborted) {\n\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst notifySubscriber = (state: FlowState): void => {\n\t\t\t\ttry {\n\t\t\t\t\tsubscriber.callback(state);\n\t\t\t\t} catch {\n\t\t\t\t\t// Public observers cannot interrupt handle publication or prevent\n\t\t\t\t\t// the remaining lifecycle projections from binding.\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst unsubscribe = subscribeFlowStateForHandle(\n\t\t\t\tflowHandleId,\n\t\t\t\tnotifySubscriber,\n\t\t\t\temitCurrent\n\t\t\t\t\t? { ...subscriber.options, emitInitial: true }\n\t\t\t\t\t: subscriber.options,\n\t\t\t);\n\t\t\tif (subscriber.options?.signal?.aborted) {\n\t\t\t\tunsubscribe();\n\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\thandleClient.getHandleId() !== flowHandleId ||\n\t\t\t\t!activeSubscribers.has(subscriber)\n\t\t\t) {\n\t\t\t\tunsubscribe();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsubscriber.unsubscribe = unsubscribe;\n\t\t};\n\n\t\tconst rebindSubscribersToCurrentHandle = (emitCurrent = false): void => {\n\t\t\tfor (const subscriber of activeSubscribers) {\n\t\t\t\tbindSubscriberToCurrentHandle(subscriber, emitCurrent);\n\t\t\t}\n\t\t};\n\n\t\tconst notifySubscribersWithDefaultState = (\n\t\t\tsubscribersAtReset: readonly SubscriberEntry[],\n\t\t): void => {\n\t\t\tfor (const subscriber of subscribersAtReset) {\n\t\t\t\tif (!activeSubscribers.has(subscriber)) continue;\n\t\t\t\ttry {\n\t\t\t\t\tsubscriber.callback(cloneFlowState(DEFAULT_FLOW_STATE));\n\t\t\t\t} catch {\n\t\t\t\t\t// A subscriber cannot prevent later reset observers from seeing the\n\t\t\t\t\t// already-completed client-wide transition.\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst rebindFlowStateCache = (): void => {\n\t\t\tif (unsubscribeFlowStateCache) {\n\t\t\t\tunsubscribeFlowStateCache();\n\t\t\t\tunsubscribeFlowStateCache = null;\n\t\t\t}\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tunsubscribeFlowStateCache =\n\t\t\t\tsubscribeFlowStateCacheForHandle(flowHandleId);\n\t\t};\n\n\t\tconst clearOpenIntent = (): void => {\n\t\t\topenRequestController.clear();\n\t\t};\n\n\t\tconst flushPendingForResolvedHandle = (): void => {\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst shouldReplayPendingState =\n\t\t\t\tpendingFlowStateHandles.delete(flowHandleId);\n\t\t\tclaimedFlowStateHandles.add(flowHandleId);\n\t\t\tensureFlowStateForHandle(flowHandleId);\n\t\t\tif (latestContainer !== undefined) {\n\t\t\t\tenqueueSetContainer(flowHandleId, latestContainer);\n\t\t\t}\n\t\t\trebindSubscribersToCurrentHandle(shouldReplayPendingState);\n\t\t\trebindFlowStateCache();\n\t\t};\n\n\t\thandleClient.subscribeHandle(() => {\n\t\t\tflushPendingForResolvedHandle();\n\t\t});\n\t\tsubscribeFlowHandleInvalidation((flowHandleId) => {\n\t\t\thandleClient.invalidateResolvedHandle(flowHandleId);\n\t\t});\n\t\ttype HandleCommandPayload =\n\t\t\t| Extract<\n\t\t\t\t\tCommand,\n\t\t\t\t\t{ kind: \"open\" } | { kind: \"prefetch\" } | { kind: \"prerender\" }\n\t\t\t >\n\t\t\t| InternalHostInlineFlowCommandPayload;\n\n\t\tconst handOffHandleCommand = (payload: HandleCommandPayload) =>\n\t\t\t\"flow\" in payload\n\t\t\t\t? handOffInlineFlowCommand(payload)\n\t\t\t\t: handOffCommand(payload);\n\n\t\tconst enqueueAndWaitForSettlement = async (\n\t\t\tbuildPayload: (\n\t\t\t\tflowHandleId: FlowHandleId | undefined,\n\t\t\t) => HandleCommandPayload,\n\t\t): Promise<\"settled\" | \"superseded\"> => {\n\t\t\tconst result = await transportAdmission.runOperation(\n\t\t\t\t({ attemptHandoff }) => {\n\t\t\t\t\tlet releaseFlowHandleAllocation: (() => void) | null = null;\n\t\t\t\t\treturn handleClient\n\t\t\t\t\t\t.runCommand(buildPayload, (payload) => {\n\t\t\t\t\t\t\tconst isHandleFree =\n\t\t\t\t\t\t\t\t!(\"flowHandleId\" in payload) ||\n\t\t\t\t\t\t\t\tpayload.flowHandleId === undefined;\n\t\t\t\t\t\t\tconst requiresSerializedAllocation =\n\t\t\t\t\t\t\t\t\"flow\" in target && isHandleFree;\n\t\t\t\t\t\t\tconst handOff = (): Promise<{\n\t\t\t\t\t\t\t\tok: boolean;\n\t\t\t\t\t\t\t\tkind: string;\n\t\t\t\t\t\t\t\tresult?: unknown;\n\t\t\t\t\t\t\t}> =>\n\t\t\t\t\t\t\t\tattemptHandoff({\n\t\t\t\t\t\t\t\t\tprepare:\n\t\t\t\t\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t\t\t\t\t? prepareInlineFlowCommandHandoff\n\t\t\t\t\t\t\t\t\t\t\t: prepareCommandHandoff,\n\t\t\t\t\t\t\t\t\thandOff: () => ({\n\t\t\t\t\t\t\t\t\t\tsettlement: handOffHandleCommand(payload),\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (!requiresSerializedAllocation) {\n\t\t\t\t\t\t\t\treturn handOff();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst handOffAllocation = () =>\n\t\t\t\t\t\t\t\thandOff().catch((error) => {\n\t\t\t\t\t\t\t\t\tclearPendingFlowHandleState();\n\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (releaseFlowHandleAllocation) {\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst acquisition = acquireFlowHandleAllocation();\n\t\t\t\t\t\t\tif (typeof acquisition === \"function\") {\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation = acquisition;\n\t\t\t\t\t\t\t\tbeginFlowHandleAllocation();\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn acquisition.then((release) => {\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation = release;\n\t\t\t\t\t\t\t\tbeginFlowHandleAllocation();\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\t\tif (releaseFlowHandleAllocation) {\n\t\t\t\t\t\t\t\tendFlowHandleAllocation();\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn result.status;\n\t\t};\n\n\t\tconst openFlow = (options?: OpenFlowOptions): Promise<void> => {\n\t\t\treturn openRequestController.run(() =>\n\t\t\t\treportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\t\t\t\tflow: target.flow,\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined ? {} : { flowHandleId }),\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined &&\n\t\t\t\t\t\t\t\t\tlatestContainer !== undefined\n\t\t\t\t\t\t\t\t\t\t? { container: null }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\tmetadata: options?.metadata,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t\tcontainer: options?.container,\n\t\t\t\t\t\t\t\t\tmetadata: options?.metadata,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t),\n\t\t\t);\n\t\t};\n\n\t\tconst resetForClientBarrier = (): void => {\n\t\t\tclearOpenIntent();\n\t\t\thandleClient.reset();\n\t\t};\n\t\tresetFlowRunsForClientBarrier.add(resetForClientBarrier);\n\n\t\tconst run: InlineFlowRun = {\n\t\t\topen: openFlow,\n\t\t\tprefetch: () => {\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tkind: \"prefetch\",\n\t\t\t\t\t\t\t\t\tflow: target.flow,\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined ? {} : { flowHandleId }),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"prefetch\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tprerender: (options?: PrerenderFlowOptions) => {\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\t\t\t\tflow: target.flow,\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined ? {} : { flowHandleId }),\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tclose: () => {\n\t\t\t\tclearOpenIntent();\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\ttransportAdmission\n\t\t\t\t\t\t.runOperation(({ attemptHandoff }) => {\n\t\t\t\t\t\t\treturn handleClient.runResolvedHandleCommand(\n\t\t\t\t\t\t\t\t(flowHandleId) => ({\n\t\t\t\t\t\t\t\t\tkind: \"close\" as const,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t(payload) =>\n\t\t\t\t\t\t\t\t\tattemptHandoff({\n\t\t\t\t\t\t\t\t\t\tprepare:\n\t\t\t\t\t\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t\t\t\t\t\t? prepareInlineFlowCommandHandoff\n\t\t\t\t\t\t\t\t\t\t\t\t: prepareCommandHandoff,\n\t\t\t\t\t\t\t\t\t\thandOff: () => ({\n\t\t\t\t\t\t\t\t\t\t\tsettlement: handOffCommand(payload).then(() => {}),\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tsetContainer: (element: HTMLElement | null) => {\n\t\t\t\tlatestContainer = element;\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tenqueueSetContainer(flowHandleId, element);\n\t\t\t},\n\t\t\tgetFlowState: () => {\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\treturn flowHandleId\n\t\t\t\t\t? getFlowStateForHandle(flowHandleId)\n\t\t\t\t\t: cloneFlowState(DEFAULT_FLOW_STATE);\n\t\t\t},\n\t\t\tsubscribeFlowState: (\n\t\t\t\tcallback: FlowStateCallback,\n\t\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t\t) => {\n\t\t\t\tif (options?.signal?.aborted) {\n\t\t\t\t\treturn () => {};\n\t\t\t\t}\n\t\t\t\tconst subscriber: SubscriberEntry = {\n\t\t\t\t\tcallback,\n\t\t\t\t\toptions,\n\t\t\t\t\tunsubscribe: null,\n\t\t\t\t};\n\t\t\t\tactiveSubscribers.add(subscriber);\n\t\t\t\tconst unsubscribeSubscriber = (): void => {\n\t\t\t\t\tif (subscriber.unsubscribe) {\n\t\t\t\t\t\tsubscriber.unsubscribe();\n\t\t\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t\t\t}\n\t\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\t};\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\tconst signal = options?.signal;\n\t\t\t\t\tif (signal) {\n\t\t\t\t\t\tconst onAbort = (): void => {\n\t\t\t\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t\t\tsubscriber.unsubscribe = () => {\n\t\t\t\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.emitInitial !== false) {\n\t\t\t\t\t\tcallback(cloneFlowState(DEFAULT_FLOW_STATE));\n\t\t\t\t\t}\n\t\t\t\t\treturn unsubscribeSubscriber;\n\t\t\t\t}\n\t\t\t\tbindSubscriberToCurrentHandle(subscriber);\n\t\t\t\treturn unsubscribeSubscriber;\n\t\t\t},\n\t\t};\n\n\t\treturn \"flow\" in target ? run : { flowId: target.flowId, ...run };\n\t}\n\n\tconst flowRunByFlowId = new Map<string, FlowRun>();\n\tconst flow = (flowIdInput: string): FlowRun => {\n\t\tconst flowId = flowIdInput.trim();\n\t\tif (!flowId) {\n\t\t\tthrow new Error(\"flowId must be a non-empty string\");\n\t\t}\n\t\tconst existing = flowRunByFlowId.get(flowId);\n\t\tif (existing) return existing;\n\t\tconst run = createFlowRun({ flowId });\n\t\tflowRunByFlowId.set(flowId, run);\n\t\treturn run;\n\t};\n\n\tconst runClientBarrier = (kind: \"close\" | \"reset\"): Promise<void> => {\n\t\tconst flowRunResets = [...resetFlowRunsForClientBarrier];\n\t\treturn reportAsyncError(\n\t\t\ttransportAdmission.runBarrier({\n\t\t\t\tonGenerationAdvanced: () => {\n\t\t\t\t\tconst notifications: Array<() => void> = [];\n\t\t\t\t\tdeferredFlowRunNotifications = notifications;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor (const resetFlowRun of flowRunResets) {\n\t\t\t\t\t\t\tresetFlowRun();\n\t\t\t\t\t\t}\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tdeferredFlowRunNotifications = null;\n\t\t\t\t\t}\n\t\t\t\t\tfor (const notify of notifications) {\n\t\t\t\t\t\tnotify();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tprepare: hostWindow ? prepareCommandHandoff : () => {},\n\t\t\t\thandOff: hostWindow\n\t\t\t\t\t? () => ({ settlement: handOffCommand({ kind }).then(() => {}) })\n\t\t\t\t\t: () => ({ settlement: Promise.resolve() }),\n\t\t\t}),\n\t\t);\n\t};\n\n\tconst close = (): Promise<void> => runClientBarrier(\"close\");\n\n\tconst reset = (): Promise<void> => runClientBarrier(\"reset\");\n\n\tfunction identify(\n\t\tuserId: string,\n\t\ttraits?: IdentifyTraits,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void>;\n\tfunction identify(\n\t\ttraits: IdentifyTraits,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void>;\n\tfunction identify(\n\t\tidentifyInput: string | IdentifyTraits,\n\t\ttraitsOrOptions?: IdentifyTraits | IdentifyOptions,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void> {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\ttoIdentifyCommandPayload(identifyInput, traitsOrOptions, options),\n\t\t\t),\n\t\t);\n\t}\n\n\tconst track = (\n\t\teventName: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\tparseCustomerOccurrenceName(eventName, \"eventName\");\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\tbuildCustomerOccurrenceCommand({\n\t\t\t\t\ttype: \"track\",\n\t\t\t\t\tevent: eventName,\n\t\t\t\t\tproperties,\n\t\t\t\t\toptions,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t};\n\n\tconst page = (\n\t\tname?: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\tif (name !== undefined) {\n\t\t\t\tparseCustomerOccurrenceName(name, \"pageName\");\n\t\t\t}\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\tbuildCustomerOccurrenceCommand({\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tevent:\n\t\t\t\t\t\tname === undefined ? hostWindow.location.pathname || \"/\" : name,\n\t\t\t\t\tproperties,\n\t\t\t\t\toptions,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t};\n\n\tconst submitFeedback = async (\n\t\tinput: FeedbackInput,\n\t): Promise<SubmitFeedbackResult> => {\n\t\tif (!hostWindow) {\n\t\t\tthrow new Error(\"Feedback submission requires a browser environment.\");\n\t\t}\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\tawait registrationProbe;\n\t\t}\n\t\tconst settlement = await reportAsyncError(\n\t\t\trawSettlementDispatch({\n\t\t\t\tkind: \"instanceFeedback.capture\",\n\t\t\t\tpayload: input,\n\t\t\t}),\n\t\t);\n\t\tif (!settlement.ok) {\n\t\t\tthrow new Error(\"Feedback submission failed.\");\n\t\t}\n\t\tconst result = getFeedbackSubmissionFromSettlementDetail(settlement);\n\t\tif (!result) {\n\t\t\tthrow new Error(\"Invalid feedback submission result.\");\n\t\t}\n\t\treturn result;\n\t};\n\n\tconst fetchFeedback = async (\n\t\tinput: FetchFeedbackInput,\n\t): Promise<FetchFeedbackResult> => {\n\t\tif (!hostWindow) {\n\t\t\tthrow new Error(\"Feedback reads require a browser environment.\");\n\t\t}\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\tawait registrationProbe;\n\t\t}\n\t\tconst settlement = await reportAsyncError(\n\t\t\trawSettlementDispatch({\n\t\t\t\tkind: \"instanceFeedback.listMine\",\n\t\t\t\tpayload: input,\n\t\t\t}),\n\t\t);\n\t\tif (!settlement.ok) {\n\t\t\tthrow new Error(\"Feedback read failed.\");\n\t\t}\n\t\tconst result = getFeedbackReadFromSettlementDetail(settlement);\n\t\tif (!result) {\n\t\t\tthrow new Error(\"Invalid feedback read result.\");\n\t\t}\n\t\treturn result;\n\t};\n\n\tconst configure = (updates: ConfigureOptions): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\t// Send updates as-is; loader merges and forwards deltas to core.\n\t\treturn reportAsyncError(\n\t\t\tdispatch({ kind: \"configure\", opts: toConfigureCommandOptions(updates) }),\n\t\t);\n\t};\n\n\thostEventHub.subscribeOpenRequested((detail, hostEvent) => {\n\t\topenRequestBridge.observeFromLoader(detail, {\n\t\t\tpreventHostDefault: () => {\n\t\t\t\thostEvent.preventDefault();\n\t\t\t},\n\t\t});\n\t});\n\thostEventHub.subscribeHostActionRequested((detail, hostEvent) => {\n\t\tconst handler = actionRegistry.getHandler(detail.definition);\n\t\tif (!handler) {\n\t\t\tdetail.settle(\"unavailable\");\n\t\t\treturn;\n\t\t}\n\t\t// This adapter event stays inside the trusted host realm. Sandboxed Views\n\t\t// can request an action only through Core's empty, authorized RPC.\n\t\thostEvent.preventDefault();\n\t\tvoid Promise.resolve()\n\t\t\t.then(() => handler())\n\t\t\t.then(\n\t\t\t\t() => detail.settle(\"success\"),\n\t\t\t\t() => detail.settle(\"failure\"),\n\t\t\t);\n\t});\n\n\tconst client: Client = {\n\t\tload,\n\t\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => {\n\t\t\tenqueueSetDefaultContainerPolicy(policy);\n\t\t},\n\t\tgetFlowState: () => getInstanceFlowState(),\n\t\tsubscribeFlowState: (\n\t\t\tcallback: FlowStateCallback,\n\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t) => subscribeFlowStateForInstance(callback, options),\n\t\tflow,\n\t\tclose,\n\t\treset,\n\t\tconfigure,\n\t\tidentify,\n\t\ttrack,\n\t\tpage,\n\t\tgraph: {\n\t\t\tconnect: (relationship) =>\n\t\t\t\ttrack(\"gx.graph.relationship.connected\", relationship),\n\t\t\tdisconnect: (relationship) =>\n\t\t\t\ttrack(\"gx.graph.relationship.disconnected\", relationship),\n\t\t},\n\t\tfeedback: { fetch: fetchFeedback, submit: submitFeedback },\n\t\tonOpenRequested: (callback) => openRequestBridge.subscribe(callback),\n\t};\n\tattachInlineFlowClientBridge(client, {\n\t\tcreateInlineFlowRun: (inlineFlow) => createFlowRun({ flow: inlineFlow }),\n\t});\n\n\topenRequestBridgeByClient.set(client, openRequestBridge);\n\n\tregistry.set(registryKey, {\n\t\tclient,\n\t\tupdateOptions,\n\t});\n\n\tif (!disableAutoLoadConfig) {\n\t\tclient.load();\n\t}\n\n\treturn client;\n};\n",
20
- "import {\n\tINLINE_FLOW_PERSISTED_IDENTITY_FIELDS,\n\ttype InlineFlow,\n\tinlineFlowSchema,\n} from \"@getuserfeedback/protocol/internal/inline-flow\";\nimport type { Client, FlowRun, OpenFlowOptions } from \"../client\";\nimport { getInlineFlowClientBridge } from \"./inline-flow-client-bridge\";\n\nexport type { BundledDocsClientOptions } from \"../client\";\nexport { createBundledDocsClientOptions } from \"../client\";\n\n/** Internal supplied-flow run using the normal Flow lifecycle. */\nexport type InlineFlowRun = Omit<FlowRun, \"flowId\" | \"open\"> & {\n\topen: (options?: Omit<OpenFlowOptions, \"container\">) => Promise<void>;\n};\n\nconst ARRAY_INDEX_KEY_PATTERN = /^(0|[1-9]\\d*)$/;\n\nconst invalidJsonSnapshot = (): never => {\n\tthrow new Error(\"Inline flow must contain only JSON values.\");\n};\n\nconst toJsonSnapshot = (\n\tvalue: unknown,\n\tancestors = new Set<object>(),\n): unknown => {\n\tif (\n\t\tvalue === null ||\n\t\ttypeof value === \"string\" ||\n\t\ttypeof value === \"boolean\"\n\t) {\n\t\treturn value;\n\t}\n\tif (typeof value === \"number\") {\n\t\treturn Number.isFinite(value) ? value : invalidJsonSnapshot();\n\t}\n\tif (typeof value !== \"object\" || ancestors.has(value)) {\n\t\treturn invalidJsonSnapshot();\n\t}\n\n\tancestors.add(value);\n\ttry {\n\t\tif (Array.isArray(value)) {\n\t\t\tif (Object.getPrototypeOf(value) !== Array.prototype) {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tconst ownKeys = Reflect.ownKeys(value);\n\t\t\tif (\n\t\t\t\townKeys.length !== value.length + 1 ||\n\t\t\t\townKeys.some(\n\t\t\t\t\t(key) =>\n\t\t\t\t\t\tkey !== \"length\" &&\n\t\t\t\t\t\t(typeof key !== \"string\" ||\n\t\t\t\t\t\t\t!ARRAY_INDEX_KEY_PATTERN.test(key) ||\n\t\t\t\t\t\t\tNumber(key) >= value.length),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tconst snapshot: unknown[] = [];\n\t\t\tfor (let index = 0; index < value.length; index += 1) {\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(\n\t\t\t\t\tvalue,\n\t\t\t\t\tString(index),\n\t\t\t\t);\n\t\t\t\tif (!descriptor?.enumerable || !(\"value\" in descriptor)) {\n\t\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t\t}\n\t\t\t\tsnapshot.push(toJsonSnapshot(descriptor.value, ancestors));\n\t\t\t}\n\t\t\treturn snapshot;\n\t\t}\n\n\t\tconst prototype = Object.getPrototypeOf(value);\n\t\tif (prototype !== Object.prototype && prototype !== null) {\n\t\t\treturn invalidJsonSnapshot();\n\t\t}\n\t\tconst snapshot: Record<string, unknown> = {};\n\t\tfor (const key of Reflect.ownKeys(value)) {\n\t\t\tif (typeof key !== \"string\" || key === \"__proto__\") {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(value, key);\n\t\t\tif (!descriptor?.enumerable || !(\"value\" in descriptor)) {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tif (descriptor.value === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tObject.defineProperty(snapshot, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: toJsonSnapshot(descriptor.value, ancestors),\n\t\t\t\twritable: true,\n\t\t\t});\n\t\t}\n\t\treturn snapshot;\n\t} finally {\n\t\tancestors.delete(value);\n\t}\n};\n\nconst snapshotInlineFlowInput = (flow: unknown): Record<string, unknown> => {\n\tif (\n\t\ttypeof flow !== \"object\" ||\n\t\tflow === null ||\n\t\tArray.isArray(flow) ||\n\t\t(Object.getPrototypeOf(flow) !== Object.prototype &&\n\t\t\tObject.getPrototypeOf(flow) !== null)\n\t) {\n\t\treturn invalidJsonSnapshot();\n\t}\n\treturn toJsonSnapshot(flow) as Record<string, unknown>;\n};\n\nconst freezeJsonSnapshot = <Value>(value: Value): Value => {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn value;\n\t}\n\tfor (const child of Object.values(value)) {\n\t\tfreezeJsonSnapshot(child);\n\t}\n\treturn Object.freeze(value);\n};\n\nconst snapshotInlineFlow = (flow: InlineFlow): InlineFlow => {\n\tconst snapshot = inlineFlowSchema.parse(snapshotInlineFlowInput(flow));\n\tconst definition = snapshot.definition;\n\tif (\n\t\ttypeof definition === \"object\" &&\n\t\tdefinition !== null &&\n\t\t!Array.isArray(definition)\n\t) {\n\t\tconst field = INLINE_FLOW_PERSISTED_IDENTITY_FIELDS.find(\n\t\t\t(candidate) => candidate in definition,\n\t\t);\n\t\tif (field) {\n\t\t\tthrow new Error(\n\t\t\t\t`Inline flow definitions cannot include persisted field \"${field}\".`,\n\t\t\t);\n\t\t}\n\t}\n\treturn freezeJsonSnapshot(snapshot);\n};\n\n/** First-party supplied-flow entrypoint; intentionally absent from the public SDK root. */\nexport const createInlineFlow = (\n\tclient: Client,\n\tflow: InlineFlow,\n): InlineFlowRun =>\n\tgetInlineFlowClientBridge(client).createInlineFlowRun(\n\t\tsnapshotInlineFlow(flow),\n\t);\n\nexport type { InlineFlow };\n"
19
+ "import type {\n\tCaptureInstanceFeedbackRequest,\n\tCaptureInstanceFeedbackResponse,\n\tListInstanceFeedbackMineRequest,\n\tListInstanceFeedbackMineResponse,\n} from \"@getuserfeedback/protocol\";\nimport {\n\truntimePropertiesSchema,\n\ttype RuntimeProperties,\n} from \"@getuserfeedback/protocol\";\nimport {\n\ttype AppEventIdentity,\n\tassertNoSegmentExternalIdsInValueArgument,\n\ttype ClientMeta,\n\ttype ClientOptions,\n\ttype Command,\n\ttype CommandEnvelope,\n\tCommandSettlementError,\n\tCommandSettlementTimeoutError,\n\ttype ConfigureOptions,\n\ttype ContainerPolicy,\n\tcreateCommandEnvelope,\n\tcreateCommandRequestId,\n\tcreateCommandSettlementDispatch,\n\tcreateFlowCommandHandleController,\n\tgetFeedbackReadFromSettlementDetail,\n\tgetFeedbackSubmissionFromSettlementDetail,\n\tgetFlowHandleFromSettlementDetail,\n\ttype FlowRenderState as HostFlowRenderState,\n\ttype IdentifyOptions,\n\ttype InitOptions,\n\ttype LinkRouter,\n\tLOADER_RUNTIME_GLOBAL_KEY,\n\tLOADER_RUNTIME_PROTOCOL_VERSION,\n\tOPEN_URL_ACTION_CAPABILITY,\n\tOPEN_URL_ACTION_V1_CAPABILITY,\n\tOPEN_URL_ACTION_VERSION,\n\ttype ResponseMetadataInput,\n\tSDK_PROTOCOL_CAPABILITIES,\n\ttype WidgetLayoutTransitionPolicy,\n\twaitForCommandSettlement,\n} from \"@getuserfeedback/protocol/host\";\nimport { UNIFIED_FLOW_RUNTIME_V2_CAPABILITY } from \"@getuserfeedback/protocol/internal/core-host-command-settlement\";\nimport { suppliedOnlyLocalInitOptionsSchema } from \"@getuserfeedback/protocol/internal/core-init-options\";\nimport type { InternalHostCommandEnvelope } from \"@getuserfeedback/protocol/internal/host-command-envelope\";\nimport type {\n\tInternalHostInlineFlowCommandPayload,\n\tInternalHostSuppliedOnlyLocalInitCommandPayload,\n} from \"@getuserfeedback/protocol/internal/host-command-payload\";\nimport type { InlineFlow } from \"@getuserfeedback/protocol/internal/inline-flow\";\nimport { parseCustomerOccurrenceName } from \"@getuserfeedback/protocol/internal/sdk-event-options\";\n\nimport { createClientTransportAdmission } from \"./internal/client-transport-admission\";\nimport {\n\tbuildCustomerOccurrenceCommand,\n\ttype EventOptions,\n\ttype EventProperties,\n} from \"./internal/customer-occurrence-command\";\nimport { createFlowOpenRequestController } from \"./internal/flow-open-request-controller\";\nimport { toGraphRelationshipProperties } from \"./internal/graph-relationship-properties\";\nimport type { InlineFlowRun } from \"./internal/inline-flow\";\nimport { attachInlineFlowClientBridge } from \"./internal/inline-flow-client-bridge\";\nimport { invokeLinkRouter, resolveLinkRouter } from \"./internal/link-router\";\nimport { attachReactContainerBridge } from \"./internal/react-container\";\nimport { SDK_VERSION } from \"./version\";\n\nexport type {\n\tEventOptions,\n\tEventProperties,\n} from \"./internal/customer-occurrence-command\";\nexport type { ClientOptions };\n\n/** Feedback captured as an evaluation of the current app or a specific target. */\nexport type FeedbackInput = CaptureInstanceFeedbackRequest;\n\n/** Receipt returned after feedback has been accepted. */\nexport type SubmitFeedbackResult = CaptureInstanceFeedbackResponse;\n\n/** Selectors used to read the current authenticated user's feedback. */\nexport type FetchFeedbackInput = ListInstanceFeedbackMineRequest;\n\n/** Feedback matching each requested selector, in selector order. */\nexport type FetchFeedbackResult = ListInstanceFeedbackMineResponse;\n\n/** Operations for submitting and reading feedback through the current SDK client. */\nexport type FeedbackOperations = {\n\t/**\n\t * Read feedback matching each selector for the JWT-authenticated user.\n\t * Requires `auth.jwt` configuration; `identify()` alone does not authorize readback.\n\t */\n\tfetch: (input: FetchFeedbackInput) => Promise<FetchFeedbackResult>;\n\tsubmit: (input: FeedbackInput) => Promise<SubmitFeedbackResult>;\n};\n\n/** One endpoint in a directed relationship observation. Use `identities` for a user without a stable user ID. */\nexport type GraphEndpointIdentity =\n\t| AppEventIdentity\n\t| { type: `externalId.users.none.${string}`; value: string };\n\nexport type GraphRelationshipRef =\n\t| { collection: string; id: string; identities?: never }\n\t| { collection: \"user\"; identities: GraphEndpointIdentity[]; id?: never };\n\n/** A directed relationship observation recorded through the analytics pipeline. */\nexport type GraphRelationship = {\n\tfrom: GraphRelationshipRef;\n\tto: GraphRelationshipRef;\n};\n\n/** Operations for recording relationship observations as product events. */\nexport type GraphOperations = {\n\tconnect: (relationship: GraphRelationship) => Promise<void>;\n\tdisconnect: (relationship: GraphRelationship) => Promise<void>;\n};\n\nimport { type ActionRegistry, createActionRegistry } from \"./action-registry\";\nimport { createClientHostEventHub } from \"./client-host-event-hub\";\nimport { createOpenRequestBridge } from \"./open-request-bridge\";\nimport type { OpenRequestedEvent as OpenRequestDispatcherEvent } from \"./open-request-dispatcher\";\nimport { resolveStartupRuntimeUrls } from \"./runtime-url-defaults\";\n\n/** @internal */\ndeclare global {\n\tinterface Window {\n\t\t__getuserfeedback_queue?: Array<\n\t\t\tCommandEnvelope | InternalHostCommandEnvelope\n\t\t>;\n\t\t[LOADER_RUNTIME_GLOBAL_KEY]?: {\n\t\t\talive?: boolean;\n\t\t\tprotocolVersion?: string;\n\t\t\tfeatures?: readonly string[];\n\t\t};\n\t}\n}\n\ntype FlowHandleId = string;\n\ntype FlowRunTarget = { flowId: string } | { flow: InlineFlow };\n\n/** Current flow state (open/loading and dimensions when known). */\nexport interface FlowState extends HostFlowRenderState {\n\t/**\n\t * @deprecated Stop reading this field. SDK state snapshots and subscriptions\n\t * never populate it, and there is no replacement SDK state field.\n\t */\n\ttransitionPolicy?: WidgetLayoutTransitionPolicy;\n}\n\n/** Callback invoked when flow state changes. */\nexport type FlowStateCallback = (state: FlowState) => void;\ntype IdentifyTraits = Record<string, unknown>;\nexport type OpenRequestedEvent = OpenRequestDispatcherEvent;\nexport type OpenRequestedCallback = (event: OpenRequestedEvent) => void;\n/** Options for opening a flow run. */\nexport type OpenFlowOptions = {\n\t/** Host container used for this open request. Omit to use default floating mounting; pass null to wait for a custom container. */\n\tcontainer?: HTMLElement | null;\n\t/**\n\t * Optional response metadata to preserve with the eventual submission.\n\t * These tags are attached when the flow is opened and do not affect prerendering.\n\t */\n\tmetadata?: ResponseMetadataInput;\n\t/**\n\t * When `true`, the flow view does not show a close button.\n\t * Useful for mobile or embedded contexts where the host handles dismissal (e.g. via a drawer or back gesture).\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for prerendering a flow run. */\nexport type PrerenderFlowOptions = {\n\t/**\n\t * When `true`, the prerendered view does not show a close button.\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for subscribing to flow state updates. */\nexport type SubscribeFlowStateOptions = {\n\t/** Emit the current snapshot immediately. Default `true`. */\n\temitInitial?: boolean;\n\t/** Auto-unsubscribe when the signal is aborted. */\n\tsignal?: AbortSignal;\n};\n\nconst DEFAULT_FLOW_STATE: FlowState = {\n\tisOpen: false,\n\tisLoading: false,\n\twidth: undefined,\n\theight: undefined,\n};\nconst STALE_HANDLE_ERROR_CODE = \"STALE_HANDLE\" as const;\n\nconst isStaleHandleError = (error: unknown): boolean => {\n\tif (error instanceof CommandSettlementError) {\n\t\treturn error.code === STALE_HANDLE_ERROR_CODE;\n\t}\n\tif (!(error instanceof Error)) {\n\t\treturn false;\n\t}\n\treturn error.message.includes(\"flowHandleId is stale\");\n};\n\n/** Instance for a specific flow: open, prefetch, prerender, close, and subscribe to flow state. */\nexport type FlowRun = {\n\t/** The flow/survey ID this instance refers to. */\n\tflowId: string;\n\t/** Open the flow. Immediately reports loading until the open settles or close/reset clears its intent. */\n\topen: (options?: OpenFlowOptions) => Promise<void>;\n\t/** Prefetch the flow so it opens faster when you call `open()`. */\n\tprefetch: () => Promise<void>;\n\t/** Prerender the flow into a container (e.g. for a custom dialog). */\n\tprerender: (options?: PrerenderFlowOptions) => Promise<void>;\n\t/** Attach or detach this flow to a specific host container. */\n\tsetContainer: (element: HTMLElement | null) => void;\n\t/** Close this flow. */\n\tclose: () => Promise<void>;\n\t/** Return the latest known flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to open/loading/dimensions; returns an unsubscribe function. */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n};\n\n/**\n * getuserfeedback client for loading the widget, opening flows, configuring\n * consent/auth, identifying users, and tracking events.\n *\n * @see https://getuserfeedback.com/docs/reference/javascript-sdk-reference\n */\nexport type Client = {\n\t/** Load the widget script. Call when you created the client with `disableAutoLoad: true`. */\n\tload: () => void;\n\t/** Set how this instance should choose default containers for flows. */\n\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => void;\n\t/** Return the latest known instance-level flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to instance-level flow state updates (eg targeting-triggered opens). */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n\t/** Return a flow instance; call .open(), .prefetch(), .prerender(), .close() on it. */\n\tflow: (flowId: string) => FlowRun;\n\t/** Close all open flows. */\n\tclose: () => Promise<void>;\n\t/** Close all open flows, clear JWT authentication, and reset user identity. */\n\treset: () => Promise<void>;\n\t/**\n\t * Update color scheme, consent, or auth. Pass a fresh JWT here after login\n\t * and whenever your auth provider refreshes the session token. Await the\n\t * returned promise or handle its rejection when applying runtime updates.\n\t *\n\t * When using `disableAutoLoad`, call `load()` first. Calls made before `load()`\n\t * resolve without applying the update. Provide the initial color scheme,\n\t * default consent, and properties to `createClient()`; configure auth after\n\t * `load()`.\n\t *\n\t * @see https://getuserfeedback.com/docs/security-and-privacy/jwt-auth\n\t */\n\tconfigure: (updates: ConfigureOptions) => Promise<void>;\n\t/**\n\t * Associate the current user with a user ID, traits, and optional external IDs.\n\t *\n\t * Use `options.externalIds` for Segment-compatible identifiers from another\n\t * system. Without a user ID, pass options as `client.identify(traits, options)`,\n\t * or use `client.identify(traits, undefined, options)` when your call site needs\n\t * the explicit three-argument form. Do not put Segment-shaped `externalIds` in\n\t * traits. Some invalid arguments throw synchronously; other validation or\n\t * command-processing failures reject the returned promise.\n\t *\n\t * @see https://getuserfeedback.com/docs/guides/identity-resolution\n\t */\n\tidentify: {\n\t\t(\n\t\t\tuserId: string,\n\t\t\ttraits?: IdentifyTraits,\n\t\t\toptions?: IdentifyOptions,\n\t\t): Promise<void>;\n\t\t(\n\t\t\ttraits: IdentifyTraits,\n\t\t\tplaceholder: undefined,\n\t\t\toptions?: IdentifyOptions,\n\t\t): Promise<void>;\n\t\t(traits: IdentifyTraits, options?: IdentifyOptions): Promise<void>;\n\t};\n\t/**\n\t * Track a product event from the browser.\n\t *\n\t * Use `options.externalIds` when the event carries a Segment-compatible\n\t * identifier from another system. Do not put Segment-shaped `externalIds` in\n\t * properties. Some invalid arguments throw synchronously; other validation or\n\t * command-processing failures reject the returned promise.\n\t *\n\t * @see https://getuserfeedback.com/docs/reference/events\n\t */\n\ttrack: (\n\t\teventName: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t) => Promise<void>;\n\t/**\n\t * Record the current browser page or a named page location. Some invalid\n\t * arguments throw synchronously; other validation or command-processing\n\t * failures reject the returned promise.\n\t */\n\tpage: (\n\t\tname?: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t) => Promise<void>;\n\t/** Record directed relationship observations through the analytics pipeline. */\n\tgraph: GraphOperations;\n\t/** Submit feedback or read the authenticated user's matching feedback. */\n\tfeedback: FeedbackOperations;\n\t/** Subscribe to explicit SDK and client-side targeting open requests, or suppress them — for example if you know the user should not be interrupted.\n\t * For example, when the user is filling out a form, or is in the middle of a multi-step flow.\n\t * Prevention applies only to that presentation attempt; it does not create a\n\t * public retry schedule.\n\t *\n\t * @example — suppress open flow requests if the user is busy\n\t * ```ts\n\t * client.onOpenRequested((event) => {\n\t * if (userIsBusy()) {\n\t * event.preventDefault();\n\t * }\n\t * });\n\t * ```\n\t */\n\tonOpenRequested: (callback: OpenRequestedCallback) => () => void;\n};\n\ntype ClientRegistryEntry = {\n\tclient: Client;\n\tupdateOptions: (\n\t\toptions: ClientOptions,\n\t\tactionRegistry: ActionRegistry,\n\t\tlinkRouter: LinkRouter | undefined,\n\t) => void;\n};\n\nconst openRequestBridgeByClient = new WeakMap<\n\tClient,\n\tReturnType<typeof createOpenRequestBridge>\n>();\n\nconst clientRegistry = new Map<object, Map<string, ClientRegistryEntry>>();\n\nexport const getOpenRequestBridge = (\n\tclient: Client,\n): ReturnType<typeof createOpenRequestBridge> => {\n\tconst bridge = openRequestBridgeByClient.get(client);\n\tif (!bridge) {\n\t\tthrow new Error(\"Open request bridge not found for client instance.\");\n\t}\n\treturn bridge;\n};\n\nconst createClientInstanceId = (): string => {\n\tif (\n\t\ttypeof globalThis.crypto !== \"undefined\" &&\n\t\ttypeof globalThis.crypto.randomUUID === \"function\"\n\t) {\n\t\treturn globalThis.crypto.randomUUID();\n\t}\n\treturn `sdk-${Date.now()}-${Math.random().toString(16).slice(2)}`;\n};\n\nconst toIdentifyCommandPayload = (\n\tidentifyInput: string | IdentifyTraits,\n\ttraitsOrOptions?: IdentifyTraits | IdentifyOptions,\n\toptions?: IdentifyOptions,\n): Extract<Command, { kind: \"identify\" }> => {\n\tif (typeof identifyInput === \"string\") {\n\t\tassertNoSegmentExternalIdsInValueArgument({\n\t\t\targument: traitsOrOptions,\n\t\t\tcommandName: \"identify\",\n\t\t\tvalueArgumentName: \"traits\",\n\t\t\tcallShape: \"identify(userId, traits, { externalIds })\",\n\t\t});\n\t\treturn {\n\t\t\tkind: \"identify\",\n\t\t\tuserId: identifyInput,\n\t\t\ttraits: traitsOrOptions,\n\t\t\toptions,\n\t\t};\n\t}\n\tassertNoSegmentExternalIdsInValueArgument({\n\t\targument: identifyInput,\n\t\tcommandName: \"identify\",\n\t\tvalueArgumentName: \"traits\",\n\t\tcallShape: \"identify(traits, { externalIds })\",\n\t});\n\treturn {\n\t\tkind: \"identify\",\n\t\ttraits: identifyInput,\n\t\toptions: options ?? traitsOrOptions,\n\t};\n};\n\nconst LOADER_RUNTIME_PROBE_TIMEOUT_MS = 120;\n// Once Loader registration has been enqueued, it is ordinary command settlement\n// rather than a short ownership probe. Keep supplied-flow handoff behind that\n// settlement so Core capability negotiation can complete before admission.\nconst LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS = 30_000;\nconst INVALID_COMMAND_ERROR_CODE = \"INVALID_COMMAND\";\nconst SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL = Symbol.for(\n\t\"@getuserfeedback/sdk/internal/supplied-only-local-client-options/1\",\n);\nconst BUNDLED_DOCS_LOCAL_API_KEY = \"@getuserfeedback/internal/bundled-docs\";\n\ntype MarkedSuppliedOnlyLocalClientOptions = ClientOptions & {\n\t[SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL]: true;\n};\ntype MaybeMarkedSuppliedOnlyLocalClientOptions = ClientOptions & {\n\t[SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL]?: true;\n};\n\n/** Private runtime inputs for the deployment-owned bundled-docs client. */\nexport type BundledDocsClientOptions = {\n\tloaderUrl: string;\n\tcoreUrl: string;\n\tcolorScheme?: ClientOptions[\"colorScheme\"];\n\tdisableAutoLoad?: boolean;\n};\n\n/**\n * Build options that the public React provider can pass through to the SDK root\n * without exposing local registration in the public options type.\n * Pass the returned object intact; cloning or serializing it deliberately fails\n * closed instead of falling back to persisted registration.\n * See docs/specs/2026-08-02-flow-interaction-model.md.\n */\nexport const createBundledDocsClientOptions = (\n\toptions: BundledDocsClientOptions,\n): ClientOptions => {\n\tconst clientOptions: ClientOptions = {\n\t\tapiKey: BUNDLED_DOCS_LOCAL_API_KEY,\n\t\t_loaderUrl: options.loaderUrl,\n\t\t_coreUrl: options.coreUrl,\n\t};\n\tif (options.colorScheme !== undefined) {\n\t\tclientOptions.colorScheme = options.colorScheme;\n\t}\n\tif (options.disableAutoLoad !== undefined) {\n\t\tclientOptions.disableAutoLoad = options.disableAutoLoad;\n\t}\n\tObject.defineProperty(\n\t\tclientOptions,\n\t\tSUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL,\n\t\t{\n\t\t\tconfigurable: false,\n\t\t\tenumerable: false,\n\t\t\tvalue: true,\n\t\t\twritable: false,\n\t\t},\n\t);\n\treturn clientOptions;\n};\n\nconst isSuppliedOnlyLocalClientOptions = (\n\toptions: MaybeMarkedSuppliedOnlyLocalClientOptions,\n): options is MarkedSuppliedOnlyLocalClientOptions =>\n\toptions[SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL] === true;\n\nconst resolveRegistryKey = (\n\toptions: ClientOptions,\n\tregistrationKind: \"persisted\" | \"supplied-only-local\",\n): string => `${registrationKind}:${options.apiKey}`;\n\nconst haveSameActionDefinitions = (left: string[], right: string[]): boolean =>\n\tJSON.stringify(left) === JSON.stringify(right);\n\nconst rejectAmbiguousLinkOwnership = (\n\tlinkRouter: LinkRouter | undefined,\n\tactionRegistry: ActionRegistry,\n): void => {\n\tif (linkRouter !== undefined && actionRegistry.getOpenUrlHandler()) {\n\t\tthrow new TypeError(\n\t\t\t\"links.router cannot be configured with actions open-url; choose one link owner\",\n\t\t);\n\t}\n};\n\nconst resolveRegistryScope = (): object =>\n\ttypeof window === \"undefined\" ? globalThis : window;\n\nconst getRegistryForScope = (): Map<string, ClientRegistryEntry> => {\n\tconst scope = resolveRegistryScope();\n\tconst existing = clientRegistry.get(scope);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst created = new Map<string, ClientRegistryEntry>();\n\tclientRegistry.set(scope, created);\n\treturn created;\n};\n\n/**\n * Create a getuserfeedback client. Reuses an existing logical client for the\n * same `apiKey`. Host-action definitions may change\n * before loading starts; afterward, changing their canonical identities throws\n * while equivalent definitions refresh their handlers.\n */\nexport const createClient = (options: ClientOptions): Client => {\n\tconst suppliedOnlyLocal = isSuppliedOnlyLocalClientOptions(options);\n\tif (!suppliedOnlyLocal && options.apiKey === BUNDLED_DOCS_LOCAL_API_KEY) {\n\t\tthrow new Error(\n\t\t\t\"Bundled docs client options must be passed intact without cloning or serialization.\",\n\t\t);\n\t}\n\tconst {\n\t\tapiKey,\n\t\t_loaderUrl,\n\t\t_coreUrl,\n\t\t_apiUrl,\n\t\t_realtimeUrl,\n\t\tdisableAutoLoad = false,\n\t\tcolorScheme,\n\t\tdisableTelemetry = false,\n\t\tenableDebug = false,\n\t\tdefaultConsent,\n\t\tproperties: propertiesInput,\n\t\tactions,\n\t\tlinks,\n\t} = options;\n\tconst properties =\n\t\tpropertiesInput === undefined\n\t\t\t? undefined\n\t\t\t: runtimePropertiesSchema.parse(propertiesInput);\n\tconst initialActionRegistry = createActionRegistry(actions);\n\tconst initialLinkRouter = resolveLinkRouter(links);\n\trejectAmbiguousLinkOwnership(initialLinkRouter, initialActionRegistry);\n\tconst registryKey = resolveRegistryKey(\n\t\t{\n\t\t\tapiKey,\n\t\t\t_loaderUrl,\n\t\t\t_coreUrl,\n\t\t\t_apiUrl,\n\t\t\t_realtimeUrl,\n\t\t\tdisableAutoLoad,\n\t\t\tcolorScheme,\n\t\t\tdisableTelemetry,\n\t\t\tenableDebug,\n\t\t\tdefaultConsent,\n\t\t\tproperties,\n\t\t\tactions,\n\t\t},\n\t\tsuppliedOnlyLocal ? \"supplied-only-local\" : \"persisted\",\n\t);\n\tconst registry = getRegistryForScope();\n\tconst existing = registry.get(registryKey);\n\tif (existing) {\n\t\texisting.updateOptions(\n\t\t\t{\n\t\t\t\tapiKey,\n\t\t\t\t_loaderUrl,\n\t\t\t\t_coreUrl,\n\t\t\t\t_apiUrl,\n\t\t\t\t_realtimeUrl,\n\t\t\t\tdisableAutoLoad,\n\t\t\t\tcolorScheme,\n\t\t\t\tdisableTelemetry,\n\t\t\t\tenableDebug,\n\t\t\t\tdefaultConsent,\n\t\t\t\tproperties,\n\t\t\t\tactions,\n\t\t\t},\n\t\t\tinitialActionRegistry,\n\t\t\tinitialLinkRouter,\n\t\t);\n\t\tif (!disableAutoLoad) {\n\t\t\texisting.client.load();\n\t\t}\n\t\treturn existing.client;\n\t}\n\n\tlet loaderUrlConfig = _loaderUrl;\n\tlet coreUrlConfig = _coreUrl;\n\tlet apiUrlConfig = _apiUrl;\n\tlet realtimeUrlConfig = _realtimeUrl;\n\n\tconst notifyError = (_error: unknown): void => {\n\t\t// No-op: track/use hooks removed from public API.\n\t};\n\tconst hostWindow =\n\t\ttypeof window !== \"undefined\" &&\n\t\ttypeof window.addEventListener === \"function\" &&\n\t\ttypeof window.removeEventListener === \"function\"\n\t\t\t? window\n\t\t\t: null;\n\tconst hostDocument =\n\t\ttypeof document !== \"undefined\" &&\n\t\ttypeof document.createElement === \"function\" &&\n\t\tdocument.head !== null\n\t\t\t? document\n\t\t\t: null;\n\n\tconst sdkVersion = SDK_VERSION;\n\tconst clientInstanceId = createClientInstanceId();\n\tconst openRequestBridge = createOpenRequestBridge();\n\tconst clientMeta: ClientMeta = {\n\t\tloader: \"sdk\",\n\t\tclientName: \"@getuserfeedback/sdk\",\n\t\tclientVersion: sdkVersion,\n\t\ttransport: \"snippet\",\n\t};\n\n\tlet defaultConsentConfig = defaultConsent;\n\tlet colorSchemeConfig = colorScheme;\n\tlet propertiesConfig: RuntimeProperties | undefined = properties;\n\tlet actionRegistry = initialActionRegistry;\n\tlet linkRouterConfig = initialLinkRouter;\n\n\tconst buildRuntimeEndpoints = (): InitOptions[\"runtimeEndpoints\"] => {\n\t\tif (!(coreUrlConfig || apiUrlConfig || realtimeUrlConfig)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst runtimeEndpoints: NonNullable<InitOptions[\"runtimeEndpoints\"]> = {};\n\t\tif (coreUrlConfig !== undefined) {\n\t\t\truntimeEndpoints.coreUrl = coreUrlConfig;\n\t\t}\n\t\tif (apiUrlConfig !== undefined) {\n\t\t\truntimeEndpoints.apiUrl = apiUrlConfig;\n\t\t}\n\t\tif (realtimeUrlConfig !== undefined) {\n\t\t\truntimeEndpoints.realtimeUrl = realtimeUrlConfig;\n\t\t}\n\t\treturn runtimeEndpoints;\n\t};\n\n\tconst buildInitOpts = (includeHostActions = true): InitOptions => {\n\t\tconst runtimeEndpoints = buildRuntimeEndpoints();\n\t\tconst hostActionDefinitions = includeHostActions\n\t\t\t? actionRegistry.listDefinitions()\n\t\t\t: [];\n\t\tconst protocolCapabilities = [\n\t\t\t...SDK_PROTOCOL_CAPABILITIES,\n\t\t\t...(linkRouterConfig !== undefined || actionRegistry.getOpenUrlHandler()\n\t\t\t\t? [OPEN_URL_ACTION_CAPABILITY, OPEN_URL_ACTION_V1_CAPABILITY]\n\t\t\t\t: []),\n\t\t];\n\t\tconst initOptions: InitOptions = {\n\t\t\tapiKey,\n\t\t\tclientMeta,\n\t\t\tcapabilities: [...protocolCapabilities],\n\t\t};\n\t\tif (propertiesConfig !== undefined) {\n\t\t\tinitOptions.properties = propertiesConfig;\n\t\t}\n\t\tif (hostActionDefinitions.length > 0) {\n\t\t\tinitOptions.hostActions = hostActionDefinitions;\n\t\t}\n\t\tif (runtimeEndpoints !== undefined) {\n\t\t\tinitOptions.runtimeEndpoints = runtimeEndpoints;\n\t\t}\n\t\tif (colorSchemeConfig !== undefined) {\n\t\t\tinitOptions.colorScheme = colorSchemeConfig;\n\t\t}\n\t\tif (disableTelemetry !== undefined) {\n\t\t\tinitOptions.disableTelemetry = disableTelemetry;\n\t\t}\n\t\tif (enableDebug !== undefined) {\n\t\t\tinitOptions.enableDebug = enableDebug;\n\t\t}\n\t\tif (defaultConsentConfig !== undefined) {\n\t\t\tinitOptions.defaultConsent = defaultConsentConfig;\n\t\t}\n\t\treturn initOptions;\n\t};\n\n\tlet loaderRequested = false;\n\tlet pendingLoad: Promise<void> | null = null;\n\tlet pendingRegistrationProbe: Promise<void> | null = null;\n\tlet disableAutoLoadConfig = disableAutoLoad;\n\tconst flowStateByHandle = new Map<FlowHandleId, FlowState>();\n\tconst claimedFlowStateHandles = new Set<FlowHandleId>();\n\tconst pendingFlowStateHandles = new Set<FlowHandleId>();\n\tlet isFlowHandleAllocationActive = false;\n\tlet isFlowHandleAllocationLocked = false;\n\tconst flowHandleAllocationWaiters: Array<(release: () => void) => void> = [];\n\tlet instanceFlowState: FlowState = DEFAULT_FLOW_STATE;\n\tconst hostEventHub = createClientHostEventHub({\n\t\tinstanceId: clientInstanceId,\n\t\tonNavigationRequested: (detail) => {\n\t\t\tconst target =\n\t\t\t\tdetail.version === 1 && detail.target === \"_blank\"\n\t\t\t\t\t? undefined\n\t\t\t\t\t: detail.version === OPEN_URL_ACTION_VERSION &&\n\t\t\t\t\t\t (detail.target === undefined ||\n\t\t\t\t\t\t\t\tdetail.target === \"self\" ||\n\t\t\t\t\t\t\t\tdetail.target === \"blank\")\n\t\t\t\t\t\t? detail.target\n\t\t\t\t\t\t: null;\n\t\t\tif (target === null) {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tif (linkRouterConfig !== undefined) {\n\t\t\t\tinvokeLinkRouter(\n\t\t\t\t\tlinkRouterConfig,\n\t\t\t\t\ttarget === undefined\n\t\t\t\t\t\t? { url: detail.url }\n\t\t\t\t\t\t: { url: detail.url, target },\n\t\t\t\t);\n\t\t\t\treturn \"succeeded\";\n\t\t\t}\n\t\t\tconst handler = actionRegistry.getOpenUrlHandler();\n\t\t\tif (!handler) {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tconst outcome = handler(\n\t\t\t\ttarget === undefined\n\t\t\t\t\t? { url: detail.url }\n\t\t\t\t\t: { url: detail.url, target },\n\t\t\t);\n\t\t\tif (outcome === \"handled\") {\n\t\t\t\treturn \"succeeded\";\n\t\t\t}\n\t\t\tif (outcome === \"unhandled\") {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tthrow new TypeError(\n\t\t\t\t'Registered open-url action must return \"handled\" or \"unhandled\" synchronously.',\n\t\t\t);\n\t\t},\n\t\twindowRef: hostWindow,\n\t});\n\n\tconst resolveRequiredRuntimeUrls = (): {\n\t\tloaderUrl: string;\n\t\tcoreUrl: string;\n\t\tapiUrl: string;\n\t\trealtimeUrl?: string;\n\t} => {\n\t\tconst runtimeUrls = resolveStartupRuntimeUrls({\n\t\t\tapiKey,\n\t\t\t_loaderUrl: loaderUrlConfig,\n\t\t\t_coreUrl: coreUrlConfig,\n\t\t\t_apiUrl: apiUrlConfig,\n\t\t\t_realtimeUrl: realtimeUrlConfig,\n\t\t});\n\t\tloaderUrlConfig = runtimeUrls.loaderUrl;\n\t\tcoreUrlConfig = runtimeUrls.coreUrl;\n\t\tapiUrlConfig = runtimeUrls.apiUrl;\n\t\trealtimeUrlConfig = runtimeUrls.realtimeUrl;\n\t\treturn runtimeUrls;\n\t};\n\n\tconst cloneFlowState = (state: FlowState): FlowState => ({\n\t\tisOpen: state.isOpen,\n\t\tisLoading: state.isLoading,\n\t\twidth: state.width,\n\t\theight: state.height,\n\t});\n\n\tconst getFlowStateForHandle = (flowHandleId: FlowHandleId): FlowState => {\n\t\tconst existing = flowStateByHandle.get(flowHandleId);\n\t\tif (!existing) {\n\t\t\treturn cloneFlowState(DEFAULT_FLOW_STATE);\n\t\t}\n\t\treturn cloneFlowState(existing);\n\t};\n\n\tconst setFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tstate: FlowState,\n\t): void => {\n\t\tflowStateByHandle.set(flowHandleId, cloneFlowState(state));\n\t};\n\n\t// Core can publish state for a newly allocated supplied Flow before the\n\t// command settlement tells its FlowRun which handle was allocated. Keep the\n\t// client-owned snapshot current so binding that handle can replay the state\n\t// instead of losing the first open transition.\n\thostEventHub.subscribeFlowState((detail): void => {\n\t\tconst isClaimedHandle = claimedFlowStateHandles.has(detail.flowHandleId);\n\t\tif (!isClaimedHandle && !isFlowHandleAllocationActive) {\n\t\t\treturn;\n\t\t}\n\t\tsetFlowStateForHandle(detail.flowHandleId, {\n\t\t\tisOpen: detail.isOpen,\n\t\t\tisLoading: detail.isLoading,\n\t\t\twidth: detail.width,\n\t\t\theight: detail.height,\n\t\t});\n\t\tif (!isClaimedHandle) {\n\t\t\tpendingFlowStateHandles.add(detail.flowHandleId);\n\t\t}\n\t});\n\tconst beginFlowHandleAllocation = (): void => {\n\t\tisFlowHandleAllocationActive = true;\n\t};\n\tconst clearPendingFlowHandleState = (): void => {\n\t\tfor (const flowHandleId of pendingFlowStateHandles) {\n\t\t\tflowStateByHandle.delete(flowHandleId);\n\t\t}\n\t\tpendingFlowStateHandles.clear();\n\t};\n\tconst endFlowHandleAllocation = (): void => {\n\t\tisFlowHandleAllocationActive = false;\n\t\tclearPendingFlowHandleState();\n\t};\n\t/**\n\t * Flow-state events do not carry the allocating command requestId. Serialize\n\t * only handle-free handoffs so a pre-settlement snapshot has one possible\n\t * owner. Other commands remain concurrent. If allocation concurrency becomes\n\t * a product requirement, add explicit event correlation instead of a ledger.\n\t */\n\tconst createFlowHandleAllocationRelease = (): (() => void) => {\n\t\tlet released = false;\n\t\treturn () => {\n\t\t\tif (released) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treleased = true;\n\t\t\tconst next = flowHandleAllocationWaiters.shift();\n\t\t\tif (next) {\n\t\t\t\tnext(createFlowHandleAllocationRelease());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tisFlowHandleAllocationLocked = false;\n\t\t};\n\t};\n\tconst acquireFlowHandleAllocation = ():\n\t\t| (() => void)\n\t\t| Promise<() => void> => {\n\t\tif (!isFlowHandleAllocationLocked) {\n\t\t\tisFlowHandleAllocationLocked = true;\n\t\t\treturn createFlowHandleAllocationRelease();\n\t\t}\n\t\treturn new Promise<() => void>((resolve) => {\n\t\t\tflowHandleAllocationWaiters.push(resolve);\n\t\t});\n\t};\n\n\tconst getInstanceFlowState = (): FlowState =>\n\t\tcloneFlowState(instanceFlowState);\n\n\tconst setInstanceFlowState = (state: FlowState): void => {\n\t\tinstanceFlowState = cloneFlowState(state);\n\t};\n\n\thostEventHub.subscribeInstanceFlowState((detail): void => {\n\t\tsetInstanceFlowState({\n\t\t\tisOpen: detail.isOpen,\n\t\t\tisLoading: detail.isLoading,\n\t\t\twidth: detail.width,\n\t\t\theight: detail.height,\n\t\t});\n\t});\n\n\tconst ensureFlowStateForHandle = (flowHandleId: FlowHandleId): void => {\n\t\tif (!flowStateByHandle.has(flowHandleId)) {\n\t\t\tsetFlowStateForHandle(flowHandleId, DEFAULT_FLOW_STATE);\n\t\t}\n\t};\n\n\tconst subscribeFlowHandleInvalidation = (\n\t\tsubscriber: (flowHandleId: FlowHandleId) => void,\n\t): (() => void) => hostEventHub.subscribeFlowHandleInvalidation(subscriber);\n\n\tconst subscribeFlowStateCacheForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t): (() => void) =>\n\t\thostEventHub.subscribeFlowStateForHandle(flowHandleId, (detail): void => {\n\t\t\tconst nextState: FlowState = {\n\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\twidth: detail.width,\n\t\t\t\theight: detail.height,\n\t\t\t};\n\t\t\tsetFlowStateForHandle(flowHandleId, nextState);\n\t\t});\n\n\tconst isLoaderRequested = (): boolean => loaderRequested;\n\n\tconst enqueue = (\n\t\tenvelope: CommandEnvelope | InternalHostCommandEnvelope,\n\t): void => {\n\t\tif (!hostWindow) {\n\t\t\treturn;\n\t\t}\n\t\tif (!hostWindow.__getuserfeedback_queue) {\n\t\t\thostWindow.__getuserfeedback_queue = [];\n\t\t}\n\t\t// Stamp instanceId and clientMeta so the loader can route commands.\n\t\tconst stamped: CommandEnvelope | InternalHostCommandEnvelope = {\n\t\t\t...envelope,\n\t\t\tinstanceId: envelope.instanceId ?? clientInstanceId,\n\t\t\tclientMeta: envelope.clientMeta ?? clientMeta,\n\t\t};\n\t\thostWindow.__getuserfeedback_queue.push(stamped);\n\t};\n\n\tconst enqueueInstanceRegistration = (\n\t\trequestId?: string,\n\t\tincludeHostActions = true,\n\t): string => {\n\t\tif (suppliedOnlyLocal) {\n\t\t\tif (!coreUrlConfig) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"_coreUrl is not resolved for bundled docs registration\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst localRequestId = requestId ?? createCommandRequestId();\n\t\t\tconst suppliedOnlyLocalInitOptions =\n\t\t\t\tcolorSchemeConfig === undefined\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tregistration: {\n\t\t\t\t\t\t\t\tkind: \"supplied-only-local\" as const,\n\t\t\t\t\t\t\t\tprofile: \"bundled-docs\" as const,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tregistration: {\n\t\t\t\t\t\t\t\tkind: \"supplied-only-local\" as const,\n\t\t\t\t\t\t\t\tprofile: \"bundled-docs\" as const,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcolorScheme: colorSchemeConfig,\n\t\t\t\t\t\t};\n\t\t\tconst command: InternalHostSuppliedOnlyLocalInitCommandPayload = {\n\t\t\t\tkind: \"init\",\n\t\t\t\topts: suppliedOnlyLocalInitOptionsSchema.parse(\n\t\t\t\t\tsuppliedOnlyLocalInitOptions,\n\t\t\t\t),\n\t\t\t\truntimeEndpoints: { coreUrl: coreUrlConfig },\n\t\t\t};\n\t\t\tenqueue({\n\t\t\t\tversion: \"1\",\n\t\t\t\trequestId: localRequestId,\n\t\t\t\tidempotencyKey: localRequestId,\n\t\t\t\tcommand,\n\t\t\t});\n\t\t\treturn localRequestId;\n\t\t}\n\t\tconst envelope = createCommandEnvelope({\n\t\t\tinstanceId: clientInstanceId,\n\t\t\trequestId,\n\t\t\tcommand: { kind: \"init\", opts: buildInitOpts(includeHostActions) },\n\t\t});\n\t\tenqueue(envelope);\n\t\treturn envelope.requestId;\n\t};\n\n\tconst runAfterRegistrationProbe = (run: () => void): void => {\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (!registrationProbe) {\n\t\t\trun();\n\t\t\treturn;\n\t\t}\n\t\tvoid registrationProbe.then(run);\n\t};\n\n\tconst enqueueSetDefaultContainerPolicy = (policy: ContainerPolicy): void => {\n\t\trunAfterRegistrationProbe(() => {\n\t\t\tenqueue(\n\t\t\t\tcreateCommandEnvelope({\n\t\t\t\t\tcommand: { kind: \"setDefaultContainerPolicy\", policy },\n\t\t\t\t}),\n\t\t\t);\n\t\t});\n\t};\n\n\tconst enqueueReactContainer = (\n\t\townerId: string,\n\t\thost: HTMLElement | null,\n\t\tflowHandleId?: FlowHandleId,\n\t): void => {\n\t\tconst requestId = createCommandRequestId();\n\t\trunAfterRegistrationProbe(() =>\n\t\t\tenqueue({\n\t\t\t\tversion: \"1\",\n\t\t\t\trequestId,\n\t\t\t\tidempotencyKey: requestId,\n\t\t\t\tcommand: {\n\t\t\t\t\tkind: \"registerReactContainer\",\n\t\t\t\t\townerId,\n\t\t\t\t\thost,\n\t\t\t\t\tflowHandleId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\tconst enqueueSetContainer = (\n\t\tflowHandleId: FlowHandleId,\n\t\telement: HTMLElement | null,\n\t): void => {\n\t\tenqueue(\n\t\t\tcreateCommandEnvelope({\n\t\t\t\tcommand: { kind: \"setContainer\", flowHandleId, container: element },\n\t\t\t}),\n\t\t);\n\t};\n\n\tconst reportAsyncError = <T>(promise: Promise<T>): Promise<T> => {\n\t\treturn promise.catch((error) => {\n\t\t\tnotifyError(error);\n\t\t\tthrow error;\n\t\t});\n\t};\n\n\tconst ensureCommandsCanRun = (): void => {\n\t\tif (!hostWindow) {\n\t\t\treturn;\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\tif (disableAutoLoadConfig) {\n\t\t\t\tthrow new Error(\"Widget not loaded. Call client.load() first.\");\n\t\t\t}\n\t\t\tload();\n\t\t}\n\t};\n\n\tconst assertInlineFlowRuntimeSupport = (): void => {\n\t\tconst runtimeMarker = hostWindow?.[LOADER_RUNTIME_GLOBAL_KEY];\n\t\tif (!runtimeMarker?.alive) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Inline flows require an active compatible Loader runtime.\",\n\t\t\t);\n\t\t}\n\t\tif (runtimeMarker.protocolVersion !== LOADER_RUNTIME_PROTOCOL_VERSION) {\n\t\t\tthrow new Error(\n\t\t\t\t`Incompatible loader runtime protocol: expected ${LOADER_RUNTIME_PROTOCOL_VERSION}, received ${runtimeMarker.protocolVersion ?? \"unknown\"}`,\n\t\t\t);\n\t\t}\n\t\tif (!runtimeMarker.features?.includes(UNIFIED_FLOW_RUNTIME_V2_CAPABILITY)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Inline flows require Loader feature ${UNIFIED_FLOW_RUNTIME_V2_CAPABILITY}.`,\n\t\t\t);\n\t\t}\n\t};\n\n\t/** Enqueue a command and await its settlement.\n\t * The loader resolves instanceId from the instance registry. */\n\tconst rawSettlementDispatch = createCommandSettlementDispatch((cmd) =>\n\t\tenqueue(cmd),\n\t);\n\t// createCommandSettlementDispatch inserts the envelope synchronously before\n\t// returning its settlement promise, which makes invocation the handoff edge.\n\tconst handOffCommand = (input: Command) => rawSettlementDispatch(input);\n\tconst handOffInlineFlowCommand = (\n\t\tinput: InternalHostInlineFlowCommandPayload,\n\t) => {\n\t\tconst requestId = createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: requestId,\n\t\t\tcommand: input,\n\t\t});\n\t\treturn waitForCommandSettlement({\n\t\t\trequestId,\n\t\t\twindowRef: hostWindow ?? undefined,\n\t\t});\n\t};\n\tconst transportAdmission = createClientTransportAdmission();\n\tconst prepareCommandHandoff = (): void | Promise<void> => {\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\treturn registrationProbe;\n\t\t}\n\t};\n\tconst prepareInlineFlowCommandHandoff = (): void | Promise<void> => {\n\t\tensureCommandsCanRun();\n\t\tconst startup = pendingLoad ?? pendingRegistrationProbe;\n\t\tif (startup) {\n\t\t\treturn startup.then(assertInlineFlowRuntimeSupport);\n\t\t}\n\t\tassertInlineFlowRuntimeSupport();\n\t};\n\tconst dispatch = async (input: Command): Promise<void> => {\n\t\tconst preparation = prepareCommandHandoff();\n\t\tif (preparation) {\n\t\t\tawait preparation;\n\t\t}\n\t\tawait rawSettlementDispatch(input);\n\t};\n\n\tconst admitConfigHandoff = (handOff: () => Promise<void>): Promise<void> =>\n\t\ttransportAdmission\n\t\t\t.runOperation(({ attemptHandoff }) =>\n\t\t\t\tattemptHandoff({\n\t\t\t\t\tprepare: prepareCommandHandoff,\n\t\t\t\t\thandOff: () => ({ settlement: handOff() }),\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.then(() => {});\n\n\tconst enqueueConfigUpdate = (opts: ConfigureOptions): void => {\n\t\tif (!isLoaderRequested()) return;\n\t\tvoid admitConfigHandoff(() => {\n\t\t\tenqueue(createCommandEnvelope({ command: { kind: \"configure\", opts } }));\n\t\t\treturn Promise.resolve();\n\t\t}).catch(notifyError);\n\t};\n\n\tconst toConfigureCommandOptions = (\n\t\tupdates: ConfigureOptions,\n\t): ConfigureOptions => {\n\t\tconst nextProperties =\n\t\t\tupdates.properties === undefined\n\t\t\t\t? undefined\n\t\t\t\t: runtimePropertiesSchema.parse(updates.properties);\n\t\treturn {\n\t\t\t...(updates.colorScheme !== undefined && {\n\t\t\t\tcolorScheme: updates.colorScheme,\n\t\t\t}),\n\t\t\t...(updates.consent !== undefined && { consent: updates.consent }),\n\t\t\t...(updates.auth !== undefined && { auth: updates.auth }),\n\t\t\t...(nextProperties !== undefined && {\n\t\t\t\tproperties: nextProperties,\n\t\t\t}),\n\t\t};\n\t};\n\n\tconst updateOptions = (\n\t\tnext: ClientOptions,\n\t\tnextActionRegistry: ActionRegistry,\n\t\tnextLinkRouter: LinkRouter | undefined,\n\t): void => {\n\t\tconst linkRouterOwnershipChanged =\n\t\t\t(linkRouterConfig === undefined) !== (nextLinkRouter === undefined);\n\t\tif (\n\t\t\tlinkRouterOwnershipChanged &&\n\t\t\t(isLoaderRequested() || pendingLoad !== null)\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t\"links.router cannot be added or removed after widget init; keeping original router\",\n\t\t\t);\n\t\t}\n\t\tconst definitionsChanged = !haveSameActionDefinitions(\n\t\t\tactionRegistry.listRegistrationIdentities(),\n\t\t\tnextActionRegistry.listRegistrationIdentities(),\n\t\t);\n\t\tif (definitionsChanged && (isLoaderRequested() || pendingLoad !== null)) {\n\t\t\tconst error = new Error(\n\t\t\t\t\"actions definitions cannot be changed after widget init; keeping original registrations\",\n\t\t\t);\n\t\t\tnotifyError(error);\n\t\t\tthrow error;\n\t\t}\n\t\tactionRegistry = nextActionRegistry;\n\t\tlinkRouterConfig = nextLinkRouter;\n\t\tdisableAutoLoadConfig = next.disableAutoLoad ?? disableAutoLoadConfig;\n\t\tdefaultConsentConfig = next.defaultConsent ?? defaultConsentConfig;\n\t\tif (!isLoaderRequested() && pendingLoad === null) {\n\t\t\tif (next.colorScheme !== undefined) {\n\t\t\t\tcolorSchemeConfig = next.colorScheme;\n\t\t\t}\n\t\t\tif (next.properties !== undefined) {\n\t\t\t\tpropertiesConfig = next.properties;\n\t\t\t}\n\t\t}\n\n\t\tif (next._loaderUrl !== undefined && next._loaderUrl !== loaderUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_loaderUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tloaderUrlConfig = next._loaderUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (next._coreUrl !== undefined && next._coreUrl !== coreUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_coreUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tcoreUrlConfig = next._coreUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (next._apiUrl !== undefined && next._apiUrl !== apiUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_apiUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tapiUrlConfig = next._apiUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tnext._realtimeUrl !== undefined &&\n\t\t\tnext._realtimeUrl !== realtimeUrlConfig\n\t\t) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_realtimeUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\trealtimeUrlConfig = next._realtimeUrl;\n\t\t\t}\n\t\t}\n\n\t\tapplyStartupConfig(next);\n\n\t\tif (!disableAutoLoadConfig && !isLoaderRequested()) {\n\t\t\tload();\n\t\t}\n\t};\n\n\tconst applyStartupConfig = (next: ClientOptions): void => {\n\t\t// Send configure payload from next (colorScheme only from ClientOptions).\n\t\tif (!isLoaderRequested()) return;\n\t\tconst opts: ConfigureOptions = {};\n\t\tif (next.colorScheme !== undefined) opts.colorScheme = next.colorScheme;\n\t\tif (next.properties !== undefined) {\n\t\t\topts.properties = next.properties;\n\t\t}\n\t\tenqueueConfigUpdate(opts);\n\t};\n\n\tconst load = (): void => {\n\t\tif (!hostWindow || !hostDocument) {\n\t\t\treturn;\n\t\t}\n\t\tif (isLoaderRequested() || pendingLoad) {\n\t\t\treturn;\n\t\t}\n\t\tconst runtimeUrls = resolveRequiredRuntimeUrls();\n\n\t\tconst appendLoaderScript = (): void => {\n\t\t\tconst scriptUrl = runtimeUrls.loaderUrl;\n\t\t\tif (\n\t\t\t\t!hostDocument.querySelector(`link[href=\"${scriptUrl}\"][rel=\"preload\"]`)\n\t\t\t) {\n\t\t\t\tconst preload = hostDocument.createElement(\"link\");\n\t\t\t\tpreload.rel = \"preload\";\n\t\t\t\tpreload.as = \"script\";\n\t\t\t\tpreload.href = scriptUrl;\n\t\t\t\thostDocument.head.appendChild(preload);\n\t\t\t}\n\n\t\t\tconst script = hostDocument.createElement(\"script\");\n\t\t\tscript.src = scriptUrl;\n\t\t\tscript.async = true;\n\t\t\tif (script.dataset) {\n\t\t\t\tscript.dataset.disableAutoRegister = \"true\";\n\t\t\t} else if (typeof script.setAttribute === \"function\") {\n\t\t\t\tscript.setAttribute(\"data-disable-auto-register\", \"true\");\n\t\t\t}\n\t\t\thostDocument.head.appendChild(script);\n\t\t};\n\n\t\tconst runtimeMarker = hostWindow[LOADER_RUNTIME_GLOBAL_KEY];\n\t\tif (runtimeMarker?.alive) {\n\t\t\tconst protocolVersion = runtimeMarker.protocolVersion;\n\t\t\tif (protocolVersion !== LOADER_RUNTIME_PROTOCOL_VERSION) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Incompatible loader runtime protocol: expected ${LOADER_RUNTIME_PROTOCOL_VERSION}, received ${protocolVersion ?? \"unknown\"}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst requestId = enqueueInstanceRegistration();\n\t\t\tloaderRequested = true;\n\t\t\tif (\n\t\t\t\t!runtimeMarker.features?.includes(UNIFIED_FLOW_RUNTIME_V2_CAPABILITY)\n\t\t\t) {\n\t\t\t\tlet trackedPending: Promise<void>;\n\t\t\t\tconst pending = waitForCommandSettlement({\n\t\t\t\t\trequestId,\n\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t})\n\t\t\t\t\t.then(() => {})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tnotifyError(error);\n\t\t\t\t\t});\n\t\t\t\ttrackedPending = pending.finally(() => {\n\t\t\t\t\tif (pendingRegistrationProbe === trackedPending) {\n\t\t\t\t\t\tpendingRegistrationProbe = null;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tpendingRegistrationProbe = trackedPending;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst hasCommandQueue = Array.isArray(hostWindow.__getuserfeedback_queue);\n\t\tif (!hasCommandQueue) {\n\t\t\tconst requestId = enqueueInstanceRegistration();\n\t\t\tappendLoaderScript();\n\t\t\tloaderRequested = true;\n\t\t\tlet trackedPending: Promise<void>;\n\t\t\tconst pending = waitForCommandSettlement({\n\t\t\t\trequestId,\n\t\t\t\twindowRef: hostWindow,\n\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t})\n\t\t\t\t.then(() => {})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tnotifyError(error);\n\t\t\t\t});\n\t\t\ttrackedPending = pending.finally(() => {\n\t\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\t\tpendingLoad = null;\n\t\t\t\t}\n\t\t\t});\n\t\t\tpendingLoad = trackedPending;\n\t\t\treturn;\n\t\t}\n\n\t\tloaderRequested = true;\n\n\t\tlet trackedPending: Promise<void>;\n\t\tconst pending = (async () => {\n\t\t\tconst requestId = createCommandRequestId();\n\t\t\tenqueueInstanceRegistration(requestId);\n\t\t\ttry {\n\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\trequestId,\n\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_PROBE_TIMEOUT_MS,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof CommandSettlementTimeoutError) {\n\t\t\t\t\tappendLoaderScript();\n\t\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\terror instanceof CommandSettlementError &&\n\t\t\t\t\terror.code === INVALID_COMMAND_ERROR_CODE &&\n\t\t\t\t\tactionRegistry.listDefinitions().length > 0\n\t\t\t\t) {\n\t\t\t\t\tconst fallbackRequestId = createCommandRequestId();\n\t\t\t\t\tenqueueInstanceRegistration(fallbackRequestId, false);\n\t\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\t\trequestId: fallbackRequestId,\n\t\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})().catch((error) => {\n\t\t\tnotifyError(error);\n\t\t});\n\t\ttrackedPending = pending.finally(() => {\n\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\tpendingLoad = null;\n\t\t\t}\n\t\t\tif (pendingRegistrationProbe === trackedPending) {\n\t\t\t\tpendingRegistrationProbe = null;\n\t\t\t}\n\t\t});\n\t\tpendingLoad = trackedPending;\n\t\tif (actionRegistry.listDefinitions().length > 0) {\n\t\t\tpendingRegistrationProbe = trackedPending;\n\t\t}\n\t};\n\n\tconst subscribeFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getFlowStateForHandle(flowHandleId));\n\t\t}\n\t\treturn hostEventHub.subscribeFlowStateForHandle(\n\t\t\tflowHandleId,\n\t\t\t(detail): void => {\n\t\t\t\tconst nextState: FlowState = {\n\t\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\t\twidth: detail.width,\n\t\t\t\t\theight: detail.height,\n\t\t\t\t};\n\t\t\t\tsetFlowStateForHandle(flowHandleId, nextState);\n\t\t\t\tcallback(cloneFlowState(nextState));\n\t\t\t},\n\t\t\t{ signal: options?.signal },\n\t\t);\n\t};\n\n\tconst subscribeFlowStateForInstance = (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getInstanceFlowState());\n\t\t}\n\t\treturn hostEventHub.subscribeInstanceFlowState(\n\t\t\t(detail): void => {\n\t\t\t\tconst nextState: FlowState = {\n\t\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\t\twidth: detail.width,\n\t\t\t\t\theight: detail.height,\n\t\t\t\t};\n\t\t\t\tcallback(cloneFlowState(nextState));\n\t\t\t},\n\t\t\t{ signal: options?.signal },\n\t\t);\n\t};\n\n\tconst resetFlowRunsForClientBarrier = new Set<() => void>();\n\tlet deferredFlowRunNotifications: Array<() => void> | null = null;\n\n\tfunction createFlowRun(target: { flowId: string }): FlowRun;\n\tfunction createFlowRun(target: { flow: InlineFlow }): InlineFlowRun;\n\tfunction createFlowRun(target: FlowRunTarget): FlowRun | InlineFlowRun {\n\t\tconst openRequestController = createFlowOpenRequestController(() => {\n\t\t\tconst subscribers = [...activeSubscribers];\n\t\t\tconst notify = (): void => notifySubscribersWithCurrentState(subscribers);\n\t\t\tif (deferredFlowRunNotifications) {\n\t\t\t\tdeferredFlowRunNotifications.push(notify);\n\t\t\t} else {\n\t\t\t\tnotify();\n\t\t\t}\n\t\t});\n\t\tlet latestContainer: HTMLElement | null | undefined;\n\t\tlet reactRegistration: { ownerId: string; host: HTMLElement } | undefined;\n\t\tlet registeredReactHandleId: FlowHandleId | undefined;\n\t\tlet unsubscribeFlowStateCache: (() => void) | null = null;\n\t\ttype SubscriberEntry = {\n\t\t\tcallback: FlowStateCallback;\n\t\t\toptions?: SubscribeFlowStateOptions;\n\t\t\tunsubscribe: (() => void) | null;\n\t\t};\n\t\tconst activeSubscribers = new Set<SubscriberEntry>();\n\t\tconst handleClient = createFlowCommandHandleController<\n\t\t\tFlowHandleId,\n\t\t\t{\n\t\t\t\tok: boolean;\n\t\t\t\tkind: string;\n\t\t\t\tresult?: unknown;\n\t\t\t}\n\t\t>({\n\t\t\tgetHandleIdFromSettlement: (settlement) => {\n\t\t\t\tconst handle = getFlowHandleFromSettlementDetail(settlement);\n\t\t\t\treturn handle?.flowHandleId;\n\t\t\t},\n\t\t\tisStaleHandleError,\n\t\t\tonClearResolvedHandle: (previousFlowHandleId) => {\n\t\t\t\tclaimedFlowStateHandles.delete(previousFlowHandleId);\n\t\t\t\tpendingFlowStateHandles.delete(previousFlowHandleId);\n\t\t\t\tif (unsubscribeFlowStateCache) {\n\t\t\t\t\tunsubscribeFlowStateCache();\n\t\t\t\t\tunsubscribeFlowStateCache = null;\n\t\t\t\t}\n\t\t\t\tsetFlowStateForHandle(previousFlowHandleId, DEFAULT_FLOW_STATE);\n\t\t\t\trebindSubscribersToCurrentHandle();\n\t\t\t\tconst subscribersAtReset = [...activeSubscribers];\n\t\t\t\tconst notify = (): void =>\n\t\t\t\t\tnotifySubscribersWithCurrentState(subscribersAtReset);\n\t\t\t\tif (deferredFlowRunNotifications) {\n\t\t\t\t\tdeferredFlowRunNotifications.push(notify);\n\t\t\t\t} else {\n\t\t\t\t\tnotify();\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tconst bindSubscriberToCurrentHandle = (\n\t\t\tsubscriber: SubscriberEntry,\n\t\t\temitCurrent = false,\n\t\t): void => {\n\t\t\tif (subscriber.unsubscribe) {\n\t\t\t\tsubscriber.unsubscribe();\n\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t}\n\t\t\tif (subscriber.options?.signal?.aborted) {\n\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst notifySubscriber = (state: FlowState): void => {\n\t\t\t\ttry {\n\t\t\t\t\tsubscriber.callback(projectFlowState(state));\n\t\t\t\t} catch {\n\t\t\t\t\t// Public observers cannot interrupt handle publication or prevent\n\t\t\t\t\t// the remaining lifecycle projections from binding.\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst unsubscribe = subscribeFlowStateForHandle(\n\t\t\t\tflowHandleId,\n\t\t\t\tnotifySubscriber,\n\t\t\t\temitCurrent\n\t\t\t\t\t? { ...subscriber.options, emitInitial: true }\n\t\t\t\t\t: subscriber.options,\n\t\t\t);\n\t\t\tif (subscriber.options?.signal?.aborted) {\n\t\t\t\tunsubscribe();\n\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\thandleClient.getHandleId() !== flowHandleId ||\n\t\t\t\t!activeSubscribers.has(subscriber)\n\t\t\t) {\n\t\t\t\tunsubscribe();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsubscriber.unsubscribe = unsubscribe;\n\t\t};\n\n\t\tconst rebindSubscribersToCurrentHandle = (emitCurrent = false): void => {\n\t\t\tfor (const subscriber of activeSubscribers) {\n\t\t\t\tbindSubscriberToCurrentHandle(subscriber, emitCurrent);\n\t\t\t}\n\t\t};\n\n\t\tconst projectFlowState = (state: FlowState): FlowState => ({\n\t\t\t...state,\n\t\t\tisLoading: state.isLoading || openRequestController.isPending(),\n\t\t});\n\t\tconst getFlowState = (): FlowState => {\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\treturn projectFlowState(\n\t\t\t\tflowHandleId\n\t\t\t\t\t? getFlowStateForHandle(flowHandleId)\n\t\t\t\t\t: cloneFlowState(DEFAULT_FLOW_STATE),\n\t\t\t);\n\t\t};\n\t\tconst notifySubscribersWithCurrentState = (\n\t\t\tsubscribers: readonly SubscriberEntry[],\n\t\t): void => {\n\t\t\tfor (const subscriber of subscribers) {\n\t\t\t\tif (!activeSubscribers.has(subscriber)) continue;\n\t\t\t\ttry {\n\t\t\t\t\tsubscriber.callback(getFlowState());\n\t\t\t\t} catch {\n\t\t\t\t\t// Public observers cannot prevent other observers from updating.\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst rebindFlowStateCache = (): void => {\n\t\t\tif (unsubscribeFlowStateCache) {\n\t\t\t\tunsubscribeFlowStateCache();\n\t\t\t\tunsubscribeFlowStateCache = null;\n\t\t\t}\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tunsubscribeFlowStateCache =\n\t\t\t\tsubscribeFlowStateCacheForHandle(flowHandleId);\n\t\t};\n\n\t\tconst clearOpenIntent = (): void => {\n\t\t\topenRequestController.clear();\n\t\t};\n\n\t\tconst flushPendingForResolvedHandle = (): void => {\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst shouldReplayPendingState =\n\t\t\t\tpendingFlowStateHandles.delete(flowHandleId);\n\t\t\tclaimedFlowStateHandles.add(flowHandleId);\n\t\t\tensureFlowStateForHandle(flowHandleId);\n\t\t\tif (reactRegistration) {\n\t\t\t\tregisteredReactHandleId = flowHandleId;\n\t\t\t\tenqueueReactContainer(\n\t\t\t\t\treactRegistration.ownerId,\n\t\t\t\t\treactRegistration.host,\n\t\t\t\t\tflowHandleId,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (latestContainer !== undefined) {\n\t\t\t\tenqueueSetContainer(flowHandleId, latestContainer);\n\t\t\t}\n\t\t\trebindSubscribersToCurrentHandle(shouldReplayPendingState);\n\t\t\trebindFlowStateCache();\n\t\t};\n\n\t\thandleClient.subscribeHandle(() => {\n\t\t\tflushPendingForResolvedHandle();\n\t\t});\n\t\tconst resetForClientBarrier = (): void => {\n\t\t\tclearOpenIntent();\n\t\t\thandleClient.reset();\n\t\t};\n\t\tlet hasRegisteredClientLifecycle = false;\n\t\tconst registerClientLifecycle = (): void => {\n\t\t\tif (hasRegisteredClientLifecycle) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Run creation can happen in a React state initializer that StrictMode discards.\n\t\t\tsubscribeFlowHandleInvalidation((flowHandleId) => {\n\t\t\t\thandleClient.invalidateResolvedHandle(flowHandleId);\n\t\t\t});\n\t\t\tresetFlowRunsForClientBarrier.add(resetForClientBarrier);\n\t\t\thasRegisteredClientLifecycle = true;\n\t\t};\n\t\ttype HandleCommandPayload =\n\t\t\t| Extract<\n\t\t\t\t\tCommand,\n\t\t\t\t\t{ kind: \"open\" } | { kind: \"prefetch\" } | { kind: \"prerender\" }\n\t\t\t >\n\t\t\t| InternalHostInlineFlowCommandPayload;\n\n\t\tconst handOffHandleCommand = (payload: HandleCommandPayload) =>\n\t\t\t\"flow\" in payload\n\t\t\t\t? handOffInlineFlowCommand(payload)\n\t\t\t\t: handOffCommand(payload);\n\n\t\tconst enqueueAndWaitForSettlement = async (\n\t\t\tbuildPayload: (\n\t\t\t\tflowHandleId: FlowHandleId | undefined,\n\t\t\t) => HandleCommandPayload,\n\t\t): Promise<\"settled\" | \"superseded\"> => {\n\t\t\tconst result = await transportAdmission.runOperation(\n\t\t\t\t({ attemptHandoff }) => {\n\t\t\t\t\tlet releaseFlowHandleAllocation: (() => void) | null = null;\n\t\t\t\t\treturn handleClient\n\t\t\t\t\t\t.runCommand(buildPayload, (payload) => {\n\t\t\t\t\t\t\tconst isHandleFree =\n\t\t\t\t\t\t\t\t!(\"flowHandleId\" in payload) ||\n\t\t\t\t\t\t\t\tpayload.flowHandleId === undefined;\n\t\t\t\t\t\t\tconst requiresSerializedAllocation =\n\t\t\t\t\t\t\t\t\"flow\" in target && isHandleFree;\n\t\t\t\t\t\t\tconst handOff = (): Promise<{\n\t\t\t\t\t\t\t\tok: boolean;\n\t\t\t\t\t\t\t\tkind: string;\n\t\t\t\t\t\t\t\tresult?: unknown;\n\t\t\t\t\t\t\t}> =>\n\t\t\t\t\t\t\t\tattemptHandoff({\n\t\t\t\t\t\t\t\t\tprepare:\n\t\t\t\t\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t\t\t\t\t? prepareInlineFlowCommandHandoff\n\t\t\t\t\t\t\t\t\t\t\t: prepareCommandHandoff,\n\t\t\t\t\t\t\t\t\thandOff: () => ({\n\t\t\t\t\t\t\t\t\t\tsettlement: handOffHandleCommand(payload),\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (!requiresSerializedAllocation) {\n\t\t\t\t\t\t\t\treturn handOff();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst handOffAllocation = () =>\n\t\t\t\t\t\t\t\thandOff().catch((error) => {\n\t\t\t\t\t\t\t\t\tclearPendingFlowHandleState();\n\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (releaseFlowHandleAllocation) {\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst acquisition = acquireFlowHandleAllocation();\n\t\t\t\t\t\t\tif (typeof acquisition === \"function\") {\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation = acquisition;\n\t\t\t\t\t\t\t\tbeginFlowHandleAllocation();\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn acquisition.then((release) => {\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation = release;\n\t\t\t\t\t\t\t\tbeginFlowHandleAllocation();\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\t\tif (releaseFlowHandleAllocation) {\n\t\t\t\t\t\t\t\tendFlowHandleAllocation();\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn result.status;\n\t\t};\n\n\t\tconst openFlow = (options?: OpenFlowOptions): Promise<void> => {\n\t\t\tregisterClientLifecycle();\n\t\t\treturn openRequestController.run(() =>\n\t\t\t\treportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? ((): InternalHostInlineFlowCommandPayload => {\n\t\t\t\t\t\t\t\t\tconst flow = target.flow;\n\t\t\t\t\t\t\t\t\tif (flowHandleId === undefined) {\n\t\t\t\t\t\t\t\t\t\tif (latestContainer !== undefined) {\n\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\t\t\t\t\t\t\tflow,\n\t\t\t\t\t\t\t\t\t\t\t\tcontainer: null,\n\t\t\t\t\t\t\t\t\t\t\t\tmetadata: options?.metadata,\n\t\t\t\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\t\t\t\t\t\tflow,\n\t\t\t\t\t\t\t\t\t\t\tmetadata: options?.metadata,\n\t\t\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\t\t\t\t\tflow,\n\t\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t\t\tmetadata: options?.metadata,\n\t\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t})()\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t\tcontainer: options?.container,\n\t\t\t\t\t\t\t\t\tmetadata: options?.metadata,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t),\n\t\t\t);\n\t\t};\n\n\t\tconst run: InlineFlowRun = {\n\t\t\topen: openFlow,\n\t\t\tprefetch: () => {\n\t\t\t\tregisterClientLifecycle();\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? ((): InternalHostInlineFlowCommandPayload => {\n\t\t\t\t\t\t\t\t\tconst flow = target.flow;\n\t\t\t\t\t\t\t\t\treturn flowHandleId === undefined\n\t\t\t\t\t\t\t\t\t\t? { kind: \"prefetch\", flow }\n\t\t\t\t\t\t\t\t\t\t: { kind: \"prefetch\", flow, flowHandleId };\n\t\t\t\t\t\t\t\t})()\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"prefetch\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tprerender: (options?: PrerenderFlowOptions) => {\n\t\t\t\tregisterClientLifecycle();\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? ((): InternalHostInlineFlowCommandPayload => {\n\t\t\t\t\t\t\t\t\tconst flow = target.flow;\n\t\t\t\t\t\t\t\t\treturn flowHandleId === undefined\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\t\t\t\t\t\t\tflow,\n\t\t\t\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\t\t\t\t\t\t\tflow,\n\t\t\t\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t})()\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tclose: () => {\n\t\t\t\tregisterClientLifecycle();\n\t\t\t\tconst closing = reportAsyncError(\n\t\t\t\t\ttransportAdmission\n\t\t\t\t\t\t.runOperation(({ attemptHandoff }) => {\n\t\t\t\t\t\t\treturn handleClient.runResolvedHandleCommand(\n\t\t\t\t\t\t\t\t(flowHandleId) => ({\n\t\t\t\t\t\t\t\t\tkind: \"close\" as const,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t(payload) =>\n\t\t\t\t\t\t\t\t\tattemptHandoff({\n\t\t\t\t\t\t\t\t\t\tprepare:\n\t\t\t\t\t\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t\t\t\t\t\t? prepareInlineFlowCommandHandoff\n\t\t\t\t\t\t\t\t\t\t\t\t: prepareCommandHandoff,\n\t\t\t\t\t\t\t\t\t\thandOff: () => ({\n\t\t\t\t\t\t\t\t\t\t\tsettlement: handOffCommand(payload).then(() => {}),\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.then(() => {}),\n\t\t\t\t);\n\t\t\t\t// Reserve this FIFO turn before observers can request a replacement open.\n\t\t\t\tclearOpenIntent();\n\t\t\t\treturn closing;\n\t\t\t},\n\t\t\tsetContainer: (element: HTMLElement | null) => {\n\t\t\t\tlatestContainer = element;\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tregisterClientLifecycle();\n\t\t\t\tenqueueSetContainer(flowHandleId, element);\n\t\t\t},\n\t\t\tgetFlowState,\n\t\t\tsubscribeFlowState: (\n\t\t\t\tcallback: FlowStateCallback,\n\t\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t\t) => {\n\t\t\t\tif (options?.signal?.aborted) {\n\t\t\t\t\treturn () => {};\n\t\t\t\t}\n\t\t\t\tregisterClientLifecycle();\n\t\t\t\tconst subscriber: SubscriberEntry = {\n\t\t\t\t\tcallback,\n\t\t\t\t\toptions,\n\t\t\t\t\tunsubscribe: null,\n\t\t\t\t};\n\t\t\t\tactiveSubscribers.add(subscriber);\n\t\t\t\tconst signal = options?.signal;\n\t\t\t\tconst unsubscribeSubscriber = (): void => {\n\t\t\t\t\tsignal?.removeEventListener(\"abort\", unsubscribeSubscriber);\n\t\t\t\t\tif (subscriber.unsubscribe) {\n\t\t\t\t\t\tsubscriber.unsubscribe();\n\t\t\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t\t\t}\n\t\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\t};\n\t\t\t\tsignal?.addEventListener(\"abort\", unsubscribeSubscriber, {\n\t\t\t\t\tonce: true,\n\t\t\t\t});\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\tif (options?.emitInitial !== false) {\n\t\t\t\t\t\tcallback(getFlowState());\n\t\t\t\t\t}\n\t\t\t\t\treturn unsubscribeSubscriber;\n\t\t\t\t}\n\t\t\t\tbindSubscriberToCurrentHandle(subscriber);\n\t\t\t\treturn unsubscribeSubscriber;\n\t\t\t},\n\t\t};\n\n\t\tconst result = \"flow\" in target ? run : { flowId: target.flowId, ...run };\n\t\tattachReactContainerBridge(result, {\n\t\t\tregister: (ownerId, host) => {\n\t\t\t\tif (host) reactRegistration = { ownerId, host };\n\t\t\t\telse if (reactRegistration?.ownerId === ownerId)\n\t\t\t\t\treactRegistration = undefined;\n\t\t\t\tconst flowHandleId =\n\t\t\t\t\thandleClient.getHandleId() ?? registeredReactHandleId;\n\t\t\t\tif (flowHandleId) {\n\t\t\t\t\tregisteredReactHandleId = flowHandleId;\n\t\t\t\t\tenqueueReactContainer(ownerId, host, flowHandleId);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\treturn result;\n\t}\n\n\tconst flowRunByFlowId = new Map<string, FlowRun>();\n\tconst flow = (flowIdInput: string): FlowRun => {\n\t\tconst flowId = flowIdInput.trim();\n\t\tif (!flowId) {\n\t\t\tthrow new Error(\"flowId must be a non-empty string\");\n\t\t}\n\t\tconst existing = flowRunByFlowId.get(flowId);\n\t\tif (existing) return existing;\n\t\tconst run = createFlowRun({ flowId });\n\t\tflowRunByFlowId.set(flowId, run);\n\t\treturn run;\n\t};\n\n\tconst runClientBarrier = (kind: \"close\" | \"reset\"): Promise<void> => {\n\t\tconst flowRunResets = [...resetFlowRunsForClientBarrier];\n\t\treturn reportAsyncError(\n\t\t\ttransportAdmission.runBarrier({\n\t\t\t\tonGenerationAdvanced: () => {\n\t\t\t\t\tconst notifications: Array<() => void> = [];\n\t\t\t\t\tdeferredFlowRunNotifications = notifications;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor (const resetFlowRun of flowRunResets) {\n\t\t\t\t\t\t\tresetFlowRun();\n\t\t\t\t\t\t}\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tdeferredFlowRunNotifications = null;\n\t\t\t\t\t}\n\t\t\t\t\tfor (const notify of notifications) {\n\t\t\t\t\t\tnotify();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tprepare: hostWindow ? prepareCommandHandoff : () => {},\n\t\t\t\thandOff: hostWindow\n\t\t\t\t\t? () => ({ settlement: handOffCommand({ kind }).then(() => {}) })\n\t\t\t\t\t: () => ({ settlement: Promise.resolve() }),\n\t\t\t}),\n\t\t);\n\t};\n\n\tconst close = (): Promise<void> => runClientBarrier(\"close\");\n\n\tconst reset = (): Promise<void> => {\n\t\tpropertiesConfig = {};\n\t\treturn runClientBarrier(\"reset\");\n\t};\n\n\tfunction identify(\n\t\tuserId: string,\n\t\ttraits?: IdentifyTraits,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void>;\n\tfunction identify(\n\t\ttraits: IdentifyTraits,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void>;\n\tfunction identify(\n\t\tidentifyInput: string | IdentifyTraits,\n\t\ttraitsOrOptions?: IdentifyTraits | IdentifyOptions,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void> {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\ttoIdentifyCommandPayload(identifyInput, traitsOrOptions, options),\n\t\t\t),\n\t\t);\n\t}\n\n\tconst track = (\n\t\teventName: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\tparseCustomerOccurrenceName(eventName, \"eventName\");\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\tbuildCustomerOccurrenceCommand({\n\t\t\t\t\ttype: \"track\",\n\t\t\t\t\tevent: eventName,\n\t\t\t\t\tproperties,\n\t\t\t\t\toptions,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t};\n\n\tconst page = (\n\t\tname?: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\tif (name !== undefined) {\n\t\t\t\tparseCustomerOccurrenceName(name, \"pageName\");\n\t\t\t}\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\tbuildCustomerOccurrenceCommand({\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tevent:\n\t\t\t\t\t\tname === undefined ? hostWindow.location.pathname || \"/\" : name,\n\t\t\t\t\tproperties,\n\t\t\t\t\toptions,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t};\n\n\tconst submitFeedback = async (\n\t\tinput: FeedbackInput,\n\t): Promise<SubmitFeedbackResult> => {\n\t\tif (!hostWindow) {\n\t\t\tthrow new Error(\"Feedback submission requires a browser environment.\");\n\t\t}\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\tawait registrationProbe;\n\t\t}\n\t\tconst settlement = await reportAsyncError(\n\t\t\trawSettlementDispatch({\n\t\t\t\tkind: \"instanceFeedback.capture\",\n\t\t\t\tpayload: input,\n\t\t\t}),\n\t\t);\n\t\tif (!settlement.ok) {\n\t\t\tthrow new Error(\"Feedback submission failed.\");\n\t\t}\n\t\tconst result = getFeedbackSubmissionFromSettlementDetail(settlement);\n\t\tif (!result) {\n\t\t\tthrow new Error(\"Invalid feedback submission result.\");\n\t\t}\n\t\treturn result;\n\t};\n\n\tconst fetchFeedback = async (\n\t\tinput: FetchFeedbackInput,\n\t): Promise<FetchFeedbackResult> => {\n\t\tif (!hostWindow) {\n\t\t\tthrow new Error(\"Feedback reads require a browser environment.\");\n\t\t}\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\tawait registrationProbe;\n\t\t}\n\t\tconst settlement = await reportAsyncError(\n\t\t\trawSettlementDispatch({\n\t\t\t\tkind: \"instanceFeedback.listMine\",\n\t\t\t\tpayload: input,\n\t\t\t}),\n\t\t);\n\t\tif (!settlement.ok) {\n\t\t\tthrow new Error(\"Feedback read failed.\");\n\t\t}\n\t\tconst result = getFeedbackReadFromSettlementDetail(settlement);\n\t\tif (!result) {\n\t\t\tthrow new Error(\"Invalid feedback read result.\");\n\t\t}\n\t\treturn result;\n\t};\n\n\tconst configure = (updates: ConfigureOptions): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\t// Send updates as-is; loader merges and forwards deltas to core.\n\t\tconst opts = toConfigureCommandOptions(updates);\n\t\treturn reportAsyncError(\n\t\t\tadmitConfigHandoff(() =>\n\t\t\t\trawSettlementDispatch({ kind: \"configure\", opts }).then(() => {}),\n\t\t\t),\n\t\t);\n\t};\n\n\thostEventHub.subscribeOpenRequested((detail, hostEvent) => {\n\t\topenRequestBridge.observeFromLoader(detail, {\n\t\t\tpreventHostDefault: () => {\n\t\t\t\thostEvent.preventDefault();\n\t\t\t},\n\t\t});\n\t});\n\thostEventHub.subscribeHostActionRequested((detail, hostEvent) => {\n\t\tconst handler = actionRegistry.getHandler(detail.definition);\n\t\tif (!handler) {\n\t\t\tdetail.settle(\"unavailable\");\n\t\t\treturn;\n\t\t}\n\t\t// This adapter event stays inside the trusted host realm. Sandboxed Views\n\t\t// can request an action only through Core's empty, authorized RPC.\n\t\thostEvent.preventDefault();\n\t\tvoid Promise.resolve()\n\t\t\t.then(() => handler())\n\t\t\t.then(\n\t\t\t\t() => detail.settle(\"success\"),\n\t\t\t\t() => detail.settle(\"failure\"),\n\t\t\t);\n\t});\n\n\tconst client: Client = {\n\t\tload,\n\t\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => {\n\t\t\tenqueueSetDefaultContainerPolicy(policy);\n\t\t},\n\t\tgetFlowState: () => getInstanceFlowState(),\n\t\tsubscribeFlowState: (\n\t\t\tcallback: FlowStateCallback,\n\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t) => subscribeFlowStateForInstance(callback, options),\n\t\tflow,\n\t\tclose,\n\t\treset,\n\t\tconfigure,\n\t\tidentify,\n\t\ttrack,\n\t\tpage,\n\t\tgraph: {\n\t\t\tconnect: (relationship) =>\n\t\t\t\ttrack(\n\t\t\t\t\t\"gx.graph.relationship.connected\",\n\t\t\t\t\ttoGraphRelationshipProperties(relationship),\n\t\t\t\t),\n\t\t\tdisconnect: (relationship) =>\n\t\t\t\ttrack(\n\t\t\t\t\t\"gx.graph.relationship.disconnected\",\n\t\t\t\t\ttoGraphRelationshipProperties(relationship),\n\t\t\t\t),\n\t\t},\n\t\tfeedback: { fetch: fetchFeedback, submit: submitFeedback },\n\t\tonOpenRequested: (callback) => openRequestBridge.subscribe(callback),\n\t};\n\tattachReactContainerBridge(client, {\n\t\tregister: (ownerId, host) => enqueueReactContainer(ownerId, host),\n\t});\n\tattachInlineFlowClientBridge(client, {\n\t\tcreateInlineFlowRun: (inlineFlow) => createFlowRun({ flow: inlineFlow }),\n\t});\n\n\topenRequestBridgeByClient.set(client, openRequestBridge);\n\n\tregistry.set(registryKey, {\n\t\tclient,\n\t\tupdateOptions,\n\t});\n\n\tif (!disableAutoLoadConfig) {\n\t\tclient.load();\n\t}\n\n\treturn client;\n};\n",
20
+ "import {\n\tINLINE_FLOW_PERSISTED_IDENTITY_FIELDS,\n\ttype InlineFlow,\n\tinlineFlowSchema,\n} from \"@getuserfeedback/protocol/internal/inline-flow\";\nimport type { Client, FlowRun, OpenFlowOptions } from \"../client\";\nimport { getInlineFlowClientBridge } from \"./inline-flow-client-bridge\";\n\nexport type { BundledDocsClientOptions } from \"../client\";\nexport { createBundledDocsClientOptions } from \"../client\";\n\n/** Internal supplied-flow run using the normal Flow lifecycle. */\nexport type InlineFlowRun = Omit<FlowRun, \"flowId\" | \"open\"> & {\n\topen: (options?: Omit<OpenFlowOptions, \"container\">) => Promise<void>;\n};\n\nconst ARRAY_INDEX_KEY_PATTERN = /^(0|[1-9]\\d*)$/;\n\ninterface JsonSnapshotObject {\n\t[key: string]: JsonSnapshotValue;\n}\n\ntype JsonSnapshotValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| JsonSnapshotValue[]\n\t| JsonSnapshotObject;\n\nconst invalidJsonSnapshot = (): never => {\n\tthrow new Error(\"Inline flow must contain only JSON values.\");\n};\n\nconst toJsonSnapshot = (\n\tvalue: unknown,\n\tancestors = new Set<object>(),\n): JsonSnapshotValue => {\n\tif (\n\t\tvalue === null ||\n\t\ttypeof value === \"string\" ||\n\t\ttypeof value === \"boolean\"\n\t) {\n\t\treturn value;\n\t}\n\tif (typeof value === \"number\") {\n\t\treturn Number.isFinite(value) ? value : invalidJsonSnapshot();\n\t}\n\tif (typeof value !== \"object\" || ancestors.has(value)) {\n\t\treturn invalidJsonSnapshot();\n\t}\n\n\tancestors.add(value);\n\ttry {\n\t\tif (Array.isArray(value)) {\n\t\t\tif (Object.getPrototypeOf(value) !== Array.prototype) {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tconst ownKeys = Reflect.ownKeys(value);\n\t\t\tif (\n\t\t\t\townKeys.length !== value.length + 1 ||\n\t\t\t\townKeys.some(\n\t\t\t\t\t(key) =>\n\t\t\t\t\t\tkey !== \"length\" &&\n\t\t\t\t\t\t(typeof key !== \"string\" ||\n\t\t\t\t\t\t\t!ARRAY_INDEX_KEY_PATTERN.test(key) ||\n\t\t\t\t\t\t\tNumber(key) >= value.length),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tconst snapshot: JsonSnapshotValue[] = [];\n\t\t\tfor (let index = 0; index < value.length; index += 1) {\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(\n\t\t\t\t\tvalue,\n\t\t\t\t\tString(index),\n\t\t\t\t);\n\t\t\t\tif (!descriptor?.enumerable || !(\"value\" in descriptor)) {\n\t\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t\t}\n\t\t\t\tsnapshot.push(toJsonSnapshot(descriptor.value, ancestors));\n\t\t\t}\n\t\t\treturn snapshot;\n\t\t}\n\n\t\tconst prototype = Object.getPrototypeOf(value);\n\t\tif (prototype !== Object.prototype && prototype !== null) {\n\t\t\treturn invalidJsonSnapshot();\n\t\t}\n\t\tconst snapshot: JsonSnapshotObject = {};\n\t\tfor (const key of Reflect.ownKeys(value)) {\n\t\t\tif (typeof key !== \"string\" || key === \"__proto__\") {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(value, key);\n\t\t\tif (!descriptor?.enumerable || !(\"value\" in descriptor)) {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tif (descriptor.value === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tObject.defineProperty(snapshot, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: toJsonSnapshot(descriptor.value, ancestors),\n\t\t\t\twritable: true,\n\t\t\t});\n\t\t}\n\t\treturn snapshot;\n\t} finally {\n\t\tancestors.delete(value);\n\t}\n};\n\nconst snapshotInlineFlowInput = (flow: unknown): JsonSnapshotObject => {\n\tif (\n\t\ttypeof flow !== \"object\" ||\n\t\tflow === null ||\n\t\tArray.isArray(flow) ||\n\t\t(Object.getPrototypeOf(flow) !== Object.prototype &&\n\t\t\tObject.getPrototypeOf(flow) !== null)\n\t) {\n\t\treturn invalidJsonSnapshot();\n\t}\n\tconst snapshot = toJsonSnapshot(flow);\n\tif (\n\t\tsnapshot === null ||\n\t\tArray.isArray(snapshot) ||\n\t\ttypeof snapshot !== \"object\"\n\t) {\n\t\treturn invalidJsonSnapshot();\n\t}\n\treturn snapshot;\n};\n\nconst freezeJsonSnapshot = <Value>(value: Value): Value => {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn value;\n\t}\n\tfor (const child of Object.values(value)) {\n\t\tfreezeJsonSnapshot(child);\n\t}\n\treturn Object.freeze(value);\n};\n\nconst snapshotInlineFlow = (flow: InlineFlow): InlineFlow => {\n\tconst snapshot = inlineFlowSchema.parse(snapshotInlineFlowInput(flow));\n\tconst definition = snapshot.definition;\n\tif (\n\t\ttypeof definition === \"object\" &&\n\t\tdefinition !== null &&\n\t\t!Array.isArray(definition)\n\t) {\n\t\tconst field = INLINE_FLOW_PERSISTED_IDENTITY_FIELDS.find(\n\t\t\t(candidate) => candidate in definition,\n\t\t);\n\t\tif (field) {\n\t\t\tthrow new Error(\n\t\t\t\t`Inline flow definitions cannot include persisted field \"${field}\".`,\n\t\t\t);\n\t\t}\n\t}\n\treturn freezeJsonSnapshot(snapshot);\n};\n\n/** First-party supplied-flow entrypoint; intentionally absent from the public SDK root. */\nexport const createInlineFlow = (\n\tclient: Client,\n\tflow: InlineFlow,\n): InlineFlowRun =>\n\tgetInlineFlowClientBridge(client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