UNPKG

agent-device

Version:

Open source device layer for AI coding agents: a CLI, MCP server, and typed Node.js API to control mobile, web, TV, and desktop apps on devices and simulators, locally or in the cloud.

424 lines (397 loc) • 25 kB
import{v as e}from"./sdk-contracts.js";import{n as t}from"./metro-session-hints.js";import{createHash as n}from"node:crypto";import{parseArgs as r}from"node:util";const i={0:`unknown`,1:`class`,5:`function`,6:`forwardRef`,8:`memo`,15:`function`};function a(e){return Object.hasOwn(i,e)?i[e]:`unknown`}const o=/^([A-Za-z0-9_$]+)\((.+)\)$/;function s(e,t=!1){let n=[],r=e;for(let e=o.exec(r);e&&!(t&&e[1]!==`Memo`&&e[1]!==`ForwardRef`);e=o.exec(r))n.push(e[1]),r=e[2];return{name:r,wrappers:n}}function c(e){return s(e,!0).name}function l(e){return`@c${e.id}`}function u(e){let t=a(e);return t===`memo`||t===`class`||t===`forwardRef`?` [${t}]`:``}function d(e){return e.appId??e.description??e.title}async function f(t){let n=new URL(`json/list`,E(t)),r;try{r=await fetch(n,{signal:AbortSignal.timeout(3e3)})}catch(n){throw new e(`COMMAND_FAILED`,`Could not reach the React Native dev server at ${t.origin}.`,{hint:`Start Metro (or Expo/Re.Pack) for the app, or pass --metro-port/--metro-host when it does not run on localhost:8081.`},n)}if(!r.ok)throw new e(`COMMAND_FAILED`,`The dev server at ${t.origin} answered ${r.status} for /json/list.`);let i=await r.json().catch(()=>void 0);if(!Array.isArray(i))throw new e(`COMMAND_FAILED`,`The server at ${t.origin} is not a React Native dev server: /json/list returned no target list.`,{hint:`Pass --metro-port/--metro-host for the app's Metro, Expo, or Re.Pack dev server.`});return i.filter(p)}function p(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&typeof t.webSocketDebuggerUrl==`string`}const m=/reanimated|worklet/i;function h(e){let t=Number.parseInt(e.id.slice(e.id.lastIndexOf(`-`)+1),10);return Number.isInteger(t)?t:2**53-1}function g(e){let t=e.id.lastIndexOf(`-`);return e.reactNative?.logicalDeviceId??(t>0?e.id.slice(0,t):void 0)??e.deviceName??e.id}function _(e){return e.reactNative!==void 0&&!m.test(e.description??``)}function v(e,t){let n=t.appId===void 0||d(e)===t.appId,r=t.device===void 0||e.deviceName===t.device||g(e)===t.device;return n&&r}function y(t,n){let r=t.map(e=>`${d(e)} on ${e.deviceName??g(e)}`);return new e(`COMMAND_FAILED`,n.appId||n.device?`No matching React Native runtime is connected to the dev server.`:`No React Native runtime is connected to the dev server.`,{hint:r.length>0?`Connected runtimes: ${[...new Set(r)].join(`, `)}.`:`Open the app from a development build so it loads its bundle from this dev server.`})}function b(e){let t=new Map;for(let n of e){let e=g(n),r=t.get(e);t.set(e,r&&h(r)<=h(n)?r:n)}return[...t.values()]}function x(e){let t=new Map;for(let{deviceName:n}of e)n&&t.set(n,(t.get(n)??0)+1);return e.map(e=>e.deviceName&&t.get(e.deviceName)===1?e.deviceName:g(e))}function S(t,n={}){let r=t.filter(_),i=r.filter(e=>v(e,n));if(i.length===0)throw y(r,n);let a=new Set(i.map(d));if(a.size>1)throw new e(`INVALID_ARGS`,`Several React Native apps are connected to the dev server.`,{hint:`Pass --app with one of: ${[...a].join(`, `)}.`});let o=b(i);if(o.length>1)throw new e(`INVALID_ARGS`,`The app is connected to the dev server from several devices.`,{hint:`Pass --metro-device with one of: ${x(o).join(`, `)}.`});return o[0]}const C=WebSocket;var w=class t{#e=1;#t=new Map;#n;constructor(t){this.#n=t,t.addEventListener(`message`,e=>this.#i(String(e.data))),t.addEventListener(`close`,()=>{for(let{reject:t}of this.#t.values())t(new e(`COMMAND_FAILED`,`The app runtime closed the debugger connection.`));this.#t.clear()})}static async connect(n){let r=new URL(n),i=`http://127.0.0.1:${r.port||(r.protocol===`wss:`?`443`:`80`)}`,a=new C(r,{headers:{origin:i}});return await new Promise((t,n)=>{let r=setTimeout(()=>{a.close(),n(new e(`COMMAND_FAILED`,`Timed out connecting to the app runtime debugger.`))},5e3);a.addEventListener(`open`,()=>{clearTimeout(r),t()},{once:!0}),a.addEventListener(`error`,()=>{clearTimeout(r),n(new e(`COMMAND_FAILED`,`The dev server refused the debugger connection to the app runtime.`))},{once:!0})}),new t(a)}async evaluate(t){let n=await this.#r(`Runtime.evaluate`,{expression:t,returnByValue:!0});if(n.exceptionDetails){let{text:t,exception:r}=n.exceptionDetails;throw new e(`COMMAND_FAILED`,`The profiler runtime threw inside the app.`,void 0,r?.description??t??`unknown exception`)}return n.result?.value}close(){this.#n.close()}#r(t,n){let r=this.#e++;return new Promise((i,a)=>{let o=setTimeout(()=>{this.#t.delete(r),a(new e(`COMMAND_FAILED`,`The app runtime did not answer ${t} in time.`))},3e4);this.#t.set(r,{resolve:e=>{clearTimeout(o),i(e)},reject:e=>{clearTimeout(o),a(e)}}),this.#n.send(JSON.stringify({id:r,method:t,params:n}))})}#i(t){let n;try{n=JSON.parse(t)}catch{return}if(typeof n.id!=`number`)return;let r=this.#t.get(n.id);r&&(this.#t.delete(n.id),n.error?r.reject(new e(`COMMAND_FAILED`,`Debugger protocol error: ${n.error.message??`unknown`}`)):r.resolve(n.result))}};function T(e,t){let n=new URL(t.webSocketDebuggerUrl),r=E(e);return r.protocol=e.protocol===`https:`?`wss:`:`ws:`,r.pathname=`${r.pathname.replace(/\/+$/,``)}${n.pathname}`,r.search=n.search,r.toString()}function E(e){let t=new URL(e);return t.pathname.endsWith(`/`)||(t.pathname=`${t.pathname}/`),t.search=``,t.hash=``,t}function D(e){return e.replaceAll(/[\u0000-\u001f\u007f-\u009f]/g,` `)}function O(e){return e.map(D).join(` `)}const k=String.raw` (function (VERSION) { var g = globalThis; var previous = g.__AGENT_DEVICE_REACT_DEVTOOLS__; if (previous && previous.version === VERSION) return 'ready'; var inherited = previous && previous.elements instanceof Map ? previous.elements : null; var inheritedHistory = !!(previous && previous.history); var inheritedOrder = previous && previous.order instanceof Map ? previous.order : null; var inheritedLogs = previous && previous.logs instanceof Map ? previous.logs : null; if (previous && typeof previous.dispose === 'function') previous.dispose(); var BINDING = '__CHROME_DEVTOOLS_FRONTEND_BINDING__'; var ROOT_TYPE = 11; var KNOWN_TYPES = { 1: 1, 2: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1, 13: 1, 14: 1, 15: 1, 16: 1, 17: 1 }; var elements = inherited || new Map(); var order = inheritedOrder || new Map(); var logs = inheritedLogs || new Map(); var history = inheritedHistory; var nextRequestID = 1; var decodable = true; var unsubscribe = null; var session = null; var standInBinding = null; function hook() { return g.__REACT_DEVTOOLS_GLOBAL_HOOK__; } function size(collection) { var n = 0; if (collection && collection.forEach) collection.forEach(function () { n++; }); return n; } function eachRenderer(fn) { var h = hook(); if (h && h.rendererInterfaces) h.rendererInterfaces.forEach(fn); } /** * React DevTools 7 added a name-prop field to each non-root ADD, in the same release that gave * renderer interfaces supportsTogglingSuspense. */ function addLength(rendererID) { var h = hook(); var ri = h && h.rendererInterfaces && h.rendererInterfaces.get ? h.rendererInterfaces.get(rendererID) : null; return ri && 'supportsTogglingSuspense' in ri ? 8 : 7; } /** Length of an op this runtime skips: the Suspense tree and Activity slice ops of DevTools 7+. */ function skippedLength(ops, i) { var op = ops[i]; if (op === 4 || op === 7) return 3; if (op === 6) return 1; if (op === 8) return 6 + 4 * Math.max(ops[i + 5], 0); if (op === 9) return 2 + ops[i + 1]; if (op === 10) return 3 + ops[i + 2]; if (op === 11) return 3 + 4 * Math.max(ops[i + 2], 0); if (op === 12) { var j = i + 2; for (var c = 0; c < ops[i + 1]; c++) j += 5 + ops[j + 4]; return j - i; } if (op === 13) return 2; return 0; } function readOperations(ops) { var nonRootAdd = addLength(ops[0]); var strings = [null]; var i = 3; var tableEnd = 3 + ops[2]; while (i < tableEnd) { var length = ops[i++]; var text = ''; for (var k = 0; k < length; k++) text += String.fromCodePoint(ops[i + k]); i += length; strings.push(text); } while (i < ops.length) { var op = ops[i]; if (op === 1) { var id = ops[i + 1]; var type = ops[i + 2]; if (KNOWN_TYPES[type] !== 1) return false; if (type !== ROOT_TYPE) { var nameIndex = ops[i + 5]; var keyIndex = ops[i + 6]; if (nameIndex >= strings.length || keyIndex >= strings.length) return false; elements.set(id, [strings[nameIndex] || 'Anonymous', type, ops[i + 4], ops[i + 3], strings[keyIndex]]); } i += type === ROOT_TYPE ? 7 : nonRootAdd; } else if (op === 2) { for (var r = 0; r < ops[i + 1]; r++) forget(ops[i + 2 + r]); i += 2 + ops[i + 1]; } else if (op === 3) { order.set(ops[i + 1], ops.slice(i + 3, i + 3 + ops[i + 2])); i += 3 + ops[i + 2]; } else if (op === 5) { if (ops[i + 2] || ops[i + 3]) logs.set(ops[i + 1], [ops[i + 2], ops[i + 3]]); else logs.delete(ops[i + 1]); i += 4; } else { var skipped = skippedLength(ops, i); if (!skipped) return false; i += skipped; } } return true; } /** A profile keeps the names of what unmounts while it records; the tree drops them at once. */ function forget(id) { order.delete(id); logs.delete(id); if (session) session.removed.push(id); else elements.delete(id); } function naming() { return history && decodable ? 'operations' : 'lookup'; } function operationListenerCount(h) { var listeners = h.listeners && h.listeners.operations; return listeners ? listeners.length : 0; } function onOperations(ops) { if (!decodable) return; try { if (!readOperations(ops)) decodable = false; } catch (e) { decodable = false; } } function findDevtoolsCore() { var registry = g.__r && typeof g.__r.getModules === 'function' ? g.__r.getModules() : null; var found = null; function inspect(module) { if (found || !module || !module.isInitialized || !module.publicModule) return; var exports = module.publicModule.exports; if (exports && typeof exports.connectWithCustomMessagingProtocol === 'function') found = exports; } if (registry && typeof registry.forEach === 'function') registry.forEach(inspect); else if (registry) for (var key in registry) inspect(registry[key]); return found; } function connectBackend() { var dispatcher = g.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__; if (dispatcher) { if (g[BINDING] == null) { standInBinding = function () {}; Object.defineProperty(g, BINDING, { value: standInBinding, configurable: true, writable: true }); } dispatcher.initializeDomain('react-devtools'); return 'fusebox-domain'; } var core = findDevtoolsCore(); if (!core) return null; core.connectWithCustomMessagingProtocol({ onSubscribe: function () {}, onUnsubscribe: function () {}, onMessage: function () {} }); return 'devtools-core'; } function attach() { var h = hook(); if (!h) return { ok: false, reason: 'no-devtools-hook' }; if (size(h.renderers) === 0) return { ok: false, reason: 'no-react-renderer' }; var foreignAgent = !unsubscribe && operationListenerCount(h) > 0; var connectedBy = null; if (size(h.rendererInterfaces) === 0) { connectedBy = connectBackend(); if (!connectedBy) return { ok: false, reason: 'no-devtools-backend' }; if (size(h.rendererInterfaces) === 0) return { ok: false, reason: 'backend-attach-failed' }; } if (!unsubscribe) { unsubscribe = h.sub('operations', onOperations); var frontendBinding = g[BINDING] != null && g[BINDING] !== standInBinding; var ownsQueue = connectedBy !== null || (!foreignAgent && !frontendBinding && !!g.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__); if (!h.__agentDeviceOperationsFlushed && ownsQueue) { h.__agentDeviceOperationsFlushed = true; history = true; eachRenderer(function (ri) { ri.flushInitialOperations(); }); } } return { ok: true, attach: connectedBy || 'attached', naming: naming() }; } function lookupName(ri, id) { var lookup = ri.getDisplayNameForElementID || ri.getDisplayNameForFiberID; try { return lookup ? lookup.call(ri, id) : null; } catch (e) { return null; } } function remember(ri, id, out) { if (out[id]) return; var known = elements.get(id); if (known) { out[id] = known; return; } var name = lookupName(ri, id); if (!name) return; out[id] = [name, 0, 0, 0]; elements.set(id, out[id]); } function internAll(list, table) { if (!list || !list.length) return null; var out = []; for (var i = 0; i < list.length; i++) { var key = String(list[i]); var index = table.index[key]; if (index === undefined) { index = table.index[key] = table.keys.length; table.keys.push(key); } out.push(index); } return out; } function compactChange(change, table) { if (!change) return 0; if (change.isFirstMount) return 1; var bits = (change.context === true || (change.context && change.context.length) ? 1 : 0) | (change.didHooksChange ? 2 : 0); var props = internAll(change.props, table); var state = internAll(change.state, table); var hooks = change.hooks && change.hooks.length ? change.hooks : null; if (!bits && !props && !state && !hooks) return 0; return [bits, props, state, hooks]; } /** Reads back only the renderers this session started; another renderer has no recording. */ function exportProfile(renderers) { var commits = []; var refs = Object.create(null); var keyTable = { keys: [], index: Object.create(null) }; var failures = []; renderers.forEach(function (ri) { var data; try { ri.stopProfiling(); data = ri.getProfilingData(); } catch (e) { failures.push(String(e && e.message || e)); return; } data.dataForRoots.forEach(function (root) { root.commitData.forEach(function (commit) { var fibers = []; var self = Object.create(null); var i; for (i = 0; i < commit.fiberSelfDurations.length; i++) self[commit.fiberSelfDurations[i][0]] = commit.fiberSelfDurations[i][1]; for (i = 0; i < commit.fiberActualDurations.length; i++) { var entry = commit.fiberActualDurations[i]; remember(ri, entry[0], refs); fibers.push(entry[0], entry[1], self[entry[0]] || 0); } var changes = null; if (commit.changeDescriptions) { changes = Object.create(null); for (i = 0; i < commit.changeDescriptions.length; i++) { var compact = compactChange(commit.changeDescriptions[i][1], keyTable); if (compact !== 0) changes[commit.changeDescriptions[i][0]] = compact; } } var updaters = []; (commit.updaters || []).forEach(function (updater) { if (!refs[updater.id]) refs[updater.id] = elements.get(updater.id) || [updater.displayName || 'Anonymous', updater.type || 0, 0, 0]; updaters.push(updater.id); }); commits.push({ timestamp: commit.timestamp, duration: commit.duration, updaters: updaters, fibers: fibers, changes: changes }); }); }); }); var owners = Object.create(null); Object.keys(refs).forEach(function (id) { var owner = refs[id][2]; if (owner && !refs[owner] && !owners[owner] && elements.get(owner)) owners[owner] = elements.get(owner); }); Object.keys(owners).forEach(function (id) { refs[id] = owners[id]; }); Object.keys(refs).forEach(function (id) { for (var parent = refs[id][3]; parent && !refs[parent] && elements.get(parent); parent = refs[parent][3]) { refs[parent] = elements.get(parent); } }); return { elements: refs, keys: keyTable.keys, commits: commits, failures: failures }; } function propKind(value, path, cleaned) { for (var i = 0; cleaned && i < cleaned.length; i++) { if (cleaned[i].length === 1 && cleaned[i][0] === path) return value && value.type ? String(value.type) : 'object'; } if (value === null) return 'null'; if (Array.isArray(value)) return 'array'; return typeof value; } function describeProps(request) { var out = Object.create(null); Object.keys(request).forEach(function (id) { var keys = request[id]; var inspected = inspectBackendElement(Number(id)); if (!inspected.value || !inspected.value.props) return; var props = inspected.value.props; var data = props.data !== undefined ? props.data : props; var kinds = Object.create(null); keys.forEach(function (key) { if (data && key in data) kinds[key] = propKind(data[key], key, props.cleaned); }); out[id] = kinds; }); return out; } function tree() { var attached = attach(); if (!attached.ok) return attached; if (naming() !== 'operations') return { ok: false, reason: 'tree-unavailable' }; var unmounted = Object.create(null); if (session) session.removed.forEach(function (id) { unmounted[id] = true; }); var nodes = []; elements.forEach(function (element, id) { if (!unmounted[id]) nodes.push([id, element[0], element[1], element[3], element[2], element[4] == null ? null : element[4]]); }); var childOrder = Object.create(null); order.forEach(function (children, id) { childOrder[id] = children; }); var counts = Object.create(null); logs.forEach(function (count, id) { counts[id] = count; }); var h = hook(); var logsTracked = !!(h.settings && h.settings.showInlineWarningsAndErrors !== false); return { ok: true, nodes: nodes, order: childOrder, logs: counts, logsTracked: logsTracked }; } function inspectBackendElement(id) { var found = null; var failure = null; eachRenderer(function (ri) { if (found || (ri.hasElementWithId && !ri.hasElementWithId(id))) return; var result; try { result = ri.inspectElement(nextRequestID++, id, null, true); } catch (e) { result = { type: 'error', message: String(e && e.message || e) }; } if (!result || result.type === 'not-found') return; if (result.type === 'full-data') found = { value: result.value, name: lookupName(ri, id) }; else { failure = { error: result.message || result.type }; if (ri.hasElementWithId) found = failure; } }); return found || failure || { missing: true }; } function inspectOne(id) { var result = inspectBackendElement(id); if (!result.value) return result; var value = result.value; var known = elements.get(id); return { name: known ? known[0] : result.name, type: value.type, key: value.key == null ? null : value.key, props: value.props, state: value.state, hooks: value.hooks, context: value.context, owners: value.owners, errors: value.errors, warnings: value.warnings, isErrored: !!value.isErrored }; } function inspect(ids) { var attached = attach(); if (!attached.ok) return attached; var out = Object.create(null); ids.forEach(function (id) { out[id] = inspectOne(id); }); return { ok: true, elements: out }; } function start() { var attached = attach(); if (!attached.ok) return attached; if (session) return { ok: false, reason: 'already-profiling', elapsedMs: Date.now() - session.startedAt }; var started = []; eachRenderer(function (ri) { try { ri.startProfiling(true, false); started.push(ri); } catch (e) {} }); if (started.length === 0) return { ok: false, reason: 'start-failed' }; session = { startedAt: Date.now(), renderers: started, removed: [] }; return { ok: true, attach: attached.attach, naming: attached.naming }; } function stop() { if (!session) return { ok: false, reason: 'not-profiling' }; var startedAt = session.startedAt; var renderers = session.renderers; var profile = exportProfile(renderers); session.removed.forEach(function (id) { elements.delete(id); }); session = null; if (profile.failures.length === renderers.length) { return { ok: false, reason: 'collect-failed', detail: profile.failures[0] }; } return { ok: true, startedAt: startedAt, stoppedAt: Date.now(), naming: naming(), elements: profile.elements, keys: profile.keys, commits: profile.commits, failures: profile.failures }; } function dispose() { if (unsubscribe) unsubscribe(); unsubscribe = null; if (session) session.renderers.forEach(function (ri) { try { ri.stopProfiling(); } catch (e) {} }); session = null; } g.__AGENT_DEVICE_REACT_DEVTOOLS__ = { version: VERSION, elements: elements, order: order, logs: logs, get history() { return history; }, start: function () { return JSON.stringify(start()); }, stop: function () { return JSON.stringify(stop()); }, describeProps: function (request) { return JSON.stringify(describeProps(request)); }, tree: function () { return JSON.stringify(tree()); }, inspect: function (ids) { return JSON.stringify(inspect(ids)); }, dispose: dispose }; return 'installed'; }) `,A=n(`sha256`).update(k).digest(`hex`).slice(0,16),j={limit:{type:`string`},depth:{type:`string`},exact:{type:`boolean`},app:{type:`string`},"metro-device":{type:`string`},"metro-host":{type:`string`},"metro-port":{type:`string`},"bundle-url":{type:`string`}},M=[`app`,`metro-device`,`metro-host`,`metro-port`,`bundle-url`],N=/^[1-9]\d*$/;function P(t,n){if(n!==void 0){if(!N.test(n))throw new e(`INVALID_ARGS`,`Invalid --${t}: ${n}. Use a positive integer.`);return Number(n)}}function F(t,n){let i;try{i=r({args:t,allowPositionals:!0,strict:!0,options:j})}catch(t){throw new e(`INVALID_ARGS`,t instanceof Error?t.message:String(t))}let{values:a,positionals:o}=i,s=n(o),c=Object.keys(a).find(e=>!s.options.includes(e));if(c)throw new e(`INVALID_ARGS`,`react-devtools ${s.usage} does not take --${c}.`);if(o.length>s.positionals)throw new e(`INVALID_ARGS`,`Unexpected argument for react-devtools ${s.usage}: ${o[s.positionals]}.`);return{positionals:o,limit:P(`limit`,a.limit),depth:P(`depth`,a.depth),exact:a.exact===!0,app:a.app,metroDevice:a[`metro-device`],metroHost:a[`metro-host`],metroPort:a[`metro-port`],bundleUrl:a[`bundle-url`]}}async function I(e,n,r){let i=t(n,e),a=S(await f(i),{appId:e.app,device:e.metroDevice}),o=await w.connect(T(i,a));try{return await o.evaluate(`(${k})(${JSON.stringify(A)})`),await r(o,a)}finally{o.close()}}async function L(t,n,r){let i=`__AGENT_DEVICE_REACT_DEVTOOLS__.${n}(${r===void 0?``:JSON.stringify(r)})`,a=await t.evaluate(i);if(typeof a!=`string`)throw new e(`COMMAND_FAILED`,`The React DevTools runtime returned no result for ${n}.`);return JSON.parse(a)}const R={"no-devtools-hook":{message:`The app runtime has no React DevTools hook.`,hint:`Use a development build; release builds do not include React DevTools.`},"no-react-renderer":{message:`React has not rendered in this app runtime yet.`,hint:`Wait for the app to finish loading its bundle, then retry.`},"no-devtools-backend":{message:`This React Native version exposes no React DevTools backend to attach to.`,hint:`React Native 0.74 or newer is required.`},"backend-attach-failed":{message:`The React DevTools backend did not attach to the app renderer.`,hint:`Reload the app and retry.`},"start-failed":{message:`The React renderer refused to start profiling.`,hint:`Profile a development build; production renderers do not record render timings.`},"not-profiling":{message:`No React profile is recording in this app runtime.`,hint:`Run react-devtools profile start first. A reload or app restart discards a recording.`},"collect-failed":{message:`The React DevTools backend could not export the recorded profile.`,hint:`Run react-devtools profile start and stop again; reload the app if it keeps failing.`},"tree-unavailable":{message:`Another React DevTools frontend owns the component tree of this app runtime.`,hint:`Close the connected React DevTools window, reload the app, and retry.`},"element-not-found":{message:`No mounted component has that ref.`,hint:`Refs change when components remount or the app reloads; run react-devtools find or tree again.`},"inspect-failed":{message:`The React DevTools backend could not inspect the component.`,hint:`Retry after the component renders again, or inspect its owner.`}};function z(t){let n=R[t.reason],r=n?.message??`React DevTools failed: ${t.reason}.`;return new e(`COMMAND_FAILED`,t.detail?`${r} ${t.detail}`:r,{reason:t.reason,...n?{hint:n.hint}:{}})}export{I as a,d as c,c as d,l as f,z as i,i as l,s as m,L as n,D as o,u as p,F as r,O as s,M as t,a as u};